clinton-hall / nzbToMedia

Provides NZB and Torrent postprocessing To CouchPotatoServer, SickBeard/SickRage, HeadPhones, Mylar and Gamez
GNU General Public License v3.0
672 stars 176 forks source link

[Request] Subtitle move before Sonarr processing #768

Closed Mirabis closed 3 years ago

Mirabis commented 9 years ago

Hi,

Would it be possible to have the script move the subtitles into the target directory of Sonarr?

E.g. upon the request for the scan it returns some information. Can that information to be used to determine the location Sonarr will move the file in ( incl. name) so it keeps the subtitles?

clinton-hall commented 9 years ago

Does Sonarr not process (move and rename) subtitles downloaded by nzbToMedia?

Mirabis commented 9 years ago

Nope, it only imports/moves the media file. A shame though, as I have the embedded subtitles extracted... but just lose them afterwards due to it not being imported.

clinton-hall commented 9 years ago

There is an option to set an external subsdir

in autoProcessMedia.cfg

[Torrent]
        # externalSubDir. set the directory where subs should be saved (if not the same directory as the video)
    externalSubDir = ""

if you set this to another directory, Sonarr wont touch it, and then you can manually move them.

It isn't that trivial to find the target directory to send these to... so this will at least stop you losing the subs.

Jelmerb commented 5 years ago

@clinton-hall I believe Sonarr doens't import subtitles files that aren't named like the video file. For instance:

Video file: The.Righteous.Gemstones.S01E01.WEBRip.x264-ION10.mp4 Sub file: 2_English.srt

Can I configure nzbToMedia to rename subtitle files like the video file? Or doesn't nzbToMedia support this behaviour?

If not, which fork of SickBeard does import and rename subtitle files correctly?

clinton-hall commented 5 years ago

Interesting. I could look to add the ability to rename subs to match the video file name. The biggest issue is handling non-standard filenames.

e.g. 2_English.srt we would need to rename to The.Righteous.Gemstones.S01E01.WEBRip.x264-ION10.eng.srt or The.Righteous.Gemstones.S01E01.WEBRip.x264-ION10.english.srt but likewise 2_esp.srt would have to be identified...

So I would need to build(or reference) and index of common full-length languages, and the corresponding 2-3 character identifications to allow us to identify the language of the existing subs, and then name them appropriately.

Much of this would exist within the subliminal library. Also, the transcoding functions allow us to parse the subs to read the language from the metadata directly...

So this shouldn't be too much of an ask. I just need to do some tests and have a play.

The big question is what does Sonarr look for? Would simply adding the video file name in front work? The.Righteous.Gemstones.S01E01.WEBRip.x264-ION10.2_English.srt or do we have to keep it more conventional? The.Righteous.Gemstones.S01E01.WEBRip.x264-ION10.English.srt or The.Righteous.Gemstones.S01E01.WEBRip.x264-ION10.eng.srt

Jelmerb commented 5 years ago

you're awesome.

Sonar supports ISO 639-1 (2 letter) or ISO 639-2 (3 letter) language codes. So it will recognize these files I think:

I got this from this Sonarr thread: https://github.com/Sonarr/Sonarr/issues/2639

That would be super awesome. I don't have nearly enough experience in Python to help coding, but I am a developer so If you need some ideas how to handle this, just let me know. But it seems like you are on the right path already.

This site might help with the matching of the languages to their codes: https://www.loc.gov/standards/iso639-2/php/code_list.php

clinton-hall commented 5 years ago

Ok, I think I have this.... need to test it on a few different downloads...

Please switch to latest subs-patch-1 branch https://github.com/clinton-hall/nzbToMedia/tree/subs-patch-1 and test this out.

Jelmerb commented 5 years ago

Nice, I will test it out immediately. Do I need to turn a setting in the config?

clinton-hall commented 5 years ago

No settings. It should just check to see if the subtitle name matches the video... and if not, rename it accordingly.

there are a few checks. e.g. if more than one video file, it won't try and rename subs. if in trying to rename a sub as <Video>.<lang>.<ext> the destination file already exists, it won't rename...

clinton-hall commented 5 years ago

you should be able to use git checkout subs-patch-1 and this should keep your config otherwise, make a copy/backup of autoProcessMedia.cfg, then do a new clone and copy your backup of autoProcessMedia.cfg into the new clone.

Jelmerb commented 5 years ago

Thanks, I did the checkout and have the subs-patch-1 branch now. Unfortunately, the subtitles are not renamed. They are recognized as media files and moved to the target folder, but after that nothing happens. It checks the video file for corruption and then the script quits, the files aren't imported by Sonarr, and the processed (target) directory isn't cleaned up and it doesn't notifies me that the process is complete. I enabled log_debug and log_env but no error messages are returned.

clinton-hall commented 5 years ago

can you post logs so that I can see where it got to? I am guessing something in the new code failed....

Jelmerb commented 5 years ago

Here it comes:

2019-08-25 11:06:28 INFO ::MAIN: Loading config from [/volume1/transmission/nzbToMedia/autoProcessMedia.cfg] 2019-08-25 11:06:28 INFO ::ENVIRONMENT: SYNOPKG_PKGPORT: 9091 2019-08-25 11:06:28 INFO ::ENVIRONMENT: SYNOPKG_TEMP_LOGFILE: /tmp/synopkgmgr.log-transmission 2019-08-25 11:06:28 INFO ::ENVIRONMENT: SYNOPKG_PKGVER: 2.94-16 2019-08-25 11:06:28 INFO ::ENVIRONMENT: SYNOPKG_PKGDEST: /volume1/@appstore/transmission 2019-08-25 11:06:28 INFO ::ENVIRONMENT: SYNOPKG_DSM_ARCH: monaco 2019-08-25 11:06:28 INFO ::ENVIRONMENT: UPSTART_EVENTS: syno.pkgctl.pkgstart 2019-08-25 11:06:28 INFO ::ENVIRONMENT: SYNOPKG_DSM_VERSION_MAJOR: 6 2019-08-25 11:06:28 INFO ::ENVIRONMENT: TR_TIME_LOCALTIME: Sun Aug 25 11:06:11 2019 2019-08-25 11:06:28 INFO ::ENVIRONMENT: PATH: /volume1/@appstore/transmission/bin:/usr/local/python/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin 2019-08-25 11:06:28 INFO ::ENVIRONMENT: SYNOPKG_DSM_VERSION_BUILD: 24922 2019-08-25 11:06:28 INFO ::ENVIRONMENT: SYNOPKG_PKGNAME: transmission 2019-08-25 11:06:28 INFO ::ENVIRONMENT: TR_APP_VERSION: 2.94 2019-08-25 11:06:28 INFO ::ENVIRONMENT: TERM: vt102 2019-08-25 11:06:28 INFO ::ENVIRONMENT: SHLVL: 2 2019-08-25 11:06:28 INFO ::ENVIRONMENT: TR_TORRENT_HASH: 02307b86f527cb29404cf4f836ab82e2c6335df0 2019-08-25 11:06:28 INFO ::ENVIRONMENT: UPSTART_INSTANCE: 2019-08-25 11:06:28 INFO ::ENVIRONMENT: TR_TORRENT_NAME: Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:06:28 INFO ::ENVIRONMENT: SYNOPKG_DSM_LANGUAGE: enu 2019-08-25 11:06:28 INFO ::ENVIRONMENT: SYNOPKG_PKGDEST_VOL: /volume1 2019-08-25 11:06:28 INFO ::ENVIRONMENT: SYNOPKG_DSM_VERSIONMINOR: 2 2019-08-25 11:06:28 INFO ::ENVIRONMENT: : /volume1/@appstore/transmission/bin/transmission-daemon 2019-08-25 11:06:28 INFO ::ENVIRONMENT: TR_TORRENT_DIR: /volume1/video/complete/tv 2019-08-25 11:06:28 INFO ::ENVIRONMENT: SELF: transmission 2019-08-25 11:06:28 INFO ::ENVIRONMENT: UPSTART_JOB: pkgctl-transmission 2019-08-25 11:06:28 INFO ::ENVIRONMENT: PWD: / 2019-08-25 11:06:28 INFO ::ENVIRONMENT: TR_TORRENT_ID: 6 2019-08-25 11:06:28 INFO ::MAIN: Python v2.7 will reach end of life in 129 days. 2019-08-25 11:06:28 WARNING ::MAIN: Please upgrade to a more recent Python version. 2019-08-25 11:06:28 INFO ::MAIN: Checking database structure... 2019-08-25 11:06:28 DEBUG ::MAIN: Checking Initial Schema database upgrade 2019-08-25 11:06:28 DEBUG ::MAIN: InitialSchema upgrade not required 2019-08-25 11:06:28 DEBUG ::MAIN: Checking if we can use git commands: "git" version 2019-08-25 11:06:28 DEBUG ::MAIN: Executing "git" version with your shell in /volume1/transmission/nzbToMedia 2019-08-25 11:06:28 DEBUG ::MAIN: "git" version : returned successful 2019-08-25 11:06:28 DEBUG ::MAIN: Using: "git" 2019-08-25 11:06:28 DEBUG ::MAIN: Executing "git" symbolic-ref -q HEAD with your shell in /volume1/transmission/nzbToMedia 2019-08-25 11:06:28 DEBUG ::MAIN: "git" symbolic-ref -q HEAD : returned successful 2019-08-25 11:06:28 INFO ::MAIN: Checking if git needs an update 2019-08-25 11:06:28 DEBUG ::MAIN: Executing "git" rev-parse HEAD with your shell in /volume1/transmission/nzbToMedia 2019-08-25 11:06:28 DEBUG ::MAIN: "git" rev-parse HEAD : returned successful 2019-08-25 11:06:28 DEBUG ::MAIN: Executing "git" fetch origin with your shell in /volume1/transmission/nzbToMedia 2019-08-25 11:06:30 DEBUG ::MAIN: "git" fetch origin : returned successful 2019-08-25 11:06:30 DEBUG ::MAIN: Executing "git" rev-parse --verify --quiet '@{upstream}' with your shell in /volume1/transmission/nzbToMedia 2019-08-25 11:06:30 DEBUG ::MAIN: "git" rev-parse --verify --quiet '@{upstream}' : returned successful 2019-08-25 11:06:30 DEBUG ::MAIN: Executing "git" rev-list --left-right '@{upstream}'...HEAD with your shell in /volume1/transmission/nzbToMedia 2019-08-25 11:06:31 DEBUG ::MAIN: "git" rev-list --left-right '@{upstream}'...HEAD : returned successful 2019-08-25 11:06:31 DEBUG ::MAIN: cur_commit = 4b0933a9e34cc19c7f87a7650b780d220e7a280e % (newest_commit)= 4b0933a9e34cc19c7f87a7650b780d220e7a280e, num_commits_behind = 0, num_commits_ahead = 0 2019-08-25 11:06:31 INFO ::MAIN: No update needed 2019-08-25 11:06:31 INFO ::MAIN: nzbToMedia Version:4b0933a9e34cc19c7f87a7650b780d220e7a280e Branch:subs-patch-1 (Linux 3.10.105) 2019-08-25 11:06:31 WARNING ::MAIN: Failed to locate par2. Repair and rename using par files will not be possible! 2019-08-25 11:06:31 DEBUG ::MAIN: Connecting to transmission: http://localhost:9091 2019-08-25 11:06:31 INFO ::MAIN: ######################################################### 2019-08-25 11:06:31 INFO ::MAIN: ## ..::[TorrentToMedia.py]::.. ## 2019-08-25 11:06:31 INFO ::MAIN: ######################################################### 2019-08-25 11:06:31 DEBUG ::MAIN: Options passed into TorrentToMedia: ['/volume1/transmission/nzbToMedia/TorrentToMedia.py'] 2019-08-25 11:06:31 DEBUG ::MAIN: Adding TORRENT download info for directory /volume1/video/complete/tv to database 2019-08-25 11:06:31 DEBUG ::MAIN: Received Directory: /volume1/video/complete/tv | Name: Pennyworth.S01E06.WEBRip.x264-ION10 | Category: 2019-08-25 11:06:31 DEBUG ::MAIN: SEARCH: Found Category: tv in directory structure 2019-08-25 11:06:31 INFO ::MAIN: SEARCH: Found torrent directory Pennyworth.S01E06.WEBRip.x264-ION10 in input directory directory /volume1/video/complete/tv 2019-08-25 11:06:31 INFO ::MAIN: SEARCH: Setting input_directory to /volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:06:31 DEBUG ::MAIN: Determined Directory: /volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10 | Name: Pennyworth.S01E06.WEBRip.x264-ION10 | Category: tv 2019-08-25 11:06:31 INFO ::MAIN: Auto-detected SECTION:NzbDrone 2019-08-25 11:06:31 DEBUG ::MAIN: Stopping torrent Pennyworth.S01E06.WEBRip.x264-ION10 in transmission while processing 2019-08-25 11:06:36 INFO ::MAIN: Output directory set to: /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:06:36 DEBUG ::MAIN: Scanning files in directory: /volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:06:36 DEBUG ::MAIN: Found 3 files in /volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:06:36 INFO ::COPYLINK: MEDIAFILE: [3_English.srt] 2019-08-25 11:06:36 INFO ::COPYLINK: SOURCE FOLDER: [/volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10/Subs] 2019-08-25 11:06:36 INFO ::COPYLINK: TARGET FOLDER: [/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10] 2019-08-25 11:06:37 INFO ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER 2019-08-25 11:06:37 INFO ::COPYLINK: MEDIAFILE: [2_English.srt] 2019-08-25 11:06:37 INFO ::COPYLINK: SOURCE FOLDER: [/volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10/Subs] 2019-08-25 11:06:37 INFO ::COPYLINK: TARGET FOLDER: [/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10] 2019-08-25 11:06:37 INFO ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER 2019-08-25 11:06:37 INFO ::COPYLINK: MEDIAFILE: [Pennyworth.S01E06.WEBRip.x264-ION10.mp4] 2019-08-25 11:06:37 INFO ::COPYLINK: SOURCE FOLDER: [/volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10] 2019-08-25 11:06:37 INFO ::COPYLINK: TARGET FOLDER: [/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10] 2019-08-25 11:06:37 INFO ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER 2019-08-25 11:06:37 DEBUG ::MAIN: Checking for archives to extract in directory: /volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:06:37 INFO ::MAIN: FLATTEN: Flattening directory: /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:06:37 DEBUG ::MAIN: Checking for empty folders in:/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:06:37 INFO ::MAIN: Found 1 media files in /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:06:37 INFO ::MAIN: Calling NzbDrone:tv to post-process:Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:06:37 DEBUG ::SERVER: Attempting to connect to server at http://localhost:8989 2019-08-25 11:06:37 DEBUG ::SERVER: Server responded at http://localhost:8989 2019-08-25 11:06:37 INFO ::MAIN: Attempting to verify tv fork 2019-08-25 11:06:37 INFO ::MAIN: NzbDrone:tv fork set to default 2019-08-25 11:06:37 INFO ::MAIN: FLATTEN: Flattening directory: /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:06:37 DEBUG ::MAIN: Checking for empty folders in:/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:06:37 DEBUG ::MAIN: calling command: /usr/local/ffmpeg/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /volume1/transmission/nzbToMedia/tests/test.mp4 2019-08-25 11:06:39 INFO ::TRANSCODER: Checking [Pennyworth.S01E06.WEBRip.x264-ION10.mp4] for corruption, please stand by ... 2019-08-25 11:06:39 DEBUG ::MAIN: calling command: /usr/local/ffmpeg/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10/Pennyworth.S01E06.WEBRip.x264-ION10.mp4 2019-08-25 11:06:39 INFO ::TRANSCODER: SUCCESS: [Pennyworth.S01E06.WEBRip.x264-ION10.mp4] has no corruption.

clinton-hall commented 5 years ago

thanks. That confirms the issue was in the new code.... and a really stupid error at my end. I have just pushed a fix... please update and see if that gets any closer...

Jelmerb commented 5 years ago

Pulled the last code, but there is no difference. The log again:

2019-08-25 11:28:29 INFO ::MAIN: Loading config from [/volume1/transmission/nzbToMedia/autoProcessMedia.cfg] 2019-08-25 11:28:29 INFO ::ENVIRONMENT: SYNOPKG_PKGPORT: 9091 2019-08-25 11:28:29 INFO ::ENVIRONMENT: SYNOPKG_TEMP_LOGFILE: /tmp/synopkgmgr.log-transmission 2019-08-25 11:28:29 INFO ::ENVIRONMENT: SYNOPKG_PKGVER: 2.94-16 2019-08-25 11:28:29 INFO ::ENVIRONMENT: SYNOPKG_PKGDEST: /volume1/@appstore/transmission 2019-08-25 11:28:29 INFO ::ENVIRONMENT: SYNOPKG_DSM_ARCH: monaco 2019-08-25 11:28:29 INFO ::ENVIRONMENT: UPSTART_EVENTS: syno.pkgctl.pkgstart 2019-08-25 11:28:29 INFO ::ENVIRONMENT: SYNOPKG_DSM_VERSION_MAJOR: 6 2019-08-25 11:28:29 INFO ::ENVIRONMENT: TR_TIME_LOCALTIME: Sun Aug 25 11:28:01 2019 2019-08-25 11:28:29 INFO ::ENVIRONMENT: PATH: /volume1/@appstore/transmission/bin:/usr/local/python/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin 2019-08-25 11:28:29 INFO ::ENVIRONMENT: SYNOPKG_DSM_VERSION_BUILD: 24922 2019-08-25 11:28:29 INFO ::ENVIRONMENT: SYNOPKG_PKGNAME: transmission 2019-08-25 11:28:29 INFO ::ENVIRONMENT: TR_APP_VERSION: 2.94 2019-08-25 11:28:29 INFO ::ENVIRONMENT: TERM: vt102 2019-08-25 11:28:29 INFO ::ENVIRONMENT: SHLVL: 2 2019-08-25 11:28:29 INFO ::ENVIRONMENT: TR_TORRENT_HASH: 02307b86f527cb29404cf4f836ab82e2c6335df0 2019-08-25 11:28:29 INFO ::ENVIRONMENT: UPSTART_INSTANCE: 2019-08-25 11:28:29 INFO ::ENVIRONMENT: TR_TORRENT_NAME: Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:28:29 INFO ::ENVIRONMENT: SYNOPKG_DSM_LANGUAGE: enu 2019-08-25 11:28:29 INFO ::ENVIRONMENT: SYNOPKG_PKGDEST_VOL: /volume1 2019-08-25 11:28:29 INFO ::ENVIRONMENT: SYNOPKG_DSM_VERSIONMINOR: 2 2019-08-25 11:28:29 INFO ::ENVIRONMENT: : /volume1/@appstore/transmission/bin/transmission-daemon 2019-08-25 11:28:29 INFO ::ENVIRONMENT: TR_TORRENT_DIR: /volume1/video/complete/tv 2019-08-25 11:28:29 INFO ::ENVIRONMENT: SELF: transmission 2019-08-25 11:28:29 INFO ::ENVIRONMENT: UPSTART_JOB: pkgctl-transmission 2019-08-25 11:28:29 INFO ::ENVIRONMENT: PWD: / 2019-08-25 11:28:29 INFO ::ENVIRONMENT: TR_TORRENT_ID: 7 2019-08-25 11:28:29 INFO ::MAIN: Python v2.7 will reach end of life in 129 days. 2019-08-25 11:28:29 WARNING ::MAIN: Please upgrade to a more recent Python version. 2019-08-25 11:28:29 INFO ::MAIN: Checking database structure... 2019-08-25 11:28:29 DEBUG ::MAIN: Checking Initial Schema database upgrade 2019-08-25 11:28:29 DEBUG ::MAIN: InitialSchema upgrade not required 2019-08-25 11:28:29 DEBUG ::MAIN: Checking if we can use git commands: "git" version 2019-08-25 11:28:29 DEBUG ::MAIN: Executing "git" version with your shell in /volume1/transmission/nzbToMedia 2019-08-25 11:28:29 DEBUG ::MAIN: "git" version : returned successful 2019-08-25 11:28:29 DEBUG ::MAIN: Using: "git" 2019-08-25 11:28:29 DEBUG ::MAIN: Executing "git" symbolic-ref -q HEAD with your shell in /volume1/transmission/nzbToMedia 2019-08-25 11:28:29 DEBUG ::MAIN: "git" symbolic-ref -q HEAD : returned successful 2019-08-25 11:28:29 INFO ::MAIN: Checking if git needs an update 2019-08-25 11:28:29 DEBUG ::MAIN: Executing "git" rev-parse HEAD with your shell in /volume1/transmission/nzbToMedia 2019-08-25 11:28:29 DEBUG ::MAIN: "git" rev-parse HEAD : returned successful 2019-08-25 11:28:29 DEBUG ::MAIN: Executing "git" fetch origin with your shell in /volume1/transmission/nzbToMedia 2019-08-25 11:28:32 DEBUG ::MAIN: "git" fetch origin : returned successful 2019-08-25 11:28:32 DEBUG ::MAIN: Executing "git" rev-parse --verify --quiet '@{upstream}' with your shell in /volume1/transmission/nzbToMedia 2019-08-25 11:28:32 DEBUG ::MAIN: "git" rev-parse --verify --quiet '@{upstream}' : returned successful 2019-08-25 11:28:32 DEBUG ::MAIN: Executing "git" rev-list --left-right '@{upstream}'...HEAD with your shell in /volume1/transmission/nzbToMedia 2019-08-25 11:28:32 DEBUG ::MAIN: "git" rev-list --left-right '@{upstream}'...HEAD : returned successful 2019-08-25 11:28:32 DEBUG ::MAIN: cur_commit = fbd00dfbbdfb00e8879c5fbd616306edd58a1e59 % (newest_commit)= fbd00dfbbdfb00e8879c5fbd616306edd58a1e59, num_commits_behind = 0, num_commits_ahead = 0 2019-08-25 11:28:32 INFO ::MAIN: No update needed 2019-08-25 11:28:32 INFO ::MAIN: nzbToMedia Version:fbd00dfbbdfb00e8879c5fbd616306edd58a1e59 Branch:subs-patch-1 (Linux 3.10.105) 2019-08-25 11:28:33 WARNING ::MAIN: Failed to locate par2. Repair and rename using par files will not be possible! 2019-08-25 11:28:33 DEBUG ::MAIN: Connecting to transmission: http://localhost:9091 2019-08-25 11:28:33 INFO ::MAIN: ######################################################### 2019-08-25 11:28:33 INFO ::MAIN: ## ..::[TorrentToMedia.py]::.. ## 2019-08-25 11:28:33 INFO ::MAIN: ######################################################### 2019-08-25 11:28:33 DEBUG ::MAIN: Options passed into TorrentToMedia: ['/volume1/transmission/nzbToMedia/TorrentToMedia.py'] 2019-08-25 11:28:33 DEBUG ::MAIN: Adding TORRENT download info for directory /volume1/video/complete/tv to database 2019-08-25 11:28:33 DEBUG ::MAIN: Received Directory: /volume1/video/complete/tv | Name: Pennyworth.S01E06.WEBRip.x264-ION10 | Category: 2019-08-25 11:28:33 DEBUG ::MAIN: SEARCH: Found Category: tv in directory structure 2019-08-25 11:28:33 INFO ::MAIN: SEARCH: Found torrent directory Pennyworth.S01E06.WEBRip.x264-ION10 in input directory directory /volume1/video/complete/tv 2019-08-25 11:28:33 INFO ::MAIN: SEARCH: Setting input_directory to /volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:28:33 DEBUG ::MAIN: Determined Directory: /volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10 | Name: Pennyworth.S01E06.WEBRip.x264-ION10 | Category: tv 2019-08-25 11:28:34 INFO ::MAIN: Auto-detected SECTION:NzbDrone 2019-08-25 11:28:34 DEBUG ::MAIN: Stopping torrent Pennyworth.S01E06.WEBRip.x264-ION10 in transmission while processing 2019-08-25 11:28:39 INFO ::MAIN: Output directory set to: /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:28:39 DEBUG ::MAIN: Scanning files in directory: /volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:28:39 DEBUG ::MAIN: Found 3 files in /volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:28:39 INFO ::COPYLINK: MEDIAFILE: [3_English.srt] 2019-08-25 11:28:39 INFO ::COPYLINK: SOURCE FOLDER: [/volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10/Subs] 2019-08-25 11:28:39 INFO ::COPYLINK: TARGET FOLDER: [/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10] 2019-08-25 11:28:39 INFO ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER 2019-08-25 11:28:39 INFO ::COPYLINK: MEDIAFILE: [2_English.srt] 2019-08-25 11:28:39 INFO ::COPYLINK: SOURCE FOLDER: [/volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10/Subs] 2019-08-25 11:28:39 INFO ::COPYLINK: TARGET FOLDER: [/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10] 2019-08-25 11:28:39 INFO ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER 2019-08-25 11:28:39 INFO ::COPYLINK: MEDIAFILE: [Pennyworth.S01E06.WEBRip.x264-ION10.mp4] 2019-08-25 11:28:39 INFO ::COPYLINK: SOURCE FOLDER: [/volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10] 2019-08-25 11:28:39 INFO ::COPYLINK: TARGET FOLDER: [/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10] 2019-08-25 11:28:39 INFO ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER 2019-08-25 11:28:39 DEBUG ::MAIN: Checking for archives to extract in directory: /volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:28:39 INFO ::MAIN: FLATTEN: Flattening directory: /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:28:39 DEBUG ::MAIN: Checking for empty folders in:/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:28:39 INFO ::MAIN: Found 1 media files in /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:28:39 INFO ::MAIN: Calling NzbDrone:tv to post-process:Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:28:39 DEBUG ::SERVER: Attempting to connect to server at http://localhost:8989 2019-08-25 11:28:40 DEBUG ::SERVER: Server responded at http://localhost:8989 2019-08-25 11:28:40 INFO ::MAIN: Attempting to verify tv fork 2019-08-25 11:28:44 INFO ::MAIN: NzbDrone:tv fork set to default 2019-08-25 11:28:44 INFO ::MAIN: FLATTEN: Flattening directory: /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:28:44 DEBUG ::MAIN: Checking for empty folders in:/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-25 11:28:44 DEBUG ::MAIN: calling command: /usr/local/ffmpeg/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /volume1/transmission/nzbToMedia/tests/test.mp4 2019-08-25 11:28:46 INFO ::TRANSCODER: Checking [Pennyworth.S01E06.WEBRip.x264-ION10.mp4] for corruption, please stand by ... 2019-08-25 11:28:46 DEBUG ::MAIN: calling command: /usr/local/ffmpeg/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10/Pennyworth.S01E06.WEBRip.x264-ION10.mp4 2019-08-25 11:28:46 INFO ::TRANSCODER: SUCCESS: [Pennyworth.S01E06.WEBRip.x264-ION10.mp4] has no corruption.

clinton-hall commented 5 years ago

Sorry for this... I can't see where it is failing here... I'll need to try and set up a test scenario and figure this out...

Jelmerb commented 5 years ago

no worries, I you have something for me to test, just let me know and I will get to it ASAP.

clinton-hall commented 5 years ago

So... that was embarrassing.... such a stupid mistake at my end.

The tests I have done here now correctly rename the subs... hopefully it does now for you too.

Please update to latest subs-patch-1

Jelmerb commented 5 years ago

Okay, I ran a test. The script finishes now, so that is good. But the subtitles don't get renamed and the end result is that they are lost. The video file is The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10.mp4 and the subtitle file is 2_English.srt. It might be good to mention that the subtitle is in an external subs folder. But the subtitle is moved by nzbToMedia along with the video file to the same processed folder. Could it be possible that nzbToMedia tries to rename the subtitle before it is moved out of the Subs folder and therefore can't find it?

Log: 2019-08-26 11:43:28 INFO ::MAIN: Loading config from [/volume1/transmission/nzbToMedia/autoProcessMedia.cfg] 2019-08-26 11:43:28 INFO ::ENVIRONMENT: SYNOPKG_PKGPORT: 9091 2019-08-26 11:43:28 INFO ::ENVIRONMENT: SYNOPKG_TEMP_LOGFILE: /tmp/synopkgmgr.log-transmission 2019-08-26 11:43:28 INFO ::ENVIRONMENT: SYNOPKG_PKGVER: 2.94-16 2019-08-26 11:43:28 INFO ::ENVIRONMENT: SYNOPKG_PKGDEST: /volume1/@appstore/transmission 2019-08-26 11:43:28 INFO ::ENVIRONMENT: SYNOPKG_DSM_ARCH: monaco 2019-08-26 11:43:28 INFO ::ENVIRONMENT: UPSTART_EVENTS: syno.pkgctl.pkgstart 2019-08-26 11:43:28 INFO ::ENVIRONMENT: SYNOPKG_DSM_VERSION_MAJOR: 6 2019-08-26 11:43:28 INFO ::ENVIRONMENT: TR_TIME_LOCALTIME: Mon Aug 26 11:43:09 2019 2019-08-26 11:43:28 INFO ::ENVIRONMENT: PATH: /volume1/@appstore/transmission/bin:/usr/local/python/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin 2019-08-26 11:43:28 INFO ::ENVIRONMENT: SYNOPKG_DSM_VERSION_BUILD: 24922 2019-08-26 11:43:28 INFO ::ENVIRONMENT: SYNOPKG_PKGNAME: transmission 2019-08-26 11:43:28 INFO ::ENVIRONMENT: TR_APP_VERSION: 2.94 2019-08-26 11:43:28 INFO ::ENVIRONMENT: TERM: vt102 2019-08-26 11:43:28 INFO ::ENVIRONMENT: SHLVL: 2 2019-08-26 11:43:28 INFO ::ENVIRONMENT: TR_TORRENT_HASH: 10e222a2fddfe4901b5fca41fa332d5efac4aa62 2019-08-26 11:43:28 INFO ::ENVIRONMENT: UPSTART_INSTANCE: 2019-08-26 11:43:28 INFO ::ENVIRONMENT: TR_TORRENT_NAME: The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 2019-08-26 11:43:28 INFO ::ENVIRONMENT: SYNOPKG_DSM_LANGUAGE: enu 2019-08-26 11:43:28 INFO ::ENVIRONMENT: SYNOPKG_PKGDEST_VOL: /volume1 2019-08-26 11:43:28 INFO ::ENVIRONMENT: SYNOPKG_DSM_VERSIONMINOR: 2 2019-08-26 11:43:28 INFO ::ENVIRONMENT: : /volume1/@appstore/transmission/bin/transmission-daemon 2019-08-26 11:43:28 INFO ::ENVIRONMENT: TR_TORRENT_DIR: /volume1/video/complete/tv 2019-08-26 11:43:28 INFO ::ENVIRONMENT: SELF: transmission 2019-08-26 11:43:28 INFO ::ENVIRONMENT: UPSTART_JOB: pkgctl-transmission 2019-08-26 11:43:28 INFO ::ENVIRONMENT: PWD: / 2019-08-26 11:43:28 INFO ::ENVIRONMENT: TR_TORRENT_ID: 10 2019-08-26 11:43:28 INFO ::MAIN: Python v2.7 will reach end of life in 128 days. 2019-08-26 11:43:28 WARNING ::MAIN: Please upgrade to a more recent Python version. 2019-08-26 11:43:28 INFO ::MAIN: Checking database structure... 2019-08-26 11:43:28 DEBUG ::MAIN: Checking Initial Schema database upgrade 2019-08-26 11:43:29 DEBUG ::MAIN: InitialSchema upgrade not required 2019-08-26 11:43:29 DEBUG ::MAIN: Checking if we can use git commands: "git" version 2019-08-26 11:43:29 DEBUG ::MAIN: Executing "git" version with your shell in /volume1/transmission/nzbToMedia 2019-08-26 11:43:29 DEBUG ::MAIN: "git" version : returned successful 2019-08-26 11:43:29 DEBUG ::MAIN: Using: "git" 2019-08-26 11:43:29 DEBUG ::MAIN: Executing "git" symbolic-ref -q HEAD with your shell in /volume1/transmission/nzbToMedia 2019-08-26 11:43:29 DEBUG ::MAIN: "git" symbolic-ref -q HEAD : returned successful 2019-08-26 11:43:29 INFO ::MAIN: Checking if git needs an update 2019-08-26 11:43:29 DEBUG ::MAIN: Executing "git" rev-parse HEAD with your shell in /volume1/transmission/nzbToMedia 2019-08-26 11:43:30 DEBUG ::MAIN: "git" rev-parse HEAD : returned successful 2019-08-26 11:43:30 DEBUG ::MAIN: Executing "git" fetch origin with your shell in /volume1/transmission/nzbToMedia 2019-08-26 11:43:35 DEBUG ::MAIN: "git" fetch origin : returned successful 2019-08-26 11:43:35 DEBUG ::MAIN: Executing "git" rev-parse --verify --quiet '@{upstream}' with your shell in /volume1/transmission/nzbToMedia 2019-08-26 11:43:35 DEBUG ::MAIN: "git" rev-parse --verify --quiet '@{upstream}' : returned successful 2019-08-26 11:43:35 DEBUG ::MAIN: Executing "git" rev-list --left-right '@{upstream}'...HEAD with your shell in /volume1/transmission/nzbToMedia 2019-08-26 11:43:35 DEBUG ::MAIN: "git" rev-list --left-right '@{upstream}'...HEAD : returned successful 2019-08-26 11:43:35 DEBUG ::MAIN: cur_commit = 81755cd751a1f6a9a487210cc5d596c2ccb37949 % (newest_commit)= 81755cd751a1f6a9a487210cc5d596c2ccb37949, num_commits_behind = 0, num_commits_ahead = 0 2019-08-26 11:43:35 INFO ::MAIN: No update needed 2019-08-26 11:43:35 INFO ::MAIN: nzbToMedia Version:81755cd751a1f6a9a487210cc5d596c2ccb37949 Branch:subs-patch-1 (Linux 3.10.105) 2019-08-26 11:43:35 WARNING ::MAIN: Failed to locate par2. Repair and rename using par files will not be possible! 2019-08-26 11:43:36 DEBUG ::MAIN: Connecting to transmission: http://localhost:9091 2019-08-26 11:43:36 INFO ::MAIN: ######################################################### 2019-08-26 11:43:36 INFO ::MAIN: ## ..::[TorrentToMedia.py]::.. ## 2019-08-26 11:43:36 INFO ::MAIN: ######################################################### 2019-08-26 11:43:36 DEBUG ::MAIN: Options passed into TorrentToMedia: ['/volume1/transmission/nzbToMedia/TorrentToMedia.py'] 2019-08-26 11:43:36 DEBUG ::MAIN: Adding TORRENT download info for directory /volume1/video/complete/tv to database 2019-08-26 11:43:36 DEBUG ::MAIN: Received Directory: /volume1/video/complete/tv | Name: The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 | Category: 2019-08-26 11:43:36 DEBUG ::MAIN: SEARCH: Found Category: tv in directory structure 2019-08-26 11:43:36 INFO ::MAIN: SEARCH: Found torrent directory The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 in input directory directory /volume1/video/complete/tv 2019-08-26 11:43:36 INFO ::MAIN: SEARCH: Setting input_directory to /volume1/video/complete/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 2019-08-26 11:43:36 DEBUG ::MAIN: Determined Directory: /volume1/video/complete/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 | Name: The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 | Category: tv 2019-08-26 11:43:36 INFO ::MAIN: Auto-detected SECTION:NzbDrone 2019-08-26 11:43:36 DEBUG ::MAIN: Stopping torrent The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 in transmission while processing 2019-08-26 11:43:42 INFO ::MAIN: Output directory set to: /volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 2019-08-26 11:43:42 DEBUG ::MAIN: Scanning files in directory: /volume1/video/complete/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 2019-08-26 11:43:42 DEBUG ::MAIN: Found 2 files in /volume1/video/complete/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 2019-08-26 11:43:42 INFO ::COPYLINK: MEDIAFILE: [2_English.srt] 2019-08-26 11:43:42 INFO ::COPYLINK: SOURCE FOLDER: [/volume1/video/complete/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10/Subs] 2019-08-26 11:43:42 INFO ::COPYLINK: TARGET FOLDER: [/volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10] 2019-08-26 11:43:42 INFO ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER 2019-08-26 11:43:42 INFO ::COPYLINK: MEDIAFILE: [The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10.mp4] 2019-08-26 11:43:42 INFO ::COPYLINK: SOURCE FOLDER: [/volume1/video/complete/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10] 2019-08-26 11:43:42 INFO ::COPYLINK: TARGET FOLDER: [/volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10] 2019-08-26 11:43:42 INFO ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER 2019-08-26 11:43:42 DEBUG ::MAIN: Checking for archives to extract in directory: /volume1/video/complete/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 2019-08-26 11:43:42 INFO ::MAIN: FLATTEN: Flattening directory: /volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 2019-08-26 11:43:42 DEBUG ::MAIN: Checking for empty folders in:/volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 2019-08-26 11:43:42 INFO ::MAIN: Found 1 media files in /volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 2019-08-26 11:43:42 INFO ::MAIN: Calling NzbDrone:tv to post-process:The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 2019-08-26 11:43:42 DEBUG ::SERVER: Attempting to connect to server at http://localhost:8989 2019-08-26 11:43:42 DEBUG ::SERVER: Server responded at http://localhost:8989 2019-08-26 11:43:42 INFO ::MAIN: Attempting to verify tv fork 2019-08-26 11:43:44 INFO ::MAIN: NzbDrone:tv fork set to default 2019-08-26 11:43:44 INFO ::MAIN: FLATTEN: Flattening directory: /volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 2019-08-26 11:43:44 DEBUG ::MAIN: Checking for empty folders in:/volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 2019-08-26 11:43:44 DEBUG ::MAIN: calling command: /usr/local/ffmpeg/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /volume1/transmission/nzbToMedia/tests/test.mp4 2019-08-26 11:43:47 INFO ::TRANSCODER: Checking [The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10.mp4] for corruption, please stand by ... 2019-08-26 11:43:47 DEBUG ::MAIN: calling command: /usr/local/ffmpeg/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10.mp4 2019-08-26 11:43:48 INFO ::TRANSCODER: SUCCESS: [The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10.mp4] has no corruption. 2019-08-26 11:43:48 POSTPROCESS::NZBDRONE: SUCCESS: The download succeeded, sending a post-process request 2019-08-26 11:43:48 DEBUG ::NZBDRONE: path: /volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 2019-08-26 11:43:48 DEBUG ::NZBDRONE: Opening URL: http://localhost:8989/api/command with data: {"path": "/volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10", "importMode": "Move", "name": "DownloadedEpisodesScan", "downloadClientId": "10E222A2FDDFE4901B5FCA41FA332D5EFAC4AA62"} 2019-08-26 11:43:49 DEBUG ::NZBDRONE: Scan started with id: 15921 2019-08-26 11:44:49 DEBUG ::NZBDRONE: The Scan command return status: completed 2019-08-26 11:44:49 DEBUG ::NZBDRONE: The directory /volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 has been removed. Renaming was successful. 2019-08-26 11:44:49 DEBUG ::PLEX: Attempting to update Plex Library for category tv. 2019-08-26 11:44:50 DEBUG ::PLEX: Plex Library has been refreshed. 2019-08-26 11:44:51 DEBUG ::MAIN: Deleting torrent The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 from transmission 2019-08-26 11:44:56 INFO ::CLEANDIR: Directory /volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 has been processed and removed ... 2019-08-26 11:44:56 INFO ::MAIN: The /volume1/transmission/nzbToMedia/TorrentToMedia.py script completed successfully.

clinton-hall commented 5 years ago

very strange:

2019-08-26 11:43:42 INFO ::COPYLINK: MEDIAFILE: [2_English.srt]
2019-08-26 11:43:42 INFO ::COPYLINK: SOURCE FOLDER: [/volume1/video/complete/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10/Subs]
2019-08-26 11:43:42 INFO ::COPYLINK: TARGET FOLDER: [/volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10]
2019-08-26 11:43:42 INFO ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER

after this, i expect there should be 2 files /volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10/2_English.srt and /volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10.mp4

then the subs renamer should be called to run on /volume1/video/processed/tv/The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10 there is no error logged, but also nothing to say it is renaming any file (which happens here when I run a test on these file names....) I might need to add extra logging to see where this breaks.

clinton-hall commented 5 years ago

ok... I found it... My tests were for file names. When the movie file name is the same as the directory file name, this ignored the sub rename.... I have fixed this... it works for me using your directory structure and file names.

Please update once more and hopefully this will do it.

Jelmerb commented 5 years ago

awesome it worked! 👍

The subtitle file is now renamed from 2_English.srt to The.Righteous.Gemstones.S01E02.WEBRip.x264-ION10.en.srt and is picked up by Sonarr.

I have seen instances of multiple English subtitles (e.g. 2_English.srt, 3_English.srt). How does nzbToMedia handle these instances?

Jelmerb commented 5 years ago

Okay, to answer my previous question: It doesn't yet. It is awesome that one subtitle is already renamed, so if you don't feel like adding support for multiple subs of the same language, I get it. But if you do feel like it, here is an example:

2019-08-26 14:28:48 INFO ::MAIN: ######################################################### 2019-08-26 14:28:48 INFO ::MAIN: ## ..::[TorrentToMedia.py]::.. ## 2019-08-26 14:28:48 INFO ::MAIN: ######################################################### 2019-08-26 14:28:48 DEBUG ::MAIN: Options passed into TorrentToMedia: ['/volume1/transmission/nzbToMedia/TorrentToMedia.py'] 2019-08-26 14:28:48 DEBUG ::MAIN: Adding TORRENT download info for directory /volume1/video/complete/tv to database 2019-08-26 14:28:48 DEBUG ::MAIN: Received Directory: /volume1/video/complete/tv | Name: Pennyworth.S01E06.WEBRip.x264-ION10 | Category: 2019-08-26 14:28:48 DEBUG ::MAIN: SEARCH: Found Category: tv in directory structure 2019-08-26 14:28:48 INFO ::MAIN: SEARCH: Found torrent directory Pennyworth.S01E06.WEBRip.x264-ION10 in input directory directory /volume1/video/complete/tv 2019-08-26 14:28:48 INFO ::MAIN: SEARCH: Setting input_directory to /volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-26 14:28:48 DEBUG ::MAIN: Determined Directory: /volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10 | Name: Pennyworth.S01E06.WEBRip.x264-ION10 | Category: tv 2019-08-26 14:28:48 INFO ::MAIN: Auto-detected SECTION:NzbDrone 2019-08-26 14:28:48 DEBUG ::MAIN: Stopping torrent Pennyworth.S01E06.WEBRip.x264-ION10 in transmission while processing 2019-08-26 14:28:53 INFO ::MAIN: Output directory set to: /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-26 14:28:53 DEBUG ::MAIN: Scanning files in directory: /volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-26 14:28:53 DEBUG ::MAIN: Found 3 files in /volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-26 14:28:53 INFO ::COPYLINK: MEDIAFILE: [3_English.srt] 2019-08-26 14:28:53 INFO ::COPYLINK: SOURCE FOLDER: [/volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10/Subs] 2019-08-26 14:28:53 INFO ::COPYLINK: TARGET FOLDER: [/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10] 2019-08-26 14:28:53 INFO ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER 2019-08-26 14:28:53 INFO ::COPYLINK: MEDIAFILE: [2_English.srt] 2019-08-26 14:28:53 INFO ::COPYLINK: SOURCE FOLDER: [/volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10/Subs] 2019-08-26 14:28:53 INFO ::COPYLINK: TARGET FOLDER: [/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10] 2019-08-26 14:28:53 INFO ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER 2019-08-26 14:28:53 INFO ::COPYLINK: MEDIAFILE: [Pennyworth.S01E06.WEBRip.x264-ION10.mp4] 2019-08-26 14:28:53 INFO ::COPYLINK: SOURCE FOLDER: [/volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10] 2019-08-26 14:28:53 INFO ::COPYLINK: TARGET FOLDER: [/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10] 2019-08-26 14:28:53 INFO ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER 2019-08-26 14:28:53 DEBUG ::MAIN: Checking for archives to extract in directory: /volume1/video/complete/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-26 14:28:53 INFO ::MAIN: FLATTEN: Flattening directory: /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-26 14:28:53 DEBUG ::MAIN: Checking for empty folders in:/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-26 14:28:53 INFO ::MAIN: Found 1 media files in /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-26 14:28:53 INFO ::MAIN: Calling NzbDrone:tv to post-process:Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-26 14:28:53 DEBUG ::SERVER: Attempting to connect to server at http://localhost:8989 2019-08-26 14:28:53 DEBUG ::SERVER: Server responded at http://localhost:8989 2019-08-26 14:28:53 INFO ::MAIN: Attempting to verify tv fork 2019-08-26 14:28:55 INFO ::MAIN: NzbDrone:tv fork set to default 2019-08-26 14:28:55 INFO ::MAIN: FLATTEN: Flattening directory: /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-26 14:28:55 DEBUG ::MAIN: Checking for empty folders in:/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-26 14:28:55 DEBUG ::MAIN: calling command: /usr/local/ffmpeg/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /volume1/transmission/nzbToMedia/tests/test.mp4 2019-08-26 14:29:00 INFO ::TRANSCODER: Checking [Pennyworth.S01E06.WEBRip.x264-ION10.mp4] for corruption, please stand by ... 2019-08-26 14:29:00 DEBUG ::MAIN: calling command: /usr/local/ffmpeg/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10/Pennyworth.S01E06.WEBRip.x264-ION10.mp4 2019-08-26 14:29:03 INFO ::TRANSCODER: SUCCESS: [Pennyworth.S01E06.WEBRip.x264-ION10.mp4] has no corruption. 2019-08-26 14:29:03 DEBUG ::MAIN: Renaming sub file from /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10/3_English.srt to /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10/Pennyworth.S01E06.WEBRip.x264-ION10.en.srt 2019-08-26 14:29:03 DEBUG ::MAIN: Unable to rename sub file /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10/2_English.srt as destination /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10/Pennyworth.S01E06.WEBRip.x264-ION10.en.srt already exists 2019-08-26 14:29:03 POSTPROCESS::NZBDRONE: SUCCESS: The download succeeded, sending a post-process request 2019-08-26 14:29:03 DEBUG ::NZBDRONE: path: /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 2019-08-26 14:29:03 DEBUG ::NZBDRONE: Opening URL: http://localhost:8989/api/command with data: {"path": "/volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10", "importMode": "Copy", "name": "DownloadedEpisodesScan", "downloadClientId": "02307B86F527CB29404CF4F836AB82E2C6335DF0"} 2019-08-26 14:29:04 DEBUG ::NZBDRONE: Scan started with id: 16211 2019-08-26 14:30:04 DEBUG ::NZBDRONE: The Scan command return status: completed 2019-08-26 14:30:04 DEBUG ::NZBDRONE: The Scan command has completed successfully. Renaming was successful. 2019-08-26 14:30:04 DEBUG ::PLEX: Attempting to update Plex Library for category tv. 2019-08-26 14:30:04 DEBUG ::PLEX: Plex Library has been refreshed. 2019-08-26 14:30:05 DEBUG ::MAIN: Deleting torrent Pennyworth.S01E06.WEBRip.x264-ION10 from transmission 2019-08-26 14:30:10 INFO ::CLEANDIRS: Directory /volume1/video/processed/tv/Pennyworth.S01E06.WEBRip.x264-ION10 still contains 3 unprocessed file(s), skipping ... 2019-08-26 14:30:10 INFO ::MAIN: The /volume1/transmission/nzbToMedia/TorrentToMedia.py script completed successfully.

Jelmerb commented 5 years ago

I did some tests with Sonarr, but it seems like they don't handle multiple subtitles of the same language either. I raised the issue on their Github page, but it seems likely they will provide support for this scenario looking at their responses to previous issues. It is safe to say you can ignore this scenario for the time being.

EDIT: The 3_English.srt which got renamed in this instance is a SDH subtitle. The 2_English.srt subtitle is a normal subtitle. Is it possible to sort the .srt files by name and only rename the first one so the normal one is renamed and imported by Sonarr?

clinton-hall commented 5 years ago

ok, if you update to latest, this hopefully does what you want...

I have designed this so that (hopefully) the subs are first sorted into order... i.e. 2_English.srt before 3_English.srt...

Then, we rename the first sub as <video_name>.<language>.<ext> with the next subs, if it has the same language (including none), it will append a number (n) as <video_name>.<language>.<n>.<ext>

So, in your example I would expect 2_English.srt to be renamed as Pennyworth.S01E06.WEBRip.x264-ION10.en.srt and 3_English.srt to be renamed as Pennyworth.S01E06.WEBRip.x264-ION10.en.1.srt

I am not sure how specifically Sonarr will handle these. i.e. will it ignore .1.srt or will it select this one first???

Note, this naming isn't quite as you described at Sonarr, but it was slightly easier to add the number after the language designator... this can be changed if needed.

Finally, I have made these changes online. I don't currently have access to my system to actually test... It looks ok, but it may have a bug in there that causes it to fail... I'll try and test tonight...

clinton-hall commented 5 years ago

yep.. there was a bug... now fixed. tested here on python2 and python3...

renames as I intended. It now comes down to how sonarr handles these and if I need to tweek how these are named.

Jelmerb commented 5 years ago

Ok, nice. Just tested it again. The script works like you said. Sonarr now imports both subtitles.

The second subtitle Pennyworth.S01E06.WEBRip.x264-ION10.en.1.srt is renamed to Pennyworth.S01E06.WEBRip.x264-ION10.srt by Sonarr. This is no huge deal but it could be improved I think. Now plex shows the second subtitle as Unknown (SRT External). Both Sonarr and Plex recognize the forced tag. So it might be better to rename the second subtitle like this: Pennyworth.S01E06.WEBRip.x264-ION10.en.1.srt -> Pennyworth.S01E06.WEBRip.x264-ION10.en.forced.srt. A SDH subtitle is different than a forced subtitle, but at least it will be recognized by Sonarr and Plex.

EDIT: on second thougt, this might be not such a good idea. I think Plex others like Kodi will use the forced tag to always show this subtitle instead of others, which is not desirable.

clinton-hall commented 5 years ago

interesting... The issue with "forced" is that this doesn't really allow for more subs. Whereas using an integer allows this to keep all subs.

should I try changing to <movie>.<n>.<lan>.<ext> i.e. Pennyworth.S01E06.WEBRip.x264-ION10.en.1.srt -> Pennyworth.S01E06.WEBRip.x264-ION10.1.en.srt or will this not make any difference?

Jelmerb commented 5 years ago

no, I already tested that with Sonarr. But Sonarr will ignore subtitles named like <movie>.<n>.<lan>.<ext>. I don't have a scenario where there are three subtitles of the same language, but I'm curious what Sonarr would do when you have these subtitles for instance:

We'll cross that bridge when we get there. As I mentioned in the edit of the previous post, adding the forced tag to the subtitle is not a good idea. I just confirmed that Plex always chooses the subtitle with forced in stead of others, so in this case the SDH subtitle is chosen over the narrative (normal) subtitle, which is not what I want.

clinton-hall commented 5 years ago

yeah, I can't think of a scenario with multiple of same language... I'm just aware that most of what I do here is stuff that I hadn't originally thought likely :)

What I'm looking at here is that the subs are named consistently and not deleted (I think we have achieved this).

I'm hoping your issue at Sonarr results in them adding the support.... if they then dictate specific input naming conventions, I can try and match that...

Jelmerb commented 5 years ago

There are actually quit a few types of subtitles that can exist for the same language.

I think the first three you see the most. In the last month I have come across a movie or episode that had three English subtitles, but I can't remember which.

You did all you can I think. I'm running some tests now in Plex to see which subtitles are recognized and which not and will provide the results of those tests to Sonarr, see if they bite. The problem with the original subtitles is that they also don't have the type of subtitle in their file name so there is no way for nzbToMedia to know which is which. Thanks for all your hard work! Much appreciated. My (Dutch) family will be grateful to you.

Edit: Plex and Kodi don't support SDH subtitles. I guess people that are deaf or hard-of-hearing don't use Plex or Kodi.

clinton-hall commented 5 years ago

hmmm... https://github.com/clinton-hall/nzbToMedia/blob/subs-patch-1/core/plugins/subtitles.py#L76

I was thinking about using the transcoder-ffprobe code I already have to parse each subtitle... I could read the metadata to determine the language and sub-type etc. (if they are defined)....

but that is a bit more work to get that implemented.

Jelmerb commented 5 years ago

Yeah, I shouldn't bother with it for now if I where you as Sonarr, Plex and Kodi don't know how to deal with those extra subtitles. If something changes in that apartment I will let you know. Also, I don't think the type of subtitle is defined in the metadata. Or I don't know where to look.

I just confirmed that Plex does support this naming scheme: <movie>.<n>.<lan>.<ext>. So if I can get Sonarr to support this too, than this would be the way to go. I'll keep you updated.

Jelmerb commented 5 years ago

Today I downloaded two episodes of Season 5 of Peaky Blinders right after each other. The download of the first episode finished after the download of the second episode. What is strange is that the subtitles of the second episode (which finished first) did get imported by Sonarr, but the subtitles of the first episode (which finished second) did not. Could it be that the renaming happens after or during Sonarr trying to import the subtitle files?

This is the log of the first episode:

2019-08-28 15:21:26 INFO ::MAIN: ######################################################### 2019-08-28 15:21:26 INFO ::MAIN: ## ..::[TorrentToMedia.py]::.. ## 2019-08-28 15:21:26 INFO ::MAIN: ######################################################### 2019-08-28 15:21:26 DEBUG ::MAIN: Options passed into TorrentToMedia: ['/volume1/transmission/nzbToMedia/TorrentToMedia.py'] 2019-08-28 15:21:26 DEBUG ::MAIN: Adding TORRENT download info for directory /volume1/video/complete/tv to database 2019-08-28 15:21:26 DEBUG ::MAIN: Received Directory: /volume1/video/complete/tv | Name: Peaky.Blinders.S05E01.WEBRip.x264-ION10 | Category: 2019-08-28 15:21:26 DEBUG ::MAIN: SEARCH: Found Category: tv in directory structure 2019-08-28 15:21:26 INFO ::MAIN: SEARCH: Found torrent directory Peaky.Blinders.S05E01.WEBRip.x264-ION10 in input directory directory /volume1/video/complete/tv 2019-08-28 15:21:26 INFO ::MAIN: SEARCH: Setting input_directory to /volume1/video/complete/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10 2019-08-28 15:21:26 DEBUG ::MAIN: Determined Directory: /volume1/video/complete/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10 | Name: Peaky.Blinders.S05E01.WEBRip.x264-ION10 | Category: tv 2019-08-28 15:21:26 INFO ::MAIN: Auto-detected SECTION:NzbDrone 2019-08-28 15:21:26 DEBUG ::MAIN: Stopping torrent Peaky.Blinders.S05E01.WEBRip.x264-ION10 in transmission while processing 2019-08-28 15:21:31 INFO ::MAIN: Output directory set to: /volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10 2019-08-28 15:21:31 DEBUG ::MAIN: Scanning files in directory: /volume1/video/complete/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10 2019-08-28 15:21:31 DEBUG ::MAIN: Found 3 files in /volume1/video/complete/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10 2019-08-28 15:21:31 INFO ::COPYLINK: MEDIAFILE: [3_English.srt] 2019-08-28 15:21:31 INFO ::COPYLINK: SOURCE FOLDER: [/volume1/video/complete/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10/Subs] 2019-08-28 15:21:31 INFO ::COPYLINK: TARGET FOLDER: [/volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10] 2019-08-28 15:21:31 INFO ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER 2019-08-28 15:21:31 INFO ::COPYLINK: MEDIAFILE: [2_English.srt] 2019-08-28 15:21:31 INFO ::COPYLINK: SOURCE FOLDER: [/volume1/video/complete/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10/Subs] 2019-08-28 15:21:31 INFO ::COPYLINK: TARGET FOLDER: [/volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10] 2019-08-28 15:21:31 INFO ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER 2019-08-28 15:21:31 INFO ::COPYLINK: MEDIAFILE: [Peaky.Blinders.S05E01.WEBRip.x264-ION10.mp4] 2019-08-28 15:21:31 INFO ::COPYLINK: SOURCE FOLDER: [/volume1/video/complete/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10] 2019-08-28 15:21:31 INFO ::COPYLINK: TARGET FOLDER: [/volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10] 2019-08-28 15:21:31 INFO ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER 2019-08-28 15:21:31 DEBUG ::MAIN: Checking for archives to extract in directory: /volume1/video/complete/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10 2019-08-28 15:21:31 INFO ::MAIN: FLATTEN: Flattening directory: /volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10 2019-08-28 15:21:31 DEBUG ::MAIN: Checking for empty folders in:/volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10 2019-08-28 15:21:31 INFO ::MAIN: Found 1 media files in /volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10 2019-08-28 15:21:31 INFO ::MAIN: Calling NzbDrone:tv to post-process:Peaky.Blinders.S05E01.WEBRip.x264-ION10 2019-08-28 15:21:31 DEBUG ::SERVER: Attempting to connect to server at http://localhost:8989 2019-08-28 15:21:31 DEBUG ::SERVER: Server responded at http://localhost:8989 2019-08-28 15:21:31 INFO ::MAIN: Attempting to verify tv fork 2019-08-28 15:21:31 INFO ::MAIN: NzbDrone:tv fork set to default 2019-08-28 15:21:31 INFO ::MAIN: FLATTEN: Flattening directory: /volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10 2019-08-28 15:21:31 DEBUG ::MAIN: Checking for empty folders in:/volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10 2019-08-28 15:21:31 DEBUG ::MAIN: calling command: /usr/local/ffmpeg/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /volume1/transmission/nzbToMedia/tests/test.mp4 2019-08-28 15:21:31 INFO ::TRANSCODER: Checking [Peaky.Blinders.S05E01.WEBRip.x264-ION10.mp4] for corruption, please stand by ... 2019-08-28 15:21:31 DEBUG ::MAIN: calling command: /usr/local/ffmpeg/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10/Peaky.Blinders.S05E01.WEBRip.x264-ION10.mp4 2019-08-28 15:21:32 INFO ::TRANSCODER: SUCCESS: [Peaky.Blinders.S05E01.WEBRip.x264-ION10.mp4] has no corruption. 2019-08-28 15:21:32 DEBUG ::MAIN: Renaming sub file from /volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10/2_English.srt to /volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10/Peaky.Blinders.S05E01.WEBRip.x264-ION10.en.srt 2019-08-28 15:21:32 DEBUG ::MAIN: Renaming sub file from /volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10/3_English.srt to /volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10/Peaky.Blinders.S05E01.WEBRip.x264-ION10.en.1.srt 2019-08-28 15:21:32 POSTPROCESS::NZBDRONE: SUCCESS: The download succeeded, sending a post-process request 2019-08-28 15:21:32 DEBUG ::NZBDRONE: path: /volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10 2019-08-28 15:21:32 DEBUG ::NZBDRONE: Opening URL: http://localhost:8989/api/command with data: {"path": "/volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10", "importMode": "Move", "name": "DownloadedEpisodesScan", "downloadClientId": "9E72CD8B859CB4F1E0A4CFC3D55AEAF2D8A2AB7C"} 2019-08-28 15:21:32 DEBUG ::NZBDRONE: Scan started with id: 21530 2019-08-28 15:22:32 DEBUG ::NZBDRONE: The Scan command return status: completed 2019-08-28 15:22:32 DEBUG ::NZBDRONE: The Scan command has completed successfully. Renaming was successful. 2019-08-28 15:22:32 DEBUG ::PLEX: Attempting to update Plex Library for category tv. 2019-08-28 15:22:32 DEBUG ::PLEX: Plex Library has been refreshed. 2019-08-28 15:22:32 DEBUG ::MAIN: Deleting torrent Peaky.Blinders.S05E01.WEBRip.x264-ION10 from transmission 2019-08-28 15:22:37 INFO ::CLEANDIRS: Directory /volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10 still contains 3 unprocessed file(s), skipping ... 2019-08-28 15:22:37 INFO ::MAIN: The /volume1/transmission/nzbToMedia/TorrentToMedia.py script completed successfully.

clinton-hall commented 5 years ago

From the logs the script clearly renames the subs

2019-08-28 15:21:32 DEBUG ::MAIN: Renaming sub file from /volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10/2_English.srt to /volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10/Peaky.Blinders.S05E01.WEBRip.x264-ION10.en.srt
2019-08-28 15:21:32 DEBUG ::MAIN: Renaming sub file from /volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10/3_English.srt to /volume1/video/processed/tv/Peaky.Blinders.S05E01.WEBRip.x264-ION10/Peaky.Blinders.S05E01.WEBRip.x264-ION10.en.1.srt

And the video file is there at the time of running. I note that once the script calls NZBDrone (Sonarr) to run, the script still says there are 3 un-processed files (2 subs and 1 video) so at the time the script completes, Sonarr hasn't done anything (or has only copied, not moved the files?)

So I'd check the Sonarrlogs at 2019-08-28 15:21:32....

Jelmerb commented 5 years ago

Thanks for the reply. I didn't have debug logging enabled in Sonarr, so I can't see what happened. It hasn't happened since. It probably had something to do with the two episodes just finishing after each other, which probably won't happen a lot. If it happens again, I will check what goes wrong.

Jelmerb commented 5 years ago

I think I found the problem. When Completed Download Handling is enabled in Sonarr the video file is moved from the completed directory to the media library directly upon finishing the download and before the subtitles are renamed. Then when nzbToMedia sends the signal to Sonarr to move the files from the processed folder, it ignores that signal because the video file is already there, thus ignoring the renamed subtitle files also. In your guide for setting up Sonarr it says to enable Completed Download Handling. It might be better to tell people to disable the feature. Or does this break other functionality? For me this fixed it.

clinton-hall commented 5 years ago

Rule 1: Find what works for your setup.

To be honest, I don't run Sonarr, and the guide has been somewhat put together by users and snippets I get from others.

I thought with CDH enabled this was still ok so long as the drone factory was set to another location.

There may be some differences with torrent clients too... perhaps some don't show as "complete" until AFTER TorrentToMedia has completed (therefore CHD is ok, and according to Sonarr devs it is the preferred way). While other clients may show the status as complete upon hitting 100% even while TorrentToMedia is being started??

In any case, if you have a working setup with CDH disabled, that should be good. You could add into the wiki that this should be disabled when using Transmission....

Jelmerb commented 5 years ago

I will. I don't understand everything that happens in Sonarr and in your script, but to me it seems that nzbToMedia does the CDH in stead of Sonarr. But I will specify transmission as the client for disabling CDH in Sonarr.