Пример #1
0
def prep(data):
    base = create_location(data[SERIES_NAME], data['anime'])
    if not base:
        return False
    show = Series(series_name=data[SERIES_NAME],
                  location=base,
                  tvdb_id=data[TVDB_ID],
                  premiere=data[PREMIERE],
                  final=data[FINAL],
                  status=data[STATUS],
                  name_needed=data[NAME_NEEDED])

    REPORT['info'].append('Series Name: ' + show.series_name)
    REPORT['info'].append('Status: ' + show.status)

    for f in data['files']:
        if not f['s_nr'] or not f['e_nr']:
            continue

        f = File(old_location=os.path.join(FILE_DIR, f['location']),
                 series_name=show.series_name,
                 s_nr=f['s_nr'],
                 e_nr=f['e_nr'],
                 title=f['title'],
                 title2=f['title2'],
                 title3=f['title3'],
                 episode_option=f['episode_option'],
                 subs=f['sub'],
                 anime=show.anime)

        folder = make_season_folder(f.s_nr, show.location)
        if not folder:
            return False

        name = Episode.compile_file_name(None, file=f)
        if f.subs:
            f.location = os.path.join(SUB_DIR, name)
        else:
            f.location = os.path.join(folder, name)
        QUEUE.append(f)

    return show