forked from trav/lintunes
v0.23.0: covers for the whole album
- Multi-select Get Info keeps the art square; a pasted cover goes into every selected track (shared cover shown, else "mixed artwork"). - Paste Artwork button + Ctrl+V anywhere outside a text field; a caption says what happened. Clipboard reads that don't decode are retried and never staged; every attempt is logged at INFO. - Album art search queries Deezer alongside iTunes and ranks by album match (iTunes has no copy of Digable Planets' Reachin' at all). - embed_artwork shared by Get Info and Download Album Art; single-track Get Info now invalidates the MPRIS art cache.
This commit is contained in:
@@ -9,7 +9,7 @@ from PyQt6.QtWidgets import (
|
||||
from PyQt6.QtCore import Qt, QEvent, QTimer
|
||||
from PyQt6.QtGui import QAction, QKeySequence
|
||||
|
||||
from lintunes import device_sync, mpris, music_folder, tagging, theme, url_import
|
||||
from lintunes import device_sync, music_folder, theme, url_import
|
||||
from lintunes.andtunes import layout as andtunes_layout
|
||||
from lintunes.andtunes import install as andtunes_install
|
||||
from lintunes.andtunes import sync as andtunes_sync
|
||||
@@ -23,6 +23,7 @@ from lintunes.inhibit import INHIBIT_LOGOUT, INHIBIT_SUSPEND, SleepInhibitor
|
||||
from lintunes.player import Player
|
||||
from lintunes.importers import file_importer
|
||||
from lintunes.gui.album_art_dialog import AlbumArtDialog
|
||||
from lintunes.gui.art_ops import embed_artwork
|
||||
from lintunes.gui.cast_dialog import ChromecastDialog
|
||||
from lintunes.gui.device_sync_dialog import DeviceSyncSettingsDialog
|
||||
from lintunes.gui.export_dialog import ExportKindDialog, WebMixDialog
|
||||
@@ -1390,26 +1391,9 @@ class MainWindow(QMainWindow):
|
||||
self._art_next_group()
|
||||
|
||||
def _embed_album_art(self, tracks, image: bytes, mime: str):
|
||||
"""Embed confirmed artwork into each track's file. Like the Info
|
||||
dialog, the artwork write itself is not undoable; the size refresh is
|
||||
an in-memory update (size isn't a tag field)."""
|
||||
failures = []
|
||||
done = 0
|
||||
for track in tracks:
|
||||
if not track.location:
|
||||
continue
|
||||
try:
|
||||
tagging.write_artwork(track.location, image, mime)
|
||||
except Exception as e:
|
||||
failures.append(f"{track.name}: {e}")
|
||||
continue
|
||||
done += 1
|
||||
mpris.invalidate_artwork(track)
|
||||
try:
|
||||
size = Path(track.location).stat().st_size
|
||||
except OSError:
|
||||
continue
|
||||
self._manager.update_track_fields(track.track_id, {"size": size})
|
||||
"""Embed confirmed artwork into each track's file (not undoable —
|
||||
see ``art_ops``)."""
|
||||
done, failures = embed_artwork(self._manager, tracks, image, mime)
|
||||
if failures:
|
||||
QMessageBox.warning(
|
||||
self, "Download Album Art",
|
||||
|
||||
Reference in New Issue
Block a user