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

Options param does not override options.json #610

Open VeNoMouS opened 5 years ago

VeNoMouS commented 5 years ago

If you have default of "allowed_countries" in the options.json you cannot overrite the existing list...

This came up with "SS-GB" - #358 , as it was forcing country detection on me even though I had my work around in place from previous ticket.

>>> from guessit import guessit

>>> guessit('SS-GB.S01E01.1080p.x265-MeGusta.mkv')
MatchesDict([('title', 'SS'), ('country', <Country [GB]>), ('season', 1), ('episode', 1), ('screen_size', '1080p'), ('video_codec', 'h265'), ('release_group', 'MeGusta'), ('container', 'mkv'), ('mimetype', 'video/x-matroska'), ('type', 'episode')])

>>> guessit('SS-GB.S01E01.1080p.x265-MeGusta.mkv', {'allowed_countries':'NONE'})
MatchesDict([('title', 'SS-GB'), ('season', 1), ('episode', 1), ('screen_size', '1080p'), ('video_codec', 'h265'), ('release_group', 'MeGusta'), ('container', 'mkv'), ('mimetype', 'video/x-matroska'), ('type', 'episode')])
>>> 
Toilal commented 5 years ago

You may use special pristine option to discard default values from a property.

guessit('SS-GB.S01E01.1080p.x265-MeGusta.mkv', {'pristine': ['allowed_countries'], 'allowed_countries': []})
MatchesDict([('title', 'SS-GB'), ('season', 1), ('episode', 1), ('screen_size', '1080p'), ('video_codec', 'H.265'), ('release_group', 'MeGusta'), ('container', 'mkv'), ('mimetype', 'video/x-matroska'), ('type', 'episode')])

Hope it helps.

Sadly it's not documented, but this feature is lying in the code.

VeNoMouS commented 5 years ago

ah awesome, yea i was not aware of that option, thanks for the heads up @Toilal

VeNoMouS commented 4 years ago

lol, @Toilal im back :)

anythoughts on teh following....

Scorpion.S02E09.US.vs.UN.vs.UK.1080p.WEB-DL.x265.AC3-d3g.mkv

>>> pprint(guessit('Scorpion.S02E09.US.vs.UN.vs.UK.1080p.WEB-DL.x265.AC3-d3g.mkv'))
MatchesDict([('title', 'Scorpion'),
             ('season', 2),
             ('episode', 9),
             ('country', [<Country [US]>, <Country [GB]>]),
             ('episode_title', 'vs UN vs'),
             ('screen_size', '1080p'),
             ('source', 'Web'),
             ('video_codec', 'H.265'),
             ('audio_codec', 'Dolby Digital'),
             ('release_group', 'd3g'),
             ('container', 'mkv'),
             ('mimetype', 'video/x-matroska'),
             ('type', 'episode')])
>>> pprint(guessit('Scorpion.S02E09.US.vs.UN.vs.UK.1080p.WEB-DL.x265.AC3-d3g.mkv', {'pristine': ['allowed_countries'], 'allowed_countries': []}))
MatchesDict([('title', 'Scorpion'),
             ('season', 2),
             ('episode', 9),
             ('episode_title', 'US vs UN vs'),
             ('language', <Language [uk]>),
             ('screen_size', '1080p'),
             ('source', 'Web'),
             ('video_codec', 'H.265'),
             ('audio_codec', 'Dolby Digital'),
             ('release_group', 'd3g'),
             ('container', 'mkv'),
             ('mimetype', 'video/x-matroska'),
             ('type', 'episode')])

I mean... sure I could allowed_languages hijack... but clearly that is a valid scene release title and all..

pprint(guessit('Scorpion.S02E09.US.vs.UN.vs.UK.1080p.WEB-DL.x265.AC3-d3g.mkv', {'pristine': ['allowed_countries', 'allowed_languages'], 'allowed_countries': [], 'allowed_languages': []}))
MatchesDict([('title', 'Scorpion'),
             ('season', 2),
             ('episode', 9),
             ('episode_title', 'US vs UN vs UK'),
             ('screen_size', '1080p'),
             ('source', 'Web'),
             ('video_codec', 'H.265'),
             ('audio_codec', 'Dolby Digital'),
             ('release_group', 'd3g'),
             ('container', 'mkv'),
             ('mimetype', 'video/x-matroska'),
             ('type', 'episode')])
VeNoMouS commented 4 years ago

Addtionally ... this thinks the episode_title is the year..

Heroes.S03E23.1961.1080p.BluRay.x265.AC3-d3g.mkv

>>> pprint(guessit('Heroes.S03E23.1961.1080p.BluRay.x265.AC3-d3g.mkv'))
MatchesDict([('title', 'Heroes'),
             ('season', 3),
             ('episode', 23),
             ('year', 1961),
             ('screen_size', '1080p'),
             ('source', 'Blu-ray'),
             ('video_codec', 'H.265'),
             ('audio_codec', 'Dolby Digital'),
             ('release_group', 'd3g'),
             ('container', 'mkv'),
             ('mimetype', 'video/x-matroska'),
             ('type', 'episode')])
>>>
VeNoMouS commented 4 years ago

I guess I could do {'excludes': ['year', 'country', 'language']} for both... but not exactly a very clean way...