feat(audiobook_library): move file logging
This commit is contained in:
1 parent
3c2dbafc44
commit
3c805090e0
1 file changed
+7
@@ -662,11 +662,17 @@ class Audiobook:
|
|||||||
return
|
return
|
||||||
desired_path.mkdir(parents=True, exist_ok=True)
|
desired_path.mkdir(parents=True, exist_ok=True)
|
||||||
padding = len(str(len(self.files)))
|
padding = len(str(len(self.files)))
|
||||||
|
once = True
|
||||||
for number, file in enumerate(self.files, start=1):
|
for number, file in enumerate(self.files, start=1):
|
||||||
if self.singleFile:
|
if self.singleFile:
|
||||||
new_name = f"{desired_name_stem}{file.suffix.lower()}"
|
new_name = f"{desired_name_stem}{file.suffix.lower()}"
|
||||||
else:
|
else:
|
||||||
new_name = f"{number:0{padding}d} - {desired_name_stem}{file.suffix}"
|
new_name = f"{number:0{padding}d} - {desired_name_stem}{file.suffix}"
|
||||||
|
if once:
|
||||||
|
once = False
|
||||||
|
logger.debug(f"Moving {file} to {new_name}")
|
||||||
|
else:
|
||||||
|
logger.trace(f"Moving {file} to {new_name}")
|
||||||
self.files[number - 1] = file.rename(desired_path / new_name)
|
self.files[number - 1] = file.rename(desired_path / new_name)
|
||||||
for file in self.files_extra:
|
for file in self.files_extra:
|
||||||
if file.suffix.lower() in {".cue", ".log"} or file in {
|
if file.suffix.lower() in {".cue", ".log"} or file in {
|
||||||
@@ -680,6 +686,7 @@ class Audiobook:
|
|||||||
new_file = desired_path / filename
|
new_file = desired_path / filename
|
||||||
if file == new_file:
|
if file == new_file:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
logger.trace(f"Moving {file} to {new_file}")
|
logger.trace(f"Moving {file} to {new_file}")
|
||||||
new_file = file.rename(new_file)
|
new_file = file.rename(new_file)
|
||||||
if file == self.epub_file:
|
if file == self.epub_file:
|
||||||
|
|||||||
Reference in new issue
Block a user