Skip to content

Commit

Permalink
Version 2.0.5
Browse files Browse the repository at this point in the history
* Images path fix (#96)
* Local images path support (experimental)
  • Loading branch information
Cigaras committed Mar 17, 2017
1 parent d0e45a5 commit e74160a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
23 changes: 15 additions & 8 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# Version 2.0.4
# Version 2.0.5

from m3u_parser import LoadPlaylist, PlaylistReloader
from xmltv_parser import GuideReloader
Expand Down Expand Up @@ -209,13 +209,20 @@ def GetImage(file_name, default):
if file_name:
if file_name.startswith('http'):
return Resource.ContentsOfURLWithFallback(file_name, fallback = R(default))
elif Prefs['images_url'].startswith('http'):
file_name = Prefs['images_url'] + file_name if Prefs['images_url'].endswith('/') else Prefs['images_url'] + '/' + file_name
return Resource.ContentsOfURLWithFallback(file_name, fallback = R(default))
else:
r = R(file_name)
if r:
return r
if Prefs['images_path']:
path = Prefs['images_path']
if path.startswith('http'):
file_name = path + file_name if path.endswith('/') else path + '/' + file_name
return Resource.ContentsOfURLWithFallback(file_name, fallback = R(default))
else:
if '/' in path and not '\\' in path:
# must be unix system, might not work
file_name = path + file_name if path.endswith('/') else path + '/' + file_name
elif '\\' in path and not '/' in path:
file_name = path + file_name if path.endswith('\\') else path + '\\' + file_name
r = R(file_name)
if r:
return r
return R(default)

####################################################################################################
Expand Down
4 changes: 2 additions & 2 deletions Contents/DefaultPrefs.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"default": ""
},
{
"id": "images_url",
"label": "URL path where images are located, if left empty images will be loaded from Resources folder",
"id": "images_path",
"label": "Local path (experimental) or URL where images are located, if left empty images will be loaded from Resources folder",
"type": "text",
"default": ""
},
Expand Down

0 comments on commit e74160a

Please sign in to comment.