Esempio n. 1
0
 def test_compiler(self):
     comp_true = TEST_DATA['compile_truth']
     for t1 in ['Brian', '']:
         for t2 in ['Roger', '', 'Brian']:
             for t3 in ['John', '', 'Brian', 'Roger']:
                 for eo in [SINGLE, DOUBLE, TRIPLE]:
                     for a in [True, False]:
                         for se in [[2, 1], [20, 10], [2, 100]]:
                             if se[1] == 100 and not a:
                                 continue
                             f = File(
                                 s_nr=se[0],
                                 e_nr=se[1],
                                 series_name='Freddie',
                                 title=t1,
                                 title2=t2,
                                 title3=t3,
                                 episode_option=eo,
                                 anime=a)
                             f.extension = 'mkv'
                             comp = Episode.compile_file_name(None, f)
                             s = ''.join([t1[0] if t1 else '_', t2[0] if t2 else '_',
                                          t3[0] if t3 else '_', 'A' if a else '_', eo[0],
                                          str(len(str(se[0])) + 3), str(len(str(se[1])))])
                             # print(s)
                             self.assertEqual(comp, comp_true[s])
Esempio n. 2
0
def queue_episode(file):
    name = Episode.compile_file_name(None, file=file)

    base_path = get_base_path(file)
    file.location = os.path.join(base_path, name)

    if file.subs:
        for sub in file.subs:
            QUEUE.append(File(old_location=sub,
                              series_name=file.series_name,
                              location=os.path.join(
                                  SUB_DIR, '{}.{}'.format(name.rsplit('.', 1)[0], sub.rsplit('.', 1)[1]))))
    QUEUE.append(file)
    return QUEUE
Esempio n. 3
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