pymedusa / Medusa

Automatic Video Library Manager for TV Shows. It watches for new episodes of your favorite shows, and when they are posted it does its magic.
https://pymedusa.com
GNU General Public License v3.0
1.76k stars 274 forks source link

Post-processing fails after processing one episode. #9506

Open Sparhawk76 opened 3 years ago

Sparhawk76 commented 3 years ago

Describe the bug Upon a fresh restart of medusa with a newly downloaded torrent waiting to process, it will process the one file then throw the following error:

2021-05-05 09:32:22 ERROR POSTPROCESSOR :: [0286e89] Exception generated: Expecting value: line 1 column 1 (char 0) Traceback (most recent call last): File "/opt/medusa/medusa/schedulers/scheduler.py", line 78, in run self.action.run(self.force) File "/opt/medusa/medusa/process_tv.py", line 197, in run process_results.process(force=force, **kwargs) File "/opt/medusa/medusa/process_tv.py", line 344, in process self.process_files(dir_path, force=force, is_priority=is_priority, File "/opt/medusa/medusa/process_tv.py", line 602, in process_files self.process_media(path, self.video_in_rar, force, is_priority, ignore_subs) File "/opt/medusa/medusa/process_tv.py", line 839, in process_media self.result = processor.process() File "/opt/medusa/medusa/post_processor.py", line 1311, in process notifiers.trakt_notifier.update_library(ep_obj) File "/opt/medusa/medusa/notifiers/trakt.py", line 83, in update_library sync.add_to_collection(data) File "/opt/medusa/ext/trakt/core.py", line 582, in inner json_data = self._handle_request('post', url, data=args) File "/opt/medusa/ext/trakt/core.py", line 527, in _handle_request json_data = json.loads(response.content.decode('UTF-8', 'ignore')) File "/usr/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/usr/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

After throwing the error in the server status page it shows post process as not alive, with no apparent way to restart it other than to restart the medusa process:

Post Process | false | true | false |   | 10m |   | 5/5/2021, 9:22:02 AM | false

It's been doing this since the last time I updated the software about a week or so ago, I only just looked into why my episodes weren't being processed today.

To Reproduce Steps to reproduce the behavior: 1: With at least one file ready to be processed, restart Medusa 2: Wait for post-processing to process that file 3: After that file is processed error will appear in logs 4: Check server status page and after a little bit it will show that the Post Process function is not Alive.

Expected behavior Medusa keeps processing after just the one file, and will re-run at the next interval selected

Screenshots If applicable, add screenshots to help explain your problem. image

Medusa (please complete the following information):

Debug logs (at least 50 lines): General > Advanced Settings > Enable debug

``` 2021-05-05 11:09:18 ERROR POSTPROCESSOR :: [0286e89] Exception generated: Expecting value: line 1 column 1 (char 0) Traceback (most recent call last): File "/opt/medusa/medusa/schedulers/scheduler.py", line 78, in run self.action.run(self.force) File "/opt/medusa/medusa/process_tv.py", line 197, in run process_results.process(force=force, **kwargs) File "/opt/medusa/medusa/process_tv.py", line 344, in process self.process_files(dir_path, force=force, is_priority=is_priority, File "/opt/medusa/medusa/process_tv.py", line 617, in process_files self.process_media(path, self.video_files, force, is_priority, ignore_subs) File "/opt/medusa/medusa/process_tv.py", line 839, in process_media self.result = processor.process() File "/opt/medusa/medusa/post_processor.py", line 1311, in process notifiers.trakt_notifier.update_library(ep_obj) File "/opt/medusa/medusa/notifiers/trakt.py", line 83, in update_library sync.add_to_collection(data) File "/opt/medusa/ext/trakt/core.py", line 582, in inner json_data = self._handle_request('post', url, data=args) File "/opt/medusa/ext/trakt/core.py", line 527, in _handle_request json_data = json.loads(response.content.decode('UTF-8', 'ignore')) File "/usr/lib/python3.8/json/__init__.py", line 357, in loads return _default_decoder.decode(s) File "/usr/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] 78957: Formatting pattern: %SN - %Sx01 - %EN - %QN -> Deadliest Catch - 17x01 - Out of the Ashes - 1080p WEB-DL 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Found codec for Deadliest Catch Out of the Ashes 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Parsed Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb into title: Deadliest Catch, season: 17, episode: [1], episode_title: Out of the Ashes, screen_size: 1080p, streaming_service: Amazon Prime, source: Web, audio_codec: Dolby Digital Plus, audio_channels: 2.0, video_codec: H.264, release_group: NTb, type: episode, parsing_time: 0.0006613731384277344, absolute_episode: [], quality: 1080p WEB-DL, total_time: 0.0006775856018066406 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Matched release Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb to a series in your database: Deadliest Catch 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Using cache item for Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Using guessit cache item for Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Parsed /data/Videos/TV/Deadliest Catch/Season 17/Deadliest Catch - S17E01 - Out of the Ashes into title: Deadliest Catch, season: 17, episode: [1], episode_title: Out of the Ashes, type: episode, parsing_time: 0.03570199012756348, absolute_episode: [], quality: Unknown, total_time: 0.035906314849853516 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Matched release /data/Videos/TV/Deadliest Catch/Season 17/Deadliest Catch - S17E01 - Out of the Ashes to a series in your database: Deadliest Catch 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Using guessit cache item for /data/Videos/TV/Deadliest Catch/Season 17/Deadliest Catch - S17E01 - Out of the Ashes 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Notification for NMJ scan update not enabled, skipping this notification 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Transaction with 1 queries executed 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] 78957: Setter sets location to /data/Videos/TV/Deadliest Catch/Season 17/Deadliest Catch - S17E01 - Out of the Ashes.mkv 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Hard linking file from /data/Downloads/Medusa/Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb.mkv to /data/Videos/TV/Deadliest Catch/Season 17/Deadliest Catch - S17E01 - Out of the Ashes.mkv 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Checking if the path /data/Videos/TV/Deadliest Catch/Season 17 already exists 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Destination folder for this episode: /data/Videos/TV/Deadliest Catch/Season 17 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] 78957: Formatting pattern: Season %0S -> Season 17 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Found codec for Deadliest Catch Out of the Ashes 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Parsed Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb into title: Deadliest Catch, season: 17, episode: [1], episode_title: Out of the Ashes, screen_size: 1080p, streaming_service: Amazon Prime, source: Web, audio_codec: Dolby Digital Plus, audio_channels: 2.0, video_codec: H.264, release_group: NTb, type: episode, parsing_time: 0.0006232261657714844, absolute_episode: [], quality: 1080p WEB-DL, total_time: 0.0006380081176757812 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Matched release Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb to a series in your database: Deadliest Catch 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Using cache item for Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Using guessit cache item for Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] 78957: Formatting pattern: %SN - S%0SE01 - %EN -> Deadliest Catch - S17E01 - Out of the Ashes 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Found codec for Deadliest Catch Out of the Ashes 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Parsed Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb into title: Deadliest Catch, season: 17, episode: [1], episode_title: Out of the Ashes, screen_size: 1080p, streaming_service: Amazon Prime, source: Web, audio_codec: Dolby Digital Plus, audio_channels: 2.0, video_codec: H.264, release_group: NTb, type: episode, parsing_time: 0.03263425827026367, absolute_episode: [], quality: 1080p WEB-DL, total_time: 0.03265571594238281 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Matched release Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb to a series in your database: Deadliest Catch 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Using guessit cache item for Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Folder name (Medusa) appears to be a valid release name. Using it. 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Using guessit cache item for Medusa 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Found release name Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Trying to determine free space on destination drive 2021-05-05 11:09:17 INFO POSTPROCESSOR :: [0286e89] This download is marked a priority download so I'm going to replace an existing file if I find one 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] There is no existing file so there's no worries about replacing it 2021-05-05 11:09:17 INFO POSTPROCESSOR :: [0286e89] New size: 6.80 GB 2021-05-05 11:09:17 INFO POSTPROCESSOR :: [0286e89] New file: /data/Downloads/Medusa/Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb.mkv 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] This episode is a priority download: True 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Proper: False 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] New quality: 1080p WEB-DL 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Current quality: 1080p WEB-DL 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] NZB: False 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Info hash: ac0e6709de9db39da30f9cb5845c7d3eafda3151 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Manually snatched: False 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Snatch in history: True 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Quality of the episode we are processing: 1080p WEB-DL 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] This episode was found in history as SNATCHED. 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] The episode file has a quality in it, using that: 1080p WEB-DL 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Retrieving episode object for Deadliest Catch S17E01 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Show information parsed from file name 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Parsed Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb.mkv into title: Deadliest Catch, season: 17, episode: [1], episode_title: Out of the Ashes, screen_size: 1080p, streaming_service: Amazon Prime, source: Web, audio_codec: Dolby Digital Plus, audio_channels: 2.0, video_codec: H.264, release_group: NTb, container: mkv, mimetype: video/x-matroska, type: episode, parsing_time: 0.03877520561218262, absolute_episode: [], quality: 1080p WEB-DL, total_time: 0.039144277572631836 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Matched release Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb.mkv to a series in your database: Deadliest Catch 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Found numbering S17E01 from parser for show Deadliest Catch S17E01 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] GuessIt cache was cleared due to invalidation object change: previous={'show_type': 'anime', 'type': 'episode', 'implicit': True, 'episode_prefer_number': True, 'expected_title': [], 'expected_group': ['TV2LAX9', 'DHD', '20-40', 'E7'], 'allowed_languages': ['de', 'en', 'es', 'ca', 'fr', 'he', 'hu', 'it', 'jp', 'nl', 'pl', 'pt', 'ro', 'ru', 'sv', 'uk', 'mul', 'und'], 'allowed_countries': ['us', 'gb']} new={'show_type': 'normal', 'type': 'episode', 'implicit': True, 'episode_prefer_number': False, 'expected_title': ['Hawkeye (2021)', 'Heavy Rescue: 401', 'Raised by Wolves (2020)', 'BattleBots (2015)'], 'expected_group': ['TV2LAX9', 'DHD', '20-40', 'E7'], 'allowed_languages': ['de', 'en', 'es', 'ca', 'fr', 'he', 'hu', 'it', 'jp', 'nl', 'pl', 'pt', 'ro', 'ru', 'sv', 'uk', 'mul', 'und'], 'allowed_countries': ['us', 'gb']} 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Analyzing name: Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb.mkv 2021-05-05 11:09:17 INFO POSTPROCESSOR :: [0286e89] Processing /data/Downloads/Medusa/Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb.mkv 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Post-processing video files: ['Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb.mkv'] 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Post-processing files: ['Deadliest.Catch.S17E01.Out.of.the.Ashes.1080p.AMZN.WEB-DL.DDP2.0.H.264-NTb.mkv'] 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Processing folder: /data/Downloads/Medusa 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] No resource_name passed, using path [/data/Downloads/Medusa] to process as a source folder 2021-05-05 11:09:17 INFO POSTPROCESSOR :: [0286e89] Processing path: /data/Downloads/Medusa 2021-05-05 11:09:17 DEBUG POSTPROCESSOR :: [0286e89] Starting new thread: POSTPROCESSOR ```

Additional context Add any other context about the problem here.

p0psicles commented 3 years ago

It's because of the trakt add_to_collection() method. What are your trakt sync settings?

Sparhawk76 commented 3 years ago

image