Example #1
0
def main(src_dir):
    rl = []
    for fp in yield_filelist(src_dir):
        __, ext = os.path.splitext(fp)
        if ext == '.mp4':
            result = get_video_length_seconds(fp)
            if result:
                rl.append(result)
    _print_total_hours(rl)
    return rl
Example #2
0
def main(src_dir):
    cmds = []
    for fp in yield_filelist(src):
        fp = fp.replace(' ', '\ ')
        out_fp = fp.replace('.mp4', '.mp3')
        c = cmd.format(fp, out_fp)
        cmds.append(c)

    for l in chunks(cmds, 3):
        tmps = [Shell(c) for c in l]
        for i in tmps:
            i.communicate()
def main(src_dir, dst_dir):
    files = yield_filelist(src_dir)

    for n, src_fp in enumerate(files):
        fn = os.path.basename(src_fp)
        dst_fp = os.path.join(dst_dir, fn)
        try:
            convert_img_to_gray(src_fp, dst_fp)
        except:
            pass

        if n % 100 == 0 and n != 0:
            print n
def main(src_dir, dst_fp):
    engine, session = get_engine_and_session(dst_fp)
    objectIDs = get_objectIDs(session)
    print('get_objectIDs done')

    filelist = list(yield_filelist(src_dir))
    total = len(filelist)

    for n, fp in enumerate(filelist):
        j = load_json(fp)
        hits = j['hits']
        insert_hits(hits, objectIDs, engine)
        print('{0}/{1}'.format(n + 1, total))
    commit(session)
def main(src_dir, dst_fp):
    engine, session = get_engine_and_session(dst_fp)
    objectIDs = get_objectIDs(session)
    print('get_objectIDs done')

    filelist = list(yield_filelist(src_dir))
    total = len(filelist)

    for n, fp in enumerate(filelist):
        j = load_json(fp)
        hits = j['hits']
        is_ok_to_delete = is_this_json_in_db(hits, objectIDs)
        if is_ok_to_delete:
            os.remove(fp)
        print('{0}/{1}'.format(n, total))
def main(src_dir, dst_dir):
    for fp in yield_filelist(src_dir):
        check(fp, dst_dir)
def main(src_dir, artist, album):
    for fp in yield_filelist(src_dir):
        title = os.path.basename(fp).replace('.mp3', '')
        change_tag(fp, artist, album, title)