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)
def test_is_importable(): assert scanner.is_importable("foo.m4v") assert not scanner.is_importable("foo.avi") assert not scanner.is_importable("foo.py")