Import skeleton of organization
This commit is contained in:
parent
b731339806
commit
f2c0e5a4f7
18
karaokatalog/instructions/MoveInstruction.py
Normal file
18
karaokatalog/instructions/MoveInstruction.py
Normal file
@ -0,0 +1,18 @@
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
from karaokatalog.instructions.Instruction import Instruction
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MoveInstruction(Instruction):
|
||||
"""
|
||||
Move the old path (might point to a file, a folder or a link) to the new path, no questions asked.
|
||||
Does not override existing paths.
|
||||
"""
|
||||
|
||||
old_path: Path
|
||||
new_path: Path
|
||||
|
||||
def __call__(self) -> None:
|
||||
raise NotImplementedError() # TODO
|
@ -1,7 +1,10 @@
|
||||
import logging
|
||||
|
||||
from tqdm import tqdm
|
||||
|
||||
from karaokatalog.get_parser import get_parser
|
||||
from karaokatalog.Library import Library
|
||||
from karaokatalog.organize.move import move
|
||||
|
||||
logging.basicConfig(
|
||||
format="%(asctime)s [%(levelname)s] %(message)s", level=logging.INFO
|
||||
@ -18,6 +21,13 @@ if __name__ == "__main__":
|
||||
library = Library.from_dir(args.library_path)
|
||||
logging.info("Library loaded")
|
||||
|
||||
# TODO
|
||||
logging.info("Generating move instructions")
|
||||
move_instructions = move(library.songs, args.library_path)
|
||||
logging.info(f"{len(move_instructions)} move instructions generated")
|
||||
|
||||
logging.warning(f"Moving {len(move_instructions)} songs!")
|
||||
for instruction in tqdm(move_instructions, unit=" songs"):
|
||||
instruction()
|
||||
logging.info("Moving done")
|
||||
|
||||
logging.info("Karaokatalog Organization done")
|
||||
|
13
karaokatalog/organize/move.py
Normal file
13
karaokatalog/organize/move.py
Normal file
@ -0,0 +1,13 @@
|
||||
from collections.abc import Sequence
|
||||
from pathlib import Path
|
||||
|
||||
from karaokatalog.instructions.MoveInstruction import MoveInstruction
|
||||
from karaokatalog.Song import Song
|
||||
|
||||
|
||||
def move(songs: Sequence[Song], base_dir: Path) -> Sequence[MoveInstruction]:
|
||||
"""
|
||||
Create move instructions to move every song into the proper song directory
|
||||
within the given base_dir.
|
||||
"""
|
||||
raise NotImplementedError() # TODO
|
Loading…
x
Reference in New Issue
Block a user