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

missing title #585

Closed kitten77 closed 5 years ago

kitten77 commented 5 years ago

missing title when brakets are present

>>> from guessit import guessit
>>> name = '[ Engineering Catastrophes S02E10 1080p AMZN WEB-DL DD+ 2.0 x264-TrollHD ]'
>>> g = guessit(name)
>>> print(g["title"])
Traceback (most recent call last):
  File "<input>", line 1, in <module>
KeyError: 'title'
>>>print(g)
MatchesDict([('season', 2), ('episode', 10), ('screen_size', '1080p'), ('streaming_service', 'Amazon Prime'), ('source', 'Web'), ('audio_codec', 'Dolby Digital Plus'), ('audio_channels', '2.0'), ('video_codec', 'H.264'), ('release_group', 'TrollHD '), ('type', 'episode')])
(venv) muad@podde:~/workbench/gitlab/tonder$ guessit --version
+-------------------------------------------------------+
+                   GuessIt 3.0.3                       +
+-------------------------------------------------------+
+                   Rebulk 1.0.0                        +
+-------------------------------------------------------+
|      Please report any bug or feature request at      |
|     https://github.com/guessit-io/guessit/issues.     |
+-------------------------------------------------------+
kitten77 commented 5 years ago

workaround that fixes this

>>> from guessit import guessit
>>> name = '[ Engineering Catastrophes S02E10 1080p AMZN WEB-DL DD+ 2.0 x264-TrollHD ]'
>>> if name[0] == '[' and name[-1] == ']':
>>>     #added to catch bad formated strings
>>>     #thanks deniska for coming up with this one :)
>>>     name = name[1:-1]
>>> g = guessit(name)
JohnDoee commented 5 years ago

Wouldn't it be smarter to just trim it before handing it to guessit ?

kitten77 commented 5 years ago

Sorry i wasn't completly clear in my workaround, updated it with all code

ratoaq2 commented 5 years ago

Fixed by 0e1dc09aa3a73ad95a4787e84fd1e35e5445245f