Skip to content

Commit

Permalink
Merge pull request #2595 from goggle/srgssr_2.2.4
Browse files Browse the repository at this point in the history
[script.module.srgssr@matrix] 2.2.4
  • Loading branch information
basrieter authored Mar 22, 2024
2 parents 4eb7bff + 3cf5cb0 commit 3e6ec82
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion script.module.srgssr/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.module.srgssr" name="SRG SSR" version="2.2.3" provider-name="Alexander Seiler">
<addon id="script.module.srgssr" name="SRG SSR" version="2.2.4" provider-name="Alexander Seiler">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.inputstreamhelper" version="0.5.10"/>
Expand Down
19 changes: 11 additions & 8 deletions script.module.srgssr/lib/srgssr.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import datetime
import json
import requests
import utils

import xbmc
import xbmcgui
Expand All @@ -41,6 +40,7 @@
import simplecache
import youtube_channels

import utils

ADDON_ID = 'script.module.srgssr'
REAL_SETTINGS = xbmcaddon.Addon(id=ADDON_ID)
Expand Down Expand Up @@ -106,7 +106,8 @@ def __init__(self, plugin_handle, bu='srf', addon_id=ADDON_ID):

def get_youtube_icon(self):
path = os.path.join(
xbmc.translatePath(self.media_uri), 'icon_youtube.png')
# https://github.com/xbmc/xbmc/pull/19301
xbmcvfs.translatePath(self.media_uri), 'icon_youtube.png')
if os.path.exists(path):
return path
return self.icon
Expand Down Expand Up @@ -383,7 +384,7 @@ def build_menu_apiv3(self, queries, mode=1000, page=1, page_hash=None,
item, is_show=is_show, whitelist_ids=whitelist_ids)

if cursor:
if page == 0 or page == '0':
if page in (0, '0'):
return

# Next page urls containing the string 'urns=' do not work
Expand Down Expand Up @@ -1351,7 +1352,7 @@ def read_favourite_show_ids(self):
containing these ids.
An empty list will be returned in case of failure.
"""
path = xbmc.translatePath(
path = xbmcvfs.translatePath(
self.real_settings.getAddonInfo('profile'))
file_path = os.path.join(path, FAVOURITE_SHOWS_FILENAME)
try:
Expand All @@ -1375,7 +1376,7 @@ def write_favourite_show_ids(self, show_ids):
show_ids -- a list of show ids (as strings)
"""
show_ids_dict_list = [{'id': show_id} for show_id in show_ids]
path = xbmc.translatePath(
path = xbmcvfs.translatePath(
self.real_settings.getAddonInfo('profile'))
file_path = os.path.join(path, FAVOURITE_SHOWS_FILENAME)
if not os.path.exists(path):
Expand All @@ -1384,7 +1385,8 @@ def write_favourite_show_ids(self, show_ids):
json.dump(show_ids_dict_list, f)

def read_searches(self, filename):
path = xbmc.translatePath(self.real_settings.getAddonInfo('profile'))
path = xbmcvfs.translatePath(
self.real_settings.getAddonInfo('profile'))
file_path = os.path.join(path, filename)
try:
with open(file_path, 'r') as f:
Expand All @@ -1407,7 +1409,8 @@ def write_search(self, filename, name, max_entries=10):
searches.pop()
searches.insert(0, name)
write_dict_list = [{'search': entry} for entry in searches]
path = xbmc.translatePath(self.real_settings.getAddonInfo('profile'))
path = xbmcvfs.translatePath(
self.real_settings.getAddonInfo('profile'))
file_path = os.path.join(path, filename)
if not os.path.exists(path):
os.makedirs(path)
Expand Down Expand Up @@ -1451,7 +1454,7 @@ def _read_youtube_channels(self, fname):
Keyword arguments:
fname -- the path to the file to be read
"""
data_file = os.path.join(xbmc.translatePath(self.data_uri), fname)
data_file = os.path.join(xbmcvfs.translatePath(self.data_uri), fname)
with open(data_file, 'r', encoding='utf-8') as f:
ch_content = json.load(f)
cids = [elem['channel'] for elem in ch_content.get('channels', [])]
Expand Down

0 comments on commit 3e6ec82

Please sign in to comment.