emericg / OpenSubtitlesDownload

Automatically find and download the right subtitles for your favorite videos!
https://emeric.io/OpenSubtitlesDownload
GNU General Public License v3.0
607 stars 66 forks source link

opt_search_overwrite #112

Closed andersonmoura closed 6 months ago

andersonmoura commented 6 months ago

Even with the 'opt_search_overwrite' set to False the script downloads again subtitles that had the language in its name.

Using the 6.2 release!

Eg: File: SkyMed.S02E01.SkyMed.Return.to.Base.1080p.PMTP.WEB-DL.DDP5.1.H.264.DUAL-SiGLA.mkv Sub: SkyMed.S02E01.SkyMed.Return.to.Base.1080p.PMTP.WEB-DL.DDP5.1.H.264.DUAL-SiGLA.srt (it will be skipped properly)

File: SkyMed.S02E01.SkyMed.Return.to.Base.1080p.PMTP.WEB-DL.DDP5.1.H.264.DUAL-SiGLA.mkv Sub: SkyMed.S02E01.SkyMed.Return.to.Base.1080p.PMTP.WEB-DL.DDP5.1.H.264.DUAL-SiGLA_pt-BR.srt (it will be downloaded again)

https://github.com/emericg/OpenSubtitlesDownload/assets/1872176/e77001f5-cdec-40f8-87cd-7d26e4058924

andersonmoura commented 6 months ago

Even with the 'opt_search_overwrite' set to False the script downloads again subtitles that had the language in its name.

Using the 6.2 release!

Eg: File: SkyMed.S02E01.SkyMed.Return.to.Base.1080p.PMTP.WEB-DL.DDP5.1.H.264.DUAL-SiGLA.mkv Sub: SkyMed.S02E01.SkyMed.Return.to.Base.1080p.PMTP.WEB-DL.DDP5.1.H.264.DUAL-SiGLA.srt (it will be skipped properly)

File: SkyMed.S02E01.SkyMed.Return.to.Base.1080p.PMTP.WEB-DL.DDP5.1.H.264.DUAL-SiGLA.mkv Sub: SkyMed.S02E01.SkyMed.Return.to.Base.1080p.PMTP.WEB-DL.DDP5.1.H.264.DUAL-SiGLA_pt-BR.srt (it will be downloaded again)

2024-05-04_13h01_23.1.mp4

Not sure if it is the best approach or even if it was intended, but these changes seems to do the work for me:

  '''if opt_language_suffix in ('on', 'auto'):
        for language in opt_languages:
           for l in list(language.split(',')):
                lngList.append(opt_language_suffix_separator + l)'''

    if opt_language_suffix in ('on', 'auto'):
        for language in opt_languages.split(','):
            lngList.append(opt_language_suffix_separator + language)

    for ext in extList:
        for lng in lngList:
            #subPath = path.rsplit('.', 1)[0] + lng + '.' + ext
            subPath = os.path.splitext(path)[0] + lng + '.' + ext
            if os.path.isfile(subPath) is True:
                superPrint("info", "Subtitles already downloaded!", "A subtitles file already exists for this file:\n<i>" + subPath + "</i>")
                return True
emericg commented 6 months ago

Hi, can you check the latest commit and see if it's working better for you?

andersonmoura commented 6 months ago

Yeah.. 6.3 fixed it

emericg commented 6 months ago

good news, like I said in the other report the basic subtitles filenames were not checked, only complexes cases like sub-en.sub