def test_movie_queue_different_queue_forget(self, execute_task): queue_add(title=u'MovieInQueue', imdb_id=u'tt1931533', tmdb_id=603, queue_name='A new queue') task = execute_task('movie_queue_different_queue_accept') assert len(queue_get(downloaded=True, queue_name='A new queue')) == 1 task = execute_task('movie_queue_different_queue_forget') assert not queue_get(downloaded=True, queue_name='A new queue') assert len(queue_get(queue_name='a New queue')) == 1
def test_movie_queue_forget(self): queue_add(title=u'MovieInQueue', imdb_id=u'tt1931533', tmdb_id=603) self.execute_task('movie_queue_accept') assert len(queue_get(downloaded=True)) == 1 self.execute_task('movie_queue_forget') assert not queue_get(downloaded=True) assert len(queue_get()) == 1
def test_movie_queue_different_queue_accept(self): default_queue = queue_get() named_queue = queue_get(queue_name='A new queue') assert len(default_queue) == len(named_queue) == 0 queue_add(title=u'MovieInQueue', imdb_id=u'tt1931533', tmdb_id=603, queue_name='A new queue') queue_add(title=u'MovieInQueue', imdb_id=u'tt1931533', tmdb_id=603) default_queue = queue_get() named_queue = queue_get(queue_name='A new queue') assert len(named_queue) == len(default_queue) == 1 self.execute_task('movie_queue_different_queue_accept') assert len(self.task.entries) == 1 entry = self.task.entries[0] assert entry.get('imdb_id', eval_lazy=False) == 'tt1931533' assert entry.get('tmdb_id', eval_lazy=False) == 603 default_queue = queue_get() named_queue = queue_get(queue_name='A new queue', downloaded=False) assert len(named_queue) == 0 assert len(default_queue) == 1 self.execute_task('movie_queue_different_queue_accept') assert len(self.task.entries) == 0, 'Movie should only be accepted once'
def test_movie_queue_different_queue_forget(self): queue_add(title=u'MovieInQueue', imdb_id=u'tt1931533', tmdb_id=603, queue_name='A new queue') self.execute_task('movie_queue_different_queue_accept') assert len(queue_get(downloaded=True, queue_name='A new queue')) == 1 self.execute_task('movie_queue_different_queue_forget') assert not queue_get(downloaded=True, queue_name='A new queue') assert len(queue_get(queue_name='a New queue')) == 1
def test_movie_queue_different_queue_accept(self): default_queue = queue_get() named_queue = queue_get(queue_name='A new queue') assert len(default_queue) == len(named_queue) == 0 queue_add(title=u'MovieInQueue', imdb_id=u'tt1931533', tmdb_id=603, queue_name='A new queue') queue_add(title=u'MovieInQueue', imdb_id=u'tt1931533', tmdb_id=603) default_queue = queue_get() named_queue = queue_get(queue_name='A new queue') assert len(named_queue) == len(default_queue) == 1 self.execute_task('movie_queue_different_queue_accept') assert len(self.task.entries) == 1 entry = self.task.entries[0] assert entry.get('imdb_id', eval_lazy=False) == 'tt1931533' assert entry.get('tmdb_id', eval_lazy=False) == 603 default_queue = queue_get() named_queue = queue_get(queue_name='A new queue', downloaded=False) assert len(named_queue) == 0 assert len(default_queue) == 1 self.execute_task('movie_queue_different_queue_accept') assert len( self.task.entries) == 0, 'Movie should only be accepted once'
def test_emit_undownloaded(self, execute_task): """Makes sure that items already downloaded are not emitted.""" queue_add(title='The Matrix 1999', imdb_id='tt0133093', tmdb_id=603) task = execute_task('test_default') assert len(task.entries) == 1 task = execute_task('download_movie') task = execute_task('test_default') assert len(task.entries) == 0, 'Should not emit already downloaded queue items.'
def test_default(self, execute_task): queue_add(title='The Matrix 1999', imdb_id='tt0133093', tmdb_id=603) task = execute_task('test_default') assert len(task.entries) == 1 # Movie ids should be provided on the entry without needing lookups entry = task.entries[0] assert entry.get('imdb_id', eval_lazy=False) == 'tt0133093' assert entry.get('tmdb_id', eval_lazy=False) == 603 task = execute_task('test_default') assert len(task.entries) == 1, 'Movie should be emitted every run'
def test_default(self): queue_add(title='The Matrix 1999', imdb_id='tt0133093', tmdb_id=603) self.execute_task('test_default') assert len(self.task.entries) == 1 # Movie ids should be provided on the entry without needing lookups entry = self.task.entries[0] assert entry.get('imdb_id', eval_lazy=False) == 'tt0133093' assert entry.get('tmdb_id', eval_lazy=False) == 603 self.execute_task('test_default') assert len(self.task.entries) == 1, 'Movie should be emitted every run'
def test_movie_queue_accept(self, execute_task): queue_add(title=u'MovieInQueue', imdb_id=u'tt1931533', tmdb_id=603) task = execute_task('movie_queue_accept') assert len(task.entries) == 1 entry = task.entries[0] assert entry.get('imdb_id', eval_lazy=False) == 'tt1931533' assert entry.get('tmdb_id', eval_lazy=False) == 603 task = execute_task('movie_queue_accept') assert len(task.entries) == 0, 'Movie should only be accepted once'
def test_movie_queue_accept(self): queue_add(title=u'MovieInQueue', imdb_id=u'tt1931533', tmdb_id=603) self.execute_task('movie_queue_accept') assert len(self.task.entries) == 1 entry = self.task.entries[0] assert entry.get('imdb_id', eval_lazy=False) == 'tt1931533' assert entry.get('tmdb_id', eval_lazy=False) == 603 self.execute_task('movie_queue_accept') assert len(self.task.entries) == 0, 'Movie should only be accepted once'
def test_emit_different_queue(self, execute_task): queue_add(title='The Matrix 1999', imdb_id='tt0133093', tmdb_id=603) queue_add(title='The Matrix 1999', imdb_id='tt0133093', tmdb_id=603, queue_name='queue 2') task = execute_task('test_default') assert len(task.entries) == 1 task = execute_task('emit_from_separate_queue') assert len(task.entries) == 1 task = execute_task('download_movie_separate_queue') task = execute_task('test_default') assert len(task.entries) == 1 task = execute_task('emit_from_separate_queue') assert len(task.entries) == 0
def test_movie_queue_remove(self): queue_add(title=u'MovieInQueue', imdb_id=u'tt1931533', tmdb_id=603) queue_add(title=u'KeepMe', imdb_id=u'tt1933533', tmdb_id=604) self.execute_task('movie_queue_remove') assert len(self.task.entries) == 1 queue = queue_get() assert len(queue) == 1 entry = queue[0] assert entry.imdb_id == 'tt1933533' assert entry.tmdb_id == 604
def test_movie_queue_different_queue_remove(self, execute_task): queue_add(title=u'MovieInQueue', imdb_id=u'tt1931533', tmdb_id=603, queue_name='A new queue') queue_add(title=u'KeepMe', imdb_id=u'tt1933533', tmdb_id=604, queue_name='A new queue') task = execute_task('movie_queue_different_queue_remove') assert len(task.entries) == 1 queue = queue_get(queue_name='A new queue') assert len(queue) == 1 entry = queue[0] assert entry.imdb_id == 'tt1933533' assert entry.tmdb_id == 604
def on_task_output(self, task, config): if not config: return if not isinstance(config, dict): config = {} for entry in task.accepted: # Tell tmdb_lookup to add lazy lookup fields if not already present try: get_plugin_by_name('tmdb_lookup').instance.lookup(entry) except DependencyError: log.debug( 'tmdb_lookup is not available, queue will not work if movie ids are not populated' ) # Find one or both movie id's for this entry. See if an id is already populated before incurring lazy lookup kwargs = {} for lazy in [False, True]: if entry.get('imdb_id', eval_lazy=lazy): kwargs['imdb_id'] = entry['imdb_id'] if entry.get('tmdb_id', eval_lazy=lazy): kwargs['tmdb_id'] = entry['tmdb_id'] if kwargs: break if not kwargs: log.warning( 'Could not determine a movie id for %s, it will not be added to queue.' % entry['title']) continue # since entries usually have unknown quality we need to ignore that .. if entry.get('quality'): quality = qualities.Requirements(entry['quality'].name) else: quality = qualities.Requirements(config.get('quality', 'any')) kwargs['quality'] = quality force = entry.get('force', config.get('force')) if force is not None: kwargs['force'] = force # Provide movie title if it is already available, to avoid movie_queue doing a lookup kwargs['title'] = entry.get('imdb_name') or entry.get( 'tmdb_name') or entry.get('movie_name') log.debug('queueing kwargs: %s' % kwargs) try: queue_add(**kwargs) except QueueError, e: task.fail(entry, 'Error adding movie to queue: %s' % e.message)
def on_task_output(self, task, config): if not config: return if not isinstance(config, dict): config = {} for entry in task.accepted: # Tell tmdb_lookup to add lazy lookup fields if not already present try: get_plugin_by_name('tmdb_lookup').instance.lookup(entry) except DependencyError: log.debug('tmdb_lookup is not available, queue will not work if movie ids are not populated') # Find one or both movie id's for this entry. See if an id is already populated before incurring lazy lookup kwargs = {} for lazy in [False, True]: if entry.get('imdb_id', eval_lazy=lazy): kwargs['imdb_id'] = entry['imdb_id'] if entry.get('tmdb_id', eval_lazy=lazy): kwargs['tmdb_id'] = entry['tmdb_id'] if kwargs: break if not kwargs: log.warning('Could not determine a movie id for %s, it will not be added to queue.' % entry['title']) continue # since entries usually have unknown quality we need to ignore that .. if entry.get('quality'): quality = qualities.Requirements(entry['quality'].name) else: quality = qualities.Requirements(config.get('quality', 'any')) kwargs['quality'] = quality force = entry.get('force', config.get('force')) if force is not None: kwargs['force'] = force # Provide movie title if it is already available, to avoid movie_queue doing a lookup kwargs['title'] = (entry.get('imdb_name', eval_lazy=False) or entry.get('tmdb_name', eval_lazy=False) or entry.get('movie_name', eval_lazy=False)) log.debug('queueing kwargs: %s' % kwargs) try: queue_add(**kwargs) except QueueError as e: # Ignore already in queue errors if e.errno != 1: entry.fail('Error adding movie to queue: %s' % e.message)
def add_to_queue(): what = request.values.get('what') imdb_id = request.values.get('imdb_id') quality = request.values.get('quality', 'ANY') force = request.values.get('force') == 'on' try: title = queue_add(title=what, imdb_id=imdb_id, quality=quality, force=force)['title'] except QueueError, e: flash(e.message, 'error')
def add_to_queue(): what = request.values.get('what') imdb_id = request.values.get('imdb_id') # TODO: This is a rather limited selection of quality considering the new quality system. Improve it. quality = qualities.Requirements(request.values.get('quality', 'ANY')) force = request.values.get('force') == 'on' try: title = queue_add(title=what, imdb_id=imdb_id, quality=quality, force=force)['title'] except QueueError, e: flash(e.message, 'error')
def on_feed_output(self, feed, config): if not config: return if not isinstance(config, dict): config = {} for entry in feed.accepted: # Tell tmdb_lookup to add lazy lookup fields if not already present try: get_plugin_by_name("tmdb_lookup").instance.lookup(entry) except DependencyError: log.debug("tmdb_lookup is not available, queue will not work if movie ids are not populated") # Find one or both movie id's for this entry. See if an id is already populated before incurring lazy lookup kwargs = {} for lazy in [False, True]: if entry.get("imdb_id", eval_lazy=lazy): kwargs["imdb_id"] = entry["imdb_id"] if entry.get("tmdb_id", eval_lazy=lazy): kwargs["tmdb_id"] = entry["tmdb_id"] if kwargs: break if not kwargs: log.warning("Could not determine a movie id for %s, it will not be added to queue." % entry["title"]) continue # since entries usually have unknown quality we need to ignore that .. if "quality" in entry and entry["quality"] != qualities.UNKNOWN: quality = entry["quality"] else: quality = config.get("quality", "ANY") kwargs["quality"] = quality force = entry.get("force", config.get("force")) if force is not None: kwargs["force"] = force # Provide movie title if it is already available, to avoid movie_queue doing a lookup kwargs["title"] = entry.get("imdb_name") or entry.get("tmdb_name") or entry.get("movie_name") log.debug("queueing kwargs: %s" % kwargs) try: queue_add(**kwargs) except QueueError, e: feed.fail(entry, "Error adding movie to queue: %s" % e.message)
def add_to_queue(): what = request.values.get('what') imdb_id = request.values.get('imdb_id') # TODO: This is a rather limited selection of quality considering the new quality system. Improve it. quality = qualities.Requirements(request.values.get('quality', 'ANY')) force = request.values.get('force') == 'on' try: title = queue_add(title=what, imdb_id=imdb_id, quality=quality, force=force)['title'] except QueueError as e: flash(e.message, 'error') else: flash('%s successfully added to queue.' % title, 'success') return redirect(url_for('.index'))
def post(self, session=None): """ Add movies to movie queue """ kwargs = request.json kwargs['quality'] = qualities.Requirements(kwargs.get('quality')) kwargs['session'] = session try: movie = mq.queue_add(**kwargs) except mq.QueueError as e: reply = {'status': 'error', 'message': e.message} return reply, 500 reply = jsonify(movie) reply.status_code = 201 return reply
def post(self, session=None): """ Add movies to movie queue """ kwargs = request.json kwargs['quality'] = qualities.Requirements(kwargs.get('quality')) kwargs['session'] = session try: movie = mq.queue_add(**kwargs) except mq.QueueError as e: reply = { 'status': 'error', 'message': e.message } return reply, 500 reply = jsonify(movie) reply.status_code = 201 return reply
# Adding to queue requires a lookup for missing information try: what = parse_what(options['what']) options.update(what) except QueueError, e: console(e.message) if not options.get('title') or not (options.get('imdb_id') or options.get('tmdb_id')): 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']) except QueueError, e: console(e.message) if e.errno == 1: # This is an invalid quality error, display some more info # TODO: Fix this error? #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"""
def on_process_start(self, task): """Handle --movie-queue management""" if not getattr(task.manager.options, 'movie_queue', False): return task.manager.disable_tasks() options = task.manager.options.movie_queue if options['action'] == 'list': self.queue_list(task.session) return # If the action affects make sure all entries are processed again next run. task.manager.config_changed() if options['action'] == 'downloaded': self.queue_list(task.session, downloaded=True) return if options['action'] == 'clear': self.clear(task.session) return if options['action'] == 'del': try: what = parse_what(options['what']) title = queue_del(title=what.get('title'), imdb_id=what.get('imdb_id'), tmdb_id=what.get('tmdb_id')) except QueueError as e: console('ERROR: %s' % e.message) else: console('Removed %s from queue' % title) return if options['action'] == 'forget': try: what = parse_what(options['what']) title = queue_forget(title=what.get('title'), imdb_id=what.get('imdb_id'), tmdb_id=what.get('tmdb_id')) except QueueError as e: console('ERROR: %s' % e.message) else: console( 'Forgot that %s was downloaded. Movie will be downloaded again.' % title) return if options['action'] == 'add': # Adding to queue requires a lookup for missing information what = {} try: what = parse_what(options['what']) except QueueError as e: console('ERROR: %s' % e.message) if not what.get('title') or not (what.get('imdb_id') or what.get('tmdb_id')): console('could not determine movie') # TODO: Rethink errors return try: added = queue_add(title=what['title'], imdb_id=what['imdb_id'], tmdb_id=what['tmdb_id'], quality=options['quality'], force=options['force']) except QueueError as e: console(e.message) if e.errno == 1: # This is an invalid quality error, display some more info # TODO: Fix this error? #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.' ) except OperationalError: log.critical('OperationalError')
def do_cli(manager, options): """Handle movie-queue subcommand""" if options.queue_action == "list": queue_list(options) return # If the action affects make sure all entries are processed again next run. manager.config_changed() if options.queue_action == "clear": clear(options) return if options.queue_action == "del": try: what = parse_what(options.movie_name, lookup=False) title = queue_del(queue_name=options.queue_name, **what) except QueueError as e: console("ERROR: %s" % e.message) else: console("Removed %s from queue" % title) return if options.queue_action == "forget": try: what = parse_what(options.movie_name, lookup=False) title = queue_forget(queue_name=options.queue_name, **what) except QueueError as e: console("ERROR: %s" % e.message) else: console("Forgot that %s was downloaded. Movie will be downloaded again." % title.get("title")) return if options.queue_action == "add": try: quality = qualities.Requirements(options.quality) except ValueError as e: console("`%s` is an invalid quality requirement string: %s" % (options.quality, e.message)) return # Adding to queue requires a lookup for missing information what = {} try: what = parse_what(options.movie_name) except QueueError as e: console("ERROR: %s" % e.message) if not what.get("title") or not (what.get("imdb_id") or what.get("tmdb_id")): console("could not determine movie") # TODO: Rethink errors return try: queue_add(quality=quality, queue_name=options.queue_name, **what) except QueueError as e: console(e.message) if e.errno == 1: # This is an invalid quality error, display some more info # TODO: Fix this error? # 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.") except OperationalError: console("OperationalError") return
def on_process_start(self, task): """Handle --movie-queue management""" if not getattr(task.manager.options, "movie_queue", False): return task.manager.disable_tasks() options = task.manager.options.movie_queue if options["action"] == "list": self.queue_list(task.session) return # If the action affects make sure all entries are processed again next run. task.manager.config_changed() if options["action"] == "downloaded": self.queue_list(task.session, downloaded=True) return if options["action"] == "clear": self.clear(task.session) return if options["action"] == "del": try: what = parse_what(options["what"]) title = queue_del(title=what.get("title"), imdb_id=what.get("imdb_id"), tmdb_id=what.get("tmdb_id")) except QueueError as e: console("ERROR: %s" % e.message) else: console("Removed %s from queue" % title) return if options["action"] == "forget": try: what = parse_what(options["what"]) title = queue_forget(title=what.get("title"), imdb_id=what.get("imdb_id"), tmdb_id=what.get("tmdb_id")) except QueueError as e: console("ERROR: %s" % e.message) else: console("Forgot that %s was downloaded. Movie will be downloaded again." % title) return if options["action"] == "add": # Adding to queue requires a lookup for missing information what = {} try: what = parse_what(options["what"]) except QueueError as e: console("ERROR: %s" % e.message) if not what.get("title") or not (what.get("imdb_id") or what.get("tmdb_id")): console("could not determine movie") # TODO: Rethink errors return try: added = queue_add( title=what["title"], imdb_id=what["imdb_id"], tmdb_id=what["tmdb_id"], quality=options["quality"], force=options["force"], ) except QueueError as e: console(e.message) if e.errno == 1: # This is an invalid quality error, display some more info # TODO: Fix this error? # 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." ) except OperationalError: log.critical("OperationalError")
def on_process_start(self, task): """Handle --movie-queue management""" if not getattr(task.manager.options, 'movie_queue', False): return task.manager.disable_tasks() options = task.manager.options.movie_queue if options['action'] == 'list': self.queue_list(task.session) return # If the action was to do more than just list the series, make sure all entries are processed again next run. task.manager.config_changed() if options['action'] == 'downloaded': self.queue_list(task.session, downloaded=True) return if options['action'] == 'clear': self.clear(task.session) return if options['action'] == 'del': try: title = queue_del(options['what']) except QueueError as e: console(e.message) else: console('Removed %s from queue' % title) return if options['action'] == 'forget': try: title = queue_forget(options['what']) except QueueError as e: console(e.message) else: console('Marked %s as undownloaded' % title) return # Adding to queue requires a lookup for missing information try: what = parse_what(options['what']) options.update(what) except QueueError as e: console(e.message) if not options.get('title') or not (options.get('imdb_id') or options.get('tmdb_id')): 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']) except QueueError as e: console(e.message) if e.errno == 1: # This is an invalid quality error, display some more info # TODO: Fix this error? #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')
what = parse_what(options["what"]) options.update(what) except QueueError, e: console(e.message) if not options.get("title") or not (options.get("imdb_id") or options.get("tmdb_id")): 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."
def do_cli(manager, options): """Handle movie-queue subcommand""" console('WARNING!: movie_queue plugin is deprecated. Please switch to using movie_list\n') if options.queue_action == 'list': queue_list(options) return # If the action affects make sure all entries are processed again next run. manager.config_changed() if options.queue_action == 'clear': clear(options) return if options.queue_action == 'del': try: what = parse_what(options.movie_name, lookup=False) title = queue_del(queue_name=options.queue_name, **what) except QueueError as e: console('ERROR: %s' % e.message) else: console('Removed %s from queue' % title) return if options.queue_action == 'forget': try: what = parse_what(options.movie_name, lookup=False) title = queue_forget(queue_name=options.queue_name, **what) except QueueError as e: console('ERROR: %s' % e.message) else: console('Forgot that %s was downloaded. Movie will be downloaded again.' % title.get('title')) return if options.queue_action == 'add': try: quality = qualities.Requirements(options.quality) except ValueError as e: console('`%s` is an invalid quality requirement string: %s' % (options.quality, e.message)) return # Adding to queue requires a lookup for missing information what = {} try: what = parse_what(options.movie_name) except QueueError as e: console('ERROR: %s' % e.message) if not what.get('title') or not (what.get('imdb_id') or what.get('tmdb_id')): console('could not determine movie') # TODO: Rethink errors return try: queue_add(quality=quality, queue_name=options.queue_name, **what) except QueueError as e: console(e.message) if e.errno == 1: # This is an invalid quality error, display some more info # TODO: Fix this error? # 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.') except OperationalError: console('OperationalError') return
def do_cli(manager, options): """Handle movie-queue subcommand""" if options.queue_action == 'list': queue_list(options) return # If the action affects make sure all entries are processed again next run. manager.config_changed() if options.queue_action == 'clear': clear() return if options.queue_action == 'del': try: what = parse_what(options.movie_name, lookup=False) title = queue_del(**what) except QueueError as e: console('ERROR: %s' % e.message) else: console('Removed %s from queue' % title) return if options.queue_action == 'forget': try: what = parse_what(options.movie_name, lookup=False) title = queue_forget(**what) except QueueError as e: console('ERROR: %s' % e.message) else: console( 'Forgot that %s was downloaded. Movie will be downloaded again.' % title) return if options.queue_action == 'add': try: quality = qualities.Requirements(options.quality) except ValueError as e: console('`%s` is an invalid quality requirement string: %s' % (options.quality, e.message)) return # Adding to queue requires a lookup for missing information what = {} try: what = parse_what(options.movie_name) except QueueError as e: console('ERROR: %s' % e.message) if not what.get('title') or not (what.get('imdb_id') or what.get('tmdb_id')): console('could not determine movie') # TODO: Rethink errors return try: queue_add(quality=quality, **what) except QueueError as e: console(e.message) if e.errno == 1: # This is an invalid quality error, display some more info # TODO: Fix this error? # 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.' ) except OperationalError: console('OperationalError') return