blacktwin / JBOPS

Just a Bunch Of Plex Scripts
1.71k stars 304 forks source link

delete_watched_TV removes all unwatched episodes #142

Closed Generator closed 5 years ago

Generator commented 5 years ago

delete_watched_TV at start worked without issues, but now started to removing all unwatched episodes.

Sample setings

SHOW_LST = [1234, 4321, 6789]  # Show rating keys.
USER_LST = ['Bob', 'Joe'] # Name of users

Bob watched all episodes of SampleShow (4321), but Joe only watched one or none of the episodes, however delete_watched_TV removes all episodes

SampleShow SampleEpisode1 has been watched by Bob & Joe
Removing /path/to/TVShows/SampleShow/Season 01/SampleEpisode1.mkv
...

Screenshots History screenshot_2019-02-06 tautulli - history sanguepipi

cmd output captura de ecra_2019-02-06_15-23-28

Script settings

TAUTULLI_APIKEY = 'xxxxxxxxx'  # Your Tautulli API key
TAUTULLI_URL = 'http://localhost:8181/'  # Your Tautulli URL
SHOW_LST = [2111, 2037, 2099, 1969, 1901]  # Show rating keys.
USER_LST = ['American_Jesus', 'Ruben']  # Name of users

The same happens with other show, where one of the use haven't watched any episode.

blacktwin commented 5 years ago

Confirmed. Looking into it now.

Generator commented 5 years ago

Just to mention. with another (single) user, none of the watched episodes are getting removed, and no command output.

blacktwin commented 5 years ago

@Generator please try this update. Comment out the actual deletion line

# os.remove(meta_dict['file'])

Generator commented 5 years ago

Could only test with a single user for now (don't have common watched episodes now) seems to be working.
I'll make further tests when some episode is watched by two or more users, tried (re)adding some watched episode but didn't see it as watched.

Also i was using Tautulli's friendly name, instead of real full name, that could be one of the issues, the script doesn't seem to look up for friendly names.

blacktwin commented 5 years ago

@Generator you good?

Generator commented 5 years ago

I think so, i'm trying to figure it out if the rating keys of a show stay the same after all episodes are removed and later added.

I'm closing the issue, i'll re-open or create a new one if found something else.