Compare commits
2 Commits
e4f7172f88
...
df5fc37419
Author | SHA1 | Date | |
---|---|---|---|
df5fc37419 | |||
b5649a349b |
@ -15,6 +15,10 @@ class MoveInstruction(Instruction):
|
|||||||
new_path: Path
|
new_path: Path
|
||||||
|
|
||||||
def __call__(self) -> None:
|
def __call__(self) -> None:
|
||||||
|
if self.old_path == self.new_path:
|
||||||
|
# No-op
|
||||||
|
return
|
||||||
|
|
||||||
if self.new_path.exists():
|
if self.new_path.exists():
|
||||||
raise FileExistsError("New path already exists, not moving anything")
|
raise FileExistsError("New path already exists, not moving anything")
|
||||||
|
|
||||||
|
@ -62,6 +62,12 @@ def move(songs: Sequence[Song], base_dir: Path) -> Sequence[MoveInstruction]:
|
|||||||
variant += 1
|
variant += 1
|
||||||
|
|
||||||
song_dir_strs_lower.add(str(canonical_song_dir).lower())
|
song_dir_strs_lower.add(str(canonical_song_dir).lower())
|
||||||
|
|
||||||
|
if song_dir == canonical_song_dir:
|
||||||
|
# After finding a free variant index, we arrived at the index we already had previously, this means
|
||||||
|
# we do not need to generate a move instruction
|
||||||
|
continue
|
||||||
|
|
||||||
move_instructions.append(
|
move_instructions.append(
|
||||||
MoveInstruction(absolute_song_dir, base_dir / canonical_song_dir)
|
MoveInstruction(absolute_song_dir, base_dir / canonical_song_dir)
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user