Skip to content

Commit

Permalink
Add directory icons to main menu
Browse files Browse the repository at this point in the history
  • Loading branch information
dagwieers committed Mar 21, 2019
1 parent 5738c88 commit db907ed
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 22 deletions.
Expand Up @@ -4,12 +4,14 @@

class TitleItem:

def __init__(self, title, url_dictionary, is_playable, thumbnail=None, video_dictionary=None):
def __init__(self, title, url_dictionary, is_playable, thumbnail=None, video_dictionary=None, icon='', fanart=None):
self.title = title
self.url_dictionary = url_dictionary
self.is_playable = is_playable
self.thumbnail = thumbnail
self.video_dictionary = video_dictionary
self.icon = icon
self.fanart = self.fanart if self.fanart else self.thumbnail


class Credentials:
Expand Down
4 changes: 2 additions & 2 deletions plugin.video.vrt.nu/resources/lib/kodiwrappers/kodiwrapper.py
Expand Up @@ -28,12 +28,12 @@ def __init__(self, handle, url, addon):
def show_listing(self, list_items, sort=None):
listing = []
for title_item in list_items:
list_item = xbmcgui.ListItem(label=title_item.title)
list_item = xbmcgui.ListItem(label=title_item.title, iconImage=title_item.icon)
url = self._url + '?' + urlencode(title_item.url_dictionary)
list_item.setProperty('IsPlayable', str(title_item.is_playable))

if title_item.thumbnail is not None:
list_item.setArt({'thumb': title_item.thumbnail})
list_item.setArt({'thumb': title_item.thumbnail, 'fanart': title_item.fanart, 'icon': title_item.icon})

list_item.setInfo('video', title_item.video_dictionary)

Expand Down
52 changes: 33 additions & 19 deletions plugin.video.vrt.nu/resources/lib/vrtplayer/vrtplayer.py
Expand Up @@ -27,21 +27,29 @@ def __init__(self, kodi_wrapper, stream_service, api_helper):
def show_main_menu_items(self):
menu_items = {
helperobjects.TitleItem(self._kodi_wrapper.get_localized_string(32080),
dict(action=actions.LISTING_AZ_TVSHOWS), False,
'DefaultMovieTitle.png',
dict(plot=self._kodi_wrapper.get_localized_string(32081))),
dict(action=actions.LISTING_AZ_TVSHOWS),
is_playable=False,
thumb='DefaultMovieTitle.png',
video_dictionary=dict(plot=self._kodi_wrapper.get_localized_string(32081)),
icon='DefaultMovieTitle.png'),
helperobjects.TitleItem(self._kodi_wrapper.get_localized_string(32082),
dict(action=actions.LISTING_CATEGORIES), False,
'DefaultGenre.png',
dict(plot=self._kodi_wrapper.get_localized_string(32083))),
dict(action=actions.LISTING_CATEGORIES),
is_playable=False,
thumbnail='DefaultGenre.png',
video_dictionary=dict(plot=self._kodi_wrapper.get_localized_string(32083)),
icon='DefaultGenre.png'),
helperobjects.TitleItem(self._kodi_wrapper.get_localized_string(32084),
dict(action=actions.LISTING_LIVE), False,
'DefaultAddonPVRClient.png',
dict(plot=self._kodi_wrapper.get_localized_string(32085))),
dict(action=actions.LISTING_LIVE),
is_playable=False,
thumbnail='DefaultAddonPVRClient.png',
video_dictionary=dict(plot=self._kodi_wrapper.get_localized_string(32085)),
icon='DefaultAddonPVRClient.png'),
helperobjects.TitleItem(self._kodi_wrapper.get_localized_string(32086),
dict(action=actions.LISTING_EPISODES, video_url='recent'), False,
'DefaultYear.png',
dict(plot=self._kodi_wrapper.get_localized_string(32087))),
dict(action=actions.LISTING_EPISODES, video_url='recent'),
is_playable=False,
thumbnail='DefaultYear.png',
video_dictionary=dict(plot=self._kodi_wrapper.get_localized_string(32087)),
icon='DefaultYear.png'),
}
self._kodi_wrapper.show_listing(menu_items, sortmethod.ALPHABET)

Expand All @@ -62,17 +70,23 @@ def play(self, video):
def show_livestream_items(self):
livestream_items = {
helperobjects.TitleItem(self._kodi_wrapper.get_localized_string(32101),
{'action': actions.PLAY, 'video_url': self._EEN_LIVESTREAM},
True, self._api_helper.get_live_screenshot('een'),
dict(plot=self._kodi_wrapper.get_localized_string(32101))),
dict(action=actions.PLAY, video_url=self._EEN_LIVESTREAM),
is_playable=True,
thumbnail=self._api_helper.get_live_screenshot('een'),
video_dictionary=dict(plot=self._kodi_wrapper.get_localized_string(32101)),
icon='DefaultAddonPVRClient.png'),
helperobjects.TitleItem(self._kodi_wrapper.get_localized_string(32102),
{'action': actions.PLAY, 'video_url': self._CANVAS_LIVESTREAM_},
True, self._api_helper.get_live_screenshot('canvas'),
dict(plot=self._kodi_wrapper.get_localized_string(32102))),
is_playable=True,
thumbnail=self._api_helper.get_live_screenshot('canvas'),
video_dictionary=dict(plot=self._kodi_wrapper.get_localized_string(32102)),
icon='DefaultAddonPVRClient.png'),
helperobjects.TitleItem(self._kodi_wrapper.get_localized_string(32103),
{'action': actions.PLAY, 'video_url': self._KETNET_LIVESTREAM},
True, self._api_helper.get_live_screenshot('ketnet'),
dict(plot=self._kodi_wrapper.get_localized_string(32103))),
is_playable=True,
thumbnail=self._api_helper.get_live_screenshot('ketnet'),
video_dictionary=dict(plot=self._kodi_wrapper.get_localized_string(32103)),
icon='DefaultAddonPVRClient.png'),
}
self._kodi_wrapper.show_listing(livestream_items, sortmethod.ALPHABET)

Expand Down

0 comments on commit db907ed

Please sign in to comment.