Remove skip album methods
This commit is contained in:
parent
f6ab663343
commit
ea8c113734
55
src/main.py
55
src/main.py
|
@ -14,23 +14,6 @@ def get_args():
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
def skip_all_albums(path: Path):
|
|
||||||
for directory in path.iterdir():
|
|
||||||
if directory.is_dir():
|
|
||||||
if not skip_album(directory):
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
print(f"Warning, skipping non-dir '{directory}' found in '{path}'")
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def skip_album(path: Path):
|
|
||||||
for file in path.iterdir():
|
|
||||||
if file.name == "DONE":
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def transcode(transcode_list: list, encoder: Path, workers=16):
|
def transcode(transcode_list: list, encoder: Path, workers=16):
|
||||||
worker_args = [(row[0], row[1], encoder) for row in transcode_list]
|
worker_args = [(row[0], row[1], encoder) for row in transcode_list]
|
||||||
with Pool(workers) as p:
|
with Pool(workers) as p:
|
||||||
|
@ -65,28 +48,24 @@ def main(input_dir: Path, output_dir: Path, encoder: Path, out_extension: str =
|
||||||
for artist in input_dir.iterdir():
|
for artist in input_dir.iterdir():
|
||||||
if artist.is_dir():
|
if artist.is_dir():
|
||||||
artist_out = Path(output_dir) / artist.name
|
artist_out = Path(output_dir) / artist.name
|
||||||
if False: #skip_all_albums(artist):
|
artist_out.mkdir()
|
||||||
print(f"Skipping '{artist.parts[-1]}'")
|
for album in artist.iterdir():
|
||||||
continue
|
if album.is_dir():
|
||||||
else:
|
album_out = artist_out / album.parts[-1]
|
||||||
artist_out.mkdir()
|
if album_out.exists():
|
||||||
for album in artist.iterdir():
|
print(f"Skipping '{artist.parts[-1]} / {album.parts[-1]}'")
|
||||||
if album.is_dir():
|
|
||||||
album_out = artist_out / album.parts[-1]
|
|
||||||
if album_out.exists():
|
|
||||||
print(f"Skipping '{artist.parts[-1]} / {album.parts[-1]}'")
|
|
||||||
else:
|
|
||||||
album_out.mkdir()
|
|
||||||
done_file = album / 'DONE'
|
|
||||||
open(done_file, 'a').close()
|
|
||||||
for file in album.iterdir():
|
|
||||||
if file.is_file() and file.suffix.lower() == '.flac':
|
|
||||||
transcode_list.append((str(file), str(album_out / f"{file.stem}.{out_extension}")))
|
|
||||||
elif file.is_file() and file.suffix.lower() in file_whitelist:
|
|
||||||
shutil.copy(file, album_out / file.name)
|
|
||||||
else:
|
else:
|
||||||
print(f"Warning, skipping non-dir '{album}' found in artist '{artist.parts[-1]}'")
|
album_out.mkdir()
|
||||||
continue
|
done_file = album / 'DONE'
|
||||||
|
open(done_file, 'a').close()
|
||||||
|
for file in album.iterdir():
|
||||||
|
if file.is_file() and file.suffix.lower() == '.flac':
|
||||||
|
transcode_list.append((str(file), str(album_out / f"{file.stem}.{out_extension}")))
|
||||||
|
elif file.is_file() and file.suffix.lower() in file_whitelist:
|
||||||
|
shutil.copy(file, album_out / file.name)
|
||||||
|
else:
|
||||||
|
print(f"Warning, skipping non-dir '{album}' found in artist '{artist.parts[-1]}'")
|
||||||
|
continue
|
||||||
else:
|
else:
|
||||||
print(f"Warning, skipping non-dir '{artist}' found in root")
|
print(f"Warning, skipping non-dir '{artist}' found in root")
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue
Block a user