ZeroQI / YouTube-Agent.bundle

Plex Metadata Agent for Movies and TV Series libraries
452 stars 43 forks source link

Jsonwithapibackup fails if json file doesn't exist #58

Closed garbled1 closed 3 years ago

garbled1 commented 3 years ago

` 2020-12-25 07:46:09,810 (7f7e9b7fe700) : INFO (init:399) - ============================================================================================================================================================= 2020-12-25 07:46:09,810 (7f7e9b7fe700) : INFO (init:402) - Attempting to load details from json file - json_filename: /var/lib/plexmediaserver/alcyone/video/Misc/Youtube/Joey_van_derSteeg [UCQXBXA3pXM5A-skemMLMrug]/20160530 - FAQ-_Why_do_smiths_tap_their_anvil_during_forging [K8Mown8IY40].info.json 2020-12-25 07:46:09,815 (7f7e9b7fe700) : CRITICAL (agentkit:1095) - Exception in the update function of agent named 'YouTubeSeries', called with guid 'com.plexapp.agents.youtube://youtube|UCQXBXA3pXM5A-skemMLMrug|Joey_van_der_Steeg [UCQXBXA3pXM5A-skemMLMrug]?lang=xn' (most recent call last): File "/usr/lib/plexmediaserver/Resources/Plug-ins-6c22540d5/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1093, in _update agent.update(obj, media, lang, **kwargs) File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/YouTube-Agent.bundle/Contents/Code/init.py", line 678, in update def update (self, metadata, media, lang, force ): Update (metadata, media, lang, force, False) File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/YouTube-Agent.bundle/Contents/Code/init.py", line 406, in Update with open(json_filename) as f: IOError: [Errno 2] No such file or directory: '/var/lib/plexmediaserver/alcyone/video/Misc/Youtube/Joey_van_derSteeg [UCQXBXA3pXM5A-skemMLMrug]/20160530 - FAQ-_Why_do_smiths_tap_their_anvil_during_forging [K8Mown8IY40].info.json'

2020-12-25 07:46:09,899 (7f7e9b7fe700) : DEBUG (model:229) - Serializing to /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Metadata/TV Shows/d/ed9e34c3d5700f5c6f35897400640e7b4b2d510.bundle/Contents/com.plexapp.agents.youtube/Info.xml 2020-12-25 07:46:09,910 (7f7e9b7fe700) : DEBUG (runtime:88) - Sending packed state data (107 bytes) 2020-12-25 07:46:09,911 (7f7e9b7fe700) : DEBUG (runtime:924) - Response: [200] str, 16 bytes `

It looks like you just need a try: around line 406..

com.plexapp.system.log com.plexapp.agents.youtube.log

Simple patch that I think does the right thing:

init.patch.txt

ZeroQI commented 3 years ago

with open should have handled the issue but clearly it isn't Looked over code and it seem fine to include into the master code. Can you do a pull request as i dunno how to import diff patches...

ZeroQI commented 3 years ago

Didn't i fixed this 2 month ago? https://github.com/ZeroQI/YouTube-Agent.bundle/commit/27edbb6b63bf771d9deae00f11376f3380e1c16a

garbled1 commented 3 years ago

That one is around line 180 or so.. My failure was on line 406. I'll do a PR.

ZeroQI commented 3 years ago

Thanks for the PR. Any issues, reply/reopen this bug report