def display_jobs(**kwargs): q = build_job_query(**kwargs) header = "%-40s %16s %16s %4s [%2s %2s %2s] [%4s ] %8s %-20s %s" format = "%-40s %16s %16s %04d [%03d %03d %03d] [%04dMB] %8s %-20s %s" print header % ( "Job", "State", "User", "Pend", "Run", "Min", "Max", "RAM", "Duration", "Start Time", "End Time" ) print "-" * 160 for job in plow.client.get_jobs(**q): print format % ( util.clipText(job.name, 40), constants.JOB_STATES[job.state], job.username, job.totals.waiting + job.totals.depend, job.runCores, job.minCores, job.maxCores, job.stats.highRam, util.formatDuration(job.startTime, job.stopTime), util.formatDateTime(job.startTime), util.formatDateTime(job.stopTime) )
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 display_jobs(**kwargs): q = build_job_query(**kwargs) header = "%-40s %16s %16s %4s [%2s %2s %2s] [%4s ] %8s %-20s %s" format = "%-40s %16s %16s %04d [%03d %03d %03d] [%04dMB] %8s %-20s %s" print header % ("Job", "State", "User", "Pend", "Run", "Min", "Max", "RAM", "Duration", "Start Time", "End Time") print "-" * 160 for job in plow.client.get_jobs(**q): print format % (util.clipText( job.name, 40), constants.JOB_STATES[job.state], job.username, job.totals.waiting + job.totals.depend, job.runCores, job.minCores, job.maxCores, job.stats.highRam, util.formatDuration(job.startTime, job.stopTime), util.formatDateTime( job.startTime), util.formatDateTime(job.stopTime))