def preview_scooper(): scoop = tvdb_scooper_loader() scoop.scoop() res = {} vars = request.vars.scooper_strings if not isinstance(vars, list): vars = [vars] vars = [a for a in vars if a <> ''] for a in vars: res[a] = scoop.preview(a, reload=True) examples = scoop.find_patterns() all_strings = db( (db.seasons_settings.series_id == db.series.id) & (db.seasons_settings.scooper_strings != None) ).select(db.series.id, db.series.name, db.seasons_settings.seasonnumber, db.seasons_settings.scooper_strings) all = {} for row in all_strings: a = row.seasons_settings.scooper_strings if len(row.seasons_settings.scooper_strings) > 0: for b in a: if b not in all: all[b] = Storage( name=row.series.name, seasonnumber=row.seasons_settings.seasonnumber, url=URL('series', 'index', args=[row.series.id], anchor='settings', extension='') ) return dict(form='', res=res, examples=examples, all=all)
def scoop_season(series_id, seasonnumber, cb=None): scooper = tvdb_scooper_loader() scooper.move_files(series_id, seasonnumber) db.commit() if cb: default_callback(cb, series_id, seasonnumber)