Closed Jelmerb closed 7 months 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.
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.
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
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.
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?
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
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.
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.
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
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