Medusa icon indicating copy to clipboard operation
Medusa copied to clipboard

Files get deleted in manual PP whereas PP should be postponed

Open NicoLeOca opened this issue 2 years ago • 15 comments

When Manual PP, when:

  • postpone if no subtitles is enabled in the setting
  • Delete files and folders is turned on the manual PP settings if there are no subtitles, the file gets deleted.
Capture d’écran 2022-03-27 à 08 47 13 Capture d’écran 2022-03-27 à 08 48 22
2022-03-27 08:02:21 DEBUG    POSTPROCESSOR :: [9b23c72] Starting new thread: POSTPROCESSOR
2022-03-27 08:02:21 INFO     POSTPROCESSOR :: [9b23c72] Processing path: /home/**********/Downloads/Completed/MedusaUS
2022-03-27 08:02:21 INFO     POSTPROCESSOR :: [9b23c72] Feature 'postpone post-processing if no subtitle available' is enabled.
2022-03-27 08:02:21 DEBUG    POSTPROCESSOR :: [9b23c72] No processable items found in folder: /home/**********/Downloads/Completed/MedusaUS
2022-03-27 08:02:21 DEBUG    POSTPROCESSOR :: [9b23c72] No resource_name passed, using path [/home/**********/Downloads/Completed/MedusaUS/Euphoria.US.S01.REPACK.1080p.AMZN.WEBRip.DDP5.1.x264-KiNGS[rartv]] to process as a source folder
2022-03-27 08:02:21 DEBUG    POSTPROCESSOR :: [9b23c72] Processing folder: /home/**********/Downloads/Completed/MedusaUS/Euphoria.US.S01.REPACK.1080p.AMZN.WEBRip.DDP5.1.x264-KiNGS[rartv]
2022-03-27 08:02:21 DEBUG    POSTPROCESSOR :: [9b23c72] Post-processing files: ['Euphoria.US.S01E01.Pilot.1080p.AMZN.WEB-DL.DDP5.1.H.264-KiNGS.mkv']
2022-03-27 08:02:21 DEBUG    POSTPROCESSOR :: [9b23c72] Post-processing video files: ['Euphoria.US.S01E01.Pilot.1080p.AMZN.WEB-DL.DDP5.1.H.264-KiNGS.mkv']
2022-03-27 08:02:21 DEBUG    POSTPROCESSOR :: [9b23c72] Using cache item for /home/**********/Downloads/Completed/MedusaUS/Euphoria.US.S01.REPACK.1080p.AMZN.WEBRip.DDP5.1.x264-KiNGS[rartv]/Euphoria.US.S01E01.Pilot.1080p.AMZN.WEB-DL.DDP5.1.H.264-KiNGS.mkv
2022-03-27 08:02:22 DEBUG    POSTPROCESSOR :: [9b23c72] Video '/home/**********/Downloads/Completed/MedusaUS/Euphoria.US.S01.REPACK.1080p.AMZN.WEBRip.DDP5.1.x264-KiNGS[rartv]/Euphoria.US.S01E01.Pilot.1080p.AMZN.WEB-DL.DDP5.1.H.264-KiNGS.mkv' scanned using mediainfo 'libmediainfo.so.0' has raw data:
<?xml version="1.0" encoding="utf-8"?>
<Mediainfo version="18.08.1">
  <File>
    <track type="General">
      <Count>331</Count>
      <Count_of_stream_of_this_kind>1</Count_of_stream_of_this_kind>
      <Kind_of_stream>General</Kind_of_stream>
      <Kind_of_stream>General</Kind_of_stream>
      <Stream_identifier>0</Stream_identifier>
      <Unique_ID>104503554635609542979467301725602968870</Unique_ID>
      <Unique_ID>104503554635609542979467301725602968870 (0x4E9EA70B56AC4BED5EA5BEDC00A9F526)</Unique_ID>
      <Count_of_video_streams>1</Count_of_video_streams>
      <Count_of_audio_streams>1</Count_of_audio_streams>
      <Video_Format_List>AVC</Video_Format_List>
      <Video_Format_WithHint_List>AVC</Video_Format_WithHint_List>
      <Codecs_Video>AVC</Codecs_Video>
      <Audio_Format_List>E-AC-3</Audio_Format_List>
      <Audio_Format_WithHint_List>E-AC-3</Audio_Format_WithHint_List>
      <Audio_codecs>E-AC-3</Audio_codecs>
      <Audio_Language_List>English</Audio_Language_List>
      <Complete_name>/home/**********/Downloads/Completed/MedusaUS/Euphoria.US.S01.REPACK.1080p.AMZN.WEBRip.DDP5.1.x264-KiNGS[rartv]/Euphoria.US.S01E01.Pilot.1080p.AMZN.WEB-DL.DDP5.1.H.264-KiNGS.mkv</Complete_name>
      <Folder_name>/home/**********/Downloads/Completed/MedusaUS/Euphoria.US.S01.REPACK.1080p.AMZN.WEBRip.DDP5.1.x264-KiNGS[rartv]</Folder_name>
      <File_name>Euphoria.US.S01E01.Pilot.1080p.AMZN.WEB-DL.DDP5.1.H.264-KiNGS.mkv</File_name>
      <File_name>Euphoria.US.S01E01.Pilot.1080p.AMZN.WEB-DL.DDP5.1.H.264-KiNGS</File_name>
      <File_extension>mkv</File_extension>
      <Format>Matroska</Format>
      <Format>Matroska</Format>
      <Format_Url>https://matroska.org/downloads/windows.html</Format_Url>
      <Format_Extensions_usually_used>mkv mk3d mka mks</Format_Extensions_usually_used>
      <Commercial_name>Matroska</Commercial_name>
      <Format_version>Version 4</Format_version>
      <File_size>3479229086</File_size>
      <File_size>3.24 GiB</File_size>
      <File_size>3 GiB</File_size>
      <File_size>3.2 GiB</File_size>
      <File_size>3.24 GiB</File_size>
      <File_size>3.240 GiB</File_size>
      <Duration>3233254</Duration>
      <Duration>53 min 53 s</Duration>
      <Duration>53 min 53 s 254 ms</Duration>
      <Duration>53 min 53 s</Duration>
      <Duration>00:53:53.254</Duration>
      <Duration>00:53:54;00</Duration>
      <Duration>00:53:53.254 (00:53:54;00)</Duration>
      <Overall_bit_rate_mode>CBR</Overall_bit_rate_mode>
      <Overall_bit_rate_mode>Constant</Overall_bit_rate_mode>
      <Overall_bit_rate>8608613</Overall_bit_rate>
      <Overall_bit_rate>8 609 kb/s</Overall_bit_rate>
      <Frame_rate>23.976</Frame_rate>
      <Frame_rate>23.976 FPS</Frame_rate>
      <Frame_count>77520</Frame_count>
      <Stream_size>811098</Stream_size>
      <Stream_size>792 KiB (0%)</Stream_size>
      <Stream_size>792 KiB</Stream_size>
      <Stream_size>792 KiB</Stream_size>
      <Stream_size>792 KiB</Stream_size>
      <Stream_size>792.1 KiB</Stream_size>
      <Stream_size>792 KiB (0%)</Stream_size>
      <Proportion_of_this_stream>0.00023</Proportion_of_this_stream>
      <IsStreamable>Yes</IsStreamable>
      <Encoded_date>UTC 2019-06-17 10:52:33</Encoded_date>
      <File_last_modification_date>UTC 2022-03-26 22:09:42</File_last_modification_date>
      <File_last_modification_date__local_>2022-03-26 23:09:42</File_last_modification_date__local_>
      <Writing_application>mkvmerge v34.0.0 ('Sight and Seen') 64-bit</Writing_application>
      <Writing_application>mkvmerge v34.0.0 ('Sight and Seen') 64-bit</Writing_application>
      <Writing_library>libebml v1.3.7 + libmatroska v1.5.0</Writing_library>
      <Writing_library>libebml v1.3.7 + libmatroska v1.5.0</Writing_library>
    </track>
    <track type="Video">
      <Count>347</Count>
      <Count_of_stream_of_this_kind>1</Count_of_stream_of_this_kind>
      <Kind_of_stream>Video</Kind_of_stream>
      <Kind_of_stream>Video</Kind_of_stream>
      <Stream_identifier>0</Stream_identifier>
      <StreamOrder>0</StreamOrder>
      <ID>1</ID>
      <ID>1</ID>
      <Unique_ID>16213319671984929130</Unique_ID>
      <Format>AVC</Format>
      <Format>AVC</Format>
      <Format_Info>Advanced Video Codec</Format_Info>
      <Format_Url>http://developers.videolan.org/x264.html</Format_Url>
      <Commercial_name>AVC</Commercial_name>
      <Format_profile>High@L4</Format_profile>
      <Format_settings>CABAC / 4 Ref Frames</Format_settings>
      <Format_settings__CABAC>Yes</Format_settings__CABAC>
      <Format_settings__CABAC>Yes</Format_settings__CABAC>
      <Format_settings__ReFrames>4</Format_settings__ReFrames>
      <Format_settings__ReFrames>4 frames</Format_settings__ReFrames>
      <Internet_media_type>video/H264</Internet_media_type>
      <Codec_ID>V_MPEG4/ISO/AVC</Codec_ID>
      <Codec_ID_Url>http://ffdshow-tryout.sourceforge.net/</Codec_ID_Url>
      <Duration>3233230.000000</Duration>
      <Duration>53 min 53 s</Duration>
      <Duration>53 min 53 s 230 ms</Duration>
      <Duration>53 min 53 s</Duration>
      <Duration>00:53:53.230</Duration>
      <Duration>00:53:54;00</Duration>
      <Duration>00:53:53.230 (00:53:54;00)</Duration>
      <Bit_rate_mode>CBR</Bit_rate_mode>
      <Bit_rate_mode>Constant</Bit_rate_mode>
      <Bit_rate>7966666</Bit_rate>
      <Bit_rate>7 967 kb/s</Bit_rate>
      <Nominal_bit_rate>10000000</Nominal_bit_rate>
      <Nominal_bit_rate>10 000 kb/s</Nominal_bit_rate>
      <Width>1920</Width>
      <Width>1 920 pixels</Width>
      <Height>1080</Height>
      <Height>1 080 pixels</Height>
      <Stored_Height>1088</Stored_Height>
      <Sampled_Width>1920</Sampled_Width>
      <Sampled_Height>1080</Sampled_Height>
      <Pixel_aspect_ratio>1.000</Pixel_aspect_ratio>
      <Display_aspect_ratio>1.778</Display_aspect_ratio>
      <Display_aspect_ratio>16:9</Display_aspect_ratio>
      <Frame_rate_mode>CFR</Frame_rate_mode>
      <Frame_rate_mode>Constant</Frame_rate_mode>
      <Frame_rate>23.976</Frame_rate>
      <Frame_rate>23.976 (24000/1001) FPS</Frame_rate>
      <FrameRate_Num>24000</FrameRate_Num>
      <FrameRate_Den>1001</FrameRate_Den>
      <Frame_count>77520</Frame_count>
      <Color_space>YUV</Color_space>
      <Chroma_subsampling>4:2:0</Chroma_subsampling>
      <Chroma_subsampling>4:2:0</Chroma_subsampling>
      <Bit_depth>8</Bit_depth>
      <Bit_depth>8 bits</Bit_depth>
      <Scan_type>Progressive</Scan_type>
      <Scan_type>Progressive</Scan_type>
      <Bits__Pixel_Frame_>0.160</Bits__Pixel_Frame_>
      <Delay>0</Delay>
      <Delay>00:00:00.000</Delay>
      <Delay__origin>Container</Delay__origin>
      <Delay__origin>Container</Delay__origin>
      <Stream_size>3219758148</Stream_size>
      <Stream_size>3.00 GiB (93%)</Stream_size>
      <Stream_size>3 GiB</Stream_size>
      <Stream_size>3.0 GiB</Stream_size>
      <Stream_size>3.00 GiB</Stream_size>
      <Stream_size>2.999 GiB</Stream_size>
      <Stream_size>3.00 GiB (93%)</Stream_size>
      <Proportion_of_this_stream>0.92542</Proportion_of_this_stream>
      <Default>Yes</Default>
      <Default>Yes</Default>
      <Forced>No</Forced>
      <Forced>No</Forced>
      <Buffer_size>31250000</Buffer_size>
      <Color_range>Limited</Color_range>
      <colour_description_present>Yes</colour_description_present>
      <Color_primaries>BT.709</Color_primaries>
      <Transfer_characteristics>BT.709</Transfer_characteristics>
      <Matrix_coefficients>BT.709</Matrix_coefficients>
    </track>
    <track type="Audio">
      <Count>298</Count>
      <Count_of_stream_of_this_kind>1</Count_of_stream_of_this_kind>
      <Kind_of_stream>Audio</Kind_of_stream>
      <Kind_of_stream>Audio</Kind_of_stream>
      <Stream_identifier>0</Stream_identifier>
      <StreamOrder>1</StreamOrder>
      <ID>2</ID>
      <ID>2</ID>
      <Unique_ID>15875770715706031085</Unique_ID>
      <Format>E-AC-3</Format>
      <Format>E-AC-3</Format>
      <Format_Info>Enhanced AC-3</Format_Info>
      <Format_Url>https://en.wikipedia.org/wiki/Dolby_Digital_Plus</Format_Url>
      <Commercial_name>Dolby Digital Plus</Commercial_name>
      <Commercial_name>Dolby Digital Plus</Commercial_name>
      <Format_settings__Endianness>Big</Format_settings__Endianness>
      <Internet_media_type>audio/eac3</Internet_media_type>
      <Codec_ID>A_EAC3</Codec_ID>
      <Duration>3233248.000000</Duration>
      <Duration>53 min 53 s</Duration>
      <Duration>53 min 53 s 248 ms</Duration>
      <Duration>53 min 53 s</Duration>
      <Duration>00:53:53.248</Duration>
      <Duration>00:54:19:10</Duration>
      <Duration>00:53:53.248 (00:54:19:10)</Duration>
      <Bit_rate_mode>CBR</Bit_rate_mode>
      <Bit_rate_mode>Constant</Bit_rate_mode>
      <Bit_rate>640000</Bit_rate>
      <Bit_rate>640 kb/s</Bit_rate>
      <Channel_s_>6</Channel_s_>
      <Channel_s_>6 channels</Channel_s_>
      <Channel_positions>Front: L C R, Side: L R, LFE</Channel_positions>
      <Channel_positions>3/2/0.1</Channel_positions>
      <Channel_layout>L R C LFE Ls Rs</Channel_layout>
      <Samples_per_frame>1536</Samples_per_frame>
      <Sampling_rate>48000</Sampling_rate>
      <Sampling_rate>48.0 kHz</Sampling_rate>
      <Samples_count>155195904</Samples_count>
      <Frame_rate>31.250</Frame_rate>
      <Frame_rate>31.250 FPS (1536 SPF)</Frame_rate>
      <Frame_count>101039</Frame_count>
      <Compression_mode>Lossy</Compression_mode>
      <Compression_mode>Lossy</Compression_mode>
      <Delay>6</Delay>
      <Delay>6 ms</Delay>
      <Delay>6 ms</Delay>
      <Delay>6 ms</Delay>
      <Delay>00:00:00.006</Delay>
      <Delay__origin>Container</Delay__origin>
      <Delay__origin>Container</Delay__origin>
      <Delay_relative_to_video>6</Delay_relative_to_video>
      <Delay_relative_to_video>6 ms</Delay_relative_to_video>
      <Delay_relative_to_video>6 ms</Delay_relative_to_video>
      <Delay_relative_to_video>6 ms</Delay_relative_to_video>
      <Delay_relative_to_video>00:00:00.006</Delay_relative_to_video>
      <Stream_size>258659840</Stream_size>
      <Stream_size>247 MiB (7%)</Stream_size>
      <Stream_size>247 MiB</Stream_size>
      <Stream_size>247 MiB</Stream_size>
      <Stream_size>247 MiB</Stream_size>
      <Stream_size>246.7 MiB</Stream_size>
      <Stream_size>247 MiB (7%)</Stream_size>
      <Proportion_of_this_stream>0.07434</Proportion_of_this_stream>
      <Language>en</Language>
      <Language>English</Language>
      <Language>English</Language>
      <Language>en</Language>
      <Language>eng</Language>
      <Language>en</Language>
      <Service_kind>CM</Service_kind>
      <Service_kind>Complete Main</Service_kind>
      <Default>Yes</Default>
      <Default>Yes</Default>
      <Forced>No</Forced>
      <Forced>No</Forced>
      <bsid>16</bsid>
      <dialnorm>-31</dialnorm>
      <dialnorm>-31 dB</dialnorm>
      <compr>-0.28</compr>
      <compr>-0.28 dB</compr>
      <acmod>7</acmod>
      <lfeon>1</lfeon>
      <dialnorm_Average>-31</dialnorm_Average>
      <dialnorm_Average>-31 dB</dialnorm_Average>
      <dialnorm_Minimum>-31</dialnorm_Minimum>
      <dialnorm_Minimum>-31 dB</dialnorm_Minimum>
      <dialnorm_Maximum>-31</dialnorm_Maximum>
      <dialnorm_Maximum>-31 dB</dialnorm_Maximum>
      <dialnorm_Count>582</dialnorm_Count>
      <compr_Average>-4.35</compr_Average>
      <compr_Average>-4.35 dB</compr_Average>
      <compr_Minimum>-10.55</compr_Minimum>
      <compr_Minimum>-10.55 dB</compr_Minimum>
      <compr_Maximum>-0.56</compr_Maximum>
      <compr_Maximum>-0.56 dB</compr_Maximum>
      <compr_Count>217</compr_Count>
    </track>
  </File>
</Mediainfo>

2022-03-27 08:02:22 DEBUG    POSTPROCESSOR :: [9b23c72] Handling general track
2022-03-27 08:02:22 DEBUG    POSTPROCESSOR :: [9b23c72] Handling video track
2022-03-27 08:02:22 DEBUG    POSTPROCESSOR :: [9b23c72] Handling audio track
2022-03-27 08:02:22 DEBUG    POSTPROCESSOR :: [9b23c72] Skipping rule language since property is already present: <Language [en]>
2022-03-27 08:02:22 DEBUG    POSTPROCESSOR :: [9b23c72] No associated files were found for /home/**********/Downloads/Completed/MedusaUS/Euphoria.US.S01.REPACK.1080p.AMZN.WEBRip.DDP5.1.x264-KiNGS[rartv]/Euphoria.US.S01E01.Pilot.1080p.AMZN.WEB-DL.DDP5.1.H.264-KiNGS.mkv
2022-03-27 08:02:22 DEBUG    POSTPROCESSOR :: [9b23c72] No subtitles associated. Postponing the post-processing of this file: Euphoria.US.S01E01.Pilot.1080p.AMZN.WEB-DL.DDP5.1.H.264-KiNGS.mkv
2022-03-27 08:02:22 INFO     POSTPROCESSOR :: [9b23c72] Not deleting folder /home/**********/Downloads/Completed/MedusaUS/Euphoria.US.S01.REPACK.1080p.AMZN.WEBRip.DDP5.1.x264-KiNGS[rartv] found the following files: ['Euphoria.US.S01E01.Pilot.1080p.AMZN.WEB-DL.DDP5.1.H.264-KiNGS.mkv']
2022-03-27 08:02:22 DEBUG    POSTPROCESSOR :: [9b23c72] Ignoring folder: .stfolder
2022-03-27 08:02:22 INFO     POSTPROCESSOR :: [9b23c72] Post-processing completed.
2022-03-27 08:02:22 INFO     POSTPROCESSOR :: [9b23c72] I did encounter some unprocessable items: 
2022-03-27 08:02:22 WARNING  POSTPROCESSOR :: [9b23c72] Missed file: /home/**********/Downloads/Completed/MedusaUS/.stfolder: Hidden or ignored folder

NicoLeOca avatar Mar 27 '22 06:03 NicoLeOca

Someone added that feature a Looonnnng time ago. And tbh I haven't a clue what the feature should actually do. So when I refactored large parts of the code last summer, i stumbled upon this. And I kinda tried to left it alone. But I should actually ripped any trace of it out of medusa.

p0psicles avatar Mar 27 '22 09:03 p0psicles

which feature are you talking about exactly? What do you want to get rid of?

I use it the way I described for years I think. Until a few weeks/months ago, the files were not deleted and were sitting in the PP folder until subs were available.

NicoLeOca avatar Mar 27 '22 14:03 NicoLeOca

I just don't understand what problem that solves over letting it postprocess and have it download the sub when it gets available ?

p0psicles avatar Mar 27 '22 15:03 p0psicles

Indeed that was implemented a looonnnggg time ago 8-D If I remember well, I did request this feature and beta tested it.

it prevents complications when you use the automatic download to device feature from Plex. Let's say you always want 10 unwatched episodes of your favorite show on your mobile. Once there is a new episode, Plex copies it to the device no matter if there subs or not. If you go offline, you're trapped. Since this feature was implemented, Plex integrated the possibility to download subs online directly from the app. Still, if you are offline...

I like this feature in Medusa :-D probably the least understood feature it's a killer for non english-native people. your episode does not show up in your media center until you can really watch it.

Please keep it

NicoLeOca avatar Mar 27 '22 19:03 NicoLeOca

It's also great for hearing impaired. The feature is a great idea, the implementation was lacking.

labrys avatar Mar 28 '22 09:03 labrys

@NicoLeOca would it be okay if I made this work with only the Download Handling?

Then I could extract the logic out of the postprocessing. Like, I don't think pp should be run until a sub is available

p0psicles avatar Mar 28 '22 11:03 p0psicles

@p0psicles It is a bit of a shame, but I understand that the workload to fix an underused feature is not justified. Would it be possible to have a warning displayed when someone with the feature enabled runs manual PP, please?

NicoLeOca avatar Mar 29 '22 19:03 NicoLeOca

@p0psicles The cleanest way would be to support one of the built-in Plex features. It excludes files by adding a specific file in the media folder. https://support.plex.tv/articles/201381883-special-keyword-file-folder-exclusion/

NicoLeOca avatar Apr 08 '22 09:04 NicoLeOca

Hi, you havent' really answered my question?

p0psicles avatar Apr 08 '22 10:04 p0psicles

Hi, you havent' really answered my question?

Hi, can you reformulate it please? I thought I answered it.

NicoLeOca avatar Apr 08 '22 10:04 NicoLeOca

We have different ways of postprocessing in medusa.

  1. Manual PP
  2. Scheduled PP
  3. Download Handling

Download handling is the new (preferred) way of processing. Here medusa keeps track of the download, by communicating with the download client. My proposal is to add the wait for subs in this PP method only. That would save me a lot of time.

p0psicles avatar Apr 08 '22 11:04 p0psicles

If I explain my usage:

  1. Manual PP : a few media per month; if I lose the "delay PP if no subs" feature, I only need to pay attention that the subs are ok before it gets processed
  2. Scheduled PP : that's a bit trickier as it runs automatically; I have a distant seedbox where Medusa pushes a few dl; the media is synced back into the Medusa PP folder by Syncthing. once a day, it gets PPed automatically. If there are no subs, I miss it and Plex will push the media to any device without subs.
  3. Download handling : I use it locally, with Usenet. That's my main usage.

Now about what you should do. Not my time, not my decision. Whatever you decide, I will adapt.

one idea: Would it be appropriate to block PP instead of delaying it when the required subtitles are not present? Would it apply to all the 3 methods?

NicoLeOca avatar Apr 08 '22 13:04 NicoLeOca

My suggestion is to block / delay the postprocessing only for method 3. And my question to you is, if you would be okay with that?

p0psicles avatar Apr 26 '22 09:04 p0psicles

I could live with it

NicoLeOca avatar Apr 28 '22 12:04 NicoLeOca

@NicoLeOca could you contact me on discord. I have some questions about how this is supposed to work.

p0psicles avatar Apr 29 '22 08:04 p0psicles