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 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 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 createFilename(self): page = QWizardPage() label = QLabel(_("Enter the database name and location"), page) label.setWordWrap(True) button = QPushButton("", page) button.setIcon(util.getIcon("file-open.png")) button.clicked.connect(self.file_button_clicked) filename = QLineEdit(page) page.registerField("filename*", filename) overwrite = QCheckBox(_("Overwrite"), page) page.registerField("overwrite", overwrite) label1 = QLabel(_("(if unchecked and the file exists will try to use it)"), page) label1.setWordWrap(True) layout = QVBoxLayout() layout.addWidget(label) layout2 = QHBoxLayout() layout2.addWidget(filename) layout2.addWidget(button) layout.addLayout(layout2) layout.addWidget(overwrite) layout.addWidget(label1) page.setLayout(layout) return page
def menu(): shows = util.api.getShows().values() shows.sort( key=lambda show: re.sub(r'^(?i)(the)\s+', '', show['show_name'])) url = util.getActionURL('showAdd') listItem = xbmcgui.ListItem(label='Add show...', thumbnailImage=util.getIcon('showAdd')) listItem.addContextMenuItems( [('Refresh list', util.getContextCommand('refresh'))], True) xbmcplugin.addDirectoryItem(handle=util.pluginId, url=url, listitem=listItem, isFolder=False) for show in shows: url = util.getShowURL(show['tvdbid']) listItem = xbmcgui.ListItem( label=show['show_name'] + (' (Ended)' if show['status'] == 'Ended' else ''), thumbnailImage=util.api.getShowPoster(show['tvdbid'])) listItem.addContextMenuItems( [('Delete show', util.getContextCommand('showDelete', [show['tvdbid']])), (('Unpause' if show['paused'] else 'Pause') + ' show', util.getContextCommand('showPauseToggle', [show['tvdbid']])), ('Force search', util.getContextCommand('showsSearch')), ('Refresh list', util.getContextCommand('refresh'))], True) xbmcplugin.addDirectoryItem(handle=util.pluginId, url=url, listitem=listItem, isFolder=True) xbmcplugin.endOfDirectory(util.pluginId)
def menu(): shows = util.api.getShows().values() shows.sort(key = lambda show: re.sub(r'^(?i)(the)\s+', '', show['show_name'])) url = util.getActionURL('showAdd') listItem = xbmcgui.ListItem( label = 'Add show...', thumbnailImage = util.getIcon('showAdd') ) listItem.addContextMenuItems([ ('Refresh list', util.getContextCommand('refresh')) ], True) xbmcplugin.addDirectoryItem( handle = util.pluginId, url = url, listitem = listItem, isFolder = False ) for show in shows: url = util.getShowURL(show['tvdbid']) listItem = xbmcgui.ListItem( label = show['show_name'] + (' (Ended)' if show['status'] == 'Ended' else ''), thumbnailImage = util.api.getShowPoster(show['tvdbid']) ) listItem.addContextMenuItems([ ('Delete show', util.getContextCommand('showDelete', [show['tvdbid']])), (('Unpause' if show['paused'] else 'Pause') + ' show', util.getContextCommand('showPauseToggle', [show['tvdbid']])), ('Force search', util.getContextCommand('showsSearch')), ('Refresh list', util.getContextCommand('refresh')) ], True) xbmcplugin.addDirectoryItem( handle = util.pluginId, url = url, listitem = listItem, isFolder = True ) xbmcplugin.endOfDirectory(util.pluginId)
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 createFilename(self): page = QWizardPage(self) label = QLabel(_("Enter the database name and location"), page) label.setWordWrap(True) button = QPushButton("") button.setIcon(util.getIcon("file-open.png")) button.clicked.connect(self.file_button_clicked) filename = QLineEdit() page.registerField("filename*", filename) layout = QVBoxLayout() layout.addWidget(label) layout2 = QHBoxLayout() layout2.addWidget(filename) layout2.addWidget(button) layout.addLayout(layout2) page.setLayout(layout) return page