Create directory skeleton of albums not already processed
This commit is contained in:
parent
4d35f24aa3
commit
de02cb2d08
41
src/main.py
41
src/main.py
|
@ -9,8 +9,45 @@ def get_args():
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
def main(input_dir: str, output_dir: str):
|
def skip_all_albums(path: Path):
|
||||||
pass
|
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 main(input_dir: Path, output_dir: Path):
|
||||||
|
for artist in input_dir.iterdir():
|
||||||
|
if artist.is_dir():
|
||||||
|
artist_out = Path(output_dir) / artist.name
|
||||||
|
if skip_all_albums(artist):
|
||||||
|
print(f"Skipping '{artist.parts[-1]}'")
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
artist_out.mkdir()
|
||||||
|
for album in artist.iterdir():
|
||||||
|
if album.is_dir():
|
||||||
|
album_out = artist_out / album.parts[-1]
|
||||||
|
if skip_album(album):
|
||||||
|
print(f"Skipping '{artist.parts[-1]} / {album.parts[-1]}'")
|
||||||
|
else:
|
||||||
|
album_out.mkdir()
|
||||||
|
else:
|
||||||
|
print(f"Warning, skipping non-dir '{album}' found in artist '{artist.parts[-1]}'")
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
print(f"Warning, skipping non-dir '{artist}' found in root")
|
||||||
|
continue
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user