def addShow(when, show): airs = show['airs'].split(' ') if when == 0: label = util.formatTime(airs[1], airs[2]) icon = util.getIcon('today'); elif when == 1: label = airs[0] + ' ' + util.formatTime(airs[1], airs[2]) icon = util.getIcon('soon'); elif when == 2: label = util.formatDate(show['airdate']) + ', ' + airs[0] + ' ' + util.formatTime(airs[1], airs[2]) icon = util.getIcon('later'); else: icon = None url = util.getShowURL(show['tvdbid']) listItem = xbmcgui.ListItem( label = label + ': ' + util.formatEpisodeName(show), iconImage = icon #thumbnailImage = util.api.getShowPoster(show['tvdbid']) ) listItem.addContextMenuItems([ ('Refresh list', util.getContextCommand('refresh')) ], True) xbmcplugin.addDirectoryItem( handle = util.pluginId, url = url, listitem = listItem, isFolder = True )
def menu(): history = util.api.getHistory() shows = {} for show in history: uId = str(show['tvdbid']) + '-' + str(show['season']) + '-' + str( show['episode']) if (not uId in shows) or (show['status'] == 'Downloaded'): shows[uId] = show shows = shows.values() shows.sort(key=lambda show: show['date'], reverse=True) for show in shows: url = util.getShowURL(show['tvdbid']) listItem = xbmcgui.ListItem( label=util.formatDateTime(show['date']) + ': ' + show['status'] + ' ' + util.formatEpisodeName(show), iconImage=util.getIcon('downloaded' if show['status'] == 'Downloaded' else 'snatched') #thumbnailImage = util.api.getShowPosterThumbnail(show['tvdbid']) ) listItem.addContextMenuItems( [('Refresh list', util.getContextCommand('refresh'))], True) xbmcplugin.addDirectoryItem(handle=util.pluginId, url=url, listitem=listItem, isFolder=True) xbmcplugin.endOfDirectory(util.pluginId)
def addShow(when, show): airs = show['airs'].split(' ') if when == 0: label = util.formatTime(airs[1], airs[2]) icon = util.getIcon('today') elif when == 1: label = airs[0] + ' ' + util.formatTime(airs[1], airs[2]) icon = util.getIcon('soon') elif when == 2: label = util.formatDate( show['airdate']) + ', ' + airs[0] + ' ' + util.formatTime( airs[1], airs[2]) icon = util.getIcon('later') else: icon = None url = util.getShowURL(show['tvdbid']) listItem = xbmcgui.ListItem( label=label + ': ' + util.formatEpisodeName(show), iconImage=icon #thumbnailImage = util.api.getShowPoster(show['tvdbid']) ) listItem.addContextMenuItems( [('Refresh list', util.getContextCommand('refresh'))], True) xbmcplugin.addDirectoryItem(handle=util.pluginId, url=url, listitem=listItem, isFolder=True)
def menu(): shows = util.api.getBacklog() shows.sort(key = lambda show: re.sub(r'^(?i)(the)\s+', '', show['show_name'])) for show in shows: url = util.getShowURL(show['indexerid']) for ep in show['episodes']: ep['show_name'] = show['show_name'] listItem = xbmcgui.ListItem( label = util.formatEpisodeName(ep), iconImage = util.getIcon('wanted' if ep['status'] == 3 else 'qual') ) listItem.addContextMenuItems([ ('Refresh list', util.getContextCommand('refresh')) ], True) xbmcplugin.addDirectoryItem( handle = util.pluginId, url = url, listitem = listItem, isFolder = True ) xbmcplugin.endOfDirectory(util.pluginId)
def menu(): history = util.api.getHistory() shows = {} for show in history: uId = str(show['tvdbid']) + '-' + str(show['season']) + '-' + str(show['episode']) if (not uId in shows) or (show['status'] == 'Downloaded'): shows[uId] = show shows = shows.values() shows.sort(key = lambda show: show['date'], reverse = True) for show in shows: url = util.getShowURL(show['tvdbid']) listItem = xbmcgui.ListItem( label = util.formatDateTime(show['date']) + ': ' + show['status'] + ' ' + util.formatEpisodeName(show), iconImage = util.getIcon('downloaded' if show['status'] == 'Downloaded' else 'snatched') #thumbnailImage = util.api.getShowPosterThumbnail(show['tvdbid']) ) listItem.addContextMenuItems([ ('Refresh list', util.getContextCommand('refresh')) ], True) xbmcplugin.addDirectoryItem( handle = util.pluginId, url = url, listitem = listItem, isFolder = True ) xbmcplugin.endOfDirectory(util.pluginId)