def addDirectory(self, items):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        addonFanart = control.addonFanart()
        addonThumb = control.addonThumb()
        artPath = control.artPath()

        for i in items:
            try:
                try: name = control.lang(i['name']).encode('utf-8')
                except: name = i['name']

                if not artPath == None: thumb = os.path.join(artPath, i['image'])
                else: thumb = addonThumb

                url = '%s?action=%s' % (sysaddon, i['action'])
                try: url += '&url=%s' % urllib.quote_plus(i['url'])
                except: pass

                item = control.item(label=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=True)
            except:
                pass

        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #2
0
    def addDirectory(self, items):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        addonFanart = control.addonFanart()
        addonThumb = control.addonThumb()
        artPath = control.artPath()

        for i in items:
            try:
                try: name = control.lang(i['name']).encode('utf-8')
                except: name = i['name']

                if i['image'].startswith('http://'): thumb = i['image']
                elif not artPath == None: thumb = os.path.join(artPath, i['image'])
                else: thumb = addonThumb

                url = '%s?action=%s' % (sysaddon, i['action'])
                try: url += '&url=%s' % urllib.quote_plus(i['url'])
                except: pass

                cm = []

                #try: cm.append((control.lang(30239).encode('utf-8'), 'RunPlugin(%s?action=tvshowsToLibrary&url=%s)' % (sysaddon, urllib.quote_plus(i['context']))))
                #except: pass

                item = control.item(label=name, iconImage=thumb, thumbnailImage=thumb)
                item.addContextMenuItems(cm, replaceItems=False)
                if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
            except:
                pass

        views.setView('tvshows', {'skin.confluence': control.viewMode['mediainfo1']})
        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #3
0
    def addDirectory(self, items):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        addonFanart = control.addonFanart()
        addonThumb = control.addonThumb()
        artPath = control.artPath()

        for i in items:
            try:
                try: name = control.lang(i['name']).encode('utf-8')
                except: name = i['name']

                if not artPath == None: thumb = os.path.join(artPath, i['image'])
                else: thumb = addonThumb

                url = '%s?action=%s' % (sysaddon, i['action'])
                try: url += '&url=%s' % urllib.quote_plus(i['url'])
                except: pass

                item = control.item(label=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=True)
            except:
                pass

        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #4
0
    def listEpisodes(self, showid, page, image):
        url = self.episodes_link % (showid)
        try: result = client.request(url)
        except: pass
        result = re.compile('(.+?)]').findall(result)[0] + ']'
        shows = json.loads(result)

        self.list.append({'name': '[UPPERCASE][COLOR orange]Try again if a show does not play![/COLOR][/UPPERCASE]', 'url': '', 'image': ''})
        # episodes per page
        for show in shows:
            if 'Not Show' == show['item_title']:
                continue
            name = show['date_added'] + ' ' + show['item_title']
            u = self.player_link % (show['media_id'], show['media_item_id'])

            self.list.append({'name': name, 'url': urllib.quote_plus(u), 'image': image})

        for episode in self.list:
            name = episode['name']
            url = episode['url']
            image = episode['image']
            action = 'sourcePage2'
            query = '?action=%s&image=%s&url=%s&name=%s' % (action, image, url, name)

            url = '%s%s' % (sysaddon, query)
            item = control.item(name, iconImage=image, thumbnailImage=image)
            if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
            item.setInfo(type="Video", infoLabels={"Title": name, "OriginalTitle": name})
            control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False)

        control.content(int(sys.argv[1]), 'movies')
        if control.skin == 'skin.confluence': control.execute('Container.SetViewMode(50)')
        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #5
0
    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
Beispiel #6
0
Datei: thai.py Projekt: mpie/repo
    def listShows(self, catid, page):
        limatch = []
        url = self.shows_link % (catid)

        try: result = client.request(url)
        except: pass

        pageContent = ''.join(result.splitlines()).replace('\'','"')
        pages = re.compile('id="a_page_(.+?)" href').findall(pageContent)

        if str(page) in pages:
            pageUrl = self.shows_ajax_link % (catid, str(page))
            result = client.request(pageUrl)
            limatch+=re.compile('<figure>(.+?)</a></li>').findall(result)

        for li_content in limatch:
            show = re.compile('<a href=".+?id=(.+?)"><img src="(.+?)" alt="(.+?)" w').findall(li_content)
            #print show
            title = show[0][2].decode('iso-8859-11')
            showid = show[0][0]
            image = show[0][1]
            self.list.append({'name': title, 'showid': showid, 'image': image})

        for show in self.list:
            name = show['name'].encode('utf-8')
            showid = show['showid']
            image = show['image']
            action = 'listEpisodes'
            query = '?action=%s&name=%s&catid=%s&showid=%s&image=%s' % (action, name, catid, showid, image)
            url = '%s%s' % (sysaddon, query)
            item = control.item(name, iconImage=image, thumbnailImage=image)
            if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
            item.setInfo(type="Video", infoLabels={"Title": name, "OriginalTitle": name})
            control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)

        nextPage = int(page) + 1
        if nextPage <= len(pages):
            if 'first' in pages:
                pages.remove('first')
            if 'pre' in pages:
                pages.remove('pre')
            if 'next' in pages:
                pages.remove('next')
            if 'last' in pages:
                pages.remove('last')

            for page in pages:
                action = 'listShows'
                pageNumber = int(page) + 1
                query = '?action=%s&page=%d&name=%s&catid=%s' % (action, int(page), 'Page ' + str(pageNumber), catid)
                url = '%s%s' % (sysaddon, query)
                item = control.item('Page ' + str(pageNumber), iconImage='', thumbnailImage='')
                if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
                item.setInfo(type="Video", infoLabels={"Title": 'Page ' + str(pageNumber), "OriginalTitle": 'Page ' + str(pageNumber)})
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)

        control.content(int(sys.argv[1]), 'movies')
        if control.skin == 'skin.confluence': control.execute('Container.SetViewMode(500)')
        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #7
0
def endDirectory(content, close):
    if content in ['movies', 'tvshows', 'seasons', 'episodes']:
        control.content(int(sys.argv[1]), content)

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

    if close == True and content in ['movies', 'tvshows', 'seasons', 'episodes']:
        views.setView(content)
Beispiel #8
0
    def channelDirectory(self, items):
        if items == None or len(items) == 0: return

        playbackMenu = control.lang(30292).encode('utf-8') if control.setting('autoplay') == 'true' else control.lang(30291).encode('utf-8')

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart = control.addonFanart()
        sysaddon = sys.argv[0]


        for i in items:
            try:
                label = "[B]%s[/B] : %s" % (i['channel'].upper(), i['name'])
                sysname = urllib.quote_plus(i['name'])
                systitle = urllib.quote_plus(i['title'])
                imdb, tmdb, year = i['imdb'], '0', i['year']

                poster, banner = i['poster'], i['poster']
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster

                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, sysname)})
                if i['duration'] == '0': meta.update({'duration': '120'})
                try: meta.update({'duration': str(int(meta['duration']) * 60)})
                except: pass
                sysmeta = urllib.quote_plus(json.dumps(meta))

                url = '%s?action=play&name=%s&title=%s&year=%s&imdb=%s&tmdb=%s&meta=%s&t=%s' % (sysaddon, sysname, systitle, year, imdb, tmdb, sysmeta, self.systime)
                sysurl = urllib.quote_plus(url)

                cm = []
                cm.append((playbackMenu, 'RunPlugin(%s?action=alterSources&url=%s&meta=%s)' % (sysaddon, sysurl, sysmeta)))
                cm.append((control.lang(30293).encode('utf-8'), 'Action(Info)'))
                cm.append((control.lang(30294).encode('utf-8'), 'RunPlugin(%s?action=refresh)' % (sysaddon)))
                cm.append((control.lang(30295).encode('utf-8'), 'RunPlugin(%s?action=openSettings)' % (sysaddon)))
                cm.append((control.lang(30296).encode('utf-8'), 'RunPlugin(%s?action=openPlaylist)' % (sysaddon)))

                item = control.item(label=label, iconImage=poster, thumbnailImage=poster)

                try: item.setArt({'poster': poster, 'banner': banner})
                except: pass

                if not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setInfo(type='Video', infoLabels = meta)
                item.setProperty('Video', 'true')
                #item.setProperty('IsPlayable', 'true')
                item.addContextMenuItems(cm, replaceItems=True)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False)
            except:
                pass

        control.content(int(sys.argv[1]), 'movies')
        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #9
0
    def channelDirectory(self, items):
        if items == None or len(items) == 0: return

        playbackMenu = control.lang(30292).encode('utf-8') if control.setting('autoplay') == 'true' else control.lang(30291).encode('utf-8')

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart = control.addonFanart()
        sysaddon = sys.argv[0]


        for i in items:
            try:
                label = "[B]%s[/B] : %s" % (i['channel'].upper(), i['name'])
                sysname = urllib.quote_plus(i['name'])
                systitle = urllib.quote_plus(i['title'])
                imdb, tmdb, year = i['imdb'], '0', i['year']

                poster, banner = i['poster'], i['poster']
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster

                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, sysname)})
                if i['duration'] == '0': meta.update({'duration': '120'})
                try: meta.update({'duration': str(int(meta['duration']) * 60)})
                except: pass
                sysmeta = urllib.quote_plus(json.dumps(meta))

                url = '%s?action=play&name=%s&title=%s&year=%s&imdb=%s&tmdb=%s&meta=%s&t=%s' % (sysaddon, sysname, systitle, year, imdb, tmdb, sysmeta, self.systime)
                sysurl = urllib.quote_plus(url)

                cm = []
                cm.append((playbackMenu, 'RunPlugin(%s?action=alterSources&url=%s&meta=%s)' % (sysaddon, sysurl, sysmeta)))
                cm.append((control.lang(30293).encode('utf-8'), 'Action(Info)'))
                cm.append((control.lang(30294).encode('utf-8'), 'RunPlugin(%s?action=refresh)' % (sysaddon)))
                cm.append((control.lang(30295).encode('utf-8'), 'RunPlugin(%s?action=openSettings)' % (sysaddon)))
                cm.append((control.lang(30296).encode('utf-8'), 'RunPlugin(%s?action=openPlaylist)' % (sysaddon)))

                item = control.item(label=label, iconImage=poster, thumbnailImage=poster)

                try: item.setArt({'poster': poster, 'banner': banner})
                except: pass

                if not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setInfo(type='Video', infoLabels = meta)
                item.setProperty('Video', 'true')
                #item.setProperty('IsPlayable', 'true')
                item.addContextMenuItems(cm, replaceItems=True)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False)
            except:
                pass

        control.content(int(sys.argv[1]), 'movies')
        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #10
0
def endDirectory(content, close):
    if content in ['movies', 'tvshows', 'seasons', 'episodes']:
        control.content(int(sys.argv[1]), content)

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

    if close == True and content in [
            'movies', 'tvshows', 'seasons', 'episodes'
    ]:
        views.setView(content)
Beispiel #11
0
    def channelDirectory(self, items):
        if items == None or len(items) == 0: return

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart = control.addonFanart()
        sysaddon = sys.argv[0]


        for i in items:
            try:
                label = "%s" % (i['name'])
                sysname = urllib.quote_plus(i['name'])

                poster, banner, direct = i['poster'], i['poster'], i['direct']
                try :provider=i['provider']
                except:provider=None
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster

                url = i['url']
                if not direct:
                    content = 'live'
                    meta = {"poster":poster, "iconImage":poster}
                    source = {"provider":provider,
                              "url":url,
                              "quality":'HD',
                              "label":'Resolving %s' % label,
                              "source":provider, "meta":json.dumps(meta)}
                    syssource = urllib.quote_plus(json.dumps([source]))

                    url = 'action=playItem&content=%s&name=%s&source=%s' % (content, sysname, syssource)
                    url = '%s?%s' % (sysaddon, url)

                item = control.item(label=label, iconImage=poster, thumbnailImage=poster)

                try: item.setArt({'poster': poster, 'banner': banner})
                except: pass

                if not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setProperty('Video', 'true')
                item.setProperty("IsPlayable", "true")
                item.addContextMenuItems([], replaceItems=True)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False)
            except:
                pass

        control.content(int(sys.argv[1]), 'video')
        control.directory(int(sys.argv[1]), cacheToDisc=False)
        views.setView('movies', {'skin.confluence': 500})
Beispiel #12
0
    def addSimpleDirectory(self, items):
        if not items: return

        sysaddon = sys.argv[0]
        handle = int(sys.argv[1])
        thumb = control.addonThumb()
        for i in items:
            query = i['title']
            url = '%s?action=tvSearch&query=%s' % (sysaddon, urllib.quote_plus(query))
            item = control.item(label=query, iconImage=thumb, thumbnailImage=thumb)
            control.addItem(handle=handle, url=url, listitem=item, isFolder=True)

        control.directory(handle, cacheToDisc=True)
Beispiel #13
0
    def listBollywood(self, url, page):
        try:
            html = client.request(url + 'page/' + str(page))
        except:
            pass

        result = client.parseDOM(html, 'article', attrs={'id': 'posts'})
        result = [(client.parseDOM(i, 'a', ret='href'),
                   client.parseDOM(i, 'img',
                                   ret='src'), client.parseDOM(i, 'a'))
                  for i in result]
        result = [(i[0][0], i[1][0], i[2][1]) for i in result
                  if len(i[0]) > 0 and len(i[1]) > 0 and len(i[2][1]) > 0]

        for movie in result:
            uri = movie[0]
            image = movie[1]
            name = movie[2]
            action = 'resolveBollywoodUrl'
            query = '%s?action=%s&name=%s&url=%s&image=%s' % (sysaddon, action,
                                                              name, uri, image)
            item = control.item(name, iconImage=image, thumbnailImage=image)
            item.setInfo(type="Video",
                         infoLabels={
                             "Title": name,
                             "OriginalTitle": name
                         })
            control.addItem(handle=int(sys.argv[1]),
                            url=query,
                            listitem=item,
                            isFolder=True)

        pageNum = int(page) + 1
        query = '%s?action=%s&url=%s&page=%s' % (sysaddon, 'listBollywood',
                                                 url, pageNum)
        print query
        item = control.item('Next page', iconImage='', thumbnailImage='')
        item.setInfo(type="Video",
                     infoLabels={
                         "Title": 'Page ' + str(page),
                         "OriginalTitle": 'Page ' + str(page)
                     })
        control.addItem(handle=int(sys.argv[1]),
                        url=query,
                        listitem=item,
                        isFolder=True)

        control.content(int(sys.argv[1]), 'movies')
        if control.skin == 'skin.confluence':
            control.execute('Container.SetViewMode(500)')
        control.directory(int(sys.argv[1]), cacheToDisc=True)
def getSearch():
    addDirectoryItem('%s...' % control.lang(30702).encode('utf-8'), '0', 'searchDirectory', '0', '0', '0', '0', '0', {})
    addDirectoryItem(control.lang(30703).encode('utf-8'), '0', 'clearSearch', '0', '0', '0', '0', '0', {})

    try:
        def search(): return
        result = cache.get(search, 600000000, table='rel_srch')
        for q in result:
                try: addDirectoryItem('%s...' % q, q, 'searchDirectory2', '0', '0', '0', '0', '0', {})
                except: pass
    except:
        pass

    control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #15
0
def getSearch():
    addDirectoryItem('Search...', '0', 'searchDirectory', '0', '0', '0', '0', '0', {})
    addDirectoryItem('Clear History', '0', 'clearSearch', '0', '0', '0', '0', '0', {})

    try:
        def search(): return
        result = cache.get(search, 600000000, table='rel_srch')
        for q in result:
                try: addDirectoryItem('%s...' % q, q, 'searchDirectory2', '0', '0', '0', '0', '0', {})
                except: pass
    except:
        pass

    control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #16
0
Datei: thai.py Projekt: mpie/repo
    def listEpisodes(self, catid, showid, page, image):
        url = self.episodes_link % (page, showid)
        try: result = client.request(url)
        except: pass
        link = ''.join(result.splitlines()).replace('\'','"')
        link = ''.join(link.splitlines()).replace('<i class="icon-new"></i>','')

        episodematch = re.compile('<table class="program-archive">(.+?)</table>').findall(link)
        episodes = re.compile('<a href="(.+?)" >(.+?)</a>.+?</td>\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t<a href="(.+?)" ><img').findall(episodematch[0])

        programMeta = re.compile('<div class="program-meta">(.+?)</div>').findall(link)
        image = re.compile('<img src="(.+?)" alt').findall(programMeta[0])[0]

        # episodes per page
        for episode in episodes:
            name = episode[1].decode('iso-8859-11')
            u = 'http://www.seesantv.com/seesantv_2014/' + episode[0] + '&bitrate=high'
            self.list.append({'name': name, 'url': urllib.quote_plus(u), 'image': image})

        for episode in self.list:
            name = episode['name'].encode('utf-8')
            url = episode['url']
            image = episode['image']
            action = 'sourcePage'
            query = '?action=%s&image=%s&url=%s&name=%s' % (action, image, url, urllib.quote_plus(name))

            url = '%s%s' % (sysaddon, query)
            item = control.item(name, iconImage=image, thumbnailImage=image)
            if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
            item.setInfo(type="Video", infoLabels={"Title": name, "OriginalTitle": name})
            control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False)

        # Pagination
        paginator = re.compile('<div class="page_list"  align="center">(.+?)</ul>').findall(link)[0]
        pages = re.compile('>(\d+)</a>').findall(paginator)
        nextPage = int(page) + 1
        if nextPage < len(pages):
            action = 'listEpisodes'
            query = '?action=%s&page=%d&name=%s&catid=%s&showid=%s&image=%s' % (action, nextPage, 'Next Page', catid, showid, image)
            url = '%s%s' % (sysaddon, query)
            item = control.item('Next Page', iconImage=image, thumbnailImage=image)
            if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
            item.setInfo(type="Video", infoLabels={"Title": 'Next Page', "OriginalTitle": 'Next Page'})
            control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)

        control.content(int(sys.argv[1]), 'movies')
        if control.skin == 'skin.confluence': control.execute('Container.SetViewMode(50)')
        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #17
0
    def addDirectory(self, items):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        addonFanart = control.addonFanart()
        addonThumb = control.addonThumb()
        artPath = control.artPath()

        for i in items:
            try:
                try:
                    name = control.lang(i['name']).encode('utf-8')
                except:
                    name = i['name']

                if i['image'].startswith('http://'): thumb = i['image']
                elif not artPath == None:
                    thumb = os.path.join(artPath, i['image'])
                else:
                    thumb = addonThumb

                url = '%s?action=%s' % (sysaddon, i['action'])
                try:
                    url += '&url=%s' % urllib.quote_plus(i['url'])
                except:
                    pass

                cm = []

                #try: cm.append((control.lang(30239).encode('utf-8'), 'RunPlugin(%s?action=tvshowsToLibrary&url=%s)' % (sysaddon, urllib.quote_plus(i['context']))))
                #except: pass

                item = control.item(label=name,
                                    iconImage=thumb,
                                    thumbnailImage=thumb)
                item.addContextMenuItems(cm, replaceItems=False)
                if not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)
                control.addItem(handle=int(sys.argv[1]),
                                url=url,
                                listitem=item,
                                isFolder=True)
            except:
                pass

        views.setView('tvshows',
                      {'skin.confluence': control.viewMode['mediainfo1']})
        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #18
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]+'?mode=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]+'?mode=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]+'?mode=statusDownload', listitem=item, isFolder=True)

    def download(): return []
    result = cache.get(download, 600000000, table='rel_dl')

    for i in result:
        try:
            cm = []
            cm.append(('Remove from Queue', 'RunPlugin(%s?mode=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)
Beispiel #19
0
    def listShows(self, catid, page, limit, channel):
        url = self.shows_link % (page, limit, channel, catid)
        try: result = client.request(url)
        except: pass

        data = json.loads(result)
        paginationInfo = data['pagination']
        shows = data['data']

        for show in shows:
            title = show['media_title']
            showid = show['media_id']
            image = self.cdn % (show['image_file'])
            self.list.append({'name': title, 'showid': showid, 'image': image})

        for show in self.list:
            name = show['name']
            showid = show['showid']
            image = show['image']
            action = 'listEpisodes2'
            query = '?action=%s&name=%s&showid=%s&image=%s&page=1' % (action, name, showid, image)
            url = '%s%s' % (sysaddon, query)
            item = control.item(name, iconImage=image, thumbnailImage=image)
            if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
            item.setInfo(type="Video", infoLabels={"Title": name, "OriginalTitle": name})
            control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)

        nextPage = int(page) + 1
        if nextPage <= paginationInfo['totalPages']:
            for page in range(1, paginationInfo['totalPages']):
                action = 'listShows2'
                query = '?action=%s&page=%d&name=%s&catid=%s&limit=%s&channel=%s' % (action, page, 'Page ' + str(page), catid, limit, channel)
                url = '%s%s' % (sysaddon, query)
                item = control.item('Page ' + str(page), iconImage='', thumbnailImage='')
                if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
                item.setInfo(type="Video", infoLabels={"Title": 'Page ' + str(page), "OriginalTitle": 'Page ' + str(page)})
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)

        control.content(int(sys.argv[1]), 'movies')
        if control.skin == 'skin.confluence': control.execute('Container.SetViewMode(500)')
        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #20
0
def getSearch():
    addDirectoryItem('Search...', '0', 'searchDirectory', '0', '0', '0', '0',
                     '0', {})
    addDirectoryItem('Clear History', '0', 'clearSearch', '0', '0', '0', '0',
                     '0', {})

    try:

        def search():
            return

        result = cache.get(search, 600000000, table='rel_srch')
        for q in result:
            try:
                addDirectoryItem('%s...' % q, q, 'searchDirectory2', '0', '0',
                                 '0', '0', '0', {})
            except:
                pass
    except:
        pass

    control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #21
0
def getSearch():
    addDirectoryItem('%s...' % control.lang(30702).encode('utf-8'), '0',
                     'searchDirectory', '0', '0', '0', '0', '0', {})
    addDirectoryItem(
        control.lang(30703).encode('utf-8'), '0', 'clearSearch', '0', '0', '0',
        '0', '0', {})

    try:

        def search():
            return

        result = cache.get(search, 600000000, table='rel_srch')
        for q in result:
            try:
                addDirectoryItem('%s...' % q, q, 'searchDirectory2', '0', '0',
                                 '0', '0', '0', {})
            except:
                pass
    except:
        pass

    control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #22
0
    def channelDirectory(self, items):
        if items == None or len(items) == 0: return

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart = control.addonFanart()
        sysaddon = sys.argv[0]


        for i in items:
            try:
                label = "%s" % (i['name'])
                sysname = urllib.quote_plus(i['name'])

                poster, banner = i['poster'], i['poster']
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster

                url = i['url']

                item = control.item(label=label, iconImage=poster, thumbnailImage=poster)

                try: item.setArt({'poster': poster, 'banner': banner})
                except: pass

                if not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setProperty('Video', 'true')
                item.addContextMenuItems([], replaceItems=True)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False)
            except:
                pass

        control.content(int(sys.argv[1]), 'video')
        control.directory(int(sys.argv[1]), cacheToDisc=False)
        views.setView('movies', {'skin.confluence': 500})
Beispiel #23
0
    def episodeDirectory(self, items, provider=None):
        if items == None or len(items) == 0: return

        isFolder = True if control.setting('autoplay') == 'false' and control.setting('host_select') == '1' else False
        isFolder = False if control.window.getProperty('PseudoTVRunning') == 'True' else isFolder

        playbackMenu = control.lang(30271).encode('utf-8') if control.setting('autoplay') == 'true' else control.lang(30270).encode('utf-8')

        cacheToDisc = False

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart, settingFanart = control.addonFanart(), control.setting('fanart')
        sysaddon = sys.argv[0]

        try: multi = [i['tvshowtitle'] for i in items]
        except: multi = []
        multi = len([x for y,x in enumerate(multi) if x not in multi[:y]])
        multi = True if multi > 1 else False

        try: sysaction = items[0]['action']
        except: sysaction = ''

        for i in items:
            try:
                try :
                    if i['title'] == '0':
                        label = '%sx%02d . %s %s' % (i['season'], int(i['episode']), 'Episode', i['episode'])
                    else:
                        label = '%sx%02d . %s' % (i['season'], int(i['episode']), i['title'])
                except:
                    label = i['title']
                if multi == True:
                    label = '%s - %s' % (i['tvshowtitle'], label)

                systitle = sysname = urllib.quote_plus(i['tvshowtitle'])
                episodetitle, episodename = urllib.quote_plus(i['title']), urllib.quote_plus(i['name'])
                syspremiered = urllib.quote_plus(i['premiered'])
                imdb, tmdb, tvdb, tvrage, year, season, episode, alter = i['imdb'], i['tmdb'], i['tvdb'], i['tvrage'], i['year'], i['season'], i['episode'], i['alter']

                poster, banner, fanart, thumb = i['poster'], i['banner'], i['fanart'], i['thumb']
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster
                if thumb == '0' and fanart == '0': thumb = addonFanart
                elif thumb == '0': thumb = fanart

                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, sysname)})
                if i['duration'] == '0': meta.update({'duration': '60'})
                try: meta.update({'duration': str(int(meta['duration']) * 60)})
                except: pass
                sysmeta = urllib.quote_plus(json.dumps(meta))

                url = '%s?action=play&name=%s&title=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s&season=%s&episode=%s&tvshowtitle=%s&alter=%s&date=%s&meta=%s&t=%s' % (sysaddon, episodename, episodetitle, year, imdb, tmdb, tvdb, tvrage, season, episode, systitle, alter, syspremiered, sysmeta, self.systime)
                sysurl = urllib.quote_plus(url)

                if isFolder == True:
                    url = '%s?action=sources&name=%s&title=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s&season=%s&episode=%s&tvshowtitle=%s&alter=%s&date=%s&meta=%s&provider=%s' % (sysaddon, episodename, episodetitle, year, imdb, tmdb, tvdb, tvrage, season, episode, systitle, alter, syspremiered, sysmeta, provider)

                if sysaction == 'episodes':
                    url = '%s?action=episodes&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s&season=%s&episode=%s' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage, season, episode)
                    isFolder = True ; cacheToDisc = True

                cm = []

                cm.append((playbackMenu, 'RunPlugin(%s?action=alterSources&url=%s&meta=%s)' % (sysaddon, sysurl, sysmeta)))

                if isFolder == False:
                    cm.append((control.lang(30261).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon))

                cm.append((control.lang(30272).encode('utf-8'), 'Action(Info)'))

                if multi == True:
                    cm.append((control.lang(30274).encode('utf-8'), 'ActivateWindow(Videos,%s?action=seasons&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s,return)' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage)))

                cm.append((control.lang(30263).encode('utf-8'), 'RunPlugin(%s?action=episodePlaycount&imdb=%s&tvdb=%s&season=%s&episode=%s&query=7)' % (sysaddon, imdb, tvdb, season, episode)))
                cm.append((control.lang(30264).encode('utf-8'), 'RunPlugin(%s?action=episodePlaycount&imdb=%s&tvdb=%s&season=%s&episode=%s&query=6)' % (sysaddon, imdb, tvdb, season, episode)))

                #cm.append((control.lang(30268).encode('utf-8'), 'RunPlugin(%s?action=tvshowToLibrary&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s)' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage)))

                cm.append((control.lang(30273).encode('utf-8'), 'RunPlugin(%s?action=addView&content=episodes)' % sysaddon))

                item = control.item(label=label, iconImage=thumb, thumbnailImage=thumb)

                try: item.setArt({'poster': poster, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})
                except: pass

                if settingFanart == 'true' and not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setInfo(type='Video', infoLabels = meta)
                item.setProperty('Video', 'true')
                #item.setProperty('IsPlayable', 'true')
                item.setProperty('resumetime',str(0))
                item.setProperty('totaltime',str(1))
                item.addContextMenuItems(cm, replaceItems=True)

                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=isFolder)
            except:
                pass

        try:
            url = items[0]['next']
            if url == '': raise Exception()
            url = '%s?action=episodes&tvshowtitle=%s&url=%s&provider=%s' % (sysaddon, systitle, urllib.quote_plus(url), provider)
            addonNext = control.addonNext()
            item = control.item(label=control.lang(30213).encode('utf-8'), iconImage=addonNext, thumbnailImage=addonNext)
            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=True)
        except:
            pass

        control.content(int(sys.argv[1]), 'episodes')
        control.directory(int(sys.argv[1]), cacheToDisc=cacheToDisc)
        views.setView('episodes', {'skin.confluence': 504})
Beispiel #24
0
    def addDirectory(self, items, content=None):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        sysicon = os.path.join(control.addonInfo('path'), 'resources', 'media')
        sysimage = control.addonInfo('icon')
        sysfanart = control.addonInfo('fanart')

        for i in items:
            try:
                try: label = control.lang(i['title']).encode('utf-8')
                except: label = i['title']

                if 'image' in i and not i['image'] == '0': image = i['image']
                elif 'icon' in i and not i['icon'] == '0': image = os.path.join(sysicon, i['icon'])
                else: image = sysimage

                fanart = i['fanart'] if 'fanart' in i and not i['fanart'] == '0' else sysfanart

                isFolder = False if 'isFolder' in i and not i['isFolder'] == '0' else True

                url = '%s?action=%s' % (sysaddon, i['action'])

                try: url += '&url=%s' % urllib.quote_plus(i['url'])
                except: pass
                try: url += '&tvshowtitle=%s' % urllib.quote_plus(i['tvshowtitle'])
                except: pass
                try: url += '&title=%s' % urllib.quote_plus(i['title'])
                except: pass
                try: url += '&image=%s' % urllib.quote_plus(i['image'])
                except: pass
                try: url += '&fanart=%s' % urllib.quote_plus(i['fanart'])
                except: pass

                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                try: meta.update({'duration': str(int(meta['duration']) * 60)})
                except: pass

                item = control.item(label=label, iconImage=image, thumbnailImage=image)

                try: item.setArt({'poster': image, 'tvshow.poster': image, 'season.poster': image, 'banner': image, 'tvshow.banner': image, 'season.banner': image})
                except: pass

                item.setProperty('Fanart_Image', fanart)

                item.addContextMenuItems([])
                item.setInfo(type='Video', infoLabels = meta)
                if isFolder == False: item.setProperty('IsPlayable', 'true')
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=isFolder)
            except:
                pass

        try:
            i = items[0]
            if i['next'] == '': raise Exception()
            url = '%s?action=%s&url=%s' % (sysaddon, i['nextaction'], urllib.quote_plus(i['next']))
            icon = i['nexticon'] if 'nexticon' in i else os.path.join(sysicon, 'next.png')
            fanart = i['nextfanart'] if 'nextfanart' in i else sysfanart
            item = control.item(label=control.lang(30500).encode('utf-8'), iconImage=icon, thumbnailImage=icon)
            item.setProperty('Fanart_Image', fanart)
            control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
        except:
            pass

        if not content == None: control.content(int(sys.argv[1]), content)
        #control.do_block_check(False)
        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #25
0
    def addItem(self, name, title, year, imdb, tmdb, tvdb, tvrage, season,
                episode, tvshowtitle, alter, date, meta):
        try:
            if imdb == '0': imdb = '0000000'
            imdb = 'tt' + re.sub('[^0-9]', '', str(imdb))

            content = 'movie' if tvshowtitle == None else 'episode'

            self.sources = self.getSources(name, title, year, imdb, tmdb, tvdb,
                                           tvrage, season, episode,
                                           tvshowtitle, alter, date)
            if self.sources == []: raise Exception()
            self.sources = self.sourcesFilter()

            meta = json.loads(meta)

            infoMenu = control.lang(30502).encode(
                'utf-8') if content == 'movie' else control.lang(30503).encode(
                    'utf-8')

            poster = meta['poster'] if 'poster' in meta else '0'
            banner = meta['banner'] if 'banner' in meta else '0'
            thumb = meta['thumb'] if 'thumb' in meta else poster
            fanart = meta['fanart'] if 'fanart' in meta else '0'

            if poster == '0': poster = control.addonPoster()
            if banner == '0' and poster == '0': banner = control.addonBanner()
            elif banner == '0': banner = poster
            if thumb == '0' and fanart == '0': thumb = control.addonFanart()
            elif thumb == '0': thumb = 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, label, provider = i['url'], i['label'], i['provider']

                    sysname, sysurl, sysimage, sysprovider = urllib.quote_plus(
                        name), urllib.quote_plus(url), urllib.quote_plus(
                            poster), urllib.quote_plus(provider)

                    syssource = urllib.quote_plus(json.dumps([i]))

                    query = 'action=playItem&content=%s&name=%s&imdb=%s&tvdb=%s&source=%s' % (
                        content, sysname, imdb, tvdb, syssource)

                    cm = []
                    cm.append((control.lang(30504).encode('utf-8'),
                               'RunPlugin(%s?action=queueItem)' % sysaddon))
                    cm.append((
                        control.lang(30505).encode('utf-8'),
                        'RunPlugin(%s?action=download&name=%s&image=%s&url=%s&provider=%s)'
                        % (sysaddon, sysname, sysimage, sysurl, sysprovider)))
                    cm.append((infoMenu, 'Action(Info)'))
                    cm.append((control.lang(30506).encode('utf-8'),
                               'RunPlugin(%s?action=refresh)' % sysaddon))
                    cm.append((control.lang(30507).encode('utf-8'),
                               'RunPlugin(%s?action=openSettings)' % sysaddon))
                    cm.append((control.lang(30508).encode('utf-8'),
                               'RunPlugin(%s?action=openPlaylist)' % sysaddon))

                    item = control.item(label=label,
                                        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(30501).encode('utf-8'))
            pass
def episodeCategory():
    control.content(int(sys.argv[1]), "episodes")
    control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #27
0
    def seasonDirectory(self, items):
        if items == None or len(items) == 0: return

        isFolder = True if control.setting('autoplay') == 'false' and control.setting('host_select') == '1' else False
        isFolder = False if control.window.getProperty('PseudoTVRunning') == 'True' else isFolder

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart, settingFanart = control.addonFanart(), control.setting('fanart')
        sysaddon = sys.argv[0]

        for i in items:
            try:
                label = '%s %s' % ('Season', i['season'])
                systitle = sysname = urllib.quote_plus(i['tvshowtitle'])
                imdb, tmdb, tvdb, tvrage, year, season = i['imdb'], i['tmdb'], i['tvdb'], i['tvrage'], i['year'], i['season']

                poster, banner, fanart, thumb = i['poster'], i['banner'], i['fanart'], i['thumb']
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster
                if thumb == '0' and poster == '0': thumb = addonPoster
                elif thumb == '0': thumb = poster

                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, sysname)})
                if i['duration'] == '0': meta.update({'duration': '60'})
                try: meta.update({'duration': str(int(meta['duration']) * 60)})
                except: pass
                sysmeta = urllib.quote_plus(json.dumps(meta))


                url = '%s?action=episodes&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s&season=%s' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage, season)


                cm = []

                if isFolder == False:
                    cm.append((control.lang(30261).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon))

                cm.append((control.lang(30262).encode('utf-8'), 'Action(Info)'))

                cm.append((control.lang(30263).encode('utf-8'), 'RunPlugin(%s?action=tvPlaycount&name=%s&year=%s&imdb=%s&tvdb=%s&season=%s&query=7)' % (sysaddon, systitle, year, imdb, tvdb, season)))
                cm.append((control.lang(30264).encode('utf-8'), 'RunPlugin(%s?action=tvPlaycount&name=%s&year=%s&imdb=%s&tvdb=%s&season=%s&query=6)' % (sysaddon, systitle, year, imdb, tvdb, season)))

                #cm.append((control.lang(30267).encode('utf-8'), 'RunPlugin(%s?action=deleteFavourite&meta=%s&content=tvshows)' % (sysaddon, sysmeta)))

                #cm.append((control.lang(30268).encode('utf-8'), 'RunPlugin(%s?action=tvshowToLibrary&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s)' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage)))

                cm.append((control.lang(30269).encode('utf-8'), 'RunPlugin(%s?action=addView&content=seasons)' % sysaddon))


                item = control.item(label=label, iconImage=thumb, thumbnailImage=thumb)

                try: item.setArt({'poster': thumb, 'tvshow.poster': poster, 'season.poster': thumb, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})
                except: pass

                if settingFanart == 'true' and not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setInfo(type='Video', infoLabels = meta)
                item.setProperty('Video', 'true')
                item.addContextMenuItems(cm, replaceItems=True)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
            except:
                pass


        try: control.property(int(sys.argv[1]), 'showplot', items[0]['plot'])
        except: pass

        control.content(int(sys.argv[1]), 'seasons')
        control.directory(int(sys.argv[1]), cacheToDisc=True)
        views.setView('seasons', {'skin.confluence': 500})
Beispiel #28
0
    def channelDirectory(self, items):
        if items == None or len(items) == 0:
            return

        playbackMenu = (
            control.lang(30292).encode("utf-8")
            if control.setting("autoplay") == "true"
            else control.lang(30291).encode("utf-8")
        )

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart = control.addonFanart()
        sysaddon = sys.argv[0]

        for i in items:
            try:
                label = "[B]%s[/B] : %s" % (i["channel"].upper(), i["name"])
                sysname = urllib.quote_plus(i["name"])
                systitle = urllib.quote_plus(i["title"])
                imdb, tmdb, year = i["imdb"], "0", i["year"]

                poster, banner = i["poster"], i["poster"]
                if poster == "0":
                    poster = addonPoster
                if banner == "0" and poster == "0":
                    banner = addonBanner
                elif banner == "0":
                    banner = poster

                meta = dict((k, v) for k, v in i.iteritems() if not v == "0")
                meta.update({"trailer": "%s?action=trailer&name=%s" % (sysaddon, sysname)})
                if i["duration"] == "0":
                    meta.update({"duration": "120"})
                try:
                    meta.update({"duration": str(int(meta["duration"]) * 60)})
                except:
                    pass
                sysmeta = urllib.quote_plus(json.dumps(meta))

                url = "%s?action=play&name=%s&title=%s&year=%s&imdb=%s&tmdb=%s&t=%s" % (
                    sysaddon,
                    sysname,
                    systitle,
                    year,
                    imdb,
                    tmdb,
                    self.systime,
                )
                sysurl = urllib.quote_plus(url)

                cm = []
                cm.append(
                    (playbackMenu, "RunPlugin(%s?action=alterSources&url=%s&meta=%s)" % (sysaddon, sysurl, sysmeta))
                )
                cm.append((control.lang(30293).encode("utf-8"), "Action(Info)"))
                cm.append((control.lang(30294).encode("utf-8"), "RunPlugin(%s?action=refresh)" % (sysaddon)))
                cm.append((control.lang(30295).encode("utf-8"), "RunPlugin(%s?action=openSettings)" % (sysaddon)))
                cm.append((control.lang(30296).encode("utf-8"), "RunPlugin(%s?action=openPlaylist)" % (sysaddon)))

                item = control.item(label=label, iconImage=poster, thumbnailImage=poster)

                try:
                    item.setArt({"poster": poster, "banner": banner})
                except:
                    pass

                if not addonFanart == None:
                    item.setProperty("Fanart_Image", addonFanart)

                item.setInfo(type="Video", infoLabels=meta)
                item.setProperty("Video", "true")
                item.setProperty("IsPlayable", "true")
                item.addContextMenuItems(cm, replaceItems=True)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False)
            except:
                pass

        control.content(int(sys.argv[1]), "movies")
        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #29
0
    def addItem(self, name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta):
        try:
            imdb = "tt" + re.sub("[^0-9]", "", str(imdb))

            content = "movie" if tvshowtitle == None else "episode"

            self.sources = self.getSources(
                name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date
            )
            if self.sources == []:
                raise Exception()
            self.sources = self.sourcesFilter()

            meta = json.loads(meta)

            infoMenu = (
                control.lang(30502).encode("utf-8") if content == "movie" else control.lang(30503).encode("utf-8")
            )

            poster = meta["poster"] if "poster" in meta else "0"
            banner = meta["banner"] if "banner" in meta else "0"
            thumb = meta["thumb"] if "thumb" in meta else poster
            fanart = meta["fanart"] if "fanart" in meta else "0"

            if poster == "0":
                poster = control.addonPoster()
            if banner == "0" and poster == "0":
                banner = control.addonBanner()
            elif banner == "0":
                banner = poster
            if thumb == "0" and fanart == "0":
                thumb = control.addonFanart()
            elif thumb == "0":
                thumb = 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, sysurl, sysimage, syssource, sysprovider = (
                        urllib.quote_plus(name),
                        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,
                        imdb,
                        tvdb,
                        sysurl,
                        syssource,
                        sysprovider,
                    )

                    cm = []
                    cm.append((control.lang(30504).encode("utf-8"), "RunPlugin(%s?action=queueItem)" % sysaddon))
                    # cm.append((control.lang(30505).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s&provider=%s)' % (sysaddon, sysname, sysurl, sysimage, sysprovider)))
                    cm.append((infoMenu, "Action(Info)"))
                    cm.append((control.lang(30506).encode("utf-8"), "RunPlugin(%s?action=refresh)" % sysaddon))
                    cm.append((control.lang(30507).encode("utf-8"), "RunPlugin(%s?action=openSettings)" % sysaddon))
                    cm.append((control.lang(30508).encode("utf-8"), "RunPlugin(%s?action=openPlaylist)" % sysaddon))

                    item = control.item(label=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(30501).encode("utf-8"))
            pass
Beispiel #30
0
    def tvshowDirectory(self, items):
        if items == None or len(items) == 0: return

        isFolder = True if control.setting('autoplay') == 'false' and control.setting('host_select') == '1' else False
        isFolder = False if control.window.getProperty('PseudoTVRunning') == 'True' else isFolder

        traktMode = False if trakt.getTraktCredentials() == False else True

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart, settingFanart = control.addonFanart(), control.setting('fanart')
        sysaddon = sys.argv[0]

        try:
            favitems = favourites.getFavourites('tvshows')
            favitems = [i[0] for i in favitems]
        except:
            pass

        try:
            if traktMode == False: raise Exception()
            indicators = trakt.syncTVShows(timeout=720)
            indicators = json.loads(indicators)
        except:
            pass


        for i in items:
            try:
                label = i['name']
                systitle = sysname = urllib.quote_plus(i['title'])
                sysimage = urllib.quote_plus(i['poster'])
                imdb, tmdb, tvdb, tvrage, year = i['imdb'], i['tmdb'], i['tvdb'], i['tvrage'], i['year']

                poster, banner, fanart = i['poster'], i['banner'], i['fanart']
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster


                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, sysname)})
                if i['duration'] == '0': meta.update({'duration': '60'})
                try: meta.update({'duration': str(int(meta['duration']) * 60)})
                except: pass
                sysmeta = urllib.quote_plus(json.dumps(meta))


                url = '%s?action=seasons&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage)

                try:
                    if traktMode == False: raise Exception()
                    match = [i for i in indicators if str(i['show']['ids']['tvdb']) == tvdb][0]
                    num_1 = 0
                    for i in range(0, len(match['seasons'])): num_1 += len(match['seasons'][i]['episodes'])
                    num_2 = int(match['show']['aired_episodes'])
                    if num_1 >= num_2: meta.update({'playcount': 1, 'overlay': 7})
                except:
                    pass


                cm = []

                if isFolder == False:
                    cm.append((control.lang(30232).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon))

                cm.append((control.lang(30233).encode('utf-8'), 'Action(Info)'))

                if not action == 'tvSearch':
                    cm.append((control.lang(30234).encode('utf-8'), 'RunPlugin(%s?action=tvPlaycount&name=%s&year=%s&imdb=%s&tvdb=%s&query=7)' % (sysaddon, systitle, year, imdb, tvdb)))
                    cm.append((control.lang(30235).encode('utf-8'), 'RunPlugin(%s?action=tvPlaycount&name=%s&year=%s&imdb=%s&tvdb=%s&query=6)' % (sysaddon, systitle, year, imdb, tvdb)))

                if traktMode == True:
                    cm.append((control.lang(30236).encode('utf-8'), 'RunPlugin(%s?action=traktManager&name=%s&tvdb=%s&content=tvshow)' % (sysaddon, sysname, tvdb)))

                if action == 'tvFavourites':
                    cm.append((control.lang(30238).encode('utf-8'), 'RunPlugin(%s?action=deleteFavourite&meta=%s&content=tvshows)' % (sysaddon, sysmeta)))
                elif action.startswith('tvSearch'):
                    cm.append((control.lang(30237).encode('utf-8'), 'RunPlugin(%s?action=addFavourite&meta=%s&query=0&content=tvshows)' % (sysaddon, sysmeta)))
                else:
                    if not imdb in favitems and not tvdb in favitems: cm.append((control.lang(30237).encode('utf-8'), 'RunPlugin(%s?action=addFavourite&meta=%s&content=tvshows)' % (sysaddon, sysmeta)))
                    else: cm.append((control.lang(30238).encode('utf-8'), 'RunPlugin(%s?action=deleteFavourite&meta=%s&content=tvshows)' % (sysaddon, sysmeta)))

                cm.append((control.lang(30239).encode('utf-8'), 'RunPlugin(%s?action=tvshowToLibrary&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s)' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage)))

                cm.append((control.lang(30240).encode('utf-8'), 'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon))


                item = control.item(label=label, iconImage=poster, thumbnailImage=poster)

                try: item.setArt({'poster': poster, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})
                except: pass

                if settingFanart == 'true' and not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setInfo(type='Video', infoLabels = meta)
                item.setProperty('Video', 'true')
                item.addContextMenuItems(cm, replaceItems=True)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
            except:
                pass

        try:
            url = items[0]['next']
            if url == '': raise Exception()
            url = '%s?action=tvshows&url=%s' % (sysaddon, urllib.quote_plus(url))
            addonNext = control.addonNext()
            item = control.item(label=control.lang(30241).encode('utf-8'), iconImage=addonNext, thumbnailImage=addonNext)
            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=True)
        except:
            pass


        control.content(int(sys.argv[1]), 'tvshows')
        control.directory(int(sys.argv[1]), cacheToDisc=True)
        views.setView('tvshows', {'skin.confluence': 500})
Beispiel #31
0
 def endDirectory(self, cacheToDisc=True):
     views.setView('movies',
                   {'skin.confluence': control.viewMode['thumbnails']})
     control.directory(int(sys.argv[1]), cacheToDisc=cacheToDisc)
Beispiel #32
0
    def tvshowDirectory(self, items):
        if items == None or len(items) == 0: return

        isFolder = True if control.setting(
            'autoplay') == 'false' and control.setting(
                'host_select') == '1' else False
        isFolder = False if control.window.getProperty(
            'PseudoTVRunning') == 'True' else isFolder

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart, settingFanart = control.addonFanart(), control.setting(
            'fanart')
        sysaddon = sys.argv[0]

        for i in items:
            try:
                label = i['name']
                systitle = sysname = urllib.quote_plus(i['title'])
                sysimage = urllib.quote_plus(i['poster'])
                imdb, tmdb, tvdb, tvrage, year = i['imdb'], i['tmdb'], i[
                    'tvdb'], i['tvrage'], i['year']
                try:
                    sysurl, sysprovider = urllib.quote_plus(
                        i['url']), i['provider']
                except:
                    pass

                poster, banner, fanart = i['poster'], i['banner'], i['fanart']
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster

                meta = dict((k, v) for k, v in i.iteritems() if not v == '0')
                meta.update({
                    'trailer':
                    '%s?action=trailer&name=%s' % (sysaddon, sysname)
                })
                if i['duration'] == '0': meta.update({'duration': '60'})
                try:
                    meta.update({'duration': str(int(meta['duration']) * 60)})
                except:
                    pass
                sysmeta = urllib.quote_plus(json.dumps(meta))

                action = 'episodes'
                #if not (tvdb == '0' or tvdb == 'None'):
                #    action = 'seasons'
                url = '%s?action=%s&provider=%s&url=%s&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s' % (
                    sysaddon, action, sysprovider, sysurl, systitle, year,
                    imdb, tmdb, tvdb, tvrage)

                cm = []

                if isFolder == False:
                    cm.append((control.lang(30232).encode('utf-8'),
                               'RunPlugin(%s?action=queueItem)' % sysaddon))

                #cm.append((control.lang(30214).encode('utf-8'), 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, sysname)))
                cm.append(
                    (control.lang(30233).encode('utf-8'), 'Action(Info)'))

                if not action == 'tvSearch':
                    cm.append((control.lang(30234).encode(
                        'utf-8'
                    ), 'RunPlugin(%s?action=tvPlaycount&name=%s&year=%s&imdb=%s&tvdb=%s&query=7)'
                               % (sysaddon, systitle, year, imdb, tvdb)))
                    cm.append((control.lang(30235).encode(
                        'utf-8'
                    ), 'RunPlugin(%s?action=tvPlaycount&name=%s&year=%s&imdb=%s&tvdb=%s&query=6)'
                               % (sysaddon, systitle, year, imdb, tvdb)))

                #if action == 'tvFavourites':
                #    cm.append((control.lang(30238).encode('utf-8'), 'RunPlugin(%s?action=deleteFavourite&meta=%s&content=tvshows)' % (sysaddon, sysmeta)))
                #elif action.startswith('tvSearch'):
                #    cm.append((control.lang(30237).encode('utf-8'), 'RunPlugin(%s?action=addFavourite&meta=%s&query=0&content=tvshows)' % (sysaddon, sysmeta)))

                #cm.append((control.lang(30239).encode('utf-8'), 'RunPlugin(%s?action=tvshowToLibrary&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s)' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage)))

                cm.append((control.lang(30240).encode('utf-8'),
                           'RunPlugin(%s?action=addView&content=tvshows)' %
                           sysaddon))

                item = control.item(label=label,
                                    iconImage=poster,
                                    thumbnailImage=poster)

                try:
                    item.setArt({
                        'poster': poster,
                        'tvshow.poster': poster,
                        'season.poster': poster,
                        'banner': banner,
                        'tvshow.banner': banner,
                        'season.banner': banner
                    })
                except:
                    pass

                if settingFanart == 'true' and not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setInfo(type='Video', infoLabels=meta)
                item.setProperty('Video', 'true')
                item.addContextMenuItems(cm, replaceItems=True)
                control.addItem(handle=int(sys.argv[1]),
                                url=url,
                                listitem=item,
                                isFolder=True)
            except:
                pass

        control.content(int(sys.argv[1]), 'tvshows')
        views.setView('tvshows',
                      {'skin.confluence': control.viewMode['mediainfo1']})
        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #33
0
def searchDirectory(query=None):
    if (query == None or query == ''):
        keyboard = control.keyboard('', control.lang(30702).encode('utf-8'))
        keyboard.doModal()
        if not (keyboard.isConfirmed()): return
        query = keyboard.getText()

    if (query == None or query == ''): return

    def search():
        return [query]

    result = cache.get(search, 600000000, table='rel_srch')

    def search():
        return [
            x for y, x in enumerate((result + [query]))
            if x not in (result + [query])[:y]
        ]

    result = cache.get(search, 0, table='rel_srch')

    global global_search
    global_search = []

    def worker(url):
        global_search.append(str(client.request(url)))

    servers = client.request(phLink)
    servers = str(servers).replace('\n', '')
    servers = re.findall('</name><link>(.+?)</link>', servers)
    servers = [urlparse.urlparse(i).netloc for i in servers]
    servers = [phSearch % i for i in servers if not 'mecca' in i]

    threads = []
    for server in servers:
        threads.append(workers.Thread(worker, server))
    [i.start() for i in threads]
    [i.join() for i in threads]

    urls = global_search
    global_search = []
    urls = [str(i).replace('\n', '') for i in urls]
    urls = [re.findall('<link>(.+?)</link>', i)[:30] for i in urls]
    urls = sum(urls, [])

    threads = []
    for url in urls:
        threads.append(workers.Thread(worker, url))
    [i.start() for i in threads]
    [i.join() for i in threads]

    links = global_search
    global_search = []

    for link in links:
        try:
            link = str(link).replace('\r', '').replace('\n', '').replace(
                '\t', '').replace('&nbsp;', '')

            try:
                fanart = re.findall('<fanart>(.+?)</fanart>', link)[0]
            except:
                fanart = '0'

            try:
                vip = re.findall('<poster>(.+?)</poster>', link)[0]
            except:
                vip = ''

            if vip == 'Team Phoenix': vip = ''

            try:
                content = re.findall('<meta>(.+?)</meta>', link)[0]
            except:
                content = '0'

            try:
                tvshow = re.findall('<tvshow>(.+?)</tvshow>', link)[0]
            except:
                tvshow = '0'

            if content in ['seasons', 'episodes'] and tvshow == '0':
                content = '0'

            dirs = re.compile('<dir>(.+?)</dir>').findall(link)

            for dir in dirs:
                try:
                    data = {}

                    name = re.findall('<name>(.+?)</name>', dir)[0]
                    name = cleantitle(name)

                    if not query.lower() in name.lower(): raise Exception()

                    url = re.findall('<link>(.+?)</link>', dir)[0]

                    try:
                        image = re.findall('<thumbnail>(.+?)</thumbnail>',
                                           dir)[0]
                    except:
                        image = '0'

                    try:
                        fanart2 = re.findall('<fanart>(.+?)</fanart>', dir)[0]
                    except:
                        fanart2 = fanart

                    if content == 'tvshows':
                        try:
                            title = cleantitle(name).encode('utf-8')
                            data = {'title': title, 'tvshowtitle': title}
                        except:
                            pass

                    if re.search('[a-zA-Z]', vip):
                        name += ' [COLOR orange]%s[/COLOR]' % vip

                    addDirectoryItem(name, url, 'ndmode', image, image,
                                     fanart2, '0', content, data)
                except:
                    pass

            items = re.compile('<item>(.+?)</item>').findall(link)

            for item in items:
                try:

                    data = {}

                    name = re.findall('<title>(.+?)</title>', item)[0]
                    name = cleantitle(name)

                    if not query.lower() in name.lower(): raise Exception()

                    url = re.findall('<link>(.+?)</link>', item)[0]

                    try:
                        image = re.findall('<thumbnail>(.+?)</thumbnail>',
                                           item)[0]
                    except:
                        image = '0'

                    try:
                        fanart2 = re.findall('<fanart>(.+?)</fanart>', item)[0]
                    except:
                        fanart2 = fanart

                    if content == 'movies':
                        try:
                            title = cleantitle(name).encode('utf-8')
                            data = {'title': title}

                            title, year = re.compile(
                                '(.+?)[(](\d{4})[)]').findall(name)[0]
                            title = cleantitle(title).encode('utf-8')
                            data = {'title': title, 'year': year}
                        except:
                            pass

                    if re.search('[a-zA-Z]', vip):
                        name += ' [COLOR orange]%s[/COLOR]' % vip

                    if 'sublink' in url:
                        addDirectoryItem(name,
                                         url,
                                         'subDirectory',
                                         image,
                                         image,
                                         fanart2,
                                         '0',
                                         content,
                                         data,
                                         isFolder=True)
                    else:
                        addDirectoryItem(name,
                                         url,
                                         'resolveUrl',
                                         image,
                                         image,
                                         fanart2,
                                         '0',
                                         content,
                                         data,
                                         isFolder=False)
                except:
                    pass
        except:
            pass

    control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #34
0
def subDirectory(name, url, audio, image, fanart, playable, tvshow, content):
    match = re.compile('<sublink>(.+?)</sublink>').findall(url)
    if len(match) == 0: return

    try:
        title = cleantitle(name).encode('utf-8')
        data = {'title': title}
    except:
        pass

    try:
        if not content == 'movies': raise Exception()

        title = cleantitle(name).encode('utf-8')
        data = {'title': title}

        title, year = re.compile('(.+?)[(](\d{4})[)]').findall(name)[0]
        title = cleantitle(title).encode('utf-8')
        data = {'title': title, 'year': year}

        from metahandler import metahandlers
        metaget = metahandlers.MetaData(preparezip=False)

        #data = metaget.get_meta('movie', title, year=year)
        data = cachemeta.get(metaget.get_meta, 24, 'movie', title, '', '',
                             year)

        metaimage = data['cover_url']
        if not metaimage == '': image = metaimage
        metafanart = data['backdrop_url']
        if not metafanart == '': fanart = metafanart
    except:
        pass

    try:
        if tvshow == '0' and not content == 'episodes': raise Exception()

        try:
            title = cleantitle(name).encode('utf-8')
            data = {'title': title, 'tvshowtitle': tvshow}
        except:
            pass
        try:
            i = cleaneptitle(tvshow, title)
            title, season, episode = i[0].encode('utf-8'), i[1], i[2]
            data = {
                'title': title,
                'tvshowtitle': tvshow,
                'season': season,
                'episode': episode
            }
        except:
            pass

        from metahandler import metahandlers
        metaget = metahandlers.MetaData(preparezip=False)
        tvd = metaget.get_meta('tvshow', tvshow)
        tvd = cachemeta.get(metaget.get_meta, 24, 'tvshow', tvshow, '', '', '')

        data.update({
            'year': tvd['year'],
            'imdb_id': tvd['imdb_id'],
            'tvdb_id': tvd['tvdb_id'],
            'tvshowtitle': tvd['TVShowTitle'],
            'genre': tvd['genre'],
            'studio': tvd['studio'],
            'status': tvd['status'],
            'duration': tvd['duration'],
            'rating': tvd['rating'],
            'mpaa': tvd['mpaa'],
            'plot': tvd['plot'],
            'cast': tvd['cast']
        })

        metafanart = tvd['backdrop_url']
        if not metafanart == '': image = fanart = metafanart
    except:
        pass

    for i in range(0, len(match)):
        url = match[i]
        label = '%s %s %s' % (name, control.lang(30704).encode('utf-8'),
                              str(i + 1))
        addDirectoryItem(label,
                         url,
                         'resolveUrl',
                         image,
                         image,
                         fanart,
                         '0',
                         content,
                         data,
                         isFolder=False)

    control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #35
0
    def channelDirectory(self, items):
        if items == None or len(items) == 0: return

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart = control.addonFanart()
        sysaddon = sys.argv[0]

        for i in items:
            try:
                label = "%s" % (i['name'])
                sysname = urllib.quote_plus(i['name'])

                poster, banner, direct = i['poster'], i['poster'], i['direct']
                try:
                    provider = i['provider']
                except:
                    provider = None
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster

                url = i['url']
                if not direct:
                    content = 'live'
                    meta = {"poster": poster, "iconImage": poster}
                    source = {
                        "provider": provider,
                        "url": url,
                        "quality": 'HD',
                        "label": 'Resolving %s' % label,
                        "source": provider,
                        "meta": json.dumps(meta)
                    }
                    syssource = urllib.quote_plus(json.dumps([source]))

                    url = 'action=playItem&content=%s&name=%s&source=%s' % (
                        content, sysname, syssource)
                    url = '%s?%s' % (sysaddon, url)

                item = control.item(label=label,
                                    iconImage=poster,
                                    thumbnailImage=poster)

                try:
                    item.setArt({'poster': poster, 'banner': banner})
                except:
                    pass

                if not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setProperty('Video', 'true')
                item.setProperty("IsPlayable", "true")
                item.addContextMenuItems([], replaceItems=True)
                control.addItem(handle=int(sys.argv[1]),
                                url=url,
                                listitem=item,
                                isFolder=False)
            except:
                pass

        control.content(int(sys.argv[1]), 'video')
        control.directory(int(sys.argv[1]), cacheToDisc=False)
        views.setView('movies', {'skin.confluence': 500})
Beispiel #36
0
    def tvshowDirectory(self, items):
        if items == None or len(items) == 0: return

        isFolder = True if control.setting('autoplay') == 'false' and control.setting('host_select') == '1' else False
        isFolder = False if control.window.getProperty('PseudoTVRunning') == 'True' else isFolder

        traktMode = False if trakt.getTraktCredentials() == False else True

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart, settingFanart = control.addonFanart(), control.setting('fanart')
        sysaddon = sys.argv[0]

        try:
            favitems = favourites.getFavourites('tvshows')
            favitems = [i[0] for i in favitems]
        except:
            pass

        try:
            if traktMode == False: raise Exception()
            indicators = trakt.syncTVShows(timeout=720)
            indicators = json.loads(indicators)
        except:
            pass


        for i in items:
            try:
                label = i['name']
                systitle = sysname = urllib.quote_plus(i['title'])
                sysimage = urllib.quote_plus(i['poster'])
                imdb, tmdb, tvdb, tvrage, year = i['imdb'], i['tmdb'], i['tvdb'], i['tvrage'], i['year']

                poster, banner, fanart = i['poster'], i['banner'], i['fanart']
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster


                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, sysname)})
                if i['duration'] == '0': meta.update({'duration': '60'})
                try: meta.update({'duration': str(int(meta['duration']) * 60)})
                except: pass
                sysmeta = urllib.quote_plus(json.dumps(meta))


                url = '%s?action=seasons&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage)

                try:
                    if traktMode == False: raise Exception()
                    match = [i for i in indicators if str(i['show']['ids']['tvdb']) == tvdb][0]
                    num_1 = 0
                    for i in range(0, len(match['seasons'])): num_1 += len(match['seasons'][i]['episodes'])
                    num_2 = int(match['show']['aired_episodes'])
                    if num_1 >= num_2: meta.update({'playcount': 1, 'overlay': 7})
                except:
                    pass


                cm = []

                if isFolder == False:
                    cm.append((control.lang(30232).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon))

                cm.append((control.lang(30233).encode('utf-8'), 'Action(Info)'))

                if not action == 'tvSearch':
                    cm.append((control.lang(30234).encode('utf-8'), 'RunPlugin(%s?action=tvPlaycount&name=%s&year=%s&imdb=%s&tvdb=%s&query=7)' % (sysaddon, systitle, year, imdb, tvdb)))
                    cm.append((control.lang(30235).encode('utf-8'), 'RunPlugin(%s?action=tvPlaycount&name=%s&year=%s&imdb=%s&tvdb=%s&query=6)' % (sysaddon, systitle, year, imdb, tvdb)))

                if traktMode == True:
                    cm.append((control.lang(30236).encode('utf-8'), 'RunPlugin(%s?action=traktManager&name=%s&tvdb=%s&content=tvshow)' % (sysaddon, sysname, tvdb)))

                if action == 'tvFavourites':
                    cm.append((control.lang(30238).encode('utf-8'), 'RunPlugin(%s?action=deleteFavourite&meta=%s&content=tvshows)' % (sysaddon, sysmeta)))
                elif action.startswith('tvSearch'):
                    cm.append((control.lang(30237).encode('utf-8'), 'RunPlugin(%s?action=addFavourite&meta=%s&query=0&content=tvshows)' % (sysaddon, sysmeta)))
                else:
                    if not imdb in favitems: cm.append((control.lang(30237).encode('utf-8'), 'RunPlugin(%s?action=addFavourite&meta=%s&content=tvshows)' % (sysaddon, sysmeta)))
                    else: cm.append((control.lang(30238).encode('utf-8'), 'RunPlugin(%s?action=deleteFavourite&meta=%s&content=tvshows)' % (sysaddon, sysmeta)))

                cm.append((control.lang(30239).encode('utf-8'), 'RunPlugin(%s?action=tvshowToLibrary&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s)' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage)))

                cm.append((control.lang(30240).encode('utf-8'), 'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon))


                item = control.item(label=label, iconImage=poster, thumbnailImage=poster)

                try: item.setArt({'poster': poster, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})
                except: pass

                if settingFanart == 'true' and not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setInfo(type='Video', infoLabels = meta)
                item.setProperty('Video', 'true')
                item.addContextMenuItems(cm, replaceItems=True)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
            except:
                pass

        try:
            url = items[0]['next']
            if url == '': raise Exception()
            url = '%s?action=tvshows&url=%s' % (sysaddon, urllib.quote_plus(url))
            addonNext = control.addonNext()
            item = control.item(label=control.lang(30241).encode('utf-8'), iconImage=addonNext, thumbnailImage=addonNext)
            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=True)
        except:
            pass


        control.content(int(sys.argv[1]), 'tvshows')
        control.directory(int(sys.argv[1]), cacheToDisc=True)
        views.setView('tvshows', {'skin.confluence': 500})
Beispiel #37
0
    def tvshowDirectory(self, items):
        if items == None or len(items) == 0: return

        isFolder = True if control.setting('autoplay') == 'false' and control.setting('host_select') == '1' else False
        isFolder = False if control.window.getProperty('PseudoTVRunning') == 'True' else isFolder

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart, settingFanart = control.addonFanart(), control.setting('fanart')
        sysaddon = sys.argv[0]

        for i in items:
            try:
                label = i['name']
                systitle = sysname = urllib.quote_plus(i['title'])
                sysimage = urllib.quote_plus(i['poster'])
                imdb, tmdb, tvdb, tvrage, year = i['imdb'], i['tmdb'], i['tvdb'], i['tvrage'], i['year']
                try :sysurl, sysprovider = urllib.quote_plus(i['url']), i['provider']
                except:pass

                poster, banner, fanart = i['poster'], i['banner'], i['fanart']
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster




                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, sysname)})
                if i['duration'] == '0': meta.update({'duration': '60'})
                try: meta.update({'duration': str(int(meta['duration']) * 60)})
                except: pass
                sysmeta = urllib.quote_plus(json.dumps(meta))

                action = 'episodes'
                #if not (tvdb == '0' or tvdb == 'None'):
                #    action = 'seasons'
                url = '%s?action=%s&provider=%s&url=%s&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s' % (sysaddon, action, sysprovider, sysurl, systitle, year, imdb, tmdb, tvdb, tvrage)

                cm = []

                if isFolder == False:
                    cm.append((control.lang(30232).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon))

                #cm.append((control.lang(30214).encode('utf-8'), 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, sysname)))
                cm.append((control.lang(30233).encode('utf-8'), 'Action(Info)'))

                if not action == 'tvSearch':
                    cm.append((control.lang(30234).encode('utf-8'), 'RunPlugin(%s?action=tvPlaycount&name=%s&year=%s&imdb=%s&tvdb=%s&query=7)' % (sysaddon, systitle, year, imdb, tvdb)))
                    cm.append((control.lang(30235).encode('utf-8'), 'RunPlugin(%s?action=tvPlaycount&name=%s&year=%s&imdb=%s&tvdb=%s&query=6)' % (sysaddon, systitle, year, imdb, tvdb)))

                #if action == 'tvFavourites':
                #    cm.append((control.lang(30238).encode('utf-8'), 'RunPlugin(%s?action=deleteFavourite&meta=%s&content=tvshows)' % (sysaddon, sysmeta)))
                #elif action.startswith('tvSearch'):
                #    cm.append((control.lang(30237).encode('utf-8'), 'RunPlugin(%s?action=addFavourite&meta=%s&query=0&content=tvshows)' % (sysaddon, sysmeta)))

                #cm.append((control.lang(30239).encode('utf-8'), 'RunPlugin(%s?action=tvshowToLibrary&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s)' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage)))


                cm.append((control.lang(30240).encode('utf-8'), 'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon))


                item = control.item(label=label, iconImage=poster, thumbnailImage=poster)

                try: item.setArt({'poster': poster, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})
                except: pass

                if settingFanart == 'true' and not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setInfo(type='Video', infoLabels = meta)
                item.setProperty('Video', 'true')
                item.addContextMenuItems(cm, replaceItems=True)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
            except:
                pass

        control.content(int(sys.argv[1]), 'tvshows')
        views.setView('tvshows', {'skin.confluence': control.viewMode['mediainfo1']})
        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #38
0
def endCategory():
    if control.skin == 'skin.confluence':
        control.execute('Container.SetViewMode(500)')
    control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #39
0
    def listShows(self, catid, page):
        limatch = []
        url = self.shows_link % (catid)

        try:
            result = client.request(url)
        except:
            pass

        pageContent = ''.join(result.splitlines()).replace('\'', '"')
        pages = re.compile('id="a_page_(.+?)" href').findall(pageContent)

        if str(page) in pages:
            pageUrl = self.shows_ajax_link % (catid, str(page))
            result = client.request(pageUrl)
            limatch += re.compile('<figure>(.+?)</a></li>').findall(result)

        for li_content in limatch:
            show = re.compile(
                '<a href=".+?id=(.+?)"><img src="(.+?)" alt="(.+?)" w'
            ).findall(li_content)
            #print show
            title = show[0][2].decode('iso-8859-11')
            showid = show[0][0]
            image = show[0][1]
            self.list.append({'name': title, 'showid': showid, 'image': image})

        for show in self.list:
            name = show['name'].encode('utf-8')
            showid = show['showid']
            image = show['image']
            action = 'listEpisodes'
            query = '?action=%s&name=%s&catid=%s&showid=%s&image=%s' % (
                action, name, catid, showid, image)
            url = '%s%s' % (sysaddon, query)
            item = control.item(name, iconImage=image, thumbnailImage=image)
            if not addonFanart == None:
                item.setProperty('Fanart_Image', addonFanart)
            item.setInfo(type="Video",
                         infoLabels={
                             "Title": name,
                             "OriginalTitle": name
                         })
            control.addItem(handle=int(sys.argv[1]),
                            url=url,
                            listitem=item,
                            isFolder=True)

        nextPage = int(page) + 1
        if nextPage <= len(pages):
            if 'first' in pages:
                pages.remove('first')
            if 'pre' in pages:
                pages.remove('pre')
            if 'next' in pages:
                pages.remove('next')
            if 'last' in pages:
                pages.remove('last')

            for page in pages:
                action = 'listShows'
                pageNumber = int(page) + 1
                query = '?action=%s&page=%d&name=%s&catid=%s' % (
                    action, int(page), 'Page ' + str(pageNumber), catid)
                url = '%s%s' % (sysaddon, query)
                item = control.item('Page ' + str(pageNumber),
                                    iconImage='',
                                    thumbnailImage='')
                if not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)
                item.setInfo(type="Video",
                             infoLabels={
                                 "Title": 'Page ' + str(pageNumber),
                                 "OriginalTitle": 'Page ' + str(pageNumber)
                             })
                control.addItem(handle=int(sys.argv[1]),
                                url=url,
                                listitem=item,
                                isFolder=True)

        control.content(int(sys.argv[1]), 'movies')
        if control.skin == 'skin.confluence':
            control.execute('Container.SetViewMode(500)')
        control.directory(int(sys.argv[1]), cacheToDisc=True)
def endDirectory():
    control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #41
0
    def listEpisodes(self, catid, showid, page, image):
        url = self.episodes_link % (page, showid)
        try:
            result = client.request(url)
        except:
            pass
        link = ''.join(result.splitlines()).replace('\'', '"')
        link = ''.join(link.splitlines()).replace('<i class="icon-new"></i>',
                                                  '')

        episodematch = re.compile(
            '<table class="program-archive">(.+?)</table>').findall(link)
        episodes = re.compile(
            '<a href="(.+?)" >(.+?)</a>.+?</td>\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t<a href="(.+?)" ><img'
        ).findall(episodematch[0])

        programMeta = re.compile(
            '<div class="program-meta">(.+?)</div>').findall(link)
        image = re.compile('<img src="(.+?)" alt').findall(programMeta[0])[0]

        # episodes per page
        for episode in episodes:
            name = episode[1].decode('iso-8859-11')
            u = 'http://www.seesantv.com/seesantv_2014/' + episode[
                0] + '&bitrate=high'
            self.list.append({
                'name': name,
                'url': urllib.quote_plus(u),
                'image': image
            })

        for episode in self.list:
            name = episode['name'].encode('utf-8')
            url = episode['url']
            image = episode['image']
            action = 'sourcePage'
            query = '?action=%s&image=%s&url=%s&name=%s' % (
                action, image, url, urllib.quote_plus(name))

            url = '%s%s' % (sysaddon, query)
            item = control.item(name, iconImage=image, thumbnailImage=image)
            if not addonFanart == None:
                item.setProperty('Fanart_Image', addonFanart)
            item.setInfo(type="Video",
                         infoLabels={
                             "Title": name,
                             "OriginalTitle": name
                         })
            control.addItem(handle=int(sys.argv[1]),
                            url=url,
                            listitem=item,
                            isFolder=False)

        # Pagination
        paginator = re.compile(
            '<div class="page_list"  align="center">(.+?)</ul>').findall(
                link)[0]
        pages = re.compile('>(\d+)</a>').findall(paginator)
        nextPage = int(page) + 1
        if nextPage < len(pages):
            action = 'listEpisodes'
            query = '?action=%s&page=%d&name=%s&catid=%s&showid=%s&image=%s' % (
                action, nextPage, 'Next Page', catid, showid, image)
            url = '%s%s' % (sysaddon, query)
            item = control.item('Next Page',
                                iconImage=image,
                                thumbnailImage=image)
            if not addonFanart == None:
                item.setProperty('Fanart_Image', addonFanart)
            item.setInfo(type="Video",
                         infoLabels={
                             "Title": 'Next Page',
                             "OriginalTitle": 'Next Page'
                         })
            control.addItem(handle=int(sys.argv[1]),
                            url=url,
                            listitem=item,
                            isFolder=True)

        control.content(int(sys.argv[1]), 'movies')
        if control.skin == 'skin.confluence':
            control.execute('Container.SetViewMode(50)')
        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #42
0
    def episodeDirectory(self, items, provider=None):
        if items == None or len(items) == 0: return

        isFolder = True if control.setting('autoplay') == 'false' and control.setting('host_select') == '1' else False
        isFolder = False if control.window.getProperty('PseudoTVRunning') == 'True' else isFolder

        playbackMenu = control.lang(30271).encode('utf-8') if control.setting('autoplay') == 'true' else control.lang(30270).encode('utf-8')

        cacheToDisc = False

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart, settingFanart = control.addonFanart(), control.setting('fanart')
        sysaddon = sys.argv[0]

        try: multi = [i['tvshowtitle'] for i in items]
        except: multi = []
        multi = len([x for y,x in enumerate(multi) if x not in multi[:y]])
        multi = True if multi > 1 else False


        try: sysaction = items[0]['action']
        except: sysaction = ''

        for i in items:
            try:
                try :
                    if i['title'] == '0':
                        label = '%sx%02d . %s %s' % (i['season'], int(i['episode']), 'Episode', i['episode'])
                    else:
                        label = '%sx%02d . %s' % (i['season'], int(i['episode']), i['title'])
                except:
                    label = i['title']
                if multi == True:
                    label = '%s - %s' % (i['tvshowtitle'], label)

                systitle = sysname = urllib.quote_plus(i['tvshowtitle'])
                episodetitle, episodename = urllib.quote_plus(i['title']), urllib.quote_plus(i['name'])
                syspremiered = urllib.quote_plus(i['premiered'])
                imdb, tmdb, tvdb, tvrage, year, season, episode, alter = i['imdb'], i['tmdb'], i['tvdb'], i['tvrage'], i['year'], i['season'], i['episode'], i['alter']

                poster, banner, fanart, thumb = i['poster'], i['banner'], i['fanart'], i['thumb']
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster
                if thumb == '0' and fanart == '0': thumb = addonFanart
                elif thumb == '0': thumb = fanart

                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, sysname)})
                if i['duration'] == '0': meta.update({'duration': '60'})
                try: meta.update({'duration': str(int(meta['duration']) * 60)})
                except: pass
                sysmeta = urllib.quote_plus(json.dumps(meta))

                url = '%s?action=play&name=%s&title=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s&season=%s&episode=%s&tvshowtitle=%s&alter=%s&date=%s&meta=%s&t=%s' % (sysaddon, episodename, episodetitle, year, imdb, tmdb, tvdb, tvrage, season, episode, systitle, alter, syspremiered, sysmeta, self.systime)
                sysurl = urllib.quote_plus(url)

                if isFolder == True:
                    url = '%s?action=sources&name=%s&title=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s&season=%s&episode=%s&tvshowtitle=%s&alter=%s&date=%s&meta=%s&provider=%s' % (sysaddon, episodename, episodetitle, year, imdb, tmdb, tvdb, tvrage, season, episode, systitle, alter, syspremiered, sysmeta, provider)

                if sysaction == 'episodes':
                    url = '%s?action=episodes&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s&season=%s&episode=%s' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage, season, episode)
                    isFolder = True ; cacheToDisc = True

                cm = []

                cm.append((playbackMenu, 'RunPlugin(%s?action=alterSources&url=%s&meta=%s)' % (sysaddon, sysurl, sysmeta)))

                if isFolder == False:
                    cm.append((control.lang(30261).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon))

                cm.append((control.lang(30272).encode('utf-8'), 'Action(Info)'))

                if multi == True:
                    cm.append((control.lang(30274).encode('utf-8'), 'ActivateWindow(Videos,%s?action=seasons&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s,return)' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage)))

                cm.append((control.lang(30263).encode('utf-8'), 'RunPlugin(%s?action=episodePlaycount&imdb=%s&tvdb=%s&season=%s&episode=%s&query=7)' % (sysaddon, imdb, tvdb, season, episode)))
                cm.append((control.lang(30264).encode('utf-8'), 'RunPlugin(%s?action=episodePlaycount&imdb=%s&tvdb=%s&season=%s&episode=%s&query=6)' % (sysaddon, imdb, tvdb, season, episode)))

                #cm.append((control.lang(30268).encode('utf-8'), 'RunPlugin(%s?action=tvshowToLibrary&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s)' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage)))

                cm.append((control.lang(30273).encode('utf-8'), 'RunPlugin(%s?action=addView&content=episodes)' % sysaddon))

                item = control.item(label=label, iconImage=thumb, thumbnailImage=thumb)

                try: item.setArt({'poster': poster, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})
                except: pass

                if settingFanart == 'true' and not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setInfo(type='Video', infoLabels = meta)
                item.setProperty('Video', 'true')
                #item.setProperty('IsPlayable', 'true')
                item.setProperty('resumetime',str(0))
                item.setProperty('totaltime',str(1))
                item.addContextMenuItems(cm, replaceItems=True)

                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=isFolder)
            except:
                client.printException('episodeDirectory')
                pass

        try:
            url = items[0]['next']
            if url == '': raise Exception()
            url = '%s?action=episodes&tvshowtitle=%s&url=%s&provider=%s' % (sysaddon, systitle, urllib.quote_plus(url), provider)
            addonNext = control.addonNext()
            item = control.item(label=control.lang(30213).encode('utf-8'), iconImage=addonNext, thumbnailImage=addonNext)
            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=True)
        except:
            client.printException('movies.movieDirectory(provider=%s, item=next)' % (provider))
            pass

        control.content(int(sys.argv[1]), 'episodes')
        control.directory(int(sys.argv[1]), cacheToDisc=cacheToDisc)
        views.setView('episodes', {'skin.confluence': 504})
Beispiel #43
0
    def addItem(self, name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta):
        try:
            if imdb == '0': imdb = '0000000'
            imdb = 'tt' + re.sub('[^0-9]', '', str(imdb))

            content = 'movie' if tvshowtitle == None else 'episode'

            self.sources = self.getSources(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta)
            if self.sources == []: raise Exception()

            self.progressDialog = control.progressDialog
            self.progressDialog.create(control.addonInfo('name'), '')
            self.progressDialog.update(0, control.lang(30515).encode('utf-8'), str(' '))

            self.sources = self.sourcesFilter()
            if self.sources == []: raise Exception()

            infoMenu = control.lang(30502).encode('utf-8') if content == 'movie' else control.lang(30503).encode('utf-8')

            downloads = True if control.setting('downloads') == 'true' and not control.setting('movie.download.path') == '' else False

            logger.debug('Downloads : %s' % downloads)

            sysmeta = urllib.quote_plus(meta)
            sysaddon = sys.argv[0]

            meta = json.loads(meta)

            poster = meta['poster'] if 'poster' in meta else '0'
            banner = meta['banner'] if 'banner' in meta else '0'
            thumb = meta['thumb'] if 'thumb' in meta else poster
            fanart = meta['fanart'] if 'fanart' in meta else '0'

            if poster == '0': poster = control.addonPoster()
            if banner == '0' and poster == '0': banner = control.addonBanner()
            elif banner == '0': banner = poster
            if thumb == '0' and fanart == '0': thumb = control.addonFanart()
            elif thumb == '0': thumb = fanart
            if control.setting('fanart') == 'true' and not fanart == '0': pass
            else: fanart = control.addonFanart()

            for i in range(len(self.sources)):
                try:
                    if self.progressDialog.iscanceled(): break

                    self.progressDialog.update(int((100 / float(len(self.sources))) * i))

                    url, label, provider = self.sources[i]['url'], self.sources[i]['label'], self.sources[i]['provider']

                    try :
                        parts = int(self.sources[i]['parts'])
                        logger.debug('Download : %s, Parts : %s, Label : %s' % (downloads, parts, label))
                    except:
                        parts = 2

                    logger.debug('Downloads : %s Parts : %s' % (downloads, parts))

                    systitle = urllib.quote_plus('%s (%s)' % (title, year) if tvshowtitle == None or season == None or episode == None else '%s S%02dE%02d' % (tvshowtitle, int(season), int(episode)))
                    sysname, sysurl, sysimage, sysprovider = urllib.quote_plus(name), urllib.quote_plus(url), urllib.quote_plus(poster), urllib.quote_plus(provider)

                    syssource = urllib.quote_plus(json.dumps([self.sources[i]]))

                    if i == 0:
                        query = 'action=playItem&content=%s&name=%s&year=%s&imdb=%s&tvdb=%s&source=%s&meta=%s' % (content, sysname, year, imdb, tvdb, syssource, sysmeta)
                    else:
                        query = 'action=playItem&content=%s&name=%s&year=%s&imdb=%s&tvdb=%s&source=%s' % (content, sysname, year, imdb, tvdb, syssource)

                    cm = []
                    cm.append((control.lang(30504).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon))
                    if (downloads == True and parts <= 1):
                        cm.append((control.lang(30505).encode('utf-8'), 'RunPlugin(%s?action=download&name=%s&image=%s&source=%s)' % (sysaddon, systitle, sysimage, syssource)))
                    cm.append((infoMenu, 'Action(Info)'))
                    cm.append((control.lang(30506).encode('utf-8'), 'RunPlugin(%s?action=refresh)' % sysaddon))
                    cm.append((control.lang(30507).encode('utf-8'), 'RunPlugin(%s?action=openSettings)' % sysaddon))
                    cm.append((control.lang(30508).encode('utf-8'), 'RunPlugin(%s?action=openPlaylist)' % sysaddon))

                    item = control.item(label=label, 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)
            try: self.progressDialog.close()
            except: pass
        except:
            control.infoDialog(control.lang(30501).encode('utf-8'))
            try: self.progressDialog.close()
            except: pass
Beispiel #44
0
def searchDirectory(query=None):
    if (query == None or query == ''):
        keyboard = control.keyboard('', 'Search')
        keyboard.doModal()
        if not (keyboard.isConfirmed()): return
        query = keyboard.getText()

    if (query == None or query == ''): return

    def search(): return [query]
    result = cache.get(search, 600000000, table='rel_srch')
    def search(): return [x for y,x in enumerate((result + [query])) if x not in (result + [query])[:y]]
    result = cache.get(search, 0, table='rel_srch')


    global global_search ; global_search = []

    def worker(url): global_search.append(str(client.request(url)))

    servers = client.request(phLink)
    servers = str(servers).replace('\n','')
    servers = re.findall('</name><link>(.+?)</link>', servers)
    servers = [urlparse.urlparse(i).netloc for i in servers]
    servers = [phSearch % i for i in servers if not 'mecca' in i]

    threads = []
    for server in servers: threads.append(Thread(worker, server))
    [i.start() for i in threads]
    [i.join() for i in threads]

    urls = global_search ; global_search = []
    urls = [str(i).replace('\n','') for i in urls]
    urls = [re.findall('<link>(.+?)</link>', i)[:30] for i in urls]
    urls = sum(urls, [])

    threads = []
    for url in urls: threads.append(Thread(worker, url))
    [i.start() for i in threads]
    [i.join() for i in threads]

    links = global_search ; global_search = []

    for link in links:
        try:
            link = str(link).replace('\r','').replace('\n','').replace('\t','').replace('&nbsp;','')

            try: fanart = re.findall('<fanart>(.+?)</fanart>', link)[0]
            except: fanart = '0'

            try: vip = re.findall('<poster>(.+?)</poster>', link)[0]
            except: vip = ''

            if vip == 'Team Phoenix': vip = ''

            try: content = re.findall('<meta>(.+?)</meta>', link)[0]
            except: content = '0'

            try: tvshow = re.findall('<tvshow>(.+?)</tvshow>', link)[0]
            except: tvshow = '0'

            if content in ['seasons', 'episodes'] and tvshow == '0':
                content = '0'


            dirs = re.compile('<dir>(.+?)</dir>').findall(link)

            for dir in dirs:
                try:
                    data = {}

                    name = re.findall('<name>(.+?)</name>', dir)[0]
                    name = cleantitle(name)

                    if not query.lower() in name.lower() : raise Exception()

                    url = re.findall('<link>(.+?)</link>', dir)[0]

                    try: image = re.findall('<thumbnail>(.+?)</thumbnail>', dir)[0]
                    except: image = '0'

                    try: fanart2 = re.findall('<fanart>(.+?)</fanart>', dir)[0]
                    except: fanart2 = fanart

                    if content =='tvshows':
                        try:
                            title = cleantitle(name).encode('utf-8')
                            data = {'title': title, 'tvshowtitle': title}
                        except:
                            pass

                    if re.search('[a-zA-Z]', vip): name += ' [COLOR orange]%s[/COLOR]' % vip

                    addDirectoryItem(name, url, 'ndmode', image, image, fanart2, '0', content, data)
                except:
                    pass


            items = re.compile('<item>(.+?)</item>').findall(link)

            for item in items:
                try:

                    data = {}

                    name = re.findall('<title>(.+?)</title>', item)[0]
                    name = cleantitle(name)

                    if not query.lower() in name.lower() : raise Exception()

                    url = re.findall('<link>(.+?)</link>', item)[0]

                    try: image = re.findall('<thumbnail>(.+?)</thumbnail>', item)[0]
                    except: image = '0'

                    try: fanart2 = re.findall('<fanart>(.+?)</fanart>', item)[0]
                    except: fanart2 = fanart

                    if content =='movies':
                        try:
                            title = cleantitle(name).encode('utf-8')
                            data = {'title': title}

                            title, year = re.compile('(.+?)[(](\d{4})[)]').findall(name)[0]
                            title = cleantitle(title).encode('utf-8')
                            data = {'title': title, 'year': year}
                        except:
                            pass

                    if re.search('[a-zA-Z]', vip): name += ' [COLOR orange]%s[/COLOR]' % vip

                    if 'sublink' in url:
                        addDirectoryItem(name, url, 'subDirectory', image, image, fanart2, '0', content, data, isFolder=True)
                    else:
                        addDirectoryItem(name, url, 'resolveUrl', image, image, fanart2, '0', content, data, isFolder=False)
                except:
                    pass
        except:
            pass

    control.directory(int(sys.argv[1]), cacheToDisc=True)
def endCategory():
    if control.skin == 'skin.confluence': control.execute('Container.SetViewMode(500)')
    control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #46
0
    def movieDirectory(self, items, provider=None, lang=None):
        if items == None or len(items) == 0: return

        isFolder = True if control.setting('autoplay') == 'false' and control.setting('host_select') == '1' else False
        isFolder = False if control.window.getProperty('PseudoTVRunning') == 'True' else isFolder

        playbackMenu = control.lang(30204).encode('utf-8') if control.setting('autoplay') == 'true' else control.lang(30203).encode('utf-8')

        cacheToDisc = False if not action == 'movieSearch' else True

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart, settingFanart = control.addonFanart(), control.setting('fanart')
        sysaddon = sys.argv[0]

        try:
            from metahandler import metahandlers
            metaget = metahandlers.MetaData(tmdb_api_key=self.tmdb_key, preparezip=False)
        except:
            pass

        for i in items:
            try:
                label = i['name']
                sysname = urllib.quote_plus(label)
                systitle = urllib.quote_plus(i['title'])
                imdb, tmdb, year = i['imdb'], i['tmdb'], i['year']


                poster, banner, fanart = i['poster'], i['banner'], i['fanart']
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster


                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, sysname)})
                if i['duration'] == '0': meta.update({'duration': '120'})
                try: meta.update({'duration': str(int(meta['duration']) * 60)})
                except: pass
                sysmeta = urllib.quote_plus(json.dumps(meta))


                url = '%s?action=play&name=%s&title=%s&year=%s&imdb=%s&tmdb=%s&meta=%s&t=%s' % (sysaddon, sysname, systitle, year, imdb, tmdb, sysmeta, self.systime)
                sysurl = urllib.quote_plus(url)

                if isFolder == True:
                    url = '%s?action=sources&name=%s&title=%s&year=%s&imdb=%s&tmdb=%s&meta=%s' % (sysaddon, sysname, systitle, year, imdb, tmdb, sysmeta)


                try:
                    playcount = metaget._get_watched('movie', imdb, '', '')
                    if playcount == 7: meta.update({'playcount': 1, 'overlay': 7})
                    else: meta.update({'playcount': 0, 'overlay': 6})
                except:
                    pass

                cm = []

                cm.append((playbackMenu, 'RunPlugin(%s?action=alterSources&url=%s&meta=%s)' % (sysaddon, sysurl, sysmeta)))

                cm.append((control.lang(30214).encode('utf-8'), 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, sysname)))
                cm.append((control.lang(30205).encode('utf-8'), 'Action(Info)'))

                if not action == 'movieSearch':
                    cm.append((control.lang(30206).encode('utf-8'), 'RunPlugin(%s?action=moviePlaycount&title=%s&year=%s&imdb=%s&query=7)' % (sysaddon, systitle, year, imdb)))
                    cm.append((control.lang(30207).encode('utf-8'), 'RunPlugin(%s?action=moviePlaycount&title=%s&year=%s&imdb=%s&query=6)' % (sysaddon, systitle, year, imdb)))#

                cm.append((control.lang(30212).encode('utf-8'), 'RunPlugin(%s?action=addView&content=movies)' % sysaddon))


                item = control.item(label=label, iconImage=poster, thumbnailImage=poster)

                try: item.setArt({'poster': poster, 'banner': banner})
                except: pass

                if settingFanart == 'true' and not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setInfo(type='Video', infoLabels = meta)
                item.setProperty('Video', 'true')
                #item.setProperty('IsPlayable', 'true')
                item.addContextMenuItems(cm, replaceItems=True)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=isFolder)
            except:
                pass

        try:
            url = items[0]['next']
            if url == '': raise Exception()
            url = '%s?action=movies&url=%s&provider=%s&lang=%s' % (sysaddon, urllib.quote_plus(url), provider, lang)
            addonNext = control.addonNext()
            item = control.item(label=control.lang(30213).encode('utf-8'), iconImage=addonNext, thumbnailImage=addonNext)
            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=True)
        except:
            pass


        control.content(int(sys.argv[1]), 'movies')
        views.setView('movies', {'skin.confluence': control.viewMode['thumbnails']})
        control.directory(int(sys.argv[1]), cacheToDisc=cacheToDisc)
Beispiel #47
0
elif action == 'updateLibrary':
    from resources.lib.libraries import libtools
    libtools.libepisodes().update(query)

elif action == 'service':
    from resources.lib.libraries import libtools
    libtools.libepisodes().service()

elif action == 'resolve':
    from resources.lib.sources import sources
    from resources.lib.libraries import control
    url = sources().sourcesResolve(url, provider)
    control.addItem(handle=int(sys.argv[1]),
                    url=url,
                    listitem=control.item(name))
    control.directory(int(sys.argv[1]))

elif action == 'download':
    from resources.lib.sources import sources
    from resources.lib.libraries import simpledownloader
    url = sources().sourcesResolve(url, provider)
    simpledownloader.download(name, image, url)

elif action == 'play':
    from resources.lib.sources import sources
    sources().play(name, title, year, imdb, tmdb, tvdb, tvrage, season,
                   episode, tvshowtitle, alter, date, meta, url)

elif action == 'sources':
    from resources.lib.sources import sources
    sources().addItem(name, title, year, imdb, tmdb, tvdb, tvrage, season,
Beispiel #48
0
def episodeCategory():
    control.content(int(sys.argv[1]), 'episodes')
    control.directory(int(sys.argv[1]), cacheToDisc=True)
def movieCategory():
    control.content(int(sys.argv[1]), "movies")
    if control.skin == "skin.confluence":
        control.execute("Container.SetViewMode(500)")
    control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #50
0
    libtools.libtvshows().range(url)

elif action == 'updateLibrary':
    from resources.lib.libraries import libtools
    libtools.libepisodes().update(query)

elif action == 'service':
    from resources.lib.libraries import libtools
    libtools.libepisodes().service()

elif action == 'resolve':
    from resources.lib.sources import sources
    from resources.lib.libraries import control
    url = sources().sourcesResolve(url, provider)
    control.addItem(handle=int(sys.argv[1]), url=url, listitem=control.item(name))
    control.directory(int(sys.argv[1]))

elif action == 'download':
    from resources.lib.sources import sources
    from resources.lib.libraries import simpledownloader
    url = sources().sourcesResolve(url, provider)
    simpledownloader.download(name, image, url)

elif action == 'play':
    from resources.lib.sources import sources
    sources().play(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta, url)

elif action == 'sources':
    from resources.lib.sources import sources
    sources().addItem(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta)
Beispiel #51
0
 def endDirectory(self, cacheToDisc=True):
     control.directory(int(sys.argv[1]), cacheToDisc=cacheToDisc)
Beispiel #52
0
    def seasonDirectory(self, items):
        if items == None or len(items) == 0: return

        isFolder = True if control.setting('autoplay') == 'false' and control.setting('host_select') == '1' else False
        isFolder = False if control.window.getProperty('PseudoTVRunning') == 'True' else isFolder

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart, settingFanart = control.addonFanart(), control.setting('fanart')
        sysaddon = sys.argv[0]

        for i in items:
            try:
                label = '%s %s' % ('Season', i['season'])
                systitle = sysname = urllib.quote_plus(i['tvshowtitle'])
                imdb, tmdb, tvdb, tvrage, year, season = i['imdb'], i['tmdb'], i['tvdb'], i['tvrage'], i['year'], i['season']

                poster, banner, fanart, thumb = i['poster'], i['banner'], i['fanart'], i['thumb']
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster
                if thumb == '0' and poster == '0': thumb = addonPoster
                elif thumb == '0': thumb = poster

                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, sysname)})
                if i['duration'] == '0': meta.update({'duration': '60'})
                try: meta.update({'duration': str(int(meta['duration']) * 60)})
                except: pass
                sysmeta = urllib.quote_plus(json.dumps(meta))


                url = '%s?action=episodes&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s&season=%s' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage, season)


                cm = []

                if isFolder == False:
                    cm.append((control.lang(30261).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon))

                cm.append((control.lang(30262).encode('utf-8'), 'Action(Info)'))

                cm.append((control.lang(30263).encode('utf-8'), 'RunPlugin(%s?action=tvPlaycount&name=%s&year=%s&imdb=%s&tvdb=%s&season=%s&query=7)' % (sysaddon, systitle, year, imdb, tvdb, season)))
                cm.append((control.lang(30264).encode('utf-8'), 'RunPlugin(%s?action=tvPlaycount&name=%s&year=%s&imdb=%s&tvdb=%s&season=%s&query=6)' % (sysaddon, systitle, year, imdb, tvdb, season)))

                #cm.append((control.lang(30267).encode('utf-8'), 'RunPlugin(%s?action=deleteFavourite&meta=%s&content=tvshows)' % (sysaddon, sysmeta)))

                #cm.append((control.lang(30268).encode('utf-8'), 'RunPlugin(%s?action=tvshowToLibrary&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s)' % (sysaddon, systitle, year, imdb, tmdb, tvdb, tvrage)))

                cm.append((control.lang(30269).encode('utf-8'), 'RunPlugin(%s?action=addView&content=seasons)' % sysaddon))


                item = control.item(label=label, iconImage=thumb, thumbnailImage=thumb)

                try: item.setArt({'poster': thumb, 'tvshow.poster': poster, 'season.poster': thumb, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})
                except: pass

                if settingFanart == 'true' and not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setInfo(type='Video', infoLabels = meta)
                item.setProperty('Video', 'true')
                item.addContextMenuItems(cm, replaceItems=True)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
            except:
                pass


        try: control.property(int(sys.argv[1]), 'showplot', items[0]['plot'])
        except: pass

        control.content(int(sys.argv[1]), 'seasons')
        control.directory(int(sys.argv[1]), cacheToDisc=True)
        views.setView('seasons', {'skin.confluence': 500})
Beispiel #53
0
    def addItem(self, name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta):
        try:
            if imdb == '0': imdb = '0000000'
            imdb = 'tt' + re.sub('[^0-9]', '', str(imdb))

            content = 'movie' if tvshowtitle == None else 'episode'

            self.sources = self.getSources(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date)
            if self.sources == []: raise Exception()
            self.sources = self.sourcesFilter()

            meta = json.loads(meta)

            infoMenu = control.lang(30502).encode('utf-8') if content == 'movie' else control.lang(30503).encode('utf-8')

            poster = meta['poster'] if 'poster' in meta else '0'
            banner = meta['banner'] if 'banner' in meta else '0'
            thumb = meta['thumb'] if 'thumb' in meta else poster
            fanart = meta['fanart'] if 'fanart' in meta else '0'

            if poster == '0': poster = control.addonPoster()
            if banner == '0' and poster == '0': banner = control.addonBanner()
            elif banner == '0': banner = poster
            if thumb == '0' and fanart == '0': thumb = control.addonFanart()
            elif thumb == '0': thumb = 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, label, provider = i['url'], i['label'], i['provider']

                    sysname, sysurl, sysimage, sysprovider = urllib.quote_plus(name), urllib.quote_plus(url), urllib.quote_plus(poster), urllib.quote_plus(provider)

                    syssource = urllib.quote_plus(json.dumps([i]))

                    query = 'action=playItem&content=%s&name=%s&imdb=%s&tvdb=%s&source=%s' % (content, sysname, imdb, tvdb, syssource)

                    cm = []
                    cm.append((control.lang(30504).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon))
                    cm.append((control.lang(30505).encode('utf-8'), 'RunPlugin(%s?action=download&name=%s&image=%s&url=%s&provider=%s)' % (sysaddon, sysname, sysimage, sysurl, sysprovider)))
                    cm.append((infoMenu, 'Action(Info)'))
                    cm.append((control.lang(30506).encode('utf-8'), 'RunPlugin(%s?action=refresh)' % sysaddon))
                    cm.append((control.lang(30507).encode('utf-8'), 'RunPlugin(%s?action=openSettings)' % sysaddon))
                    cm.append((control.lang(30508).encode('utf-8'), 'RunPlugin(%s?action=openPlaylist)' % sysaddon))

                    item = control.item(label=label, 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(30501).encode('utf-8'))
            pass
Beispiel #54
0
 def endDirectory(self):
     control.content(syshandle, 'addons')
     control.directory(syshandle, cacheToDisc=True)
Beispiel #55
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.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)
Beispiel #56
0
def subDirectory(name, url, audio, image, fanart, playable, tvshow, content):
    match = re.compile('<sublink>(.+?)</sublink>').findall(url)
    if len(match) == 0: return

    try:
        title = cleantitle(name).encode('utf-8')
        data = {'title': title}
    except:
        pass

    try:
        if not content == 'movies': raise Exception()

        title = cleantitle(name).encode('utf-8')
        data = {'title': title}

        title, year = re.compile('(.+?)[(](\d{4})[)]').findall(name)[0]
        title = cleantitle(title).encode('utf-8')
        data = {'title': title, 'year': year}

        from metahandler import metahandlers
        metaget = metahandlers.MetaData(preparezip=False)

        #data = metaget.get_meta('movie', title, year=year)
        data = cachemeta.get(metaget.get_meta, 24, 'movie', title, '', '', year)

        metaimage = data['cover_url']
        if not metaimage == '': image = metaimage
        metafanart = data['backdrop_url']
        if not metafanart == '': fanart = metafanart
    except:
        pass

    try:
        if tvshow == '0' and not content == 'episodes': raise Exception()

        try:
            title = cleantitle(name).encode('utf-8')
            data = {'title': title, 'tvshowtitle': tvshow}
        except:
            pass
        try:
            i = cleaneptitle(tvshow, title)
            title, season, episode = i[0].encode('utf-8'), i[1], i[2]
            data = {'title': title, 'tvshowtitle': tvshow, 'season': season, 'episode': episode}
        except:
            pass

        from metahandler import metahandlers
        metaget = metahandlers.MetaData(preparezip=False)
        tvd = metaget.get_meta('tvshow', tvshow)
        tvd = cachemeta.get(metaget.get_meta, 24, 'tvshow', tvshow, '', '', '')

        data.update({'year': tvd['year'], 'imdb_id' : tvd['imdb_id'], 'tvdb_id' : tvd['tvdb_id'], 'tvshowtitle': tvd['TVShowTitle'], 'genre' : tvd['genre'], 'studio': tvd['studio'], 'status': tvd['status'], 'duration' : tvd['duration'], 'rating': tvd['rating'], 'mpaa' : tvd['mpaa'], 'plot': tvd['plot'], 'cast': tvd['cast']})

        metafanart = tvd['backdrop_url']
        if not metafanart == '': image = fanart = metafanart
    except:
        pass

    for i in range(0, len(match)):
        url = match[i]
        label = '%s Link %s' % (name, str(i+1))
        addDirectoryItem(label, url, 'resolveUrl', image, image, fanart, '0', content, data, isFolder=False)

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