Example #1
0
 def validator(self):
     from flexget import validator
     root = validator.factory()
     root.accept('boolean')
     opts = root.accept('dict')
     opts.accept('choice', key='quality').accept_choices([q.name for q in qualities.all()], ignore_case=True)
     opts.accept('boolean', key='force')
     return root
Example #2
0
    def validator(self):
        from flexget import validator

        root = validator.factory()
        root.accept("boolean")
        opts = root.accept("dict")
        opts.accept("choice", key="quality").accept_choices([q.name for q in qualities.all()], ignore_case=True)
        opts.accept("boolean", key="force")
        return root
Example #3
0
    def validator(self):
        from flexget import validator

        qualities = [q.name for q in quals.all()]

        root = validator.factory()
        root.accept('choice').accept_choices(qualities, ignore_case=True)
        root.accept('list').accept('choice').accept_choices(qualities, ignore_case=True)
        advanced = root.accept('dict')
        advanced.accept('choice', key='min').accept_choices(qualities, ignore_case=True)
        advanced.accept('choice', key='max').accept_choices(qualities, ignore_case=True)
        advanced.accept('choice', key='quality').accept_choices(qualities, ignore_case=True)
        advanced.accept('list', key='quality').accept('choice').accept_choices(qualities, ignore_case=True)
        return root
Example #4
0
    def operate(self, op, other):
        if hasattr(other, 'value'):
            value = other.value
        elif isinstance(other, basestring):
            qual = qualities.get(other, False)
            if qual:
                value = qual.value
            else:
                raise ValueError('%s is not a valid quality' % other)
        else:
            raise TypeError('%r cannot be compared to a quality' % other)

        whens = dict((quality.name, quality.value) for quality in qualities.all())
        return op(case(value=self.__clause_element__(), whens=whens, else_=0), value)
Example #5
0
 def build_options_validator(self, options):
     quals = [q.name for q in qualities.all()]
     options.accept('text', key='path')
     # set
     options.accept('dict', key='set').accept_any_key('any')
     # regexes can be given in as a single string ..
     options.accept('regexp', key='name_regexp')
     options.accept('regexp', key='ep_regexp')
     options.accept('regexp', key='id_regexp')
     # .. or as list containing strings
     options.accept('list', key='name_regexp').accept('regexp')
     options.accept('list', key='ep_regexp').accept('regexp')
     options.accept('list', key='id_regexp').accept('regexp')
     # quality
     options.accept('choice', key='quality').accept_choices(quals, ignore_case=True)
     options.accept('list', key='qualities').accept('choice').accept_choices(quals, ignore_case=True)
     options.accept('boolean', key='upgrade')
     options.accept('choice', key='min_quality').accept_choices(quals, ignore_case=True)
     options.accept('choice', key='max_quality').accept_choices(quals, ignore_case=True)
     # propers
     options.accept('boolean', key='propers')
     message = "should be in format 'x (minutes|hours|days|weeks)' e.g. '5 days'"
     options.accept('interval', key='propers', message=message + ' or yes/no')
     # expect flags
     options.accept('choice', key='identified_by').accept_choices(['ep', 'id', 'auto'])
     # timeframe
     options.accept('interval', key='timeframe', message=message)
     # strict naming
     options.accept('boolean', key='exact')
     # watched in SXXEXX form
     watched = options.accept('regexp_match', key='watched')
     watched.accept('(?i)s\d\de\d\d$', message='Must be in SXXEXX format')
     # watched in dict form
     watched = options.accept('dict', key='watched')
     watched.accept('integer', key='season')
     watched.accept('integer', key='episode')
     # from group
     options.accept('text', key='from_group')
     options.accept('list', key='from_group').accept('text')
     # parse only
     options.accept('boolean', key='parse_only')
     # This is a flag set by all_series and series_premiere plugins, it should not be set by the user
     options.accept('boolean', key='series_guessed')
Example #6
0
                        title=options["title"],
                        imdb_id=options["imdb_id"],
                        tmdb_id=options["tmdb_id"],
                        quality=options["quality"],
                        force=options["force"],
                    )
                    # warn about a bit silly quality value
                    if qualities.common_name(options["quality"]) == "720p":
                        console(
                            'WARNING: quality 720p in movie context will not retrieve BluRay rips. You might want to use "720p bluray" instead!'
                        )
                except QueueError, e:
                    console(e.message)
                    if e.errno == 1:
                        # This is an invalid quality error, display some more info
                        console("Recognized qualities are %s" % ", ".join([qual.name for qual in qualities.all()]))
                        console(
                            "ANY is the default and can also be used explicitly to specify that quality should be ignored."
                        )
                else:
                    console("Added %s to queue with quality %s" % (added["title"], added["quality"]))
        except OperationalError:
            log.critical("OperationalError")

    def queue_list(self, session, downloaded=False):
        """List IMDb queue"""

        items = queue_get(session=session, downloaded=downloaded)
        console("-" * 79)
        console("%-10s %-7s %-37s %-15s %s" % ("IMDB id", "TMDB id", "Title", "Quality", "Force"))
        console("-" * 79)
Example #7
0
            console('could not determine movie')  # TODO: Rethink errors
            return

        try:
            if options['action'] == 'add':
                try:
                    added = queue_add(title=options['title'], imdb_id=options['imdb_id'],
                        tmdb_id=options['tmdb_id'], quality=options['quality'], force=options['force'])
                    # warn about a bit silly quality value
                    if qualities.common_name(options['quality']) == '720p':
                        console('WARNING: quality 720p in movie context will not retrieve BluRay rips. You might want to use "720p bluray" instead!')
                except QueueError, e:
                    console(e.message)
                    if e.errno == 1:
                        # This is an invalid quality error, display some more info
                        console('Recognized qualities are %s' % ', '.join([qual.name for qual in qualities.all()]))
                        console('ANY is the default and can also be used explicitly to specify that quality should be ignored.')
                else:
                    console('Added %s to queue with quality %s' % (added['title'], added['quality']))
        except OperationalError:
            log.critical('OperationalError')

    def queue_list(self, session, downloaded=False):
        """List IMDb queue"""

        items = queue_get(session=session, downloaded=downloaded)
        console('-' * 79)
        console('%-10s %-7s %-37s %-15s %s' % ('IMDB id', 'TMDB id', 'Title', 'Quality', 'Force'))
        console('-' * 79)
        for item in items:
            console('%-10s %-7s %-37s %-15s %s' % (item.imdb_id, item.tmdb_id, item.title, item.quality, item.immortal))