Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: UTF-8 -*-
- from traceback import print_exc
- import xbmc
- import xbmcgui
- import xbmcaddon
- __addon__ = xbmcaddon.Addon()
- __cwd__ = __addon__.getAddonInfo('path')
- def log(msg):
- xbmc.log( str( msg ),level=xbmc.LOGDEBUG )
- class Gui( xbmcgui.WindowXMLDialog ):
- def __init__( self, *args, **kwargs ):
- xbmcgui.WindowXMLDialog.__init__( self )
- self.nextlist = kwargs.get( "listing" )
- def onInit(self):
- self.init_controls()
- self.fill_containers()
- def init_controls(self):
- #control ids
- self.control_list_monday_id = 200
- self.control_list_tuesday_id = 201
- self.control_list_wednesday_id = 202
- self.control_list_thursday_id = 203
- self.control_list_friday_id = 204
- self.control_list_saturday_id = 205
- self.control_list_sunday_id = 206
- #controls
- self.monday_list = self.getControl(self.control_list_monday_id)
- self.tuesday_list = self.getControl(self.control_list_tuesday_id)
- self.wednesday_list = self.getControl(self.control_list_wednesday_id)
- self.thursday_list = self.getControl(self.control_list_thursday_id)
- self.friday_list = self.getControl(self.control_list_friday_id)
- self.saturday_list = self.getControl(self.control_list_saturday_id)
- self.sunday_list = self.getControl(self.control_list_sunday_id)
- def fill_containers(self):
- for count, current_show in enumerate( self.nextlist ):
- # New listitem with tv show title, thumb and path
- listitem = xbmcgui.ListItem(label=current_show.get( "localname", "" ),thumbnailImage=current_show.get("ep_img", "" ),path=current_show.get("path", "" ))
- listitem.setProperty("Airtime", current_show.get("Airtime", "" ))
- listitem.setProperty("Status", current_show.get("Status", "" ))
- listitem.setProperty("Network", current_show.get("Network", "" ))
- listitem.setProperty("Started", current_show.get("Started", "" ))
- listitem.setProperty("Classification", current_show.get("Classification", "" ))
- listitem.setProperty("Genres", current_show.get("Genres", "" ))
- listitem.setProperty("Premiered", current_show.get("Premiered", "" ))
- listitem.setProperty("Country", current_show.get("Country", "" ))
- listitem.setProperty("Runtime", current_show.get("Runtime", "" ))
- try:
- next = current_show.get( "Next Episode","").split("^")
- listitem.setProperty("NextDate", next[2] or "")
- listitem.setProperty("NextTitle", next[1] or "")
- listitem.setProperty("NextNumber", next[0] or "")
- except: print_exc()
- try:
- latest = current_show.get("Latest Episode","").split("^")
- listitem.setProperty("LatestDate", latest[2] or "")
- listitem.setProperty("LatestTitle", latest[1] or "")
- listitem.setProperty("LatestNumber", latest[0] or "")
- except: print_exc()
- try:
- airday, shortime = current_show.get("Airtime", " at " ).split(" at ")
- except: print_exc()
- if (airday == 'Monday'):
- self.monday_list.addItem(listitem)
- elif (airday == 'Tuesday'):
- self.tuesday_list.addItem(listitem)
- elif (airday == 'Wednesday'):
- self.wednesday_list.addItem(listitem)
- elif (airday == 'Thursday'):
- self.thursday_list.addItem(listitem)
- elif (airday == 'Friday'):
- self.friday_list.addItem(listitem)
- elif (airday == 'Saturday'):
- self.saturday_list.addItem(listitem)
- else:
- self.sunday_list.addItem(listitem)
- def onClick(self, controlID):
- pass
- def onFocus(self, controlID):
- pass
- def onAction( self, action ):
- #( ACTION_PARENT_DIR, ACTION_PREVIOUS_MENU, ACTION_CONTEXT_MENU, )
- if action in ( 9, 10, 92, 216, 247, 257, 275, 61467, 61448, ): self.close()
- def MyDialog(tv_list):
- w = Gui( "DialogNextAired.xml", __cwd__, "DefaultSkin" , listing=tv_list )
- w.doModal()
- del w
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement