emericg / OpenSubtitlesDownload

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

b2ae4c1 Improve checkSubtitlesExists() functionnality introduces regression #113

Closed pmorch closed 1 month ago

pmorch commented 1 month ago

Commit b2ae4c1f34ba6344a94768f566fdbc8940b0c936 has introduced a regression in that it doesn't detect a downloaded subtitle - at least not in the way I use it.

Test case:

$ mkdir /tmp/movies

$ dd if=/dev/zero of=/tmp/movies/The\ Terror\ \(1963\).mkv bs=1024 count=2000
2000+0 records in
2000+0 records out
2048000 bytes (2.0 MB, 2.0 MiB) copied, 0.00466506 s, 439 MB/s

# Version 6.2 downloads once
$ python3 ./OpenSubtitlesDownload-6.2/OpenSubtitlesDownload.py --skip --auto --cli -u pmorch -p bogus /tmp/movies
>> Downloading 'en' subtitles for 'The Terror (1963).mkv'

# And notices it already exists when run the second time
$ python3 ./OpenSubtitlesDownload-6.2/OpenSubtitlesDownload.py --skip --auto --cli -u pmorch -p bogus /tmp/movies
>> A subtitles file already exists for this file:
/tmp/movies/The Terror (1963).srt

# But version b2ae4c1 keeps downloading it over and over again
$ python3 ./b2ae4c1/OpenSubtitlesDownload.py --skip --auto --cli -u pmorch -p bogus /tmp/movies
>> Downloading 'en' subtitles for 'The Terror (1963).mkv'

$ python3 ./b2ae4c1/OpenSubtitlesDownload.py --skip --auto --cli -u pmorch -p bogus /tmp/movies
>> Downloading 'en' subtitles for 'The Terror (1963).mkv'
emericg commented 1 month ago

Indeed, every combination of separator symbols and language codes were tested, but not the base name + .srt :) Thanks for noticing, this should be fixed in the latest commit!