Exemple #1
0
def addCategoryItem(name, action, image, isFolder=True):
    u = sys.argv[0]+"?action="+str(action)
    image = control.addonInfo('path') + '/art/' + 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)
Exemple #2
0
 def addDirectoryItem(self, name, query, thumb, icon, 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
     thumb = os.path.join(artPath, thumb) if not artPath == None else icon
     item = control.item(name, iconImage=thumb, thumbnailImage=thumb)
     item.addContextMenuItems([], replaceItems=False)
     if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
     control.addItem(handle=int(sys.argv[1]),url=url,listitem=item,isFolder=isFolder)
Exemple #3
0
def addCategoryItem(name, action, image, isFolder=True):
    u = sys.argv[0] + "?action=" + str(action)
    image = control.addonInfo('path') + '/art/' + 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)
Exemple #4
0
    def addPlayableItem(self, name, title, year, imdb, tvdb, season, episode, show, show_alt, date, genre, meta):
        try:
            if tvdb == None: tvdb = '0'

            if show == None: content = 'movie'
            else: content = 'episode'

            self.sources = self.getSources(name, title, year, imdb, tvdb, season, episode, show, show_alt, date, genre)
            if self.sources == []: raise Exception()
            self.sources = self.sourcesFilter()

            meta = json.loads(meta)

            try: poster, banner, thumb, fanart = meta['poster'], meta['banner'], meta['thumb'], meta['fanart']
            except: poster, banner, thumb, fanart = meta['poster'], meta['poster'], meta['poster'], meta['fanart']

            if control.setting('fanart') == 'true' and not fanart == '0': pass
            else: fanart = control.addonFanart()

            sysaddon = sys.argv[0]

            for i in self.sources:
                try:
                    url, source, provider = i['url'], i['label'], i['provider']

                    sysname, sysimdb, systvdb, sysurl, syssource, sysprovider = urllib.quote_plus(name), urllib.quote_plus(imdb), urllib.quote_plus(tvdb), urllib.quote_plus(url), urllib.quote_plus(source), urllib.quote_plus(provider)

                    query = 'action=playItem&content=%s&name=%s&imdb=%s&tvdb=%s&url=%s&source=%s&provider=%s' % (content, sysname, sysimdb, systvdb, sysurl, syssource, sysprovider)

                    cm = []
                    cm.append((control.lang(30401).encode('utf-8'), 'RunPlugin(%s?action=item_queue)' % (sysaddon)))
                    cm.append((control.lang(30402).encode('utf-8'), 'RunPlugin(%s?action=download&name=%s&url=%s&provider=%s)' % (sysaddon, sysname, sysurl, sysprovider)))
                    cm.append((control.lang(30412).encode('utf-8'), 'Action(Info)'))
                    cm.append((control.lang(30427).encode('utf-8'), 'RunPlugin(%s?action=container_refresh)' % (sysaddon)))
                    cm.append((control.lang(30410).encode('utf-8'), 'RunPlugin(%s?action=settings_open)' % (sysaddon)))
                    cm.append((control.lang(30411).encode('utf-8'), 'RunPlugin(%s?action=playlist_open)' % (sysaddon)))

                    item = control.item(source, iconImage='DefaultVideo.png', thumbnailImage=thumb)
                    try: item.setArt({'poster': poster, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})
                    except: pass
                    item.setInfo(type='Video', infoLabels = meta)
                    if not fanart == None: item.setProperty('Fanart_Image', fanart)
                    item.setProperty('Video', 'true')
                    item.setProperty('IsPlayable', 'true')
                    item.addContextMenuItems(cm, replaceItems=True)
                    control.addItem(handle=int(sys.argv[1]),url='%s?%s' % (sysaddon, query),listitem=item,isFolder=False)
                except:
                    pass

            control.directory(int(sys.argv[1]), cacheToDisc=True)
        except:
            control.infoDialog(control.lang(30308).encode('utf-8'))
            pass
Exemple #5
0
def addDirectoryItem(name, url, action, image, fanart, isFolder=True):
    if image == '0': image = addonIcon
    if fanart == '0': fanart = addonFanart

    u=sys.argv[0]+"?name="+urllib.quote_plus(name)+"&url="+urllib.quote_plus(url)+"&image="+urllib.quote_plus(image)+"&fanart="+urllib.quote_plus(fanart)+"&action="+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)
Exemple #6
0
 def addDirectoryItem(self,
                      name,
                      query,
                      thumb,
                      icon,
                      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
     thumb = os.path.join(artPath, thumb) if not artPath == None else icon
     item = control.item(name, iconImage=thumb, thumbnailImage=thumb)
     item.addContextMenuItems([], replaceItems=False)
     if not addonFanart == None:
         item.setProperty('Fanart_Image', addonFanart)
     control.addItem(handle=int(sys.argv[1]),
                     url=url,
                     listitem=item,
                     isFolder=isFolder)
Exemple #7
0
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 = sysaddon + "?name=" + urllib.quote_plus(
        name
    ) + "&url=" + urllib.quote_plus(url) + "&audio=" + urllib.quote_plus(
        audio) + "&image=" + urllib.quote_plus(
            image) + "&fanart=" + urllib.quote_plus(
                fanart) + "&playable=" + urllib.quote_plus(
                    playable) + "&tvshow=" + str(tvshow) + "&content=" + str(
                        content) + "&action=" + str(action)

    cm = []

    if content in ['movies', 'tvshows']:
        data.update({
            'trailer':
            '%s?action=trailer&name=%s' % (sysaddon, urllib.quote_plus(name))
        })
        cm.append(('[COLOR gold]Watch Trailer[/COLOR]',
                   'RunPlugin(%s?action=trailer&name=%s)' %
                   (sysaddon, urllib.quote_plus(name))))

    if not 'plot' in data:
        data.update({'plot': 'Discover Great Streaming Playlists!'})

    if content == 'movies':
        cm.append(
            ('[COLOR gold]Movie Information[/COLOR]', 'XBMC.Action(Info)'))
    elif content in ['tvshows', 'seasons']:
        cm.append(
            ('[COLOR gold]TV Show Information[/COLOR]', 'XBMC.Action(Info)'))
    elif content == 'episodes':
        cm.append(
            ('[COLOR gold]Episode Information[/COLOR]', 'XBMC.Action(Info)'))

    if content == 'movies' and not isFolder == True:
        downloadFile = name
        try:
            downloadFile = '%s (%s)' % (data['title'], data['year'])
        except:
            pass
        cm.append(('[COLOR gold]Download This File[/COLOR]',
                   '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(('[COLOR gold]Download This File[/COLOR]',
                   '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(('[COLOR gold]Set Movies view[/COLOR]',
                   'RunPlugin(%s?action=addView&content=movies)' % sysaddon))
    elif content == 'tvshows':
        cm.append(('[COLOR gold]Set TV Shows view[/COLOR]',
                   'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon))
    elif content == 'seasons':
        cm.append(('[COLOR gold]Set Seasons view[/COLOR]',
                   'RunPlugin(%s?action=addView&content=seasons)' % sysaddon))
    elif content == 'episodes':
        cm.append(('[COLOR gold]Set Episodes view[/COLOR]',
                   '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)
    def addPlayableItem(self, name, title, year, imdb, tvdb, season, episode, show, show_alt, date, genre, meta):
        try:
            if tvdb == None:
                tvdb = "0"

            if show == None:
                content = "movie"
            else:
                content = "episode"

            self.sources = self.getSources(name, title, year, imdb, tvdb, season, episode, show, show_alt, date, genre)
            if self.sources == []:
                raise Exception()
            self.sources = self.sourcesFilter()

            meta = json.loads(meta)

            try:
                poster, banner, thumb, fanart = meta["poster"], meta["banner"], meta["thumb"], meta["fanart"]
            except:
                poster, banner, thumb, fanart = meta["poster"], meta["poster"], meta["poster"], meta["fanart"]

            if control.setting("fanart") == "true" and not fanart == "0":
                pass
            else:
                fanart = control.addonFanart()

            sysaddon = sys.argv[0]

            for i in self.sources:
                try:
                    url, source, provider = i["url"], i["label"], i["provider"]

                    sysname, sysimdb, systvdb, sysurl, sysimage, syssource, sysprovider = (
                        urllib.quote_plus(name),
                        urllib.quote_plus(imdb),
                        urllib.quote_plus(tvdb),
                        urllib.quote_plus(url),
                        urllib.quote_plus(poster),
                        urllib.quote_plus(source),
                        urllib.quote_plus(provider),
                    )

                    query = "action=playItem&content=%s&name=%s&imdb=%s&tvdb=%s&url=%s&source=%s&provider=%s" % (
                        content,
                        sysname,
                        sysimdb,
                        systvdb,
                        sysurl,
                        syssource,
                        sysprovider,
                    )

                    cm = []
                    cm.append((control.lang(30401).encode("utf-8"), "RunPlugin(%s?action=queueItem)" % (sysaddon)))
                    cm.append(
                        (
                            control.lang(30402).encode("utf-8"),
                            "RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s&provider=%s)"
                            % (sysaddon, sysname, sysurl, sysimage, sysprovider),
                        )
                    )
                    cm.append((control.lang(30412).encode("utf-8"), "Action(Info)"))
                    cm.append((control.lang(30427).encode("utf-8"), "RunPlugin(%s?action=refresh)" % (sysaddon)))
                    cm.append((control.lang(30410).encode("utf-8"), "RunPlugin(%s?action=openSettings)" % (sysaddon)))
                    cm.append((control.lang(30411).encode("utf-8"), "RunPlugin(%s?action=openPlaylist)" % (sysaddon)))

                    item = control.item(source, iconImage="DefaultVideo.png", thumbnailImage=thumb)
                    try:
                        item.setArt(
                            {
                                "poster": poster,
                                "tvshow.poster": poster,
                                "season.poster": poster,
                                "banner": banner,
                                "tvshow.banner": banner,
                                "season.banner": banner,
                            }
                        )
                    except:
                        pass
                    item.setInfo(type="Video", infoLabels=meta)
                    if not fanart == None:
                        item.setProperty("Fanart_Image", fanart)
                    item.setProperty("Video", "true")
                    item.setProperty("IsPlayable", "true")
                    item.addContextMenuItems(cm, replaceItems=True)
                    control.addItem(
                        handle=int(sys.argv[1]), url="%s?%s" % (sysaddon, query), listitem=item, isFolder=False
                    )
                except:
                    pass

            control.directory(int(sys.argv[1]), cacheToDisc=True)
        except:
            control.infoDialog(control.lang(30308).encode("utf-8"))
            pass
Exemple #9
0
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=sysaddon+"?name="+urllib.quote_plus(name)+"&url="+urllib.quote_plus(url)+"&audio="+urllib.quote_plus(audio)+"&image="+urllib.quote_plus(image)+"&fanart="+urllib.quote_plus(fanart)+"&playable="+urllib.quote_plus(playable)+"&tvshow="+str(tvshow)+"&content="+str(content)+"&action="+str(action)

    cm = []

    if content in ['movies', 'tvshows']:
        data.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, urllib.quote_plus(name))})
        cm.append(('[COLOR gold]Watch Trailer[/COLOR]', 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, urllib.quote_plus(name))))

    if not 'plot' in data:
        data.update({'plot': 'Discover Great Streaming Playlists!'})


    if content == 'movies':
        cm.append(('[COLOR gold]Movie Information[/COLOR]', 'XBMC.Action(Info)'))
    elif content in ['tvshows', 'seasons']:
        cm.append(('[COLOR gold]TV Show Information[/COLOR]', 'XBMC.Action(Info)'))
    elif content == 'episodes':
        cm.append(('[COLOR gold]Episode Information[/COLOR]', 'XBMC.Action(Info)'))


    if content == 'movies' and not isFolder == True:
        downloadFile = name
        try: downloadFile = '%s (%s)' % (data['title'], data['year'])
        except: pass
        cm.append(('[COLOR gold]Download This File[/COLOR]', '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(('[COLOR gold]Download This File[/COLOR]', '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(('[COLOR gold]Set Movies view[/COLOR]', 'RunPlugin(%s?action=addView&content=movies)' % sysaddon))
    elif content == 'tvshows':
        cm.append(('[COLOR gold]Set TV Shows view[/COLOR]', 'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon))
    elif content == 'seasons':
        cm.append(('[COLOR gold]Set Seasons view[/COLOR]', 'RunPlugin(%s?action=addView&content=seasons)' % sysaddon))
    elif content == 'episodes':
        cm.append(('[COLOR gold]Set Episodes view[/COLOR]', '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)