From b11a9ef04386e9b1a0362cb7ebc3d385bf3c6c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vidar=20Waagb=C3=B8?= Date: Thu, 1 May 2014 02:31:31 +0200 Subject: [PATCH] Thumbnail images to history --- changelog.txt | 4 ++-- default.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/changelog.txt b/changelog.txt index 4756aca..e1a877c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,10 +2,10 @@ * Fixed/improved feature - Removed feature -2014-05-04 v1.0.2 +2014-05-01 v1.0.2 ================= -+ Added thumbnail image to streams to improve experience in favorites menu. ++ Added thumbnail to elements to improve experience in favorites and plugin. Thanks to robho (https://github.com/robho) 2014-04-23 v1.0.1 diff --git a/default.py b/default.py index 50aa8c8..6be578e 100644 --- a/default.py +++ b/default.py @@ -52,9 +52,10 @@ def __init__(self): xbmcplugin.setContent(HANDLE, 'audio') self.curl = HTTPComm() - self.name = ARGS.get('foldername', None) self.mode = ARGS.get('mode', None) + self.thumbnailImage = 'special://home/addons/%s/icon.png' % ADDON_ID + def run(self): @@ -73,10 +74,9 @@ def run(self): elif self.mode[0] == 'folder' and self.name[0] == 'streams': - thumbnailImage = 'special://home/addons/%s/icon.png' % ADDON_ID streams = self.get_streams() for stream in streams: - li = xbmcgui.ListItem(stream['name'], iconImage='DefaultAudio.png', thumbnailImage=thumbnailImage) + li = xbmcgui.ListItem(stream['name'], iconImage='DefaultAudio.png', thumbnailImage=self.thumbnailImage) li.setInfo(type="Music", infoLabels={"Size": stream['bitrate'] * 1024}) li.setProperty("IsPlayable", "true") xbmcplugin.addDirectoryItem(handle=HANDLE, url=stream['url'], listitem=li, isFolder=False) @@ -90,7 +90,7 @@ def run(self): # Currently Playing self.add_heading(ADDON.getLocalizedString(30200)) for item in history[0]: - li = xbmcgui.ListItem(item["artist"] + " - " + item["song"]) + li = xbmcgui.ListItem(item["artist"] + " - " + item["song"], thumbnailImage=self.thumbnailImage) li.setProperty("IsPlayable", "false") xbmcplugin.addDirectoryItem(handle=HANDLE, url="nnn", listitem=li, isFolder=False) @@ -98,7 +98,7 @@ def run(self): # Queue self.add_heading(ADDON.getLocalizedString(30201), True) for item in history[1]: - li = xbmcgui.ListItem(item["artist"] + " - " + item["song"]) + li = xbmcgui.ListItem(item["artist"] + " - " + item["song"], thumbnailImage=self.thumbnailImage) li.setProperty("IsPlayable", "false") xbmcplugin.addDirectoryItem(handle=HANDLE, url="nnn", listitem=li, isFolder=False) @@ -106,7 +106,7 @@ def run(self): # History self.add_heading(ADDON.getLocalizedString(30202), True) for item in history[2]: - li = xbmcgui.ListItem(item["artist"] + " - " + item["song"]) + li = xbmcgui.ListItem(item["artist"] + " - " + item["song"], thumbnailImage=self.thumbnailImage) li.setProperty("IsPlayable", "false") xbmcplugin.addDirectoryItem(handle=HANDLE, url="nnn", listitem=li, isFolder=False) @@ -180,11 +180,11 @@ def get_history(self): def add_heading(self, title, linebreak=False): # Linebreak if linebreak: - li = xbmcgui.ListItem() + li = xbmcgui.ListItem(thumbnailImage=self.thumbnailImage) li.setProperty("IsPlayable", "false") xbmcplugin.addDirectoryItem(handle=HANDLE, url="nnn", listitem=li, isFolder=False) - li = xbmcgui.ListItem(label="[COLOR FF007EFF]" + title + "[/COLOR]") + li = xbmcgui.ListItem(label="[COLOR FF007EFF]" + title + "[/COLOR]", thumbnailImage=self.thumbnailImage) li.setProperty("IsPlayable", "false") xbmcplugin.addDirectoryItem(handle=HANDLE, url="nnn", listitem=li, isFolder=False)