blacktwin / JBOPS

Just a Bunch Of Plex Scripts
1.67k stars 307 forks source link

delete_watched_tv.py get_history error #186

Closed shidraconis closed 5 years ago

shidraconis commented 5 years ago

When I run the script I initally had the issue of the requests not being installed, I fixed that and now when I run it I get: Tautulli API 'get_history' request failed: No connection adapters were found for '192.168.1.50:8181/api/v2'

I am running this on my unraid server with tautulli and plex running in different dockers on the same machine.

This is the modified section of the script excluding the tautulli api key which is there just not posted: TAUTULLI_URL = 'http://192.168.1.50:8181' # Your Tautulli URL SHOW_LST = [33258] # Show rating keys. USER_LST = ['Linda'] # Name of users

blacktwin commented 5 years ago

Is that the correct IP address? Do you have your APIEY information?

shidraconis commented 5 years ago

Yes it is the correct IP, it's the IP of my server with the port number being tautulli. Here is the full section of information that needed to be edited. TAUTULLI_APIKEY = '7cca744a2e084b58818dc009a2cb550b' # Your Tautulli API key TAUTULLI_URL = 'http://192.168.1.50:8181' # Your Tautulli URL SHOW_LST = [33258] # Show rating keys. USER_LST = ['Linda'] # Name of users

blacktwin commented 5 years ago

Sounds like where ever you're running the script from can't connect to Tautulli. More logs may help, as in the entire log file.

shidraconis commented 5 years ago

I did change the api key and tested it with that as well, no change. I tried seeing what would show up if I ran the script with the api disabled. It still gave the same exact error. Here are the tautuilli logs. I did look through the logs and it doesn't even look like it logged the attempt to run it. It does list the script name further up last week, but that was due to thinking I had to run it through the tautuilli notifications. This is the updated edited section: TAUTULLI_APIKEY = 'b8f7aa01c5a34dfebb7463d33a79a24d' # Your Tautulli API key TAUTULLI_URL = '192.168.1.50:8181' # Your Tautulli URL SHOW_LST = [33258] # Show rating keys. USER_LST = ['Linda'] # Name of users tautulli.log

EDIT: The script is named "Plex Delete After Watch.py"

shidraconis commented 5 years ago

Ok, so upon further trial and error, It does run, I did add the http:// in front of the tautuilli address again with the different api key, and works to the point of deleting the file. It gets to line 119 and this is the output it gives: root@Athena:/mnt/cache/SSD Cache/Scripts# python Plex_Delete_After_Watch.py The Young and the Restless Episode 11759 - Aug 27, 2019 has been watched by Linda Removing /media/TV Shows/The Young and the Restless (1973)/Season 46/The Young and the Restless (1973) - S46E251 - 08-27-2019.ts Traceback (most recent call last): File "Plex_Delete_After_Watch.py", line 119, in os.remove(meta_dict['file']) OSError: [Errno 2] No such file or directory: '/media/TV Shows/The Young and the Restless (1973)/Season 46/The Young and the Restless (1973) - S46E251 - 08-27-2019.ts'

Just to try I did add the plex media folder directory to the tautuilli docker so it does it knows where the file is to delete. The /media directory is normally empty before I added the path to the docker. The file it is talking about does exist in the directory on the array though.

shidraconis commented 5 years ago

I figured out the reason it wasn't deleting the files. It was due to the script looking in the root /media folder of my server and not the one in tautulli. I made a symbolic link from my plex media folder on my array to the root /media folder. I ran it again afterwards and it did detect all the watched files and deleted them.

shidraconis commented 5 years ago

I know you didn't help much but it must have helped talking it through. Thanks anyways.