Copy album art and log files to output dir
This commit is contained in:
parent
a6cdc8d31e
commit
6574182bfe
|
@ -1,5 +1,6 @@
|
|||
import argparse
|
||||
import subprocess
|
||||
import shutil
|
||||
from subprocess import CalledProcessError
|
||||
from pathlib import Path
|
||||
|
||||
|
@ -42,6 +43,7 @@ def transcode(transcode_list: list, encoder: Path):
|
|||
|
||||
def main(input_dir: Path, output_dir: Path, encoder: Path):
|
||||
transcode_list = []
|
||||
file_whitelist = ['.jpg', '.jpeg', '.png', '.log']
|
||||
for artist in input_dir.iterdir():
|
||||
if artist.is_dir():
|
||||
artist_out = Path(output_dir) / artist.name
|
||||
|
@ -57,11 +59,11 @@ def main(input_dir: Path, output_dir: Path, encoder: Path):
|
|||
print(f"Skipping '{artist.parts[-1]} / {album.parts[-1]}'")
|
||||
else:
|
||||
album_out.mkdir()
|
||||
# todo: copy files not on blacklist
|
||||
# todo: create blacklist
|
||||
for track in album.iterdir():
|
||||
if track.is_file() and track.suffix.lower() == '.flac':
|
||||
transcode_list.append((str(track), str(album_out / f"{track.stem}.opus")))
|
||||
elif track.is_file() and track.suffix.lower() in file_whitelist:
|
||||
shutil.copy(track, album_out / track.name)
|
||||
else:
|
||||
print(f"Warning, skipping non-dir '{album}' found in artist '{artist.parts[-1]}'")
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue
Block a user