clinton-hall / nzbToMedia

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

nzbToMedia not renaming subs #1823

Closed Jelmerb closed 7 months ago

Jelmerb commented 3 years ago

Describe the bug Recently I started over with my nzbToMedia setup as I moved everything to docker. I have everything back the way I want except nzbToMedia is not renaming my subs and as a result Sonarr is not picking them up. Can somebody tell me why?

Technical Specs

  1. Running on (Windows, Linux, NAS Model etc) 'Synology DS720+'
  2. Python version '3.8'
  3. Download Client (NZBget, SABnbzd, Transmission) 'Transmission'
  4. Intended Media Management (SickChill, CouchPotoato, Radarr, Sonarr) 'Sonarr'

Expected behavior I downloaded an episode of The Falcon and The Winter Soldier. Inside the torrent directory there is another folder with a few subs with different languages like 10_Dutch.srt. These files are moved to the root of the output directory. After that the subtitles used to be renamed to match the filename of the video file so that Sonarr would recognize them and move them over to the library. But the renaming doesn't happen.

Log

2021-04-03 22:40:48 INFO    ::MAIN: Loading config from [/config/nzbToMedia/autoProcessMedia.cfg]
2021-04-03 22:40:48 INFO    ::MAIN: Python v3.8 will reach end of life in 1290 days.
2021-04-03 22:40:48 INFO    ::MAIN: Checking database structure...
2021-04-03 22:40:48 DEBUG   ::MAIN: Checking Initial Schema database upgrade
2021-04-03 22:40:48 DEBUG   ::MAIN: InitialSchema upgrade not required
2021-04-03 22:40:48 DEBUG   ::MAIN: Checking if we can use git commands: git version
2021-04-03 22:40:48 DEBUG   ::MAIN: Executing git version with your shell in /config/nzbToMedia
2021-04-03 22:40:48 DEBUG   ::MAIN: Not using: git
2021-04-03 22:40:48 DEBUG   ::MAIN: Unable to find your git executable - Set git_path in your autoProcessMedia.cfg OR delete your .git folder and run from source to enable updates.
2021-04-03 22:40:48 DEBUG   ::MAIN: No git specified, can't use git commands
2021-04-03 22:40:48 INFO    ::MAIN: Checking if git needs an update
2021-04-03 22:40:48 DEBUG   ::MAIN: No git specified, can't use git commands
2021-04-03 22:40:48 ERROR   ::MAIN: Unable to determine installed version via git, please check your logs!
2021-04-03 22:40:48 INFO    ::MAIN: No update needed
2021-04-03 22:40:48 INFO    ::MAIN: nzbToMedia Version:12.1.08 Branch:master (Linux 4.4.59+)
2021-04-03 22:40:48 WARNING ::MAIN: Failed to locate par2. Repair and rename using par files will not be possible!
2021-04-03 22:40:48 WARNING ::MAIN: Failed to locate ffmpeg. Transcoding disabled!
2021-04-03 22:40:48 WARNING ::MAIN: Install ffmpeg with x264 support to enable this feature  ...
2021-04-03 22:40:48 DEBUG   ::MAIN: Connecting to transmission: http://172.17.0.1:9091
2021-04-03 22:40:48 INFO    ::MAIN: #########################################################
2021-04-03 22:40:48 INFO    ::MAIN: ## ..::[TorrentToMedia.py]::.. ##
2021-04-03 22:40:48 INFO    ::MAIN: #########################################################
2021-04-03 22:40:48 DEBUG   ::MAIN: Options passed into TorrentToMedia: ['/config/nzbToMedia/TorrentToMedia.py']
2021-04-03 22:40:48 DEBUG   ::MAIN: Adding TORRENT download info for directory /downloads/complete/tv to database
2021-04-03 22:40:48 DEBUG   ::MAIN: Received Directory: /downloads/complete/tv | Name: The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10 | Category: 
2021-04-03 22:40:48 DEBUG   ::MAIN: SEARCH: Found Category: tv in directory structure
2021-04-03 22:40:48 INFO    ::MAIN: SEARCH: Found torrent directory The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10 in input directory directory /downloads/complete/tv
2021-04-03 22:40:48 INFO    ::MAIN: SEARCH: Setting input_directory to /downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10
2021-04-03 22:40:48 DEBUG   ::MAIN: Determined Directory: /downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10 | Name: The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10 | Category: tv
2021-04-03 22:40:48 INFO    ::MAIN: Auto-detected SECTION:NzbDrone
2021-04-03 22:40:48 DEBUG   ::MAIN: Stopping torrent The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10 in transmission while processing
2021-04-03 22:40:53 INFO    ::MAIN: Output directory set to: /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10
2021-04-03 22:40:53 DEBUG   ::MAIN: Scanning files in directory: /downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10
2021-04-03 22:40:53 DEBUG   ::MAIN: Found 15 files in /downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10
2021-04-03 22:40:53 INFO    ::COPYLINK: MEDIAFILE: [11_nor.srt]
2021-04-03 22:40:53 INFO    ::COPYLINK: SOURCE FOLDER: [/downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/Subs]
2021-04-03 22:40:53 INFO    ::COPYLINK: TARGET FOLDER: [/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER
2021-04-03 22:40:53 INFO    ::COPYLINK: MEDIAFILE: [10_Dutch.srt]
2021-04-03 22:40:53 INFO    ::COPYLINK: SOURCE FOLDER: [/downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/Subs]
2021-04-03 22:40:53 INFO    ::COPYLINK: TARGET FOLDER: [/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER
2021-04-03 22:40:53 INFO    ::COPYLINK: MEDIAFILE: [3_Danish.srt]
2021-04-03 22:40:53 INFO    ::COPYLINK: SOURCE FOLDER: [/downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/Subs]
2021-04-03 22:40:53 INFO    ::COPYLINK: TARGET FOLDER: [/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER
2021-04-03 22:40:53 INFO    ::COPYLINK: MEDIAFILE: [4_German.srt]
2021-04-03 22:40:53 INFO    ::COPYLINK: SOURCE FOLDER: [/downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/Subs]
2021-04-03 22:40:53 INFO    ::COPYLINK: TARGET FOLDER: [/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER
2021-04-03 22:40:53 INFO    ::COPYLINK: MEDIAFILE: [7_French.srt]
2021-04-03 22:40:53 INFO    ::COPYLINK: SOURCE FOLDER: [/downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/Subs]
2021-04-03 22:40:53 INFO    ::COPYLINK: TARGET FOLDER: [/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER
2021-04-03 22:40:53 INFO    ::COPYLINK: MEDIAFILE: [8_French.srt]
2021-04-03 22:40:53 INFO    ::COPYLINK: SOURCE FOLDER: [/downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/Subs]
2021-04-03 22:40:53 INFO    ::COPYLINK: TARGET FOLDER: [/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER
2021-04-03 22:40:53 INFO    ::COPYLINK: MEDIAFILE: [2_English.srt]
2021-04-03 22:40:53 INFO    ::COPYLINK: SOURCE FOLDER: [/downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/Subs]
2021-04-03 22:40:53 INFO    ::COPYLINK: TARGET FOLDER: [/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER
2021-04-03 22:40:53 INFO    ::COPYLINK: MEDIAFILE: [5_Spanish.srt]
2021-04-03 22:40:53 INFO    ::COPYLINK: SOURCE FOLDER: [/downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/Subs]
2021-04-03 22:40:53 INFO    ::COPYLINK: TARGET FOLDER: [/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER
2021-04-03 22:40:53 INFO    ::COPYLINK: MEDIAFILE: [6_Spanish.srt]
2021-04-03 22:40:53 INFO    ::COPYLINK: SOURCE FOLDER: [/downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/Subs]
2021-04-03 22:40:53 INFO    ::COPYLINK: TARGET FOLDER: [/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER
2021-04-03 22:40:53 INFO    ::COPYLINK: MEDIAFILE: [9_Italian.srt]
2021-04-03 22:40:53 INFO    ::COPYLINK: SOURCE FOLDER: [/downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/Subs]
2021-04-03 22:40:53 INFO    ::COPYLINK: TARGET FOLDER: [/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER
2021-04-03 22:40:53 INFO    ::COPYLINK: MEDIAFILE: [14_Finnish.srt]
2021-04-03 22:40:53 INFO    ::COPYLINK: SOURCE FOLDER: [/downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/Subs]
2021-04-03 22:40:53 INFO    ::COPYLINK: TARGET FOLDER: [/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER
2021-04-03 22:40:53 INFO    ::COPYLINK: MEDIAFILE: [15_Swedish.srt]
2021-04-03 22:40:53 INFO    ::COPYLINK: SOURCE FOLDER: [/downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/Subs]
2021-04-03 22:40:53 INFO    ::COPYLINK: TARGET FOLDER: [/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER
2021-04-03 22:40:53 INFO    ::COPYLINK: MEDIAFILE: [12_Portuguese.srt]
2021-04-03 22:40:53 INFO    ::COPYLINK: SOURCE FOLDER: [/downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/Subs]
2021-04-03 22:40:53 INFO    ::COPYLINK: TARGET FOLDER: [/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER
2021-04-03 22:40:53 INFO    ::COPYLINK: MEDIAFILE: [13_Portuguese.srt]
2021-04-03 22:40:53 INFO    ::COPYLINK: SOURCE FOLDER: [/downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/Subs]
2021-04-03 22:40:53 INFO    ::COPYLINK: TARGET FOLDER: [/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER
2021-04-03 22:40:53 INFO    ::COPYLINK: MEDIAFILE: [The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.mp4]
2021-04-03 22:40:53 INFO    ::COPYLINK: SOURCE FOLDER: [/downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: TARGET FOLDER: [/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10]
2021-04-03 22:40:53 INFO    ::COPYLINK: Moving SOURCE MEDIAFILE -> TARGET FOLDER
2021-04-03 22:40:53 DEBUG   ::MAIN: Checking for archives to extract in directory: /downloads/complete/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10
2021-04-03 22:40:53 INFO    ::MAIN: FLATTEN: Flattening directory: /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10
2021-04-03 22:40:53 DEBUG   ::MAIN: Checking for empty folders in:/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10
2021-04-03 22:40:53 INFO    ::MAIN: Found 1 media files in /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10
2021-04-03 22:40:53 INFO    ::MAIN: Calling NzbDrone:tv to post-process:The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10
2021-04-03 22:40:53 DEBUG   ::SERVER: Attempting to connect to server at http://172.17.0.1:8989
2021-04-03 22:40:53 DEBUG   ::SERVER: Server responded at http://172.17.0.1:8989
2021-04-03 22:40:53 INFO    ::MAIN: Attempting to verify tv fork
2021-04-03 22:40:53 INFO    ::MAIN: NzbDrone:tv fork set to default
2021-04-03 22:40:53 INFO    ::MAIN: FLATTEN: Flattening directory: /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10
2021-04-03 22:40:53 DEBUG   ::MAIN: Checking for empty folders in:/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10
2021-04-03 22:40:53 POSTPROCESS::NZBDRONE: SUCCESS: The download succeeded, sending a post-process request
2021-04-03 22:40:53 DEBUG   ::NZBDRONE: path: /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10
2021-04-03 22:40:53 DEBUG   ::NZBDRONE: Opening URL: http://172.17.0.1:8989/api/command with data: {"name": "DownloadedEpisodesScan", "path": "/downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10", "downloadClientId": "33EF92426DCE9C5F1FE91BC6F97836196F3F8E46", "importMode": "Move"}
2021-04-03 22:40:53 DEBUG   ::NZBDRONE: Scan started with id: 883
2021-04-03 22:41:54 DEBUG   ::NZBDRONE: The Scan command return status: completed
2021-04-03 22:41:54 DEBUG   ::NZBDRONE: The directory /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10 has been removed. Renaming was successful.
2021-04-03 22:41:54 DEBUG   ::MAIN: Deleting torrent The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10 from transmission
2021-04-03 22:41:59 INFO    ::CLEANDIR: Directory /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10 has been processed and removed ...
2021-04-03 22:41:59 INFO    ::MAIN: The /config/nzbToMedia/TorrentToMedia.py script completed successfully.
clinton-hall commented 3 years ago

I believe the issue here is you were using code that I never merged into nightly or Master (I think we had some questions I still wanted resolved). https://github.com/clinton-hall/nzbToMedia/issues/768

What I don't follow is how I was able to delete a branch with un-merged commits!

I have now re-created that work as rename_subs branch. Are you able to switch to that branch and see if this is working as required. If so, might be time to merge it all.

Jelmerb commented 3 years ago

Correct, but I think those questions applied to edge cases that Sonarr doesn't (want to) support. The basic functionality worked perfectly, which is detecting the language in a subtitle (ex. 13_English.srt) and renaming the subtitle using the video filename and a 3 or 2 letter language code, I can't remember which. I'll switch to the rename_subs branch and test it.

Jelmerb commented 3 years ago

Ok, It's a good thing that we ran a test. Something strange happens. When the script encounters a second subtitle with the same language it adds a few numbers after it. Have a look.

2021-04-07 17:34:06 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/10_Dutch.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.nl.srt
2021-04-07 17:34:06 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/11_nor.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.no.srt
2021-04-07 17:34:06 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/12_Portuguese.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.pt.srt
2021-04-07 17:34:06 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/13_Portuguese.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.pt.1.2.3.srt
2021-04-07 17:34:06 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/14_Finnish.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.fi.srt
2021-04-07 17:34:06 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/15_Swedish.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.sv.srt
2021-04-07 17:34:06 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/2_English.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.en.srt
2021-04-07 17:34:06 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/3_Danish.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.da.srt
2021-04-07 17:34:06 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/4_German.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.de.srt
2021-04-07 17:34:06 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/5_Spanish.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.es.srt
2021-04-07 17:34:06 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/6_Spanish.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.es.1.2.3.4.5.6.7.8.9.10.srt
2021-04-07 17:34:06 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/7_French.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.fr.srt
2021-04-07 17:34:06 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/8_French.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.fr.1.2.3.4.5.6.7.8.9.10.11.12.srt
2021-04-07 17:34:06 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/9_Italian.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.it.srt
Jelmerb commented 3 years ago

Something else strange is happening, but I don't think there is anything you can do about it. The subtitles that have a few numbers after the language code are not picked up by Sonarr (understandably) except for de the Portuguese subtitle The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.pt.1.2.3.srt. Maybe it is because it has only 3 numbers after it. It also doesn't matter if I change pt to por (ISO 639-2/T). The resulting subtitle file in my Sonarr library is The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.srt. It probably is because it couldn't detect the subtitle language so Sonarr just striped the last part and discarded the other malformed subtitles.

clinton-hall commented 3 years ago

Ok, I just made a quick fix... basically I missed a break that was supposed to stop the loop of adding numbers. Without the break, it would append each number from 1 to the total number of Subtitles that had already been renamed!

If you update to latest rename_subs branch, this should be working now in that it will only ever add 1 number to the end. This should prevent the issue of Sonarr ignoring the subs with multiple numbers. I would hope that this then also works to detect the language?

Jelmerb commented 3 years ago

Ok, the issue with the extra numbers is solved.

Sonarr detects the language when there is no number after the language code, but it still picks up the second Portuguese subtitle and renames it from The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.pt.1.srt to The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.srt. Any other second subtitle file with a number after the language code is not picked up by Sonarr. I have done a quick search on the internet to find out what their logic is behind importing subtitle files, but I can't find it anywhere. It also seems, judging on their posts, that they are not really interested in improving the logic either. I am satisfied with way your script handles the renaming now, are you?

2021-04-08 14:34:30 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/10_Dutch.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.nl.srt
2021-04-08 14:34:30 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/11_nor.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.no.srt
2021-04-08 14:34:30 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/12_Portuguese.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.pt.srt
2021-04-08 14:34:30 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/13_Portuguese.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.pt.1.srt
2021-04-08 14:34:30 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/14_Finnish.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.fi.srt
2021-04-08 14:34:30 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/15_Swedish.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.sv.srt
2021-04-08 14:34:30 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/2_English.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.en.srt
2021-04-08 14:34:30 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/3_Danish.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.da.srt
2021-04-08 14:34:30 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/4_German.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.de.srt
2021-04-08 14:34:30 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/5_Spanish.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.es.srt
2021-04-08 14:34:30 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/6_Spanish.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.es.1.srt
2021-04-08 14:34:30 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/7_French.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.fr.srt
2021-04-08 14:34:30 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/8_French.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.fr.1.srt
2021-04-08 14:34:30 DEBUG   ::MAIN: Renaming sub file from /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/9_Italian.srt to /downloads/processed/tv/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10/The.Falcon.and.the.Winter.Soldier.S01E01.WEBRip.x264-ION10.it.srt
clinton-hall commented 3 years ago

ok. have merged into nightly. deleted the rename_subs branch. If you switch to nightly now you should be able to get regular updates again.

Jelmerb commented 3 years ago

Thanks, I switched to the nightly branch and will double check if everything is okay.

UPDATE: yup, everything seems fine. Many thanks for implementing this feature.