Skip to content

Commit 573612a

Browse files
authored
Fix all occurences of xbmc.translatePath (#29)
* Fix translatePath removal xbmc/xbmc#19301 * Fix all occurrences of xbmc.translatePath
1 parent af6c4de commit 573612a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/srgssr.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ def __init__(self, plugin_handle, bu='srf', addon_id=ADDON_ID):
106106

107107
def get_youtube_icon(self):
108108
path = os.path.join(
109-
xbmc.translatePath(self.media_uri), 'icon_youtube.png')
109+
# https://github.com/xbmc/xbmc/pull/19301
110+
xbmcvfs.translatePath(self.media_uri), 'icon_youtube.png')
110111
if os.path.exists(path):
111112
return path
112113
return self.icon
@@ -1351,7 +1352,7 @@ def read_favourite_show_ids(self):
13511352
containing these ids.
13521353
An empty list will be returned in case of failure.
13531354
"""
1354-
path = xbmc.translatePath(
1355+
path = xbmcvfs.translatePath(
13551356
self.real_settings.getAddonInfo('profile'))
13561357
file_path = os.path.join(path, FAVOURITE_SHOWS_FILENAME)
13571358
try:
@@ -1375,7 +1376,7 @@ def write_favourite_show_ids(self, show_ids):
13751376
show_ids -- a list of show ids (as strings)
13761377
"""
13771378
show_ids_dict_list = [{'id': show_id} for show_id in show_ids]
1378-
path = xbmc.translatePath(
1379+
path = xbmcvfs.translatePath(
13791380
self.real_settings.getAddonInfo('profile'))
13801381
file_path = os.path.join(path, FAVOURITE_SHOWS_FILENAME)
13811382
if not os.path.exists(path):
@@ -1384,7 +1385,7 @@ def write_favourite_show_ids(self, show_ids):
13841385
json.dump(show_ids_dict_list, f)
13851386

13861387
def read_searches(self, filename):
1387-
path = xbmc.translatePath(self.real_settings.getAddonInfo('profile'))
1388+
path = xbmcvfs.translatePath(self.real_settings.getAddonInfo('profile'))
13881389
file_path = os.path.join(path, filename)
13891390
try:
13901391
with open(file_path, 'r') as f:
@@ -1407,7 +1408,7 @@ def write_search(self, filename, name, max_entries=10):
14071408
searches.pop()
14081409
searches.insert(0, name)
14091410
write_dict_list = [{'search': entry} for entry in searches]
1410-
path = xbmc.translatePath(self.real_settings.getAddonInfo('profile'))
1411+
path = xbmcvfs.translatePath(self.real_settings.getAddonInfo('profile'))
14111412
file_path = os.path.join(path, filename)
14121413
if not os.path.exists(path):
14131414
os.makedirs(path)
@@ -1451,7 +1452,7 @@ def _read_youtube_channels(self, fname):
14511452
Keyword arguments:
14521453
fname -- the path to the file to be read
14531454
"""
1454-
data_file = os.path.join(xbmc.translatePath(self.data_uri), fname)
1455+
data_file = os.path.join(xbmcvfs.translatePath(self.data_uri), fname)
14551456
with open(data_file, 'r', encoding='utf-8') as f:
14561457
ch_content = json.load(f)
14571458
cids = [elem['channel'] for elem in ch_content.get('channels', [])]

0 commit comments

Comments
 (0)