From ee5aff33c1c87dd50944176c0d166ecb127e83fd Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Thu, 30 Jun 2022 16:17:55 +0200 Subject: [PATCH] Fix paths for assets --- {src/Utils => data}/assets/Barnkanalen.png | Bin {src/Utils => data}/assets/Cast.png | Bin {src/Utils => data}/assets/Default.png | Bin .../Utils => data}/assets/Kunskapskanalen.png | Bin {src/Utils => data}/assets/SVT.png | Bin {src/Utils => data}/assets/SVT1.png | Bin {src/Utils => data}/assets/SVT2.png | Bin {src/Utils => data}/assets/SVT24.png | Bin {src/Utils => data}/assets/YouTube.png | Bin scripts/cast | 5 +++-- setup.py | 2 +- src/Utils/__init__.py | 21 +++++++++--------- stdeb.cfg | 4 ++-- 13 files changed, 16 insertions(+), 16 deletions(-) rename {src/Utils => data}/assets/Barnkanalen.png (100%) rename {src/Utils => data}/assets/Cast.png (100%) rename {src/Utils => data}/assets/Default.png (100%) rename {src/Utils => data}/assets/Kunskapskanalen.png (100%) rename {src/Utils => data}/assets/SVT.png (100%) rename {src/Utils => data}/assets/SVT1.png (100%) rename {src/Utils => data}/assets/SVT2.png (100%) rename {src/Utils => data}/assets/SVT24.png (100%) rename {src/Utils => data}/assets/YouTube.png (100%) diff --git a/src/Utils/assets/Barnkanalen.png b/data/assets/Barnkanalen.png similarity index 100% rename from src/Utils/assets/Barnkanalen.png rename to data/assets/Barnkanalen.png diff --git a/src/Utils/assets/Cast.png b/data/assets/Cast.png similarity index 100% rename from src/Utils/assets/Cast.png rename to data/assets/Cast.png diff --git a/src/Utils/assets/Default.png b/data/assets/Default.png similarity index 100% rename from src/Utils/assets/Default.png rename to data/assets/Default.png diff --git a/src/Utils/assets/Kunskapskanalen.png b/data/assets/Kunskapskanalen.png similarity index 100% rename from src/Utils/assets/Kunskapskanalen.png rename to data/assets/Kunskapskanalen.png diff --git a/src/Utils/assets/SVT.png b/data/assets/SVT.png similarity index 100% rename from src/Utils/assets/SVT.png rename to data/assets/SVT.png diff --git a/src/Utils/assets/SVT1.png b/data/assets/SVT1.png similarity index 100% rename from src/Utils/assets/SVT1.png rename to data/assets/SVT1.png diff --git a/src/Utils/assets/SVT2.png b/data/assets/SVT2.png similarity index 100% rename from src/Utils/assets/SVT2.png rename to data/assets/SVT2.png diff --git a/src/Utils/assets/SVT24.png b/data/assets/SVT24.png similarity index 100% rename from src/Utils/assets/SVT24.png rename to data/assets/SVT24.png diff --git a/src/Utils/assets/YouTube.png b/data/assets/YouTube.png similarity index 100% rename from src/Utils/assets/YouTube.png rename to data/assets/YouTube.png diff --git a/scripts/cast b/scripts/cast index 4e162fc..fd6d529 100644 --- a/scripts/cast +++ b/scripts/cast @@ -12,7 +12,7 @@ from vlc import Instance from Channel import SVT from ChannelProvider import ChannelProvider -from Utils import MYPATH, make_bitmap_from_file, make_sized_button +from Utils import make_bitmap_from_file, make_sized_button WIDTH = int(720 / 2) HEIGHT = int(1440 / 2) @@ -34,6 +34,7 @@ class Cast(wx.Frame): :param kw: """ self.m_mode = 'normal' + self.asset_path: str = '/usr/share/cast' url = None if "url" in kw: self.m_mode = 'single' @@ -116,7 +117,7 @@ class Cast(wx.Frame): if not self.m_chromecast_thr.is_alive( ) and not self.m_selected_chromecast: - btm = make_bitmap_from_file('{}/assets/Cast.png'.format(MYPATH), wx.Size(24,24)) + btm = make_bitmap_from_file('{}/assets/Cast.png'.format(self.asset_path), wx.Size(24,24)) cast_button = wx.BitmapButton(self.m_panel, -1, bitmap=btm, diff --git a/setup.py b/setup.py index 26616d2..8be6c26 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( version="0.0.1", author="Micke Nordin", author_email="hej@mic.ke", - data_files = [('share/applications', ['data/org.smolnet.cast.desktop']),], + data_files = [('share/applications', ['data/org.smolnet.cast.desktop']),('share/cast/assets', ['data/assets/'])], description="A Public Service video player.", long_description=long_description, long_description_content_type="text/markdown", diff --git a/src/Utils/__init__.py b/src/Utils/__init__.py index 004e570..cfd210f 100644 --- a/src/Utils/__init__.py +++ b/src/Utils/__init__.py @@ -15,7 +15,6 @@ from Items import Item HEIGHT = int(1440 / 2) BTN_HEIGHT = 40 SIZE = wx.Size(68,100) -MYPATH = path.dirname(path.abspath(__file__)) SCREEN_WIDTH = int(720 / 2) BASEPATH = path.join(str(environ.get("HOME")), '.config/cast') DB_FILE_NAME = 'cast.db' @@ -68,11 +67,11 @@ def add_video(video_id: str, con.commit() -def get_default_logo(providerid: str = 'default') -> wx.Bitmap: +def get_default_logo(providerid: str = 'default', path: str = '/usr/share/cast') -> wx.Bitmap: if providerid == 'SVT': - return wx.Bitmap('{}/assets/SVT.png'.format(MYPATH)) + return wx.Bitmap('{}/assets/SVT.png'.format(path)) else: - return wx.Bitmap('{}/assets/Default.png'.format(MYPATH)) + return wx.Bitmap('{}/assets/Default.png'.format(path)) def get_latest(provider_id: str, @@ -236,42 +235,42 @@ def make_bitmap_from_file(path, size: wx.Size = SIZE) -> wx.Bitmap: return wx.Bitmap(image) -def resolve_svt_channel(svt_id: str) -> dict: +def resolve_svt_channel(svt_id: str, path: str = '/usr/share/cast') -> dict: channels = { "ch-barnkanalen": { "name": "Barnkanalen", "thumbnail": - make_bitmap_from_file('{}/assets/Barnkanalen.png'.format(MYPATH)) + make_bitmap_from_file('{}/assets/Barnkanalen.png'.format(path)) }, "ch-svt1": { "name": "SVT 1", "thumbnail": - make_bitmap_from_file('{}/assets/SVT1.png'.format(MYPATH)) + make_bitmap_from_file('{}/assets/SVT1.png'.format(path)) }, "ch-svt2": { "name": "SVT 2", "thumbnail": - make_bitmap_from_file('{}/assets/SVT2.png'.format(MYPATH)) + make_bitmap_from_file('{}/assets/SVT2.png'.format(path)) }, "ch-svt24": { "name": "SVT 24", "thumbnail": - make_bitmap_from_file('{}/assets/SVT24.png'.format(MYPATH)) + make_bitmap_from_file('{}/assets/SVT24.png'.format(path)) }, "ch-kunskapskanalen": { "name": "Kunskapskanalen", "thumbnail": make_bitmap_from_file( - '{}/assets/Kunskapskanalen.png'.format(MYPATH)) + '{}/assets/Kunskapskanalen.png'.format(path)) }, "feed": { "name": "Senaste program", "thumbnail": - make_bitmap_from_file('{}/assets/SVT.png'.format(MYPATH)) + make_bitmap_from_file('{}/assets/SVT.png'.format(path)) }, } diff --git a/stdeb.cfg b/stdeb.cfg index c027932..dfc3538 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,3 +1,3 @@ [DEFAULT] -Depends3: python3-bs4, python3-wxgtk4.0, python3-feedparser, python3-vlc, python3-pychromecast -Debian-Version: 1 +Depends3: python3-bs4, python3-wxgtk4.0, python3-wxgtk-media4.0, python3-feedparser, python3-vlc, python3-pychromecast +Debian-Version: 2