示例#1
0
def process_movie_dir(movie_dir_source: Path):
    name = movie_dir_source.name
    pfcs(f"processing: i[{name}] as type b[movie dir]")
    nfo_loc = find_nfo_file_in_path(movie_dir_source)
    rar_loc = find_rar_in_path(movie_dir_source)
    mkv_loc = find_mkv_in_path(movie_dir_source)
    if not rar_loc and not mkv_loc:
        pfcs(f"could e[not] find item to process in w[{movie_dir_source}]!")
        return
    if rar_loc and mkv_loc:
        pfcs(f"found e[both] rar and mkv in w[{movie_dir_source}]!")
        return
    pfcs(f"found file: i[{mkv_loc or rar_loc}]")
    dest = determine_movie_destination(name)
    pfcs(f"destination: i[{dest}]")
    if rar_loc:
        if not run.extract(rar_loc, dest, create_dirs=True):
            return  # extract failed
    if mkv_loc:
        run.move_file(mkv_loc, dest, create_dirs=True)
    if nfo_loc:
        imdb_id = util.parse_imdbid_from_file(nfo_loc)
        if imdb_id:
            print(
                f"found imdb-id: {cstr(imdb_id, 154)}, will create movie.nfo")
            util_movie.create_movie_nfo(dest, imdb_id)
    shutil.rmtree(movie_dir_source)
    print(f'removed {cstr(movie_dir_source, "orange")}')
示例#2
0
def process_episode(ep_path: Path):
    ep_path = validate_path(ep_path)
    if not ep_path:
        return
    dest = determine_episode_destination(ep_path.name)
    if not dest:
        pfcs(f"could not determine destination for w[{ep_path}]")
        return
    if ep_path.is_dir():
        pfcs(f"processing: i[{ep_path.name}] as type b[episode dir]")
        rar_loc = find_rar_in_path(ep_path)
        if not run.extract(rar_loc, dest, create_dirs=True):
            return  # extract failed
        return
    pfcs(f"processing: i[{ep_path.name}] as type b[episode file]")
    run.move_file(ep_path, dest, create_dirs=True)
示例#3
0
def test_unsupported_extraction_file_extension():
    with pytest.raises(Exception, match="could not extract myplugin.dat"):
        extract("myplugin.dat")
示例#4
0
def test_unsupported_extraction_file_extension():
    with pytest.raises(Exception, match="could not extract myplugin.dat"):
        extract("myplugin.dat")