示例#1
0
文件: transcoder.py 项目: NZKoz/ocdtv
def transcoded(handbrake, preset, no_act, file_info):
    """Yield files which have benn transcoded (if necessary)."""
    transcode = partial(transcode_file, handbrake, preset, no_act)
    good_files = []
    for (filename, metadata) in sorted(
        file_info, cmp=_compare, key=itemgetter(0)):
        base = os.path.splitext(os.path.basename(filename))[0]

        if base in good_files:
            continue

        if not is_importable(filename):
            filename = transcode(filename)

        good_files.append(base)
        yield (filename, metadata)
示例#2
0
def test_is_importable():
    assert scanner.is_importable("foo.m4v")
    assert not scanner.is_importable("foo.avi")
    assert not scanner.is_importable("foo.py")