Skip to content

with guessit plugin: series: list index out of range #2176

Closed

Description

@kfirufk

Hi :)
I'm using latest flexget from git on develop branch on gentoo linux ~amd64 with Python 3.5.5

running flexget check returns no warnings or errors
after I enabled the guessit plugin for series when I run a task i named tv-sort, for sorting my tv-shows, flexget crashes.

the crash report is at https://paste.pound-python.org/show/FzJA3quGxCUg6iS0CJmt/
my config.yml is at https://paste.pound-python.org/show/fj7yoiAsyBSlujXyVfVa/

thanks! :)

Activity

  1. paranoidi commented on Jul 20, 2018

    @paranoidi
    Member

    Secure Connection Failed

    The connection to paste.pound-python.org was interrupted while the page, please follow the ticket format.

  2. kfirufk commented on Jul 20, 2018

    @kfirufk
    Author

    sorry! :)

    attached the crash report
    and this is my config.yml

    templates:
      downloads:
        nzbget:
          url: http://127.0.0.1:6789/xmlrpc
        transmission:
          host: 127.0.0.1
          port: 9091
          addpaused: No
      my-tv-shows:
        series:
          settings:
            shows:
              identified_by: ep
              tracking: backfill
              quality: 1080p 720p
              season_packs: yes
          shows:
            - 30 rock
            - future man
            - new girl
            - the good place
            - mr robot
            - rick and morty
            - that 70s show
            - the magicians
            - westworld
            - how i met your mother
            - two and a half men
            - Friends:
                name_regexp:
                  - ^Friends$
    tasks:
      delete-dups-tv-shows:
        assume_quality:
          h264: 1080p
        configure_series:
          from:
            filesystem: /mnt/storage-btrfs/media/tv-shows
        filesystem:
          recursive: True
          path:
            - /mnt/storage-btrfs/media/tv-shows
          retrieve: files
        if:
          - has_field('series_episode'):
              exec:
                on_output:
                  for_undecided: echo {{series_name}} {{series_id}} {{quality}}  {{location}} >> `date +%y%m%d`.dups.out
      tv-sort:
        parsing:
          series: guessit
        filesystem:
          path:
            - /mnt/storage-btrfs/downloads/
          recursive: True
        seen: local
        template: [my-tv-shows]
        series:
          settings:
            agroup:
              parse_only: yes
        regexp:
          reject:
            - sample
          accept:
            - '.*\.(avi|mkv|mp4)$'
        require_field: series_name
        accept_all: yes
        move:
          to: /mnt/storage-btrfs/media/tv-shows/{{series_name}}/Season {{series_season|pad(2)}}
      tv-search:
        exists_series: /mnt/storage-btrfs/media/tv-shows
        template: [my-tv-shows, downloads]
        discover:
          what:
            - next_series_episodes:
                from_start: yes
                backfill: yes
          from:
            - newznab:
                website: https://api.nzbplanet.net
                apikey:  <KEY>
                category: tv
            - newznab:
                website: https://simplynzbs.com
                apikey: <KEY>
                category: tv
            - piratebay:
                category: video
                sort_by: seeds
                url: https://zombay.org
          interval: 1 hour
    

    crash_report.2018.07.20.000942885382.log

  3. kfirufk commented on Jul 21, 2018

    @kfirufk
    Author

    I added some debug information in the plugins/parsers/parser_guessit.py file

    i'll show here the last several lines of the log:

    2018-07-21 13:27 INFO     parser_guessit tv-sort         Parsing series: `new.girl.s07e08.1080p.web.x264-tbs` [op
    tions: {'identified_by': 'ep', 'date_yearfirst': None, 'name': 'new girl', 'sequence_regexps': [], 'ep_regexps':
    [], 'special_ids': [], 'date_dayfirst': None, 'name_regexps': [], 'date_regexps': [], 'alternate_names': [], 'str
    ict_name': False, 'prefer_specials': None, 'allow_groups': [], 'assume_special': None, 'id_regexps': []}]
    2018-07-21 13:27 INFO     parser_guessit tv-sort         MEEEE NAME new girl COUNTRY None
    2018-07-21 13:27 INFO     parser_guessit tv-sort         before
    2018-07-21 13:27 INFO     parser_guessit tv-sort         {'type': [<episode:(34, 34)+name=type>], 'title': [<new
    girl:(0, 8)+name=title+tags=['expected', 'title', 'equivalent-ignore', 'equivalent-ignore', 'equivalent-ignore',
    'equivalent-ignore', 'equivalent-ignore', 'equivalent-ignore', 'equivalent-ignore', 'equivalent-ignore', 'equival
    ent-ignore', 'equivalent-ignore', 'equivalent-ignore', 'equivalent-ignore', 'equivalent-ignore', 'equivalent-igno
    re', 'equivalent-ignore', 'equivalent-ignore', 'equivalent-ignore', 'equivalent-ignore', 'equivalent-ignore', 'eq
    uivalent-ignore', 'equivalent-ignore', 'equivalent-ignore', 'equivalent-ignore']>], 'format': [<WEB-DL:(22, 25)+n
    ame=format+tags=['video-codec-prefix', 'streaming_service.suffix']>], 'video_codec': [<h264:(26, 30)+name=video_c
    odec+tags=['format-suffix', 'streaming_service.suffix']>], 'release_group': [<tbs:(30, 34)+name=release_group+tag
    s=['scene']>], 'season': [<7:(10, 12)+name=season+tags=['SxxExx']+initiator=s07e08>], 'episode': [<8:(13, 15)+nam
    e=episode+tags=['SxxExx']+initiator=s07e08>], 'screen_size': [<1080p:(16, 21)+name=screen_size>]}
    2018-07-21 13:27 INFO     parser_guessit tv-sort         after
    2018-07-21 13:27 INFO     parser_guessit tv-sort         Parsing series: `NL0QPP7xNWPJd11fiBRXdhPhwOm5n50ZSy5l4Ys
    h3G6EK1kK8bFzWk` [options: {'identified_by': 'ep', 'date_yearfirst': None, 'name': 'new girl', 'sequence_regexps'
    : [], 'ep_regexps': [], 'special_ids': [], 'date_dayfirst': None, 'name_regexps': [], 'date_regexps': [], 'altern
    ate_names': [], 'strict_name': False, 'prefer_specials': None, 'allow_groups': [], 'assume_special': None, 'id_re
    gexps': []}]
    2018-07-21 13:27 INFO     parser_guessit tv-sort         MEEEE NAME new girl COUNTRY None
    2018-07-21 13:27 INFO     parser_guessit tv-sort         before
    2018-07-21 13:27 INFO     parser_guessit tv-sort         {'uuid': [<NL0QPP7xNWPJd11fiBRXdhPhwOm5n50ZSy5l4Ysh3G6EK
    1kK8bFzWk:(0, 54)+name=uuid>], 'type': [<episode:(54, 54)+name=type>]}
    2018-07-21 13:27 INFO     parser_guessit tv-sort         after
    2018-07-21 13:27 CRITICAL task          tv-sort         BUG: Unhandled error in plugin series: list index out of
    range
    

    i think a confirmation that it has found the proper name of the movie should be implemented.
    yeah I have a long movie name with random characters, it should not crash 'guessit' parseer either way.

  4. kfirufk commented on Jul 21, 2018

    @kfirufk
    Author

    welp adding try catch and a proper error message allowed the task to continue and finish

    --- a/flexget/plugins/parsers/parser_guessit.py
    +++ b/flexget/plugins/parsers/parser_guessit.py
    @@ -186,38 +186,41 @@ class ParserGuessit(object):
             else:
                 # Make sure the name match is up to FlexGet standards
                 # Check there is no unmatched cruft before the matched name
    -            title_start = guess_result.matches['title'][0].start
    -            title_end = guess_result.matches['title'][0].end
    -            if title_start != 0:
    -                try:
    -                    pre_title = max((match[0].end for match in guess_result.matches.values() if
    -                                     match[0].end <= title_start))
    -                except ValueError:
    -                    pre_title = 0
    -                for char in reversed(data[pre_title:title_start]):
    -                    if char.isalnum() or char.isdigit():
    -                        return SeriesParseResult(data=data, valid=False)
    -                    if char.isspace() or char in '._':
    -                        continue
    -                    else:
    -                        break
    -            # Check the name doesn't end mid-word (guessit might put the border before or after the space after title)
    -            if data[title_end - 1].isalnum() and len(data) <= title_end or \
    -                    not self._is_valid_name(data, guessit_options=guessit_options):
    -                valid = False
    -            # If we are in exact mode, make sure there is nothing after the title
    -            if kwargs.get('strict_name'):
    -                post_title = sys.maxsize
    -                for match_type, matches in guess_result.matches.items():
    -                    if match_type in ['season', 'episode', 'date', 'regexpId']:
    -                        if matches[0].start < title_end:
    -                            continue
    -                        post_title = min(post_title, matches[0].start)
    -                        if matches[0].parent:
    -                            post_title = min(post_title, matches[0].parent.start)
    -                for char in data[title_end:post_title]:
    -                    if char.isalnum() or char.isdigit():
    -                        valid = False
    +            try:
    +             title_start = guess_result.matches['title'][0].start
    +             title_end = guess_result.matches['title'][0].end
    +             if title_start != 0:
    +                 try:
    +                     pre_title = max((match[0].end for match in guess_result.matches.values() if
    +                                      match[0].end <= title_start))
    +                 except ValueError:
    +                     pre_title = 0
    +                 for char in reversed(data[pre_title:title_start]):
    +                     if char.isalnum() or char.isdigit():
    +                         return SeriesParseResult(data=data, valid=False)
    +                     if char.isspace() or char in '._':
    +                         continue
    +                     else:
    +                         break
    +             # Check the name doesn't end mid-word (guessit might put the border before or after the space after title)
    +             if data[title_end - 1].isalnum() and len(data) <= title_end or \
    +                     not self._is_valid_name(data, guessit_options=guessit_options):
    +                 valid = False
    +             # If we are in exact mode, make sure there is nothing after the title
    +             if kwargs.get('strict_name'):
    +                 post_title = sys.maxsize
    +                 for match_type, matches in guess_result.matches.items():
    +                     if match_type in ['season', 'episode', 'date', 'regexpId']:
    +                         if matches[0].start < title_end:
    +                             continue
    +                         post_title = min(post_title, matches[0].start)
    +                         if matches[0].parent:
    +                             post_title = min(post_title, matches[0].parent.start)
    +                 for char in data[title_end:post_title]:
    +                     if char.isalnum() or char.isdigit():
    +                         valid = False
    +            except:
    +                 log.error('FAILED Parsing movie: `%s` [options: %s]', data, kwargs)
             season = guess_result.get('season')
             episode = guess_result.get('episode')
             if episode is None and 'part' in guess_result:
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions