✨ Include dafault album image in build.

This commit is contained in:
Robert Honz
2024-04-01 19:54:11 +02:00
parent f9dd50b464
commit 1dcfd98a75
3 changed files with 18 additions and 3 deletions
+3 -1
View File
@@ -65,6 +65,7 @@ gui-windows: ## Build GUI app with PyInstaller
--noupx \
--icon $(path_asset)/icon.ico \
--add-binary="pyproject.toml:." \
--add-data="tidal_dl_ng/ui/default_album_image.png:./tidal_dl_ng/ui" \
tidal_dl_ng/gui.py
.PHONY: gui-linux
@@ -75,7 +76,7 @@ gui-linux: ## Build GUI app with PyInstaller
--noupx \
--icon $(path_asset)/icon.png \
--add-binary="pyproject.toml:." \
tidal_dl_ng/gui.py
--add-data="tidal_dl_ng/ui/default_album_image.png:./tidal_dl_ng/ui" \
.PHONY: gui-macos
gui-macos: ## Build GUI app with PyInstaller
@@ -85,6 +86,7 @@ gui-macos: ## Build GUI app with PyInstaller
--noupx \
--icon $(path_asset)/icon.icns \
--add-binary="pyproject.toml:." \
--add-data="tidal_dl_ng/ui/default_album_image.png:./tidal_dl_ng/ui" \
tidal_dl_ng/gui.py
# TODO: macos Signing: https://gist.github.com/txoof/0636835d3cc65245c6288b2374799c43
+5 -2
View File
@@ -15,7 +15,7 @@ from tidal_dl_ng.helper.gui import (
set_results_media,
set_user_list_media,
)
from tidal_dl_ng.helper.path import get_format_template
from tidal_dl_ng.helper.path import get_format_template, resource_path
from tidal_dl_ng.helper.tidal import (
get_tidal_media_id,
get_tidal_media_type,
@@ -179,7 +179,10 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.statusbar.addPermanentWidget(pb)
def _init_info(self):
self.l_pm_cover.setPixmap(QtGui.QPixmap("tidal_dl_ng/ui/default_album_image.png"))
path_image: str = resource_path("tidal_dl_ng/ui/default_album_image.png")
logger_gui.info(path_image)
self.l_pm_cover.setPixmap(QtGui.QPixmap(path_image))
def on_progress_reset(self):
self.pb_list.setValue(0)
+10
View File
@@ -2,6 +2,7 @@ import glob
import math
import os
import re
import sys
from pathlib import Path, PosixPath
from pathvalidate import sanitize_filename, sanitize_filepath
@@ -243,3 +244,12 @@ def check_file_exists(path_file: str, extension_ignore: bool = False) -> bool:
result = bool(sum([glob.glob(_file) for _file in path_files], []))
return result
def resource_path(relative_path):
try:
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)