Rename class Track to File
This commit is contained in:
parent
93ce2b1725
commit
cc5f4f77da
|
@ -1,2 +1,2 @@
|
||||||
from .track import Track
|
from .file import File
|
||||||
from .transcoder import Transcoder
|
from .transcoder import Transcoder
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
audio_extensions = ['flac']
|
audio_extensions = ['.flac']
|
||||||
art_extensions = ['.jpg', '.jpeg', '.png']
|
art_extensions = ['.jpg', '.jpeg', '.png']
|
||||||
|
|
||||||
class Track:
|
class File:
|
||||||
def __init__(self, location: Path):
|
def __init__(self, location: Path):
|
||||||
self.path = location
|
self.path = location
|
||||||
|
|
|
@ -2,7 +2,7 @@ from pathlib import Path
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from multiprocessing import Pool
|
from multiprocessing import Pool
|
||||||
from . import Track
|
from . import File
|
||||||
|
|
||||||
|
|
||||||
class Transcoder:
|
class Transcoder:
|
||||||
|
@ -20,7 +20,7 @@ class Transcoder:
|
||||||
if album.is_dir():
|
if album.is_dir():
|
||||||
for file in album.iterdir():
|
for file in album.iterdir():
|
||||||
if file.is_file():
|
if file.is_file():
|
||||||
transcode_list.append(Track(file))
|
transcode_list.append(File(file))
|
||||||
else:
|
else:
|
||||||
print(f"Warning, skipping non-dir '{album}' found in artist '{artist.parts[-1]}'")
|
print(f"Warning, skipping non-dir '{album}' found in artist '{artist.parts[-1]}'")
|
||||||
continue
|
continue
|
||||||
|
@ -52,7 +52,7 @@ class Transcoder:
|
||||||
else:
|
else:
|
||||||
return f"File {track.path} ignored"
|
return f"File {track.path} ignored"
|
||||||
|
|
||||||
def copy_album_art(self, file: Track):
|
def copy_album_art(self, file: File):
|
||||||
self.create_directories(file)
|
self.create_directories(file)
|
||||||
output_path = file.output_file(self.output_root, file.extension[1:])
|
output_path = file.output_file(self.output_root, file.extension[1:])
|
||||||
if output_path.exists():
|
if output_path.exists():
|
||||||
|
@ -83,7 +83,7 @@ class Transcoder:
|
||||||
except Exception:
|
except Exception:
|
||||||
return f"ERROR: Transcoding of '{track}' failed."
|
return f"ERROR: Transcoding of '{track}' failed."
|
||||||
|
|
||||||
def create_directories(self, track: Track):
|
def create_directories(self, track: File):
|
||||||
if not track.artist_out(self.output_root).exists():
|
if not track.artist_out(self.output_root).exists():
|
||||||
try:
|
try:
|
||||||
track.artist_out(self.output_root).mkdir()
|
track.artist_out(self.output_root).mkdir()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user