diff options
Diffstat (limited to 'plugin.video.mediathekview/resources/lib/showui.py')
-rw-r--r-- | plugin.video.mediathekview/resources/lib/showui.py | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/plugin.video.mediathekview/resources/lib/showui.py b/plugin.video.mediathekview/resources/lib/showui.py index b0bf7f9..64aff20 100644 --- a/plugin.video.mediathekview/resources/lib/showui.py +++ b/plugin.video.mediathekview/resources/lib/showui.py @@ -3,35 +3,55 @@ # # -- Imports ------------------------------------------------ -import sys, urllib -import xbmcplugin, xbmcgui +import xbmcgui +import xbmcplugin + +import resources.lib.mvutils as mvutils from resources.lib.show import Show # -- Classes ------------------------------------------------ class ShowUI( Show ): - def __init__( self, handle, sortmethods = None ): - self.base_url = sys.argv[0] - self.handle = handle + def __init__( self, plugin, sortmethods = None ): + self.plugin = plugin + self.handle = plugin.addon_handle self.sortmethods = sortmethods if sortmethods is not None else [ xbmcplugin.SORT_METHOD_TITLE ] self.querychannelid = 0 def Begin( self, channelid ): - self.querychannelid = channelid + self.querychannelid = int( channelid ) for method in self.sortmethods: xbmcplugin.addSortMethod( self.handle, method ) def Add( self, altname = None ): if altname is not None: resultingname = altname - elif self.querychannelid == '0': + elif self.querychannelid == 0: resultingname = self.show + ' [' + self.channel + ']' else: resultingname = self.show + + infoLabels = { + 'title' : resultingname, + 'sorttitle' : resultingname.lower() + } + + + if self.channel.find( ',' ) == -1: + icon = 'special://home/addons/' + self.plugin.addon_id + '/resources/icons/' + self.channel.lower() + '-m.png' + else: + icon = 'special://home/addons/' + self.plugin.addon_id + '/resources/icons/default-m.png' + li = xbmcgui.ListItem( label = resultingname ) + li.setInfo( type = 'video', infoLabels = infoLabels ) + li.setArt( { + 'thumb': icon, + 'icon': icon + } ) + xbmcplugin.addDirectoryItem( handle = self.handle, - url = self.build_url( { + url = mvutils.build_url( { 'mode': "films", 'show': self.id } ), @@ -41,6 +61,3 @@ class ShowUI( Show ): def End( self ): xbmcplugin.endOfDirectory( self.handle ) - - def build_url( self, query ): - return self.base_url + '?' + urllib.urlencode( query ) |