Skip to content

Commit

Permalink
Fix all occurences of xbmc.translatePath (#29)
Browse files Browse the repository at this point in the history
* Fix translatePath removal

xbmc/xbmc#19301

* Fix all occurrences of xbmc.translatePath
  • Loading branch information
DenTheBarde authored Mar 21, 2024
1 parent af6c4de commit 573612a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/srgssr.py
Original file line number Diff line number Diff line change
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 @@ -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,7 @@ 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 +1408,7 @@ 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 +1452,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 573612a

Please sign in to comment.