guessit-io / guessit

GuessIt is a python library that extracts as much information as possible from a video filename.
https://guessit-io.github.io/guessit
GNU Lesser General Public License v3.0
826 stars 92 forks source link

Wrong episode name when filename doesn't contain series name #721

Closed Jdogzz closed 1 year ago

Jdogzz commented 2 years ago

I came across this problem while using the latest (3.4.3) release of guessit on a path like /mydatapool/mydata/Videos/Shows/C/Caprica/Season 1/Apotheosis_1920x1080.mp4. Here is an excerpt from the python interpreter showing the results, where it will not heed the full path and consistently use the episode name as seen in the filename as the series name and have no guess for the actual episode name:

Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from guessit import guessit
>>> guessit("/mydatapool/mydata/Videos/Shows/C/Caprica/Season 1/Apotheosis_1920x1080.mp4")
MatchesDict([('season', 1), ('title', 'Apotheosis'), ('screen_size', '1080p'), ('aspect_ratio', 1.778), ('container', 'mp4'), ('mimetype', 'video/mp4'), ('type', 'episode')])
>>> guessit("/mydatapool/mydata/Videos/Shows/C/Caprica/Season 1/Apotheosis_1920x1080.mp4",{"type":"episode"})
MatchesDict([('season', 1), ('title', 'Apotheosis'), ('screen_size', '1080p'), ('aspect_ratio', 1.778), ('container', 'mp4'), ('mimetype', 'video/mp4'), ('type', 'episode')])
>>> guessit("/mydatapool/mydata/Videos/Shows/C/Caprica/Season 1/Apotheosis_1920x1080.mp4",{"type":"episode","T":"Caprica"})
MatchesDict([('season', 1), ('title', 'Apotheosis'), ('screen_size', '1080p'), ('aspect_ratio', 1.778), ('container', 'mp4'), ('mimetype', 'video/mp4'), ('type', 'episode')])
>>> guessit("/mydatapool/mydata/Videos/Shows/C/Caprica/Season 1/Apotheosis_1920x1080.mp4",{"type":"episode","title":"Caprica"})
MatchesDict([('season', 1), ('title', 'Apotheosis'), ('screen_size', '1080p'), ('aspect_ratio', 1.778), ('container', 'mp4'), ('mimetype', 'video/mp4'), ('type', 'episode')])

It's possible that guessit making use of the full path is no longer the expected behavior since Issue #460, but I could not find that in the documentation. Afterwards, after finding Issue #494 and the suggestion to give an expected title, that at least sets the series name but again leaves out the episode name, so the information in the file name isn't even used. Here is the terminal output for that since, for some reason, I can't get that to pass to the python command:

~/.local/bin/guessit -T "Caprica" -t episode "/mydatapool/mydata/Videos/Shows/C/Caprica/Season 1/Apotheosis_1920x1080.mp4"
For: /mydatapool/mydata/Videos/Shows/C/Caprica/Season 1/Apotheosis_1920x1080.mp4
GuessIt found: {
    "title": "Caprica",
    "season": 1,
    "screen_size": "1080p",
    "aspect_ratio": 1.778,
    "container": "mp4",
    "mimetype": "video/mp4",
    "type": "episode"
}

I also want to add that I initially encountered this problem when using mnamer, as described in this thread: https://github.com/jkwill87/mnamer/issues/152 The original poster had a similar issue with incorrect detection but their filename had much more information than my files do.