OpenSubtitlesDownload
OpenSubtitlesDownload copied to clipboard
Searching by filename breaks when there's a number in the title
When the filename includes the episode's title and that includes a number, it never seems to find any subtitles. Examples: The Americans S03E13 March 8, 1983.mkv The Americans S05E05 Lotus 1-2-3.mkv
(Guess what series I've been watching recently.) The search works fine when you remove the episode titles form the filenames. I also tested a random episode of Babylon 5 to see if numbers in the series name would break it too, but that seemed to work fine.
In case it matters, I'm using Windows CLI. And thanks for the tool! It's been very useful.
True i confirm this but the problem is on opensubtitles.org
.
Example:
- the one where the monkey gets away -> 9 results
- 19 the one where the monkey gets away -> 0 result
I added this custom change as a workaround:
# ==== Get file hash, size and name
videoTitle = ''
videoHash = hashFile(currentVideoPath)
videoSize = os.path.getsize(currentVideoPath)
videoFileName = os.path.basename(currentVideoPath)
# Custom Change: Remove the episode number at the beginning
# `opensubtitles.org` would not find any result with it.
# https://github.com/emericg/OpenSubtitlesDownload/issues/84
# Expectation: The character "-" split the episode number from the title
if "-" in videoFileName[:5]:
episode_number , videoFileName = videoFileName.split("-", maxsplit=1)
# ==== Search for available subtitles
So 01 - My Title
would be searched as My Title
. The episode number has to be at the beginning and separated by a -
in the first 5 characters. Of course, you can adapt the rules to match your naming preference.
This doesn't happen anymore with the "new" provider opensubtitles.com