コード例 #1
0
ファイル: navigator.py プロジェクト: Koscielny83/cherry-dev
    def views(self):
        try:
            control.idle()

            items = [ (control.lang(32001).encode('utf-8'), 'movies'), (control.lang(32002).encode('utf-8'), 'tvshows'), (control.lang(32054).encode('utf-8'), 'seasons'), (control.lang(32038).encode('utf-8'), 'episodes') ]

            select = control.selectDialog([i[0] for i in items], control.lang(32049).encode('utf-8'))

            if select == -1: return

            content = items[select][1]

            title = control.lang(32059).encode('utf-8')
            url = '%s?action=addView&content=%s' % (sys.argv[0], content)

            poster, banner, fanart = control.addonPoster(), control.addonBanner(), control.addonFanart()

            item = control.item(label=title)
            item.setInfo(type='Video', infoLabels = {'title': title})
            item.setArt({'icon': poster, 'thumb': poster, 'poster': poster, 'banner': banner})
            item.setProperty('Fanart_Image', fanart)

            control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False)
            control.content(int(sys.argv[1]), content)
            control.directory(int(sys.argv[1]), cacheToDisc=True)

            from resources.lib.libraries import views
            views.setView(content, {})
        except:
            return
コード例 #2
0
ファイル: navigator.py プロジェクト: po50on/cherry-dev
 def addDirectoryItem(self,
                      name,
                      query,
                      thumb,
                      icon,
                      context=None,
                      queue=False,
                      isAction=True,
                      isFolder=True):
     try:
         name = control.lang(name).encode('utf-8')
     except:
         pass
     url = '%s?action=%s' % (sysaddon, query) if isAction == True else query
     if "http" not in thumb:
         thumb = os.path.join(artPath,
                              thumb) if not artPath == None else icon
     cm = []
     if queue == True:
         cm.append((queueMenu, 'RunPlugin(%s?action=queueItem)' % sysaddon))
     if not context == None:
         cm.append((control.lang(context[0]).encode('utf-8'),
                    'RunPlugin(%s?action=%s)' % (sysaddon, context[1])))
     item = control.item(label=name)
     item.addContextMenuItems(cm)
     item.setArt({'icon': icon, 'thumb': thumb})
     if not addonFanart == None:
         item.setProperty('Fanart_Image', addonFanart)
     control.addItem(handle=syshandle,
                     url=url,
                     listitem=item,
                     isFolder=isFolder)
コード例 #3
0
ファイル: phstreams.py プロジェクト: po50on/cherry-dev
def addCategoryItem(name, action, image, isFolder=True):
    u = '%s?action=%s' % (sys.argv[0], str(action))
    image = control.addonInfo('path') + '/resources/media/phstreams/' + image
    item = control.item(name, iconImage=image, thumbnailImage=image)
    item.addContextMenuItems([], replaceItems=False)
    item.setProperty('Fanart_Image', control.addonInfo('fanart'))
    control.addItem(handle=int(sys.argv[1]),
                    url=u,
                    listitem=item,
                    isFolder=isFolder)
コード例 #4
0
ファイル: nhlcom.py プロジェクト: po50on/cherry-dev
def addDirectoryItem(name, url, action, image, fanart, isFolder=True):
    if image == '0': image = addonIcon
    if fanart == '0': fanart = addonFanart

    u = '%s?name=%s&url=%s&image=%s&fanart=%s&action=%s' % (sys.argv[0], urllib.quote_plus(name), urllib.quote_plus(url), urllib.quote_plus(image), urllib.quote_plus(fanart), str(action))

    item = control.item(name, iconImage=image, thumbnailImage=image)
    item.setInfo(type='Video', infoLabels = {'title': name})
    item.addContextMenuItems([], replaceItems=False)
    item.setProperty('Fanart_Image', fanart)
    if not isFolder == True: item.setProperty('IsPlayable', 'true')
    control.addItem(handle=int(sys.argv[1]),url=u,listitem=item,isFolder=isFolder)
コード例 #5
0
ファイル: phstreams.py プロジェクト: po50on/cherry-dev
def addDirectoryItem(name,
                     url,
                     action,
                     image,
                     image2,
                     fanart,
                     audio,
                     content,
                     data,
                     tvshow='0',
                     totalItems=0,
                     isFolder=True):
    if not str(image).lower().startswith('http'):
        image = control.addonInfo('icon')

    if not str(image2).lower().startswith('http'):
        image2 = control.addonInfo('icon')

    if not str(fanart).lower().startswith('http'):
        fanart = control.addonInfo('fanart')

    if content in ['movies', 'episodes']: playable = 'true'
    else: playable = 'false'

    sysaddon = sys.argv[0]

    u = '%s?name=%s&url=%s&audio=%s&image=%s&fanart=%s&playable=%s&tvshow=%s&content=%s&action=%s' % (
        sysaddon, urllib.quote_plus(name), urllib.quote_plus(url),
        urllib.quote_plus(audio), urllib.quote_plus(image),
        urllib.quote_plus(fanart), urllib.quote_plus(playable), str(tvshow),
        str(content), str(action))

    cm = []

    if content in ['movies', 'tvshows']:
        data.update({
            'trailer':
            '%s?action=trailer&name=%s' % (sysaddon, urllib.quote_plus(name))
        })
        cm.append((control.lang(30707).encode('utf-8'),
                   'RunPlugin(%s?action=trailer&name=%s)' %
                   (sysaddon, urllib.quote_plus(name))))

    if not 'plot' in data:
        data.update({'plot': control.lang(30706).encode('utf-8')})

    if content == 'movies':
        cm.append((control.lang(30708).encode('utf-8'), 'XBMC.Action(Info)'))
    elif content in ['tvshows', 'seasons']:
        cm.append((control.lang(30709).encode('utf-8'), 'XBMC.Action(Info)'))
    elif content == 'episodes':
        cm.append((control.lang(30710).encode('utf-8'), 'XBMC.Action(Info)'))

    if content == 'movies' and not isFolder == True:
        downloadFile = name
        try:
            downloadFile = '%s (%s)' % (data['title'], data['year'])
        except:
            pass
        cm.append((control.lang(30722).encode('utf-8'),
                   'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' %
                   (sysaddon, urllib.quote_plus(downloadFile),
                    urllib.quote_plus(url), urllib.quote_plus(image))))

    elif content == 'episodes' and not isFolder == True:
        downloadFile = name
        try:
            downloadFile = '%s S%02dE%02d' % (
                data['tvshowtitle'], int(data['season']), int(data['episode']))
        except:
            pass
        cm.append((control.lang(30722).encode('utf-8'),
                   'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' %
                   (sysaddon, urllib.quote_plus(downloadFile),
                    urllib.quote_plus(url), urllib.quote_plus(image))))

    if content == 'movies':
        cm.append((control.lang(30711).encode('utf-8'),
                   'RunPlugin(%s?action=addView&content=movies)' % sysaddon))
    elif content == 'tvshows':
        cm.append((control.lang(30712).encode('utf-8'),
                   'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon))
    elif content == 'seasons':
        cm.append((control.lang(30713).encode('utf-8'),
                   'RunPlugin(%s?action=addView&content=seasons)' % sysaddon))
    elif content == 'episodes':
        cm.append((control.lang(30714).encode('utf-8'),
                   'RunPlugin(%s?action=addView&content=episodes)' % sysaddon))

    item = control.item(name,
                        iconImage='DefaultFolder.png',
                        thumbnailImage=image)
    try:
        item.setArt({
            'poster': image2,
            'tvshow.poster': image2,
            'season.poster': image2,
            'banner': image,
            'tvshow.banner': image,
            'season.banner': image
        })
    except:
        pass
    item.addContextMenuItems(cm, replaceItems=False)
    item.setProperty('Fanart_Image', fanart)
    if playable == 'true': item.setProperty('IsPlayable', 'true')
    item.setInfo(type='Video', infoLabels=data)

    control.addItem(handle=int(sys.argv[1]),
                    url=u,
                    listitem=item,
                    totalItems=totalItems,
                    isFolder=isFolder)
コード例 #6
0
def downloader():

    thumb = control.addonThumb()
    fanart = control.addonFanart()

    status = control.window.getProperty(property + '.status')

    if not downloadPath == '':
        item = control.item('[COLOR FF00b8ff]Downloads[/COLOR]',
                            iconImage=thumb,
                            thumbnailImage=thumb)
        item.addContextMenuItems([], replaceItems=True)
        item.setProperty('fanart_image', fanart)
        control.addItem(handle=int(sys.argv[1]),
                        url=downloadPath,
                        listitem=item,
                        isFolder=True)

    if status == 'downloading':
        item = control.item('[COLOR red]Stop Downloads[/COLOR]',
                            iconImage=thumb,
                            thumbnailImage=thumb)
        item.addContextMenuItems([], replaceItems=True)
        item.setProperty('fanart_image', fanart)
        control.addItem(handle=int(sys.argv[1]),
                        url=sys.argv[0] + '?action=stopDownload',
                        listitem=item,
                        isFolder=True)
    else:
        item = control.item('[COLOR FF00b8ff]Start Downloads[/COLOR]',
                            iconImage=thumb,
                            thumbnailImage=thumb)
        item.addContextMenuItems([], replaceItems=True)
        item.setProperty('fanart_image', fanart)
        control.addItem(handle=int(sys.argv[1]),
                        url=sys.argv[0] + '?action=startDownload',
                        listitem=item,
                        isFolder=True)

    if status == 'downloading':
        item = control.item('[COLOR gold]Download Status[/COLOR]',
                            iconImage=thumb,
                            thumbnailImage=thumb)
        item.addContextMenuItems([], replaceItems=True)
        item.setProperty('Fanart_Image', fanart)
        control.addItem(handle=int(sys.argv[1]),
                        url=sys.argv[0] + '?action=statusDownload',
                        listitem=item,
                        isFolder=True)

    def download():
        return []

    result = cache.bennu_download_get(download, 600000000, table='rel_dl')

    for i in result:
        try:
            cm = []
            cm.append(('Remove from Queue',
                       'RunPlugin(%s?action=removeDownload&url=%s)' %
                       (sys.argv[0], urllib.quote_plus(i['url']))))
            item = control.item(i['name'],
                                iconImage=i['image'],
                                thumbnailImage=i['image'])
            item.addContextMenuItems(cm, replaceItems=True)
            item.setProperty('fanart_image', fanart)
            item.setProperty('Video', 'true')
            item.setProperty('IsPlayable', 'true')
            control.addItem(handle=int(sys.argv[1]),
                            url=i['url'],
                            listitem=item)
        except:
            pass

    control.directory(int(sys.argv[1]), cacheToDisc=True)