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
828 stars 92 forks source link

Guessit subtitle search exception #621

Closed Cubelinger closed 5 years ago

Cubelinger commented 5 years ago
===================== Guessit Exception Report =====================
version=3.0.3
string=The Blacklist - 01x07 - Frederick Barnes.WEB-DL-NTb
options={'expected_title': ['OSS 117'], 'allowed_countries': ['au', 'us', 'gb'], 'allowed_languages': ['de', 'en', 'es', 'ca', 'cs', 'fr', 'he', 'hi', 'hu', 'it', 'ja', 'ko', 'nl', 'pl', 'pt', 'ro', 'ru', 'sv', 'te', 'uk', 'mul', 'und'], 'advanced_config': {'common_words': ['de', 'it'], 'groups': {'starting': '([{', 'ending': ')]}'}, 'container': {'subtitles': ['srt', 'idx', 'sub', 'ssa', 'ass'], 'info': ['nfo'], 'videos': ['3g2', '3gp', '3gp2', 'asf', 'avi', 'divx', 'flv', 'mk3d', 'm4v', 'mk2', 'mka', 'mkv', 'mov', 'mp4', 'mp4a', 'mpeg', 'mpg', 'ogg', 'ogm', 'ogv', 'qt', 'ra', 'ram', 'rm', 'ts', 'wav', 'webm', 'wma', 'wmv', 'iso', 'vob'], 'torrent': ['torrent'], 'nzb': ['nzb']}, 'country': {'synonyms': {'ES': ['espana'], 'GB': ['UK'], 'BR': ['brazilian', 'bra'], 'CA': ['quebec', 'quebec', 'qc'], 'MX': ['Latinoamerica', 'latin america']}}, 'episodes': {'season_max_range': 100, 'episode_max_range': 100, 'max_range_gap': 1, 'season_markers': ['s'], 'season_ep_markers': ['x'], 'disc_markers': ['d'], 'episode_markers': ['xe', 'ex', 'ep', 'e', 'x'], 'range_separators': ['-', '~', 'to', 'a'], 'discrete_separators': ['+', '&', 'and', 'et'], 'season_words': ['season', 'saison', 'seizoen', 'seasons', 'saisons', 'tem', 'temp', 'temporada', 'temporadas', 'stagione'], 'episode_words': ['episode', 'episodes', 'eps', 'ep', 'episodio', 'episodios', 'capitulo', 'capitulos'], 'of_words': ['of', 'sur'], 'all_words': ['All']}, 'language': {'synonyms': {'ell': ['gr', 'greek'], 'spa': ['esp', 'espanol', 'espanol'], 'fra': ['francais', 'vf', 'vff', 'vfi', 'vfq'], 'swe': ['se'], 'por_BR': ['po', 'pb', 'pob', 'ptbr', 'br', 'brazilian'], 'deu_CH': ['swissgerman', 'swiss german'], 'nld_BE': ['flemish'], 'cat': ['catala', 'castellano', 'espanol castellano', 'espanol castellano'], 'ces': ['cz'], 'ukr': ['ua'], 'zho': ['cn'], 'jpn': ['jp'], 'hrv': ['scr'], 'mul': ['multi', 'dl']}, 'subtitle_affixes': ['sub', 'subs', 'esub', 'esubs', 'subbed', 'custom subbed', 'custom subs', 'custom sub', 'customsubbed', 'customsubs', 'customsub', 'soft subtitles', 'soft subs'], 'subtitle_prefixes': ['st', 'v', 'vost', 'subforced', 'fansub', 'hardsub', 'legenda', 'legendas', 'legendado', 'subtitulado', 'soft', 'subtitles'], 'subtitle_suffixes': ['subforced', 'fansub', 'hardsub'], 'language_affixes': ['dublado', 'dubbed', 'dub'], 'language_prefixes': ['true'], 'language_suffixes': ['audio'], 'weak_affixes': ['v', 'audio', 'true']}, 'part': {'prefixes': ['pt', 'part']}, 'release_group': {'forbidden_names': ['rip', 'by', 'for', 'par', 'pour', 'bonus'], 'ignored_seps': '[]{}()'}, 'screen_size': {'frame_rates': ['23.976', '24', '25', '30', '48', '50', '60', '120'], 'min_ar': 1.333, 'max_ar': 1.898, 'interlaced': ['360', '480', '576', '900', '1080'], 'progressive': ['360', '480', '576', '900', '1080', '368', '720', '1440', '2160', '4320']}, 'website': {'safe_tlds': ['com', 'org', 'net'], 'safe_subdomains': ['www'], 'safe_prefixes': ['co', 'com', 'org', 'net'], 'prefixes': ['from']}}, 'type': 'episode'}
--------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/guessit/api.py", line 197, in guessit
    matches = self.rebulk.matches(string, options)
  File "/usr/local/lib/python3.7/site-packages/rebulk/rebulk.py", line 113, in matches
    self._matches_patterns(matches, context)
  File "/usr/local/lib/python3.7/site-packages/rebulk/rebulk.py", line 176, in _matches_patterns
    pattern_matches = pattern.matches(matches.input_string, context)
  File "/usr/local/lib/python3.7/site-packages/rebulk/pattern.py", line 166, in matches
    for match in self._match(pattern, input_string, context):
  File "/usr/local/lib/python3.7/site-packages/rebulk/chain.py", line 81, in _match
    input_string, chain_input_string, offset, current_chain_matches)
  File "/usr/local/lib/python3.7/site-packages/rebulk/chain.py", line 111, in _to_next_chain_part
    if self._chain_breaker_eval(current_chain_matches + grouped_matches):
  File "/usr/local/lib/python3.7/site-packages/rebulk/chain.py", line 170, in _chain_breaker_eval
    return not self.chain_breaker or not self.chain_breaker(Matches(matches))
  File "/usr/local/lib/python3.7/site-packages/guessit/rules/properties/episodes.py", line 52, in episodes_season_chain_breaker
    if len(eps) > 1 and abs(eps[-1].value - eps[-2].value) > episode_max_range:
TypeError: unsupported operand type(s) for -: 'str' and 'str'
--------------------------------------------------------------------
Toilal commented 5 years ago

I can't reproduce this issue with guessit 3.1.0 version, while loading the given options in a configuration. This can be reproduced when switching to 3.0.3 tag, so you guessit should be upgraded.