Strip trailing dots, document those measures
This commit is contained in:
parent
4c00b01c78
commit
2ffae9ceda
@ -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