Rename class Track to File

This commit is contained in:
George Lacey 2025-01-18 14:53:31 +00:00
parent 93ce2b1725
commit cc5f4f77da
3 changed files with 7 additions and 7 deletions

View File

@ -1,2 +1,2 @@
from .track import Track
from .file import File
from .transcoder import Transcoder

View File

@ -1,10 +1,10 @@
from pathlib import Path
audio_extensions = ['flac']
audio_extensions = ['.flac']
art_extensions = ['.jpg', '.jpeg', '.png']
class Track:
class File:
def __init__(self, location: Path):
self.path = location

View File

@ -2,7 +2,7 @@ from pathlib import Path
import shutil
import subprocess
from multiprocessing import Pool
from . import Track
from . import File
class Transcoder:
@ -20,7 +20,7 @@ class Transcoder:
if album.is_dir():
for file in album.iterdir():
if file.is_file():
transcode_list.append(Track(file))
transcode_list.append(File(file))
else:
print(f"Warning, skipping non-dir '{album}' found in artist '{artist.parts[-1]}'")
continue
@ -52,7 +52,7 @@ class Transcoder:
else:
return f"File {track.path} ignored"
def copy_album_art(self, file: Track):
def copy_album_art(self, file: File):
self.create_directories(file)
output_path = file.output_file(self.output_root, file.extension[1:])
if output_path.exists():
@ -83,7 +83,7 @@ class Transcoder:
except Exception:
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():
try:
track.artist_out(self.output_root).mkdir()