mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 10:22:51 +01:00
Fixed album art not loading for Rekordbox collections
This commit is contained in:
1 parent
bd425f8cd6
commit
2e04bcb9f6
3 files changed
+28
-2
No files matched your search
@@ -407,7 +407,7 @@ class RekordboxAdapter:
|
||||
self._refuse("Editing cover art")
|
||||
|
||||
def cover_art(self, track_id: str) -> tuple[bytes, str] | None:
|
||||
return None
|
||||
return self._store.cover_art(track_id)
|
||||
|
||||
def set_grid_lock(self, track_id: str, locked: bool) -> TrackCues:
|
||||
# Rekordbox has no per-track grid lock; capabilities.grid.lockable says so.
|
||||
|
||||
@@ -292,6 +292,31 @@ class RekordboxStore:
|
||||
return None
|
||||
return self._mapping.apply(Path(str(folder)))
|
||||
|
||||
def cover_art(self, track_id: str) -> tuple[bytes, str] | None:
|
||||
"""The art embedded in the audio file, else Rekordbox's own copy.
|
||||
|
||||
The file comes first because it is what Traktor reads too, so one track
|
||||
shows the same art on both platforms. Rekordbox's copy (`ImagePath`,
|
||||
rooted at `share/` like `AnalysisDataPath`) covers files it cannot be
|
||||
read from — a WAV, or a drive that is not mounted.
|
||||
"""
|
||||
from ...core import audio_tags
|
||||
|
||||
path = self.audio_path(track_id)
|
||||
if path is not None and path.is_file():
|
||||
art = audio_tags.read_cover(path)
|
||||
if art:
|
||||
return art
|
||||
rel = getattr(self.content(track_id), "ImagePath", None)
|
||||
if not rel:
|
||||
return None
|
||||
image = self.path.parent / "share" / str(rel).lstrip("/\\")
|
||||
try:
|
||||
data = image.read_bytes()
|
||||
except OSError:
|
||||
return None
|
||||
return data, "image/png" if image.suffix.lower() == ".png" else "image/jpeg"
|
||||
|
||||
def all_audio_paths(self) -> list[str]:
|
||||
return [
|
||||
str(c.FolderPath) for c in self.iter_content() if getattr(c, "FolderPath", None)
|
||||
|
||||
Reference in new issue
Block a user