Example #1
0
def menu():
    showId = util.pluginArgs['id']
    season = int(util.pluginArgs['season'])
    episodes = util.api.getSeasons(showId, {'season': season})
    episodeNums = episodes.keys()
    episodeNums.sort(key = int)
    thumbnailImage = util.api.getShowPoster(showId)

    for episodeNum in episodeNums:
        episode = episodes[episodeNum]
        
        listItem = xbmcgui.ListItem(
            label = episodeNum + '. ' + episode['status'] + ': ' + episode['name'],
            thumbnailImage = thumbnailImage
        )
        listItem.addContextMenuItems([
            ('Set Episode Status', util.getContextCommand('episodeStatus', [showId, season, episodeNum, episode['status']])),
            ('Set Season Status', util.getContextCommand('seasonStatus', [showId, season])),
            ('Manual Search', util.getContextCommand('episodeSearch', [showId, season, episodeNum])),
            ('Refresh list', util.getContextCommand('refresh'))
        ], True)
        xbmcplugin.addDirectoryItem(
            handle = util.pluginId,
            url = None,
            listitem = listItem,
            isFolder = False
        )

    xbmcplugin.endOfDirectory(util.pluginId)        
Example #2
0
def menu():
    showId = util.pluginArgs['id']
    season = int(util.pluginArgs['season'])
    episodes = util.api.getSeasons(showId, {'season': season})
    episodeNums = episodes.keys()
    episodeNums.sort(key=int)
    thumbnailImage = util.api.getShowPoster(showId)

    for episodeNum in episodeNums:
        episode = episodes[episodeNum]

        listItem = xbmcgui.ListItem(label=episodeNum + '. ' +
                                    episode['status'] + ': ' + episode['name'],
                                    thumbnailImage=thumbnailImage)
        listItem.addContextMenuItems(
            [('Set Episode Status',
              util.getContextCommand(
                  'episodeStatus',
                  [showId, season, episodeNum, episode['status']])),
             ('Set Season Status',
              util.getContextCommand('seasonStatus', [showId, season])),
             ('Manual Search',
              util.getContextCommand('episodeSearch',
                                     [showId, season, episodeNum])),
             ('Refresh list', util.getContextCommand('refresh'))], True)
        xbmcplugin.addDirectoryItem(handle=util.pluginId,
                                    url=None,
                                    listitem=listItem,
                                    isFolder=False)

    xbmcplugin.endOfDirectory(util.pluginId)
Example #3
0
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)
Example #4
0
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)        
Example #5
0
def menu():
    showId = util.pluginArgs['id']
    seasons = util.api.getSeasonList(showId)
    seasons.sort()
    thumbnailImage = util.api.getShowPoster(showId)

    for season in seasons:
        url = util.pluginURL + '?' + urllib.urlencode({
            'vf': 'episodes',
            'id': showId,
            'season': season
        })
        listItem = xbmcgui.ListItem(
            label = ('Season ' + str(season)) if season > 0 else 'Extras',
            thumbnailImage = thumbnailImage
        )
        listItem.addContextMenuItems([
            ('Refresh list', util.getContextCommand('refresh'))
        ], True)
        xbmcplugin.addDirectoryItem(
            handle = util.pluginId,
            url = url,
            listitem = listItem,
            isFolder = True
        )

    xbmcplugin.endOfDirectory(util.pluginId)        
Example #6
0
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)
Example #7
0
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
    )
Example #8
0
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)
Example #9
0
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)        
Example #10
0
def menu():
    releases = util.api.getFailed()
    releases.sort(
        key=lambda release: re.sub(r'^(?i)(the)\s+', '', release['release']))

    for release in releases:
        listItem = xbmcgui.ListItem(label=str(release['release']))
        listItem.addContextMenuItems(
            [
                #('Delete', util.getContextCommand('failedDelete', [release['release']])),
                ('Refresh list', util.getContextCommand('refresh'))
            ],
            True)
        xbmcplugin.addDirectoryItem(handle=util.pluginId,
                                    url=None,
                                    listitem=listItem,
                                    isFolder=False)

    xbmcplugin.endOfDirectory(util.pluginId)
Example #11
0
def menu():
    releases = util.api.getFailed()
    releases.sort(key = lambda release: re.sub(r'^(?i)(the)\s+', '', release['release']))
    
    for release in releases:
        listItem = xbmcgui.ListItem(
            label = str(release['release'])
        )
        listItem.addContextMenuItems([
            #('Delete', util.getContextCommand('failedDelete', [release['release']])),
            ('Refresh list', util.getContextCommand('refresh'))
        ], True)
        xbmcplugin.addDirectoryItem(
            handle = util.pluginId,
            url = None,
            listitem = listItem,
            isFolder = False
        )

    xbmcplugin.endOfDirectory(util.pluginId)
Example #12
0
def menu():
    showId = util.pluginArgs['id']
    seasons = util.api.getSeasonList(showId)
    seasons.sort()
    thumbnailImage = util.api.getShowPoster(showId)

    for season in seasons:
        url = util.pluginURL + '?' + urllib.urlencode({
            'vf': 'episodes',
            'id': showId,
            'season': season
        })
        listItem = xbmcgui.ListItem(
            label=('Season ' + str(season)) if season > 0 else 'Extras',
            thumbnailImage=thumbnailImage)
        listItem.addContextMenuItems(
            [('Refresh list', util.getContextCommand('refresh'))], True)
        xbmcplugin.addDirectoryItem(handle=util.pluginId,
                                    url=url,
                                    listitem=listItem,
                                    isFolder=True)

    xbmcplugin.endOfDirectory(util.pluginId)
Example #13
0
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)