after delete album artwork, set default in qgraphicsview
This commit is contained in:
parent
485f99f6d5
commit
da7d679248
5
main.py
5
main.py
@ -47,6 +47,7 @@ from components import (
|
|||||||
CreatePlaylistWindow,
|
CreatePlaylistWindow,
|
||||||
ExportPlaylistWindow,
|
ExportPlaylistWindow,
|
||||||
)
|
)
|
||||||
|
from utils.get_album_art import get_album_art
|
||||||
|
|
||||||
# good help with signals slots in threads
|
# good help with signals slots in threads
|
||||||
# https://stackoverflow.com/questions/52993677/how-do-i-setup-signals-and-slots-in-pyqt-with-qthreads-in-both-directions
|
# https://stackoverflow.com/questions/52993677/how-do-i-setup-signals-and-slots-in-pyqt-with-qthreads-in-both-directions
|
||||||
@ -389,6 +390,10 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow):
|
|||||||
error(
|
error(
|
||||||
f"delete_album_art_for_current_song() | Error processing this file:\t {file}\n{exctype}\n{value}\n{traceback.format_exc()}"
|
f"delete_album_art_for_current_song() | Error processing this file:\t {file}\n{exctype}\n{value}\n{traceback.format_exc()}"
|
||||||
)
|
)
|
||||||
|
# Load the default album artwork in the qgraphicsview
|
||||||
|
album_art_data = self.tableView.get_current_song_album_art()
|
||||||
|
album_art_data = get_album_art(None)
|
||||||
|
self.albumGraphicsView.load_album_art(album_art_data)
|
||||||
|
|
||||||
def update_audio_visualization(self) -> None:
|
def update_audio_visualization(self) -> None:
|
||||||
"""Handles upading points on the pyqtgraph visual"""
|
"""Handles upading points on the pyqtgraph visual"""
|
||||||
|
|||||||
@ -2,7 +2,7 @@ from mutagen.id3 import ID3
|
|||||||
from logging import debug, error
|
from logging import debug, error
|
||||||
|
|
||||||
|
|
||||||
def get_album_art(file: str) -> bytes:
|
def get_album_art(file: str | None) -> bytes:
|
||||||
"""Get the album art for an audio file
|
"""Get the album art for an audio file
|
||||||
# Parameters
|
# Parameters
|
||||||
`file` | str | Fully qualified path to file
|
`file` | str | Fully qualified path to file
|
||||||
@ -10,6 +10,7 @@ def get_album_art(file: str) -> bytes:
|
|||||||
bytes for album art or placeholder artwork
|
bytes for album art or placeholder artwork
|
||||||
"""
|
"""
|
||||||
default_image_path = "./assets/default_album_art.jpg"
|
default_image_path = "./assets/default_album_art.jpg"
|
||||||
|
if file:
|
||||||
try:
|
try:
|
||||||
audio = ID3(file)
|
audio = ID3(file)
|
||||||
for tag in audio.getall("APIC"):
|
for tag in audio.getall("APIC"):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user