def delete(self, show_id, session): """ Deletes all episodes of a show""" try: show = series.show_by_id(show_id, session=session) except NoResultFound: raise NotFoundError('show with ID %s not found' % show_id) args = delete_parser.parse_args() forget = args.get('forget') for episode in show.episodes: series.remove_series_entity(show.name, episode.identifier, forget) return success_response('successfully removed all series %s episodes from DB' % show_id)
def on_task_output(self, task, config): if not config: return for entry in task.accepted: if 'series_name' in entry and 'series_id' in entry: try: remove_series_entity(entry['series_name'], entry['series_id']) log.info('Removed episode `%s` from series `%s` download history.' % (entry['series_id'], entry['series_name'])) except ValueError: log.debug('Series (%s) or id (%s) unknown.' % (entry['series_name'], entry['series_id']))
def on_task_output(self, task, config): if not config: return for entry in task.accepted: if 'series_name' in entry and 'series_id' in entry: try: plugin_series.remove_series_entity(entry['series_name'], entry['series_id']) log.info( 'Removed episode `%s` from series `%s` download history.' % (entry['series_id'], entry['series_name'])) except ValueError: log.debug('Series (%s) or id (%s) unknown.' % (entry['series_name'], entry['series_id']))
def delete(self, show_id, ep_id, session): """ Forgets episode by show ID and episode ID """ try: show = series.show_by_id(show_id, session=session) except NoResultFound: raise NotFoundError('show with ID %s not found' % show_id) try: episode = series.episode_by_id(ep_id, session) except NoResultFound: raise NotFoundError('episode with ID %s not found' % ep_id) if not series.episode_in_show(show_id, ep_id): raise BadRequest('episode with id %s does not belong to show %s' % (ep_id, show_id)) args = delete_parser.parse_args() series.remove_series_entity(show.name, episode.identifier, args.get('forget')) return success_response('successfully removed episode %s from show %s' % (ep_id, show_id))
def remove(manager, options, forget=False): name = options.series_name if options.episode_id: for identifier in options.episode_id: try: remove_series_entity(name, identifier, forget) except ValueError as e: console(e.args[0]) else: console('Removed entities(s) matching `%s` from series `%s`.' % (identifier, name.capitalize())) else: # remove whole series try: remove_series(name, forget) except ValueError as e: console(e.args[0]) else: console('Removed series `%s` from database.' % name.capitalize()) manager.config_changed()
def remove(manager, options, forget=False): name = options.series_name if options.episode_id: for identifier in options.episode_id: try: remove_series_entity(name, identifier, forget) except ValueError as e: console(e.args[0]) else: console('Removed entities(s) matching `%s` from series `%s`.' % (identifier, name.capitalize())) else: # remove whole series try: remove_series(name, forget) except ValueError as e: console(e.args[0]) else: console('Removed series `%s` from database.' % name.capitalize()) manager.config_changed()