Compare commits
2 Commits
4c00b01c78
...
e4f7172f88
Author | SHA1 | Date | |
---|---|---|---|
e4f7172f88 | |||
2ffae9ceda |
@ -27,7 +27,10 @@ if __name__ == "__main__":
|
||||
|
||||
logging.warning(f"Moving {len(move_instructions)} songs!")
|
||||
for instruction in tqdm(move_instructions, unit=" songs"):
|
||||
instruction()
|
||||
try:
|
||||
instruction()
|
||||
except FileExistsError:
|
||||
logging.error(f"Could not move {instruction.old_path} -> {instruction.new_path}")
|
||||
logging.info("Moving done")
|
||||
|
||||
logging.info("Karaokatalog Organization done")
|
||||
|
@ -7,7 +7,11 @@ from tqdm import tqdm
|
||||
from karaokatalog.instructions.MoveInstruction import MoveInstruction
|
||||
from karaokatalog.Song import Song
|
||||
|
||||
FORBIDDEN_CHARACTERS = re.compile(r'[\/<>:"\\|?*]')
|
||||
# Those characters are forbidden on Linux (few) or on Windows (many), so we strip them from filenames
|
||||
# https://stackoverflow.com/a/31976060/
|
||||
# Apparently, trailing dots are also prohibited, so we strip those as well:
|
||||
# https://lkml.iu.edu/hypermail/linux/kernel/2203.2/01877.html
|
||||
FORBIDDEN_CHARACTERS = re.compile(r'[\/<>:"\\|?*]|\.$')
|
||||
|
||||
|
||||
def _get_canonical_song_dir(song: Song, variant: int = 0) -> Path:
|
||||
@ -28,6 +32,9 @@ 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.
|
||||
"""
|
||||
|
||||
# We lower case all the song directories, because Windows filesystems are often
|
||||
# case-insensitive, so we have to ignore casing when finding duplicates
|
||||
song_dir_strs_lower = set(
|
||||
str(song.dir.relative_to(base_dir)).lower() for song in songs
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user