diff options
author | Leo Moll <leo.moll@dtms.de> | 2018-01-11 12:16:45 +0100 |
---|---|---|
committer | Martijn Kaijser <martijn@xbmc.org> | 2018-01-15 18:48:50 +0100 |
commit | e5d0f50b8d39ab7fd745b8f384ec622f6b0df5d9 (patch) | |
tree | 330896b0ec477109bcf87798feb7076a65588c45 /plugin.video.mediathekview/classes/showui.py | |
parent | 7614cf25cf45728579713777796a41bed914fe05 (diff) |
[plugin.video.mediathekview] 0.3.4
Diffstat (limited to 'plugin.video.mediathekview/classes/showui.py')
-rw-r--r-- | plugin.video.mediathekview/classes/showui.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/plugin.video.mediathekview/classes/showui.py b/plugin.video.mediathekview/classes/showui.py new file mode 100644 index 0000000..b6f0bf8 --- /dev/null +++ b/plugin.video.mediathekview/classes/showui.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright 2017 Leo Moll and Dominik Schlösser +# + +# -- Imports ------------------------------------------------ +import sys, urllib +import xbmcplugin, xbmcgui + +from classes.show import Show +from classes.settings import Settings + +# -- Classes ------------------------------------------------ +class ShowUI( Show ): + def __init__( self, handle, sortmethods = [ xbmcplugin.SORT_METHOD_TITLE ] ): + self.base_url = sys.argv[0] + self.handle = handle + self.sortmethods = sortmethods + self.querychannelid = 0 + + def Begin( self, channelid ): + self.querychannelid = 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': + resultingname = self.show + ' [' + self.channel + ']' + else: + resultingname = self.show + li = xbmcgui.ListItem( label = resultingname ) + xbmcplugin.addDirectoryItem( + handle = self.handle, + url = self.build_url( { + 'mode': "films", + 'show': self.id + } ), + listitem = li, + isFolder = True + ) + + def End( self ): + xbmcplugin.endOfDirectory( self.handle ) + + def build_url( self, query ): + return self.base_url + '?' + urllib.urlencode( query ) |