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.modules import cache
            views.setView(content, {})
        except:
            return
Exemple #2
0
    def listBollywood(self, url, page):
        try: html = client.request(url + 'page/' + str(page))
        except: pass

        syshandle = int(sys.argv[1])

        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)

        item = control.item('Next page', iconImage='', thumbnailImage='')
        item.setInfo(type="Video", infoLabels={"Title": 'Page ' + str(page), "OriginalTitle": 'Page ' + str(page)})
        control.addItem(handle=syshandle, url=query, listitem=item, isFolder=True)

        control.content(syshandle, 'movies')
        control.directory(syshandle, cacheToDisc=True)
        views.setView('movies', {'skin.estuary': 500, 'skin.confluence': 500})
Exemple #3
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 (%s)' % (i['channel'].upper(), i['title'], i['year'])
                sysname = urllib.quote_plus('%s (%s)' % (i['title'], i['year']))
                systitle = urllib.quote_plus(i['title'])
                imdb, year = i['imdb'], 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&title=%s&year=%s&imdb=%s&meta=%s&t=%s' % (sysaddon, systitle, year, imdb, 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(30297).encode('utf-8'), 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, sysname)))
                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.do_block_check(False)
        control.directory(int(sys.argv[1]), cacheToDisc=True)
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)
Exemple #5
0
    def addDirectory(self, items, queue=False):
        if items == None or len(items) == 0: control.idle() ; sys.exit()

        sysaddon = sys.argv[0]

        syshandle = int(sys.argv[1])

        addonFanart, addonThumb, artPath = control.addonFanart(), control.addonThumb(), control.artPath()

        queueMenu = control.lang(32065).encode('utf-8')

        playRandom = control.lang(32535).encode('utf-8')

        addToLibrary = control.lang(32551).encode('utf-8')

        for i in items:
            try:
                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 = []
                
                cm.append(('Settings', 'RunPlugin(%s?action=openSettings&query=0.0)' % sysaddon))
                
                cm.append((playRandom, 'RunPlugin(%s?action=random&rtype=movie&url=%s)' % (sysaddon, urllib.quote_plus(i['url']))))

                if queue == True:
                    cm.append((queueMenu, 'RunPlugin(%s?action=queueItem)' % sysaddon))

                try: cm.append((addToLibrary, 'RunPlugin(%s?action=moviesToLibrary&url=%s)' % (sysaddon, urllib.quote_plus(i['context']))))
                except: pass

                item = control.item(label=name)

                item.setArt({'icon': thumb, 'thumb': thumb})
                if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)

                item.addContextMenuItems(cm)

                control.addItem(handle=syshandle, url=url, listitem=item, isFolder=True)
            except:
                pass

        control.content(syshandle, 'addons')
        control.directory(syshandle, cacheToDisc=True)
Exemple #6
0
    def listEpisodes(self, catid, showid, page, image):
        syshandle = int(sys.argv[1])
        url = self.episodes_link % (showid, page)
        cookie = 'ssMemberID=%d' % (self.member_id)

        try: result = client.request(url, cookie=cookie)
        except: pass
        link = ''.join(result.splitlines()).replace('\'','"')
        link = ''.join(link.splitlines()).replace('<i class="fa fa-play-circle-white"></i>','')

        episodematch = re.compile('class="chapterList">(.+?)</li>').findall(link)

        for em in episodematch:
            episodes = re.compile('player-(.+)">(.+)</a>').findall(em)
            for episode in episodes:
                name = episode[1].decode('utf-8')
                url = self.player_link % (episode[0])
                self.list.append({'name': name, 'url': urllib.quote_plus(url), '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=syshandle, url=url, listitem=item, isFolder=True)

        control.content(syshandle, 'episodes')
        control.directory(syshandle, cacheToDisc=True)
        views.setView('episodes', {'skin.estuary': 55, 'skin.confluence': 50})
    def addDirectory(self, items, queue=False, isFolder=True):
        if items == None or len(items) == 0: control.idle() ; sys.exit()

        sysaddon = sys.argv[0]

        syshandle = int(sys.argv[1])

        addonFanart, addonThumb, artPath = control.addonFanart(), control.addonThumb(), control.artPath()

        queueMenu = control.lang(32065).encode('utf-8')

        playRandom = control.lang(32535).encode('utf-8')

        addToLibrary = control.lang(32551).encode('utf-8')

        for i in items:
            try:
                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

                item = control.item(label=name)

                if isFolder:
                    url = '%s?action=%s' % (sysaddon, i['action'])
                    try: url += '&url=%s' % urllib.quote_plus(i['url'])
                    except: pass
                    item.setProperty('IsPlayable', 'false')
                else:
                    url = '%s?action=%s' % (sysaddon, i['action'])
                    try: url += '&url=%s' % i['url']
                    except: pass
                    item.setProperty('IsPlayable', 'true')
                    item.setInfo("mediatype", "video")
                    item.setInfo("audio", '')

                item.setArt({'icon': thumb, 'thumb': thumb})
                if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)

                control.addItem(handle=syshandle, url=url, listitem=item, isFolder=isFolder)
            except:
                pass

        control.content(syshandle, 'addons')
        control.directory(syshandle, cacheToDisc=True)
Exemple #8
0
def add_directory(items):
    if items is None or len(items) == 0: return

    sysaddon = sys.argv[0]
    addon_poster = addon_banner = control.addonInfo('icon')
    addon_fanart = control.addonInfo('fanart')

    for i in items:
        item = control.item(i['name'])
        url = '%s?action=%s' % (sysaddon, i['action'])

        item.setArt({'poster': addon_poster, 'banner': addon_banner})
        item.setProperty('Fanart_Image', addon_fanart)
        control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)

    control.directory(int(sys.argv[1]), cacheToDisc=True)
    control.content(int(sys.argv[1]), 'files')
	def addDirectory(self, items, queue=False):
		if items == None or len(items) == 0: control.idle() ; sys.exit()

		sysaddon = sys.argv[0]

		syshandle = int(sys.argv[1])

		addonFanart = control.addonFanart()
		addonThumb = control.addonThumb()

		queueMenu = control.lang(32065).encode('utf-8')

		for i in items:
			try:
				name = i['name']

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

				cm = []

				if queue == True:
					cm.append((queueMenu, 'RunPlugin(%s?action=queueItem)' % sysaddon))

				item = control.item(label=name)

				if i['image'].startswith('http'):
					iconIcon = iconThumb = iconPoster = iconBanner = i['image']
				else:
					iconIcon, iconThumb, iconPoster, iconBanner = interface.Icon.pathAll(icon = i['image'], default = addonThumb)
				item.setArt({'icon': iconIcon, 'thumb': iconThumb, 'poster': iconPoster, 'banner': iconBanner})

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

				item.addContextMenuItems(cm)

				control.addItem(handle=syshandle, url=url, listitem=item, isFolder=True)
			except:
				pass

		control.content(syshandle, 'addons')
		control.directory(syshandle, cacheToDisc=True)

		interface.traktApi()
Exemple #10
0
    def category_combate_directory(self, items):
        if items == None or len(items) == 0:
            control.idle()
            sys.exit()

        sysaddon = sys.argv[0]
        syshandle = int(sys.argv[1])

        refreshMenu = control.lang(32072).encode('utf-8')

        for item in items:
            title = item['title']
            label = title
            slug = item['slug']
            meta = {}
            meta.update({'title': title})

            url = '%s?action=opencategory&provider=%s&category=%s' % (
                sysaddon, 'combate', slug)

            item = control.item(label=label)

            # art = {'icon': GLOBO_LOGO, 'thumb': GLOBO_LOGO, 'fanart': fanart}
            # item.setArt(art)

            # item.setProperty('Fanart_Image', fanart)

            item.setProperty('IsPlayable', "false")
            item.setInfo(type='video', infoLabels=meta)

            cm = []
            cm.append((refreshMenu, 'RunPlugin(%s?action=refresh)' % sysaddon))
            item.addContextMenuItems(cm)

            control.addItem(handle=syshandle,
                            url=url,
                            listitem=item,
                            isFolder=True)

        # control.addSortMethod(int(sys.argv[1]), control.SORT_METHOD_LABEL_IGNORE_FOLDERS)

        control.content(syshandle, 'files')
        control.directory(syshandle, cacheToDisc=False)
def search_menu():
    addon.add_directory({'mode': 'search_bb', 'url': 'new'},
                        {'title': control.lang(32014).encode('utf-8')}, img=IconPath + 'search.png', fanart=FANART)
    try:
        from sqlite3 import dbapi2 as database
    except ImportError:
        from pysqlite2 import dbapi2 as database

    dbcon = database.connect(control.searchFile)
    dbcur = dbcon.cursor()

    try:
        dbcur.execute("""CREATE TABLE IF NOT EXISTS Search (url text, search text)""")
    except BaseException:
        pass

    dbcur.execute("SELECT * FROM Search ORDER BY search")

    lst = []

    delete_option = False
    for (url, search) in dbcur.fetchall():
        title = '[B]%s[/B]' % urllib.unquote_plus(search).encode('utf-8')
        delete_option = True
        addon.add_directory({'mode': 'search_bb', 'url': search},
                            {'title': title},
                            [(control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)',),
                             (control.lang(32015).encode('utf-8'),
                              'RunPlugin(plugin://plugin.video.releaseBB/?mode=del_search_item&query=%s)' % search,),
                             (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)',),
                             (control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=setviews)',)],
                            img=IconPath + 'search.png', fanart=FANART)
        lst += [(search)]
    dbcur.close()

    if delete_option:
        addon.add_directory({'mode': 'del_search_items'},
                            {'title': control.lang(32016).encode('utf-8')},
                            img=IconPath + 'search.png', fanart=FANART, is_folder=False)

    control.content(int(sys.argv[1]), 'videos')
    control.directory(int(sys.argv[1]))
    view.setView('videos', {'skin.estuary': 55, 'skin.confluence': 500})
Exemple #12
0
    def get_extras(self):
        from resources.lib.modules.globosat import scraper_vod
        tracks = cache.get(scraper_vod.get_tracks, 1)

        sysaddon = sys.argv[0]
        syshandle = int(sys.argv[1])
        provider = 'globosat'

        url = '%s?action=openfeatured&provider=%s' % (sysaddon, provider)

        label = 'Destaques'

        item = control.item(label=label)

        item.setProperty('IsPlayable', "false")
        item.setInfo(type='video', infoLabels={'title': label})

        control.addItem(handle=syshandle,
                        url=url,
                        listitem=item,
                        isFolder=True)

        for track in tracks:
            url = '%s?action=openextra&provider=%s&id=%s&kind=%s' % (
                sysaddon, provider, track['id'], track['kind'])

            label = track['title']

            item = control.item(label=label)

            item.setProperty('IsPlayable', "false")
            item.setInfo(type='video', infoLabels={'title': label})

            control.addItem(handle=syshandle,
                            url=url,
                            listitem=item,
                            isFolder=True)

        control.addSortMethod(int(sys.argv[1]),
                              control.SORT_METHOD_LABEL_IGNORE_FOLDERS)

        control.content(syshandle, 'files')
        control.directory(syshandle, cacheToDisc=False)
Exemple #13
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.modules import views
            views.setView(content, {})
        except:
            return
	def browse_user_torrents(self, folder_id):
		try:
			sysaddon, syshandle = argv[0], int(argv[1])
			torrent_files = self.torrent_info(folder_id)
		except: return
		extensions = supported_video_extensions()
		try:
			file_info = [i for i in torrent_files['files'] if i['path'].lower().endswith(tuple(extensions))]
			file_urls = torrent_files['links']
			for c, i in enumerate(file_info):
				try: i.update({'url_link': file_urls[c]})
				except: pass
			pack_info = sorted(file_info, key=lambda k: k['path'])
		except:
			if self.server_notifications: control.notification(message='Real-Debrid Error:  browse_user_torrents failed', icon=rd_icon)
			log_utils.log('Real-Debrid Error:  browse_user_torrents failed', __name__, log_utils.LOGWARNING)
			return
		file_str, downloadMenu, renameMenu, deleteMenu, clearFinishedMenu = \
				getLS(40047).upper(), getLS(40048), getLS(40049), getLS(40050), getLS(40051)
		for count, item in enumerate(pack_info, 1):
			try:
				cm = []
				try: url_link = item['url_link']
				except: continue
				if url_link.startswith('/'): url_link = 'http' + url_link
				name = item['path']
				if name.startswith('/'): name = name.split('/')[-1]
				size = float(int(item['bytes'])) / 1073741824
				label = '%02d | [B]%s[/B] | %.2f GB | [I]%s [/I]' % (count, file_str, size, name)
				url = '%s?action=play_URL&url=%s&caller=realdebrid&type=unrestrict' % (sysaddon, url_link)
				cm.append((downloadMenu, 'RunPlugin(%s?action=download&name=%s&image=%s&url=%s&caller=realdebrid&type=unrestrict)' %
							(sysaddon, quote_plus(name), quote_plus(rd_icon), url_link)))
				cm.append((deleteMenu % 'Torrent', 'RunPlugin(%s?action=rd_DeleteUserTorrent&id=%s&name=%s)' %
							(sysaddon, item['id'], quote_plus(name))))
				item = control.item(label=label, offscreen=True)
				item.addContextMenuItems(cm)
				item.setArt({'icon': rd_icon, 'poster': rd_icon, 'thumb': rd_icon, 'fanart': addonFanart, 'banner': rd_icon})
				item.setInfo(type='video', infoLabels='')
				control.addItem(handle=syshandle, url=url, listitem=item, isFolder=False)
			except:
				log_utils.error()
		control.content(syshandle, 'files')
		control.directory(syshandle, cacheToDisc=True)
Exemple #15
0
    def channel_directory(self, items):
        if items is None or len(items) == 0:
            control.idle()
            sys.exit()

        sysaddon = sys.argv[0]
        syshandle = int(sys.argv[1])
        fanart = os.path.join(artPath, 'fanart_sexyhot.png')
        logo = os.path.join(artPath, 'logo_sexyhot.png')

        refreshMenu = control.lang(32072).encode('utf-8')

        cm = []
        cm.append((refreshMenu, 'RunPlugin(%s?action=refresh)' % sysaddon))

        for index, item in enumerate(items):
            label = item['name']
            sysurl = urllib.quote_plus(item['url'])

            url = '%s?action=getVideos&provider=sexyhot&url=%s' % (sysaddon,
                                                                   sysurl)

            item = control.item(label=label)

            item.setArt({
                'logo': logo,
                # 'thumb': logo,
                'fanart': fanart,
            })
            item.addContextMenuItems(cm)
            item.setProperty('IsPlayable', 'true')
            item.setProperty('Fanart_Image', fanart)
            item.setInfo(type='video', infoLabels={'title': label})
            control.addItem(handle=syshandle,
                            url=url,
                            listitem=item,
                            isFolder=True)

        # control.addSortMethod(int(sys.argv[1]), control.SORT_METHOD_LABEL_IGNORE_FOLDERS)

        control.content(syshandle, 'files')
        control.directory(syshandle, cacheToDisc=False)
Exemple #16
0
 def addDirectory(self, items, queue=False, isFolder=True, sortMethod=xbmcplugin.SORT_METHOD_LABEL):
     if items is None or len(items) is 0:
         control.idle()
         sys.exit()
     sysaddon = sys.argv[0]
     syshandle = int(sys.argv[1])
     addonFanart, addonThumb, artPath = control.addonFanart(), control.addonThumb(), control.artPath()
     for i in items:
         try:
             name = i['name']
             if i['image'].startswith('http'):
                 thumb = i['image']
             elif artPath is not None:
                 thumb = os.path.join(artPath, i['image'])
             else:
                 thumb = addonThumb
             item = control.item(label=name)
             if isFolder:
                 url = '%s?action=%s' % (sysaddon, i['action'])
                 try:
                     url += '&url=%s' % urllib.quote_plus(i['url'])
                 except Exception:
                     pass
                 item.setProperty('IsPlayable', 'false')
             else:
                 url = '%s?action=%s' % (sysaddon, i['action'])
                 try:
                     url += '&url=%s' % i['url']
                 except Exception:
                     pass
                 item.setProperty('IsPlayable', 'true')
                 item.setInfo("mediatype", "video")
                 item.setInfo("audio", '')
             item.setArt({'icon': thumb, 'thumb': thumb})
             if addonFanart is not None:
                 item.setProperty('Fanart_Image', addonFanart)
             control.addItem(handle=syshandle, url=url, listitem=item, isFolder=isFolder)
         except Exception:
             pass
     control.sortMethod(syshandle, sortMethod)
     control.content(syshandle, 'addons')
     control.directory(syshandle, cacheToDisc=True)
def open_episode_page(url):
    html = client.request(url)
    try:
        poster = client.parseDOM(html, 'td', attrs={'align': 'center'})
        poster = [i for i in poster if 'img src=' in i][0]
        poster = client.parseDOM(poster, 'img', ret='src')[0]
        poster = urljoin(eztv_base, poster) if poster.startswith('/') else poster
    except IndexError:
        poster = IconPath + 'eztv.png'
    try:
        img = client.parseDOM(html, 'a', attrs={'class': 'pirobox'}, ret='href')[0]
        img = 'https:' + img if img.startswith('//') else img
        img = img.replace('large', 'small')
    except IndexError:
        img = FANART
    try:

        magnet = re.findall(r'href="(magnet:.+?)"', html, re.DOTALL)[0]
        title = client.parseDOM(html, 'title')[0].split(' EZTV')[0]
        addon.add_video_item({'mode': 'PlayVideo', 'url': magnet, 'img': img},
                             {'title': title}, allfun, img=poster, fanart=img)
    except IndexError:
        control.infoDialog(
            '[COLOR red][B]No Magnet Link available![/B][/COLOR]\n'
            '[COLOR lime][B]Please try other title!![/B][/COLOR]', NAME, ICON, 5000)
        return

    try:
        alts = client.parseDOM(html, 'tr', attrs={'class': 'forum_header_border'})
        alts = [dom.parse_dom(str(i), 'a', req=['href', 'title'])[0] for i in alts if alts]

        for alt in alts:
            link, title = alt.attrs['href'], alt.attrs['title']
            link = urljoin(eztv_base, link) if link.startswith('/') else link
            addon.add_directory({'mode': 'open_page', 'url': link, 'img': img, 'plot': 'N/A'},
                                {'title': title}, allfun, img=img, fanart=FANART)
    except IndexError:
        pass

    control.content(int(sys.argv[1]), 'videos')
    control.directory(int(sys.argv[1]))
    view.setView('videos', {'skin.estuary': 55, 'skin.confluence': 500})
Exemple #18
0
def etos():
    from datetime import datetime
    dt = datetime.today()
    year = dt.year
    for etos in range(int(year) - 0, 1980, -1):
        titlos = str(etos)
        link = ''.join([Baseurl, '/tag/{}'.format(str(etos))])
        addon.add_directory({
            'mode': 'to_items',
            'url': link
        }, {
            'title': titlos,
            'plot': titlos
        },
                            allfun,
                            img=ICON,
                            fanart=FANART)
    control.content(int(sys.argv[1]), 'addons')
    control.directory(int(sys.argv[1]))
    view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
Exemple #19
0
def add_directory(items):
    if items is None or len(items) == 0: return

    sysaddon = sys.argv[0]
    addon_poster = addon_banner = control.addonInfo('icon')
    addon_fanart = control.addonInfo('fanart')

    for i in items:
        item = control.item(i['name'])
        url = '%s?action=%s' % (sysaddon, i['action'])

        item.setArt({'poster': addon_poster, 'banner': addon_banner})
        item.setProperty('Fanart_Image', addon_fanart)
        control.addItem(handle=int(sys.argv[1]),
                        url=url,
                        listitem=item,
                        isFolder=True)

    control.directory(int(sys.argv[1]), cacheToDisc=True)
    control.content(int(sys.argv[1]), 'files')
    def views(self):
        try:
            control.idle()

            items = [("Filme", 'movies'), ("TV-Serien", 'tvshows'),
                     ("Staffeln", 'seasons'), ("Episoden", 'episodes')]

            select = control.selectDialog([i[0] for i in items],
                                          "[B]LASTSHIP[/B]: Anzeige-Typen")

            if select == -1: return

            content = items[select][1]

            title = "HIER KLICKEN, UM ANSICHT ZU SPEICHERN"
            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.modules import views
            views.setView(content, {})
        except:
            return
 def user_cloud_to_listItem(self, folder_id=None):
     sysaddon, syshandle = argv[0], int(argv[1])
     folder_str, deleteMenu = control.lang(40046).upper(), control.lang(
         40050)
     cloud_dict = self.user_cloud()['magnets']
     cloud_dict = [i for i in cloud_dict if i['statusCode'] == 4]
     for count, item in enumerate(cloud_dict, 1):
         try:
             cm = []
             folder_name = control.strip_non_ascii_and_unprintable(
                 item['filename'])
             id = item['id']
             status_str = '[COLOR %s]%s[/COLOR]' % (
                 control.getColor(control.setting('highlight.color')),
                 item['status'].capitalize())
             label = '%02d | [B]%s[/B] | [B]%s[/B] | [I]%s [/I]' % (
                 count, status_str, folder_str, folder_name)
             url = '%s?action=ad_BrowseUserCloud&source=%s' % (
                 sysaddon, quote_plus(jsdumps(item)))
             cm.append(
                 (deleteMenu % 'Transfer',
                  'RunPlugin(%s?action=ad_DeleteTransfer&id=%s&name=%s)' %
                  (sysaddon, id, folder_name)))
             item = control.item(label=label)
             item.addContextMenuItems(cm)
             item.setArt({
                 'icon': ad_icon,
                 'poster': ad_icon,
                 'thumb': ad_icon,
                 'fanart': addonFanart,
                 'banner': ad_icon
             })
             item.setInfo(type='video', infoLabels='')
             control.addItem(handle=syshandle,
                             url=url,
                             listitem=item,
                             isFolder=True)
         except:
             log_utils.error()
     control.content(syshandle, 'files')
     control.directory(syshandle, cacheToDisc=True)
def MainMenu():  # homescreen
    addon.add_directory({'mode': 'open_news'},
                        {'title': '[COLOR lime][B]News - Updates[/COLOR][/B]'},
                        allfun, img=ICON, fanart=FANART, is_folder=False)

    addon.add_directory({'mode': 'Categories', 'section': 'movies'},
                        {'title': control.lang(32000).encode('utf-8')},
                        allfun, img=IconPath + 'movies.png', fanart=FANART)
    addon.add_directory({'mode': 'Categories', 'section': 'tv-shows'},
                        {'title': control.lang(32001).encode('utf-8')},
                        allfun, img=IconPath + 'tv_shows.png', fanart=FANART)
    addon.add_directory({'mode': 'search_menu'},
                        {'title': control.lang(32002).encode('utf-8')},
                        allfun, img=IconPath + 'search.png', fanart=FANART)

    downloads = True if control.setting('downloads') == 'true' and (
            len(control.listDir(control.setting('movie.download.path'))[0]) > 0 or
            len(control.listDir(control.setting('tv.download.path'))[0]) > 0) else False
    if downloads:
        addon.add_directory({'mode': 'downloadlist'}, {'title': control.lang(32003).encode('utf-8')},
                            allfun, img=IconPath + 'downloads.png', fanart=FANART)

    if control.setting('eztv_menu') == 'true':
        addon.add_directory({'mode': 'eztv'}, {'title': 'EZTV TV Shows'}, allfun,
                            img=IconPath + 'eztv.png', fanart=FANART)

    addon.add_directory({'mode': 'settings'}, {'title': control.lang(32004).encode('utf-8')},
                        allfun, img=IconPath + 'tools.png', fanart=FANART, is_folder=False)
    addon.add_directory({'mode': 'setviews'}, {'title': control.lang(32005).encode('utf-8')},
                        allfun, img=IconPath + 'set_view.png', fanart=FANART)

    # addon.add_directory({'mode': 'help'}, {'title': control.lang(32006).encode('utf-8')},
    #                     [(control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)')],
    #                     img=IconPath + 'github.png', fanart=FANART, is_folder=False)
    addon.add_directory({'mode': 'forceupdate'},
                        {'title': '[COLOR gold][B]Version: [COLOR lime]%s[/COLOR][/B]' % version},
                        allfun, img=ICON, fanart=FANART, is_folder=False)

    control.content(int(sys.argv[1]), 'addons')
    control.directory(int(sys.argv[1]))
    view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
def downloads_root():
    movie_downloads = control.setting('movie.download.path')
    tv_downloads = control.setting('tv.download.path')
    cm = [(control.lang(32007).encode('utf-8'),
           'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)'),
          (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)')]
    if len(control.listDir(movie_downloads)[0]) > 0:
        item = control.item(label='Movies')
        item.addContextMenuItems(cm)
        item.setArt({'icon': IconPath + 'movies.png', 'fanart': FANART})
        xbmcplugin.addDirectoryItem(int(sys.argv[1]), movie_downloads, item, True)

    if len(control.listDir(tv_downloads)[0]) > 0:
        item = control.item(label='Tv Shows')
        item.addContextMenuItems(cm)
        item.setArt({'icon': IconPath + 'tv_shows.png', 'fanart': FANART})
        xbmcplugin.addDirectoryItem(int(sys.argv[1]), tv_downloads, item, True)

    control.content(int(sys.argv[1]), 'videos')
    control.directory(int(sys.argv[1]))
    view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
    def root(self):
        if control.is_globosat_available() or control.is_globoplay_available():
            self.add_directory_item(32001, 'liveChannels', 'live.png', 'live.png')
            self.add_directory_item(32002, 'vodChannels', 'ondemand.png', 'ondemand.png')
        else:
            self.add_directory_item(32005, 'settings', 'tools.png', 'tools.png')

        if control.is_globosat_available():
            self.add_directory_item(32080, 'featured', 'featured.png', 'featured.png')
            self.add_directory_item(32090, 'favorites', 'favorites.png', 'favorites.png')
            self.add_directory_item(32095, 'watchlater', 'userlists.png', 'userlists.png')
            self.add_directory_item(32096, 'watchhistory', 'years.png', 'years.png')

        if control.is_globosat_available() or control.is_globoplay_available():
            self.add_directory_item(32010, 'searchMenu', 'search.png', 'search.png')

        # control.addSortMethod(int(sys.argv[1]), control.SORT_METHOD_LABEL_IGNORE_FOLDERS)

        control.content(syshandle, 'files')

        self.end_directory()
Exemple #25
0
    def get_program_dates(self, program_id, poster=None, provider='globoplay'):
        days = globoplay.Indexer().get_program_dates(program_id)

        if days is None or len(days) == 0:
            control.idle()
            sys.exit()

        sysaddon = sys.argv[0]
        syshandle = int(sys.argv[1])

        for day in days:
            label = day
            meta = {}
            meta.update({'mediatype': 'video'})
            meta.update({'overlay': 6})
            meta.update({'title': label})
            meta.update({'date': day})

            url = '%s?action=openvideos&provider=%s&program_id=%s&date=%s' % (
                sysaddon, provider, program_id, day)

            item = control.item(label=label)

            art = {'poster': poster}
            item.setArt(art)

            # item.setProperty('Fanart_Image', GLOBO_FANART)

            item.setProperty('IsPlayable', "false")
            item.setInfo(type='video', infoLabels=meta)

            control.addItem(handle=syshandle,
                            url=url,
                            listitem=item,
                            isFolder=True)

        control.addSortMethod(int(sys.argv[1]), control.SORT_METHOD_DATE)

        control.content(syshandle, 'episodes')
        control.directory(syshandle, cacheToDisc=False)
Exemple #26
0
 def views(self):
     try:
         syshandle = int(argv[1])
         control.hide()
         items = [(control.lang(32001), 'movies'),
                  (control.lang(32002), 'tvshows'),
                  (control.lang(32054), 'seasons'),
                  (control.lang(32038), 'episodes')]
         select = control.selectDialog([i[0] for i in items],
                                       control.lang(32049))
         if select == -1: return
         content = items[select][1]
         title = control.lang(32059)
         url = '%s?action=tools_addView&content=%s' % (argv[0], content)
         poster, banner, fanart = control.addonPoster(
         ), control.addonBanner(), control.addonFanart()
         try:
             item = control.item(label=title, offscreen=True)
         except:
             item = control.item(label=title)
         item.setInfo(type='video', infoLabels={'title': title})
         item.setArt({
             'icon': poster,
             'thumb': poster,
             'poster': poster,
             'fanart': fanart,
             'banner': banner
         })
         item.setProperty('IsPlayable', 'false')
         control.addItem(handle=syshandle,
                         url=url,
                         listitem=item,
                         isFolder=False)
         control.content(syshandle, content)
         control.directory(syshandle, cacheToDisc=True)
         from resources.lib.modules import views
         views.setView(content, {})
     except:
         log_utils.error()
         return
Exemple #27
0
    def list(self, url):
        html = client.request(url)
        data = json.loads(html)
        sortedData = sorted(data['items'], key=lambda d: int(d['episode']), reverse=True)

        for item in sortedData:
            url = self.embedUri % (item['id'])
            if 'retina_image' in item['images']:
                icon = item['images']['retina_image']
            else:
                icon = item['images']['nonretina_image']

            if 'synopsis' in item:
                info = item['synopsis']
            else:
                info = 'N/A'

            self.addDir(item['seriesTitle'], info, url, 'playDutchShow', icon, False)

        control.content(syshandle, 'episodes')
        control.directory(syshandle, cacheToDisc=True)
        views.setView('episodes', {'skin.estuary': 55, 'skin.confluence': 50})
def eztv_calendar(url):
    html = client.request(url)
    tables = client.parseDOM(html, 'table', attrs={'class': 'forum_header_border'})[1:]
    for table in tables:
        day = client.parseDOM(table, 'td', attrs={'class': 'forum_thread_header'})[0]
        day = '[B][COLORgold]{}[/B][/COLOR]'.format(day.strip().upper())
        addon.add_item({}, {'title': day}, allfun, img=IconPath + 'eztv.png', fanart=FANART)

        items = client.parseDOM(table, 'tr', attrs={'name': 'hover'})
        items = [i for i in items if 'alt="' in i]
        items = [(client.parseDOM(i, 'a', ret='href')[0],
                  client.parseDOM(i, 'img', ret='src')[0],
                  client.parseDOM(i, 'img', ret='alt')[0]) for i in items if i]
        for page_link, poster, name in items:
            poster = urljoin(eztv_base, poster) if poster.startswith('/') else poster
            page_link = urljoin(eztv_base, page_link) if page_link.startswith('/') else page_link
            addon.add_directory({'mode': 'open_show', 'url': page_link, 'img': poster, 'plot': 'N/A'},
                                {'title': name.encode('utf-8')}, allfun, img=poster, fanart=FANART)

    control.content(int(sys.argv[1]), 'videos')
    control.directory(int(sys.argv[1]))
    view.setView('videos', {'skin.estuary': 55, 'skin.confluence': 500})
Exemple #29
0
def transferList():
	clearfinished = '%s?action=%s' % (sysaddon, 'premiumizeClearFinished')
	item = control.item(label='Clear Finished Transfers')
	control.addItem(handle=syshandle, url=clearfinished, listitem=item, isFolder=False)
	url = urlparse.urljoin(premiumize_Api, premiumizeTransfer) 
	r = reqJson(url)
	r = r['transfers']
	for result in r:
		cm = []
		status = result['status']
		name = result['name'].encode('utf-8')
		name = normalize(name)
		progress = result.get('progress')
		if not status == 'finished': 
			if not progress == '0':
				try:
					progress = re.findall('\.(\d+)', str(progress))[0]
					progress = progress[:2]
				except: progress = ''
				try:
					message = result['message']
					
				except: message = ''								
			label = "[B]" + status.upper() + "[/B] [" + str(progress) + " %] " + message  + " | " + name
		else: label = "[B]" + status.upper() + "[/B] | " + name
		id = result['id']
		type = 'torrent'
		url = '0'
		cm.append(('Delete from Cloud', 'RunPlugin(%s?action=premiumizeDeleteItem&id=%s&type=%s)' % (sysaddon, id, type)))
		item.setArt({'icon': control.icon, 'thumb': control.icon})
		item.setProperty('Fanart_Image', control.addonFanart())
		
		item = control.item(label=label)
		item.addContextMenuItems(cm)
		control.addItem(handle=syshandle, url=url, listitem=item, isFolder=True)
				
	control.content(syshandle, 'addons')
	control.directory(syshandle, cacheToDisc=True)
def Categories(section):  # categories
    sec = r'/category/%s' % section
    #html = response_html(BASE_URL, '96')
    html = cloudflare_mode(BASE_URL)
    # xbmc.log('HTML: %s' % html)
    match = client.parseDOM(html, 'aside', attrs={'id': 'categories-2'})[0]
    items = zip(client.parseDOM(match, 'a'), client.parseDOM(match, 'a', ret='href'))
    items = [(i[0], i[1]) for i in items if sec in i[1] and not 'RSS' in i[0]]
    img = IconPath + 'movies.png' if 'movies' in section else IconPath + 'tv_shows.png'
    if 'movie' in section:
        addon.add_directory({'mode': 'recom', 'url': BASE_URL}, {'title': control.lang(32038).encode('utf-8')},
                            allfun, img=img, fanart=FANART)
        addon.add_directory({'mode': 'foreign', 'url': BASE_URL}, {'title': '[B][COLORgold]Foreign Movies[/COLOR][/B]'},
                            allfun, img=img, fanart=FANART)
    for title, link in items:
        title = '[B][COLORgold]{0}[/COLOR][/B]'.format(title)
        link = client.replaceHTMLCodes(link)
        addon.add_directory({'mode': 'GetTitles', 'section': section, 'url': link, 'startPage': '1', 'numOfPages': '2'},
                            {'title': title}, allfun, img=img, fanart=FANART)

    control.content(int(sys.argv[1]), 'addons')
    control.directory(int(sys.argv[1]))
    view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
Exemple #31
0
    def index(self):
        url = self.baseUrl % (self.mainList)
        html = client.request(url)
        data = json.loads(html)
        sortedData = sorted(data['items'], key=lambda d: d['title'])

        for item in sortedData:
            url = self.baseUrl % (self.showUri % (item['type'], item['id']))
            if 'retina_image' in item['images']:
                icon = item['images']['retina_image']
            else:
                icon = item['images']['nonretina_image']

            if 'synopsis' in item:
                info = item['synopsis']
            else:
                info = 'N/A'

            self.addDir(item['title'], info, url, 'listDutchShow', icon)

        control.content(syshandle, 'tvshows')
        control.directory(syshandle, cacheToDisc=True)
        views.setView('tvshows', {'skin.estuary': control.getSkin(control.setting('tvshows.viewtype')), 'skin.confluence': 500})
Exemple #32
0
def series_menu():
    addon.add_directory(
        {
            'mode': 'scn_genre',
            'url': Baseurl,
            'section': 'tvshows'
        }, {
            'title':
            '[B][COLOR gold]' + Lang(32035).encode('utf-8') + '[/COLOR][/B]'
        },
        allfun,
        img=ART + 'tv_shows.png',
        fanart=FANART)
    addon.add_directory({
        'mode': 'scn_items',
        'url': Baseurl + 'category/tv/'
    }, {'title': Lang(32001).encode('utf-8')},
                        allfun,
                        img=ART + 'tv_shows.png',
                        fanart=FANART)
    control.content(int(sys.argv[1]), 'addons')
    control.directory(int(sys.argv[1]))
    view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
Exemple #33
0
def downloads_root():
    movie_downloads = control.setting('movie.download.path')
    tv_downloads = control.setting('tv.download.path')
    cm = [(control.lang(32007).encode('utf-8'),
           'RunPlugin(plugin://plugin.video.cartoonsgr/?mode=17)'),
          (control.lang(32008).encode('utf-8'),
           'RunPlugin(plugin://plugin.video.cartoonsgr/?mode=9)')]
    if len(control.listDir(movie_downloads)[0]) > 0:
        item = control.item(label='Movies')
        item.addContextMenuItems(cm)
        item.setArt({'icon': ART + 'movies.jpg', 'fanart': FANART})
        xbmcplugin.addDirectoryItem(int(sys.argv[1]), movie_downloads, item,
                                    True)

    if len(control.listDir(tv_downloads)[0]) > 0:
        item = control.item(label='Tv Shows')
        item.addContextMenuItems(cm)
        item.setArt({'icon': ART + 'tvshows.jpg', 'fanart': FANART})
        xbmcplugin.addDirectoryItem(int(sys.argv[1]), tv_downloads, item, True)

    control.content(int(sys.argv[1]), 'videos')
    control.directory(int(sys.argv[1]))
    views.selectView('movies', 'movie-view')
    def get_fighters(self, letter):
        fighters = cache.get(globosat.Indexer().get_fighters, 1, letter)

        sysaddon = sys.argv[0]
        syshandle = int(sys.argv[1])

        for fighter in fighters:

            label = fighter['title']
            slug = fighter['slug']
            thumb = fighter['thumb'] if 'thumb' in fighter else None

            meta = {
                'mediatype': 'episode',
                'overlay': 6,
                'title': label,
                'slug': slug,
                'url': fighter['url']
            }

            url = '%s?action=openfighter&slug=%s' % (sysaddon, slug)

            item = control.item(label=label)

            art = {'icon': thumb, 'thumb': thumb, 'fanart': thumb, 'poster': thumb, 'banner': thumb, 'landscape': thumb }

            item.setProperty('Fanart_Image', thumb)

            item.setArt(art)
            item.setProperty('IsPlayable', "false")
            item.setInfo(type='video', infoLabels=meta)

            control.addItem(handle=syshandle, url=url, listitem=item, isFolder=True)

        control.addSortMethod(int(sys.argv[1]), control.SORT_METHOD_LABEL_IGNORE_FOLDERS)
        control.content(syshandle, 'episodes')
        control.directory(syshandle, cacheToDisc=False)
	def browse_user_cloud(self, folder):
		sysaddon = sys.argv[0]
		syshandle = int(sys.argv[1])
		extensions = supported_video_extensions()
		torrent_folder = json.loads(folder)
		links = torrent_folder['links']
		links = [i for i in links if i['filename'].lower().endswith(tuple(extensions))]
		status_code = torrent_folder['statusCode'] 
		file_str, downloadMenu, deleteMenu = control.lang(40047).upper(), control.lang(40048), control.lang(40050)

		for count, item in enumerate(links, 1):
			try:
				cm = []
				url_link = item['link']
				# name = clean_file_name(item['filename']).upper()
				name = item['filename']
				size = item['size']
				display_size = float(int(size))/1073741824
				label = '%02d | [B]%s[/B] | %.2f GB | [I]%s [/I]' % (count, file_str, display_size, name)
				if status_code == 4:
					url = '%s?action=playURL&url=%s&caller=alldebrid&type=unrestrict' % (sysaddon, url_link)
				else:
					url = ''
				cm.append((downloadMenu, 'RunPlugin(%s?action=download&name=%s&image=%s&url=%s&caller=alldebrid)' %
								(sysaddon, quote_plus(name), quote_plus(ad_icon), url_link)))
				item = control.item(label=label)
				item.addContextMenuItems(cm)
				item.setArt({'icon': ad_icon, 'poster': ad_icon, 'thumb': ad_icon, 'fanart': addonFanart, 'banner': ad_icon})
				item.setInfo(type='video', infoLabels='')
				video_streaminfo = {'codec': 'h264'}
				item.addStreamInfo('video', video_streaminfo)
				control.addItem(handle=syshandle, url=url, listitem=item, isFolder=False)
			except:
				log_utils.error()
				pass
		control.content(syshandle, 'files')
		control.directory(syshandle, cacheToDisc=True)
Exemple #36
0
	def addDirectory(self, items, queue=False):
		control.playlist.clear()
		if not items: # with reuselanguageinvoker on an empty directory must be loaded, do not use sys.exit()
			control.hide() ; control.notification(title=32002, message=33049)
		sysaddon, syshandle = argv[0], int(argv[1])
		addonThumb = control.addonThumb()
		artPath = control.artPath()
		queueMenu, playRandom, addToLibrary = control.lang(32065), control.lang(32535), control.lang(32551)
		for i in items:
			try:
				name = i['name']
				if i['image'].startswith('http'): thumb = i['image']
				elif artPath: thumb = control.joinPath(artPath, i['image'])
				else: thumb = addonThumb
				icon = i.get('icon', 0)
				if not icon: icon = 'DefaultFolder.png'
				url = '%s?action=%s' % (sysaddon, i['action'])
				try: url += '&url=%s' % quote_plus(i['url'])
				except: pass
				cm = []
				cm.append((playRandom, 'RunPlugin(%s?action=play_Random&rtype=show&url=%s)' % (sysaddon, quote_plus(i['url']))))
				if queue: cm.append((queueMenu, 'RunPlugin(%s?action=playlist_QueueItem)' % sysaddon))
				try:
					if control.setting('library.service.update') == 'true':
						cm.append((addToLibrary, 'RunPlugin(%s?action=library_tvshowsToLibrary&url=%s&name=%s)' % (sysaddon, quote_plus(i['context']), name)))
				except: pass
				cm.append(('[COLOR red]Venom Settings[/COLOR]', 'RunPlugin(%s?action=tools_openSettings)' % sysaddon))
				item = control.item(label=name, offscreen=True)
				item.setProperty('IsPlayable', 'false')
				item.setArt({'icon': icon, 'poster': thumb, 'thumb': thumb, 'fanart': control.addonFanart(), 'banner': thumb})
				item.addContextMenuItems(cm)
				control.addItem(handle=syshandle, url=url, listitem=item, isFolder=True)
			except:
				from resources.lib.modules import log_utils
				log_utils.error()
		control.content(syshandle, 'addons')
		control.directory(syshandle, cacheToDisc=True)
def recommended_movies(url):
    try:
        r = response_html(url, '8')
        # r = cloudflare_mode(url)
        r = client.parseDOM(r, 'li', attrs={'id': 'text-\d+'})[-1]
        items = zip(client.parseDOM(r, 'a', ret='href'),
                    client.parseDOM(r, 'img', ret='src'))

        for item in items:
            movieUrl = urlparse.urljoin(BASE_URL, item[0]) if not item[0].startswith('http') else item[0]
            name = movieUrl.split('/')[-1] if not movieUrl.endswith('/') else movieUrl[:-1].split('/')[-1]
            name = re.sub('-|\.', ' ', name)

            if 'search' in movieUrl:
                query = name.split('?s=')[1]
                query = query.replace('.', '+')
                action = {'mode': 'search_bb', 'url': query}
            else:
                action = {'mode': 'GetLinks', 'section': section, 'url': movieUrl, 'img': item[1], 'plot': 'N/A'}

            name = '[B][COLORgold]{0}[/COLOR][/B]'.format(name.encode('utf-8'))
            addon.add_directory(action, {'title': name, 'plot': 'N/A'},
                                [(control.lang(32007).encode('utf-8'),
                                  'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)',),
                                 (control.lang(32008).encode('utf-8'),
                                  'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)',),
                                 (control.lang(32009).encode('utf-8'),
                                  'RunPlugin(plugin://plugin.video.releaseBB/?mode=setviews)',)],
                                img=item[1], fanart=FANART)

    except BaseException:
        control.infoDialog(
            control.lang(32011).encode('utf-8'), NAME, ICON, 5000)

    control.content(int(sys.argv[1]), 'movies')
    control.directory(int(sys.argv[1]))
    view.setView('movies', {'skin.estuary': 55, 'skin.confluence': 500})
Exemple #38
0
    def channelDirectory(self, items):
        if items == None or len(items) == 0: control.idle() ; sys.exit()

        sysaddon = sys.argv[0]

        syshandle = int(sys.argv[1])

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()

        addonFanart, settingFanart = control.addonFanart(), control.setting('fanart')

        try: isOld = False ; control.item().getArt('type')
        except: isOld = True

        isPlayable = 'true' if not 'plugin' in control.infoLabel('Container.PluginName') else 'false'

        playbackMenu = control.lang(32063).encode('utf-8') if control.setting('hosts.mode') == '2' else control.lang(32064).encode('utf-8')

        queueMenu = control.lang(32065).encode('utf-8')

        refreshMenu = control.lang(32072).encode('utf-8')


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

                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                meta.update({'code': imdb, 'imdbnumber': imdb, 'imdb_id': imdb})
                meta.update({'tmdb_id': tmdb})
                meta.update({'mediatype': 'movie'})
                meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, sysname)})
                #meta.update({'trailer': 'plugin://script.extendedinfo/?info=playtrailer&&id=%s' % imdb})
                meta.update({'playcount': 0, 'overlay': 6})
                try: meta.update({'genre': cleangenre.lang(meta['genre'], self.lang)})
                except: pass

                sysmeta = urllib.quote_plus(json.dumps(meta))


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


                cm = []

                cm.append((queueMenu, 'RunPlugin(%s?action=queueItem)' % sysaddon))

                cm.append((refreshMenu, 'RunPlugin(%s?action=refresh)' % sysaddon))

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

                if isOld == True:
                    cm.append((control.lang2(19033).encode('utf-8'), 'Action(Info)'))


                item = control.item(label=label)

                art = {}

                if 'poster2' in i and not i['poster2'] == '0':
                    art.update({'icon': i['poster2'], 'thumb': i['poster2'], 'poster': i['poster2']})
                elif 'poster' in i and not i['poster'] == '0':
                    art.update({'icon': i['poster'], 'thumb': i['poster'], 'poster': i['poster']})
                else:
                    art.update({'icon': addonPoster, 'thumb': addonPoster, 'poster': addonPoster})

                art.update({'banner': addonBanner})

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

                item.setArt(art)
                item.addContextMenuItems(cm)
                item.setProperty('IsPlayable', isPlayable)
                item.setInfo(type='Video', infoLabels = meta)

                video_streaminfo = {'codec': 'h264'}
                item.addStreamInfo('video', video_streaminfo)

                control.addItem(handle=syshandle, url=url, listitem=item, isFolder=False)
            except:
                pass

        control.content(syshandle, 'files')
        control.directory(syshandle, cacheToDisc=True)
 def endDirectory(self):
     control.content(syshandle, 'addons')
     control.directory(syshandle, cacheToDisc=True)
Exemple #40
0
def episodeCategory():
    control.content(int(sys.argv[1]), 'episodes')
    control.directory(int(sys.argv[1]), cacheToDisc=True)
Exemple #41
0
    def tvshowDirectory(self, items):
        if items == None or len(items) == 0: return

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

        traktCredentials = trakt.getTraktCredentialsInfo()

        indicators = playcount.getTVShowIndicators()

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

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


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


                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
                try: meta.update({'genre': cleangenre.lang(meta['genre'], self.lang)})
                except: pass
                sysmeta = urllib.quote_plus(json.dumps(meta))


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


                try:
                    overlay = int(playcount.getTVShowOverlay(indicators, tvdb))
                    if overlay == 7: meta.update({'playcount': 1, 'overlay': 7})
                    else: meta.update({'playcount': 0, 'overlay': 6})
                except:
                    pass


                cm = []

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

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

                cm.append((control.lang(30242).encode('utf-8'), 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, sysname)))
                cm.append((control.lang(30233).encode('utf-8'), 'Action(Info)'))
                cm.append((control.lang(30234).encode('utf-8'), 'RunPlugin(%s?action=tvPlaycount&name=%s&imdb=%s&tvdb=%s&query=7)' % (sysaddon, systitle, imdb, tvdb)))
                cm.append((control.lang(30235).encode('utf-8'), 'RunPlugin(%s?action=tvPlaycount&name=%s&imdb=%s&tvdb=%s&query=6)' % (sysaddon, systitle, imdb, tvdb)))
                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.estuary': 54, 'skin.confluence': 500})
    def addItem(self, title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta):
        try:
            if 'super.fav' in control.infoLabel('Container.PluginName'):
                return control.dialog.ok('Exodus', control.lang(30518).encode('utf-8'), '', '')

            self.sources = self.getSources(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered)
            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(' '))

            trailerMenu = control.lang(30516).encode('utf-8') if tvshowtitle == None else control.lang(30517).encode('utf-8')

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

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

            meta = json.loads(meta)

            try: del meta['year']
            except: pass

            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()

            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 = urllib.quote_plus('%s (%s)' % (title, year) if tvshowtitle == None or season == None or episode == None else tvshowtitle)
            sysimage, sysaddon = urllib.quote_plus(poster), sys.argv[0]

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

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

                    label = self.sources[i]['label']

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

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

                    cm = []
                    cm.append((control.lang(30504).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon))

                    if downloads == True:
                        cm.append((control.lang(30505).encode('utf-8'), 'RunPlugin(%s?action=download&name=%s&image=%s&source=%s)' % (sysaddon, systitle, sysimage, syssource)))

                    cm.append((trailerMenu, 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, sysname)))
                    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.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]), 'files')
            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
    def addItem(self, title):
        control.playlist.clear()

        items = control.window.getProperty(self.itemProperty)
        items = json.loads(items)

        if items == None or len(items) == 0: control.idle() ; sys.exit()

        meta = control.window.getProperty(self.metaProperty)
        meta = json.loads(meta)

        sysaddon = sys.argv[0]

        syshandle = int(sys.argv[1])

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


        if 'tvshowtitle' in meta and 'season' in meta and 'episode' in meta:
            name = '%s S%02dE%02d' % (title, int(meta['season']), int(meta['episode']))
        elif 'year' in meta:
            name = '%s (%s)' % (title, meta['year'])
        else:
            name = title

        systitle = urllib.quote_plus(title.encode('utf-8'))

        sysname = urllib.quote_plus(name.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()

        sysimage = urllib.quote_plus(poster.encode('utf-8'))

        downloadMenu = control.lang(32403).encode('utf-8')


        for i in range(len(items)):
            try:
                label = items[i]['label']

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

                sysurl = '%s?action=playItem&title=%s&source=%s' % (sysaddon, systitle, syssource)

                cm = []

                if downloads == True:
                    cm.append((downloadMenu, 'RunPlugin(%s?action=download&name=%s&image=%s&source=%s)' % (sysaddon, sysname, sysimage, syssource)))

                item = control.item(label=label)

                item.setArt({'icon': thumb, 'thumb': thumb, 'poster': poster, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})

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

                item.addContextMenuItems(cm)
                item.setInfo(type='Video', infoLabels = meta)

                control.addItem(handle=syshandle, url=sysurl, listitem=item, isFolder=False)
            except:
                pass

        control.content(syshandle, 'files')
        control.directory(syshandle, cacheToDisc=True)
    def episode_directory(self, items):
        if items is None or len(items) == 0:
            return
        sysaddon = sys.argv[0]
        addon_poster = addon_banner = control.addonInfo('icon')
        addon_fanart = control.addonInfo('fanart')

        if self.fanart is None:
            self.fanart = addon_fanart

        mode = 'episodes'
        for i in items:
            # try:
                tvshowtitle = i['title']
                if tvshowtitle is None: tvshowtitle = i['label']
                episode_id = i['episode_id']
                anime_id = i['anime_id']
                duration = i['duration']
                if duration is 0 or duration is None: duration = 24

                url = '%s?action=play' % sysaddon
                try:
                    url += '&anime_id=%s&episode_id=%s' % (anime_id, episode_id)
                except:
                    pass

                plot = i['plot']
                if plot is u'' or plot is None: plot = "No overview of episode available at this time."

                season = i['season']
                if season is 0 or season is None: season = 1

                episode = i['episode']
                if i['fanart'] is not None:
                    fanart = self.fanarturl % i['fanart']
                else:
                    fanart = addon_fanart

                if i['poster'] is not None:
                    poster = self.thumbnailurl % i['poster']
                else:
                    poster = addon_poster
                premiered = i['premiered']

                iswatched = Watched().watched(anime_id, episode_id)

                if iswatched:
                    overlay = 7
                    playcount = 1
                else:
                    overlay = 6
                    playcount = 0

                item = control.item(label=tvshowtitle)

                try:
                    item.setArt({'poster': poster})
                except:
                    pass
                try:
                    item.setInfo(type='Video', infoLabels={
                        'Plot': plot, 'Year': premiered, 'premiered': premiered, 'overlay': overlay,
                        'playcount': playcount, 'episode': episode, 'duration': duration, 'season': season,
                        'title': tvshowtitle
                    })
                except:
                    pass

                item.setProperty('Fanart_Image', fanart)
                # item.setProperty('IsPlayable', 'true')

                item.setProperty('startoffset', '0')
                item.setProperty('resumetime', '0')
                item.setProperty('totaltime', '1')

                item.addStreamInfo('video', {'codec': 'h264', 'width': 1280, 'height': 720, 'aspect': round(128 / 720)})
                item.addStreamInfo('audio', {'codec': 'aac', 'language': 'en', 'channels': 2})

                cm = []
                if iswatched:
                    cm.append(('Unmark as Watched', 'RunPlugin(%s?action=watched&anime_id=%s&episode_id=%s&unmark=True)' % (
                        sysaddon, anime_id, episode_id)))
                else:
                    cm.append(('Mark as Watched', 'RunPlugin(%s?action=watched&anime_id=%s&episode_id=%s)' % (
                        sysaddon, anime_id, episode_id)))
                item.addContextMenuItems(cm)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False)
            # except:
            #     pass
        control.content(int(sys.argv[1]), mode)
        control.directory(int(sys.argv[1]), cacheToDisc=True)
        views.setView('episodes', {'skin.confluence': 504})
Exemple #45
0
    def addDirectory(self, items, queue=False):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        addonPoster = addonBanner = control.addonInfo('icon')
        addonFanart = control.addonInfo('fanart')

        playlist = control.playlist
        if not queue == False: playlist.clear()

        try: devmode = True if 'testings.xml' in control.listDir(control.dataPath)[1] else False
        except: devmode = False

        mode = [i['content'] for i in items if 'content' in i]
        if 'movies' in mode: mode = 'movies'
        elif 'tvshows' in mode: mode = 'tvshows'
        elif 'seasons' in mode: mode = 'seasons'
        elif 'episodes' in mode: mode = 'episodes'
        elif 'addons' in mode: mode = 'addons'
        else: mode = 'videos'

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

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

                if i['action'] == 'plugin' and 'url' in i: url = i['url']

                try: devurl = dict(urlparse.parse_qsl(urlparse.urlparse(url).query))['action']
                except: devurl = None
                if devurl == 'developer' and not devmode == True: raise Exception()

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

                content = i['content'] if 'content' in i else '0'

                folder = i['folder'] if 'folder' in i else True

                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')

                cm = []

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

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

                if (folder == False and not '|regex=' in str(i.get('url'))) or (folder == True and content in ['tvshows', 'seasons']):
                    cm.append((control.lang(30723).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon))

                if content == 'movies':
                    try: dfile = '%s (%s)' % (i['title'], i['year'])
                    except: dfile = name
                    try: cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(dfile), urllib.quote_plus(i['url']), urllib.quote_plus(poster))))
                    except: pass
                elif content == 'episodes':
                    try: dfile = '%s S%02dE%02d' % (i['tvshowtitle'], int(i['season']), int(i['episode']))
                    except: dfile = name
                    try: cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(dfile), urllib.quote_plus(i['url']), urllib.quote_plus(poster))))
                    except: pass
                elif content == 'songs':
                    try: cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(name), urllib.quote_plus(i['url']), urllib.quote_plus(poster))))
                    except: pass

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

                if devmode == True:
                    try: cm.append(('Open in browser', 'RunPlugin(%s?action=browser&url=%s)' % (sysaddon, urllib.quote_plus(i['url']))))
                    except: pass


                item = control.item(label=name, 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 not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                if queue == False:
                    item.setInfo(type='Video', infoLabels = meta)
                    item.addContextMenuItems(cm)
                    control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=folder)
                else:
                    item.setInfo(type='Video', infoLabels = meta)
                    playlist.add(url=url, listitem=item)
            except:
                pass

        if not queue == False:
            return control.player.play(playlist)

        try:
            i = items[0]
            if i['next'] == '': raise Exception()
            url = '%s?action=%s&url=%s' % (sysaddon, i['nextaction'], urllib.quote_plus(i['next']))
            item = control.item(label=control.lang(30500).encode('utf-8'))
            item.setArt({'addonPoster': addonPoster, 'thumb': addonPoster, 'poster': addonPoster, 'tvshow.poster': addonPoster, 'season.poster': addonPoster, 'banner': addonPoster, 'tvshow.banner': addonPoster, 'season.banner': addonPoster})
            item.setProperty('addonFanart_Image', addonFanart)
            control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
        except:
            pass

        if not mode == None: control.content(int(sys.argv[1]), mode)
        control.directory(int(sys.argv[1]), cacheToDisc=True)
        if mode in ['movies', 'tvshows', 'seasons', 'episodes']:
            views.setView(mode, {'skin.estuary': 55})
    def movieDirectory(self, items):
        if items == None or len(items) == 0: control.idle() ; sys.exit()

        sysaddon = sys.argv[0]

        syshandle = int(sys.argv[1])

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()

        addonFanart, settingFanart = control.addonFanart(), control.setting('fanart')

        traktCredentials = trakt.getTraktCredentialsInfo()

        try: isOld = False ; control.item().getArt('type')
        except: isOld = True

        isPlayable = 'true' if not 'plugin' in control.infoLabel('Container.PluginName') else 'false'

        indicators = playcount.getMovieIndicators(refresh=True) if action == 'movies' else playcount.getMovieIndicators()

        playbackMenu = control.lang(32063).encode('utf-8') if control.setting('hosts.mode') == '2' else control.lang(32064).encode('utf-8')

        watchedMenu = control.lang(32068).encode('utf-8') if trakt.getTraktIndicatorsInfo() == True else control.lang(32066).encode('utf-8')

        unwatchedMenu = control.lang(32069).encode('utf-8') if trakt.getTraktIndicatorsInfo() == True else control.lang(32067).encode('utf-8')

        queueMenu = control.lang(32065).encode('utf-8')

        traktManagerMenu = control.lang(32070).encode('utf-8')

        nextMenu = control.lang(32053).encode('utf-8')

        addToLibrary = control.lang(32551).encode('utf-8')

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

                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                meta.update({'code': imdb, 'imdbnumber': imdb, 'imdb_id': imdb})
                meta.update({'tmdb_id': tmdb})
                meta.update({'mediatype': 'movie'})
                meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, urllib.quote_plus(label))})
                #meta.update({'trailer': 'plugin://script.extendedinfo/?info=playtrailer&&id=%s' % imdb})
                if not 'duration' in i: meta.update({'duration': '120'})
                elif i['duration'] == '0': meta.update({'duration': '120'})
                try: meta.update({'duration': str(int(meta['duration']) * 60)})
                except: pass
                try: meta.update({'genre': cleangenre.lang(meta['genre'], self.lang)})
                except: pass

                poster = [i[x] for x in ['poster3', 'poster', 'poster2'] if i.get(x, '0') != '0']
                poster = poster[0] if poster else addonPoster
                meta.update({'poster': poster})

                sysmeta = urllib.quote_plus(json.dumps(meta))

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

                path = '%s?action=play&title=%s&year=%s&imdb=%s' % (sysaddon, systitle, year, imdb)


                cm = []

                cm.append(('Find similar',
                           'ActivateWindow(10025,%s?action=movies&url=https://api.trakt.tv/movies/%s/related,return)' % (
                           sysaddon, imdb)))

                cm.append((queueMenu, 'RunPlugin(%s?action=queueItem)' % sysaddon))

                try:
                    overlay = int(playcount.getMovieOverlay(indicators, imdb))
                    if overlay == 7:
                        cm.append((unwatchedMenu, 'RunPlugin(%s?action=moviePlaycount&imdb=%s&query=6)' % (sysaddon, imdb)))
                        meta.update({'playcount': 1, 'overlay': 7})
                    else:
                        cm.append((watchedMenu, 'RunPlugin(%s?action=moviePlaycount&imdb=%s&query=7)' % (sysaddon, imdb)))
                        meta.update({'playcount': 0, 'overlay': 6})
                except:
                    pass

                if traktCredentials == True:
                    cm.append((traktManagerMenu, 'RunPlugin(%s?action=traktManager&name=%s&imdb=%s&content=movie)' % (sysaddon, sysname, imdb)))

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

                if isOld == True:
                    cm.append((control.lang2(19033).encode('utf-8'), 'Action(Info)'))

                cm.append((addToLibrary, 'RunPlugin(%s?action=movieToLibrary&name=%s&title=%s&year=%s&imdb=%s&tmdb=%s)' % (sysaddon, sysname, systitle, year, imdb, tmdb)))

                item = control.item(label=label)

                art = {}
                art.update({'icon': poster, 'thumb': poster, 'poster': poster})

                if 'banner' in i and not i['banner'] == '0':
                    art.update({'banner': i['banner']})
                else:
                    art.update({'banner': addonBanner})

                if 'clearlogo' in i and not i['clearlogo'] == '0':
                    art.update({'clearlogo': i['clearlogo']})

                if 'clearart' in i and not i['clearart'] == '0':
                    art.update({'clearart': i['clearart']})


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

                item.setArt(art)
                item.addContextMenuItems(cm)
                item.setProperty('IsPlayable', isPlayable)
                item.setInfo(type='Video', infoLabels = meta)

                video_streaminfo = {'codec': 'h264'}
                item.addStreamInfo('video', video_streaminfo)

                control.addItem(handle=syshandle, url=url, listitem=item, isFolder=False)
            except:
                pass

        try:
            url = items[0]['next']
            if url == '': raise Exception()

            icon = control.addonNext()
            url = '%s?action=moviePage&url=%s' % (sysaddon, urllib.quote_plus(url))

            item = control.item(label=nextMenu)

            item.setArt({'icon': icon, 'thumb': icon, 'poster': icon, 'banner': icon})
            if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)

            control.addItem(handle=syshandle, url=url, listitem=item, isFolder=True)
        except:
            pass

        control.content(syshandle, 'movies')
        control.directory(syshandle, cacheToDisc=True)
        views.setView('movies', {'skin.estuary': 55, 'skin.confluence': 500})
Exemple #47
0
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)
Exemple #48
0
    def channelDirectory(self, items):
        if items == None or len(items) == 0:
            control.idle()
            sys.exit()

        sysaddon = sys.argv[0]

        syshandle = int(sys.argv[1])

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()

        addonFanart, settingFanart = control.addonFanart(), control.setting(
            'fanart')

        try:
            isOld = False
            control.item().getArt('type')
        except:
            isOld = True

        isPlayable = 'true' if not 'plugin' in control.infoLabel(
            'Container.PluginName') else 'false'

        playbackMenu = control.lang(32063).encode('utf-8') if control.setting(
            'hosts.mode') == '2' else control.lang(32064).encode('utf-8')

        queueMenu = control.lang(32065).encode('utf-8')

        refreshMenu = control.lang(32072).encode('utf-8')

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

                meta = dict((k, v) for k, v in i.iteritems() if not v == '0')
                meta.update({
                    'code': imdb,
                    'imdbnumber': imdb,
                    'imdb_id': imdb
                })
                meta.update({'tmdb_id': tmdb})
                meta.update({'mediatype': 'movie'})
                meta.update({
                    'trailer':
                    '%s?action=trailer&name=%s' % (sysaddon, sysname)
                })
                #meta.update({'trailer': 'plugin://script.extendedinfo/?info=playtrailer&&id=%s' % imdb})
                meta.update({'playcount': 0, 'overlay': 6})
                try:
                    meta.update(
                        {'genre': cleangenre.lang(meta['genre'], self.lang)})
                except:
                    pass

                sysmeta = urllib.quote_plus(json.dumps(meta))

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

                cm = []

                cm.append(
                    (queueMenu, 'RunPlugin(%s?action=queueItem)' % sysaddon))

                cm.append(
                    (refreshMenu, 'RunPlugin(%s?action=refresh)' % sysaddon))

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

                if isOld == True:
                    cm.append(
                        (control.lang2(19033).encode('utf-8'), 'Action(Info)'))

                item = control.item(label=label)

                art = {}

                if 'poster2' in i and not i['poster2'] == '0':
                    art.update({
                        'icon': i['poster2'],
                        'thumb': i['poster2'],
                        'poster': i['poster2']
                    })
                elif 'poster' in i and not i['poster'] == '0':
                    art.update({
                        'icon': i['poster'],
                        'thumb': i['poster'],
                        'poster': i['poster']
                    })
                else:
                    art.update({
                        'icon': addonPoster,
                        'thumb': addonPoster,
                        'poster': addonPoster
                    })

                art.update({'banner': addonBanner})

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

                item.setArt(art)
                item.addContextMenuItems(cm)
                item.setProperty('IsPlayable', isPlayable)
                item.setInfo(type='Video', infoLabels=meta)

                video_streaminfo = {'codec': 'h264'}
                item.addStreamInfo('video', video_streaminfo)

                control.addItem(handle=syshandle,
                                url=url,
                                listitem=item,
                                isFolder=False)
            except:
                pass

        control.content(syshandle, 'files')
        control.directory(syshandle, cacheToDisc=True)
Exemple #49
0
    def add_directory(self, items, mode=True):
        if items is None or len(items) == 0:
            return

        sysaddon = sys.argv[0]
        addon_poster = addon_banner = control.addonInfo('icon')
        addon_fanart = control.addonInfo('fanart')

        mode = 'episodes'
        for i in items:
            try:
                episode_link = i['episodelink']
                tvshowtitle = i['tvshowtitle']
                anime_id = i['anime_id']
                episode_id = i['episode_id'] if 'episode_id' in i else 0
                if episode_id is 0: continue

                duration = i['duration'] if 'duration' in i else 0
                if duration is 0 or duration is None:
                    duration = 24 * 60
                else:
                    duration = duration * 60


                url = '%s?action=play' % sysaddon
                try:
                    url += '&anime_id=%s&episode_id=%s' % (anime_id, episode_link)
                except:
                    pass

                episodetitle = i['title']
                plot = i['plot']
                if plot is u'' or plot is None: plot = "No overview of episode available at this time."

                season = 1
                episode = i['episode']
                if i['poster'] is not None: poster = self.posterurl % i['poster']
                else: poster = addon_poster
                if i['fanart'] is not None: fanart = self.fanarturl % i['fanart']
                else: fanart = addon_fanart
                premiered = i['premiered']

                genre = [g['name'] for g in i['genre']]
                genre = ' / '.join(genre)

                iswatched = Watched().watched(anime_id, episode_id)
                if iswatched:
                    overlay = 7
                    playcount = 1
                else:
                    overlay = 6
                    playcount = 0

                if episodetitle is not None:
                    label = "%s - %sx%s - %s" % (tvshowtitle, int(season), int(episode), episodetitle)
                else:
                    label = "%s - %sx%s" % (tvshowtitle, int(season), int(episode))

                item = control.item(label=label)

                try:
                    item.setArt({'poster': poster, 'fanart': fanart})
                    item.setInfo(type='Video', infoLabels={
                        'Plot': plot, 'Year': premiered, 'premiered': premiered, 'overlay': overlay,
                        'playcount': playcount, 'episode': episode, 'duration': duration, 'genre': genre,
                    })
                except:
                    pass

                item.setProperty('Fanart_Image', fanart)
                # item.setProperty('Video', 'true')
                # item.setProperty('IsPlayable', 'true')

                item.setProperty('startoffset', '0')
                item.setProperty('resumetime', '0')
                item.setProperty('totaltime', '1')

                item.addStreamInfo('video', {'codec': 'h264', 'width': 1280, 'height': 720, 'aspect': round(128 / 720)})
                item.addStreamInfo('audio', {'codec': 'aac', 'language': 'en', 'channels': 2})

                cm = []
                cm.append(
                    ('Browse anime', 'Container.Update(%s?action=get_episodes&anime_id=%s)' % (sysaddon, anime_id)))

                if iswatched:
                    cm.append(
                        ('Unmark as Watched', 'RunPlugin(%s?action=watched&anime_id=%s&episode_id=%s&unmark=True)' % (
                            sysaddon, anime_id, episode_id)))
                else:
                    cm.append(('Mark as Watched', 'RunPlugin(%s?action=watched&anime_id=%s&episode_id=%s)' % (
                        sysaddon, anime_id, episode_id)))
                item.addContextMenuItems(cm)

                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False)
            except:
                pass
        control.directory(int(sys.argv[1]), cacheToDisc=True)
        control.content(int(sys.argv[1]), mode)
        views.setView('episodes', {'skin.confluence': 504})
    def add_directory(self, items, stype=[], sort=0, status=0, sgenre=[], offset=0):
        if items is None or len(items) == 0:
            return
        print items

        sysaddon = sys.argv[0]
        addon_poster = addon_banner = control.addonInfo('icon')
        addon_fanart = control.addonInfo('fanart')

        # from resources.lib.modules import playcount
        # indicators = playcount.getTVShowIndicators(refresh=True)

        mode = 'tvshows'
        for i in items:
            # try:
            tvshowtitle = i['title']
            anime_id = i['anime_id']
            if anime_id is None: continue
            duration = i['duration']
            if duration is 0 or duration is None:
                duration = 24 * 60
            else:
                duration = duration * 60
            anime_id = i['anime_id']

            animetype = int(i['type'])

            if animetype is 2:
                episode_id = 0
                try:
                    episode_id = i['episodes'].keys()[0]
                except:
                    pass
                if episode_id is 0: continue

                url = '%s?action=play' % sysaddon
                try:
                    url += '&anime_id=%s&episode_id=%s' % (anime_id, episode_id)
                except:
                    pass
            else:
                url = '%s?action=get_episodes' % sysaddon
                try:
                    url += '&anime_id=%s' % anime_id
                except:
                    pass

            plot = i['plot']
            if plot is u'' or plot is None: plot = "No overview of episode available at this time."

            episode = len(i['episodes'])
            rating = i['rating']
            if rating is None or rating is 0: rating = 0.1
            genre = i['genre']

            if len(i['fanart']) > 0:
                fanart = i['fanart'][random.randint(0, len(i['fanart']) - 1)]
                fanart = self.fanarturl % fanart
            else:
                fanart = addon_fanart
            if i['poster'] is not None:
                poster = self.posterurl % i['poster']
            else:
                poster = addon_poster

            premiered = i['premiered']

            num_watched = Watched().watched(anime_id)

            # tvdb = i['tvdb']
            # if tvdb is not 0:
            # print playcount.getTVShowOverlay(indicators, str(tvdb))
            # print "%s, %s" % (tvdb, trakt.getTraktShowID(tvdb))
            # except: pass


            if num_watched is None: num_watched = 0
            if episode is None: episode = 0
            # print "%s, %s" % (episode, num_watched)
            iswatched = True if num_watched == episode else False
            if iswatched:
                overlay = 7
                pcount = 1
            else:
                overlay = 6
                pcount = 0

            item = control.item(label=tvshowtitle)

            try:
                item.setArt({'poster': poster, 'thumb': poster})
                item.setInfo(type='Video', infoLabels={
                    'Plot': plot, 'Year': premiered, 'premiered': premiered, 'episode': episode,
                    'duration': duration,
                    'genre': genre, 'rating': rating, 'overlay': overlay, 'playcount': pcount
                })

            except:
                pass

            if animetype is 2:
                item.addStreamInfo('video',
                                   {'codec': 'h264', 'width': 1280, 'height': 720, 'aspect': round(128 / 720)})
                item.addStreamInfo('audio', {'codec': 'aac', 'language': 'en', 'channels': 2})
                item.setProperty('IsPlayable', 'true')

            item.setProperty('Fanart_Image', fanart)
            item.setProperty('WatchedEpisodes', str(num_watched))
            item.setProperty('UnWatchedEpisodes', str(episode - num_watched))
            cm = []
            cm.append(("Show Information", 'Action(Info)'))
            if iswatched:
                cm.append(('Unmark Show as Watched',
                           'RunPlugin(%s?action=watched&anime_id=%s&episode_id=%s&unmark=True)' % (
                               sysaddon, anime_id, -999)))
            else:
                cm.append(('Mark Show as Watched',
                           'RunPlugin(%s?action=watched&anime_id=%s&episode_id=%s)' % (
                               sysaddon, anime_id, -999)))

            if Favorites().is_favorite(anime_id):
                cm.append(('Remove from Favorite Anime List',
                           'RunPlugin(%s?action=remove_favorite&anime_id=%s)' % (sysaddon, anime_id)))
            else:
                cm.append(('Add to Favorite Anime List',
                           'RunPlugin(%s?action=add_favorite&anime_id=%s)' % (sysaddon, anime_id)))

            item.addContextMenuItems(cm)

            control.addItem(handle=int(sys.argv[1]), url=url, listitem=item,
                            isFolder=False if animetype is 2 else True)
            # control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False)
            # except:
            #     pass

        if int(offset) + self.itemsperpage < self.totalitems:
            item = control.item(label="Next Page")
            url = '%s?action=get_by_select' % sysaddon
            url += '&stype=%s&sort=%s&status=%s&genre=%s&offset=%s' % (
                stype, sort, status, sgenre, (int(offset) + self.itemsperpage))

            item.setArt({'poster': addon_poster, 'fanart': addon_fanart})
            control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)

        control.directory(int(sys.argv[1]), cacheToDisc=True)
        control.content(int(sys.argv[1]), mode)
        views.setView('tvshows', {'skin.confluence': 504})
Exemple #51
0
    def movieDirectory(self, items):
        if items == None or len(items) == 0: return

        isFolder = True if control.setting('autoplay') == 'false' and control.setting('hosts.mode') == '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')

        traktCredentials = trakt.getTraktCredentialsInfo()

        indicators = playcount.getMovieIndicators()

        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]

        for i in items:
            try:
                label = '%s (%s)' % (i['title'], i['year'])
                imdb, title, year = i['imdb'], i['originaltitle'], i['year']
                sysname = urllib.quote_plus('%s (%s)' % (title, year))
                sysimage = urllib.quote_plus(i['poster'])
                systitle = urllib.quote_plus(title)


                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
                try: meta.update({'genre': cleangenre.lang(meta['genre'], self.lang)})
                except: pass
                try: del meta['tagline']
                except: pass
                sysmeta = urllib.quote_plus(json.dumps(meta))


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

                path = '%s?action=play&title=%s&year=%s&imdb=%s' % (sysaddon, systitle, year, imdb)

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


                try:
                    overlay = int(playcount.getMovieOverlay(indicators, imdb))
                    if overlay == 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)))

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

                if traktCredentials == True:
                    cm.append((control.lang(30208).encode('utf-8'), 'RunPlugin(%s?action=traktManager&name=%s&imdb=%s&content=movie)' % (sysaddon, sysname, imdb)))

                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)'))
                cm.append((control.lang(30206).encode('utf-8'), 'RunPlugin(%s?action=moviePlaycount&imdb=%s&query=7)' % (sysaddon, imdb)))
                cm.append((control.lang(30207).encode('utf-8'), 'RunPlugin(%s?action=moviePlaycount&imdb=%s&query=6)' % (sysaddon, 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' % (sysaddon, urllib.quote_plus(url))
            addonNext = control.addonNext()
            item = control.item(label=control.lang(30213).encode('utf-8'), iconImage=addonNext, thumbnailImage=addonNext)
            item.addContextMenuItems([], replaceItems=True)
            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')
        control.directory(int(sys.argv[1]), cacheToDisc=cacheToDisc)
        views.setView('movies', {'skin.confluence': 500})
Exemple #52
0
    def listShows(self, catid, page):
        syshandle = int(sys.argv[1])
        limatch = []
        url = self.shows_link % (catid, page)

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

        data = json.loads(result)
        pageContent = data['content'].encode('utf-8')

        # todo: fix pagination
        pages = range(2, 6)

        limatch += re.compile('<figure>(.+?)</a></li>').findall(pageContent)

        for li_content in limatch:
            show = re.compile('program-(.+?)" target.+?src="(.+?)".+?h5>(.+?)</h5').findall(li_content)
            title = show[0][2].decode('utf-8')
            showid = show[0][0]
            image = show[0][1]

            if 'program_pic/program_' in image:
                image = image.replace('../', self.img1)
            else:
                image = image.replace('../', self.img2)
                image = image.replace('program_pic', '')

            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&page=1' % (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)
        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)
                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=syshandle, url=url, listitem=item, isFolder=True)

        control.content(syshandle, 'tvshows')
        control.directory(syshandle, cacheToDisc=True)
        views.setView('tvshows', {'skin.estuary': 500, 'skin.confluence': 500})
 def endDirectory(self):
     control.content(syshandle, 'addons')
     control.directory(syshandle, cacheToDisc=True)
Exemple #54
0
    def movieDirectory(self, items):
        if items == None or len(items) == 0: control.idle() ; sys.exit()

        sysaddon = sys.argv[0]

        syshandle = int(sys.argv[1])

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()

        addonFanart, settingFanart = control.addonFanart(), control.setting('fanart')

        traktCredentials = trakt.getTraktCredentialsInfo()

        try: isOld = False ; control.item().getArt('type')
        except: isOld = True

        isEstuary = True if 'estuary' in control.skin else False

        isPlayable = 'true' if not 'plugin' in control.infoLabel('Container.PluginName') else 'false'

        indicators = playcount.getMovieIndicators(refresh=True) if action == 'movies' else playcount.getMovieIndicators()

        playbackMenu = control.lang(32063).encode('utf-8') if control.setting('hosts.mode') == '2' else control.lang(32064).encode('utf-8')

        watchedMenu = control.lang(32068).encode('utf-8') if trakt.getTraktIndicatorsInfo() == True else control.lang(32066).encode('utf-8')

        unwatchedMenu = control.lang(32069).encode('utf-8') if trakt.getTraktIndicatorsInfo() == True else control.lang(32067).encode('utf-8')

        queueMenu = control.lang(32065).encode('utf-8')

        traktManagerMenu = control.lang(32070).encode('utf-8')

        nextMenu = control.lang(32053).encode('utf-8')


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


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


                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                meta.update({'mediatype': 'movie'})
                #meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, sysname)})
                meta.update({'trailer': 'plugin://script.extendedinfo/?info=playtrailer&&id=%s' % imdb})
                if i['duration'] == '0': meta.update({'duration': '120'})
                try: meta.update({'duration': str(int(meta['duration']) * 60)})
                except: pass
                try: meta.update({'genre': cleangenre.lang(meta['genre'], self.lang)})
                except: pass
                if isEstuary == True:
                    try: del meta['cast']
                    except: pass

                sysmeta = urllib.quote_plus(json.dumps(meta))


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

                path = '%s?action=play&title=%s&year=%s&imdb=%s' % (sysaddon, systitle, year, imdb)


                cm = []

                cm.append((queueMenu, 'RunPlugin(%s?action=queueItem)' % sysaddon))

                try:
                    overlay = int(playcount.getMovieOverlay(indicators, imdb))
                    if overlay == 7:
                        cm.append((unwatchedMenu, 'RunPlugin(%s?action=moviePlaycount&imdb=%s&query=6)' % (sysaddon, imdb)))
                        meta.update({'playcount': 1, 'overlay': 7})
                    else:
                        cm.append((watchedMenu, 'RunPlugin(%s?action=moviePlaycount&imdb=%s&query=7)' % (sysaddon, imdb)))
                        meta.update({'playcount': 0, 'overlay': 6})
                except:
                    pass

                if traktCredentials == True:
                    cm.append((traktManagerMenu, 'RunPlugin(%s?action=traktManager&name=%s&imdb=%s&content=movie)' % (sysaddon, sysname, imdb)))

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

                if isOld == True:
                    cm.append((control.lang2(19033).encode('utf-8'), 'Action(Info)'))


                item = control.item(label=label)

                item.setArt({'icon': poster, 'thumb': poster, 'poster': poster, 'banner': banner})

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

                item.addContextMenuItems(cm)
                item.setProperty('IsPlayable', isPlayable)
                item.setInfo(type='Video', infoLabels = meta)

                control.addItem(handle=syshandle, url=url, listitem=item, isFolder=False)
            except:
                pass

        try:
            url = items[0]['next']
            if url == '': raise Exception()

            icon = control.addonNext()
            url = '%s?action=moviePage&url=%s' % (sysaddon, urllib.quote_plus(url))

            item = control.item(label=nextMenu)

            item.setArt({'icon': icon, 'thumb': icon, 'poster': icon, 'banner': icon})
            if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)

            control.addItem(handle=syshandle, url=url, listitem=item, isFolder=True)
        except:
            pass


        control.content(syshandle, 'movies')
        #control.do_block_check(False)
        control.directory(syshandle, cacheToDisc=True)
        views.setView('movies', {'skin.confluence': 500})
	def channelDirectory(self, items):
		if items == None or len(items) == 0: control.idle() ; sys.exit()

		sysaddon = sys.argv[0]

		syshandle = int(sys.argv[1])

		addonPoster, addonBanner = control.addonPoster(), control.addonBanner()

		addonFanart, settingFanart = control.addonFanart(), tools.Settings.getBoolean('interface.fanart')

		try: isOld = False ; control.item().getArt('type')
		except: isOld = True

		isPlayable = 'true' if not 'plugin' in control.infoLabel('Container.PluginName') else 'false'

		playbackMenu = control.lang(32063).encode('utf-8') if control.setting('playback.automatic.enabled') == 'true' else control.lang(32064).encode('utf-8')

		queueMenu = control.lang(32065).encode('utf-8')

		refreshMenu = control.lang(32072).encode('utf-8')


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

				meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
				meta.update({'mediatype': 'movie'})
				meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, sysname)})
				#meta.update({'trailer': 'plugin://script.extendedinfo/?info=playtrailer&&id=%s' % imdb})
				meta.update({'playcount': 0, 'overlay': 6})
				try: meta.update({'genre': cleangenre.lang(meta['genre'], self.lang)})
				except: pass

				sysmeta = urllib.quote_plus(json.dumps(meta))


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


				cm = []

				cm.append((queueMenu, 'RunPlugin(%s?action=queueItem)' % sysaddon))

				cm.append((refreshMenu, 'RunPlugin(%s?action=refresh)' % sysaddon))

				if not self.kidsOnly() and control.setting('downloads.manual.enabled') == 'true':
					cm.append((control.lang(33585).encode('utf-8'), 'Container.Update(%s?action=downloadsManager)' % (sysaddon)))

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

				if isOld == True:
					cm.append((control.lang2(19033).encode('utf-8'), 'Action(Info)'))


				item = control.item(label=label)

				art = {}

				poster = '0'
				if poster == '0' and 'poster3' in i: poster = i['poster3']
				if poster == '0' and 'poster2' in i: poster = i['poster2']
				if poster == '0' and 'poster' in i: poster = i['poster']

				icon = '0'
				if icon == '0' and 'icon3' in i: icon = i['icon3']
				if icon == '0' and 'icon2' in i: icon = i['icon2']
				if icon == '0' and 'icon' in i: icon = i['icon']

				thumb = '0'
				if thumb == '0' and 'thumb3' in i: thumb = i['thumb3']
				if thumb == '0' and 'thumb2' in i: thumb = i['thumb2']
				if thumb == '0' and 'thumb' in i: thumb = i['thumb']

				banner = '0'
				if banner == '0' and 'banner3' in i: banner = i['banner3']
				if banner == '0' and 'banner2' in i: banner = i['banner2']
				if banner == '0' and 'banner' in i: banner = i['banner']

				fanart = '0'
				if settingFanart:
					if fanart == '0' and 'fanart3' in i: fanart = i['fanart3']
					if fanart == '0' and 'fanart2' in i: fanart = i['fanart2']
					if fanart == '0' and 'fanart' in i: fanart = i['fanart']

				clearlogo = '0'
				if clearlogo == '0' and 'clearlogo' in i: clearlogo = i['clearlogo']

				clearart = '0'
				if clearart == '0' and 'clearart' in i: clearart = i['clearart']

				if poster == '0': poster = addonPoster
				if icon == '0': icon = poster
				if thumb == '0': thumb = poster
				if banner == '0': banner = addonBanner
				if fanart == '0': fanart = addonFanart

				if not poster == '0' and not poster == None: art.update({'poster' : poster})
				if not icon == '0' and not icon == None: art.update({'icon' : icon})
				if not thumb == '0' and not thumb == None: art.update({'thumb' : thumb})
				if not banner == '0' and not banner == None: art.update({'banner' : banner})
				if not clearlogo == '0' and not clearlogo == None: art.update({'clearlogo' : clearlogo})
				if not clearart == '0' and not clearart == None: art.update({'clearart' : clearart})
				if not fanart == '0' and not fanart == None: item.setProperty('Fanart_Image', fanart)

				item.setArt(art)
				item.addContextMenuItems(cm)
				item.setProperty('IsPlayable', isPlayable)
				item.setInfo(type='Video', infoLabels = meta)

				control.addItem(handle=syshandle, url=url, listitem=item, isFolder=False)
			except:
				pass

		control.content(syshandle, 'files')
		control.directory(syshandle, cacheToDisc=True)
Exemple #56
0
    def tvshowDirectory(self, items):
        if items == None or len(items) == 0: control.idle() ; sys.exit()

        sysaddon = sys.argv[0]

        syshandle = int(sys.argv[1])

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()

        addonFanart, settingFanart = control.addonFanart(), control.setting('fanart')

        traktCredentials = trakt.getTraktCredentialsInfo()

        try: isOld = False ; control.item().getArt('type')
        except: isOld = True

        isEstuary = True if 'estuary' in control.skin else False

        indicators = playcount.getTVShowIndicators(refresh=True) if action == 'tvshows' else playcount.getTVShowIndicators()

        watchedMenu = control.lang(32068).encode('utf-8') if trakt.getTraktIndicatorsInfo() == True else control.lang(32066).encode('utf-8')

        unwatchedMenu = control.lang(32069).encode('utf-8') if trakt.getTraktIndicatorsInfo() == True else control.lang(32067).encode('utf-8')

        queueMenu = control.lang(32065).encode('utf-8')

        traktManagerMenu = control.lang(32070).encode('utf-8')

        nextMenu = control.lang(32053).encode('utf-8')


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


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


                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                meta.update({'mediatype': 'tvshow'})
                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
                try: meta.update({'genre': cleangenre.lang(meta['genre'], self.lang)})
                except: pass
                if isEstuary == True:
                    try: del meta['cast']
                    except: pass

                try:
                    overlay = int(playcount.getTVShowOverlay(indicators, tvdb))
                    if overlay == 7: meta.update({'playcount': 1, 'overlay': 7})
                    else: meta.update({'playcount': 0, 'overlay': 6})
                except:
                    pass


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


                cm = []

                cm.append((queueMenu, 'RunPlugin(%s?action=queueItem)' % sysaddon))

                cm.append((watchedMenu, 'RunPlugin(%s?action=tvPlaycount&name=%s&imdb=%s&tvdb=%s&query=7)' % (sysaddon, systitle, imdb, tvdb)))

                cm.append((unwatchedMenu, 'RunPlugin(%s?action=tvPlaycount&name=%s&imdb=%s&tvdb=%s&query=6)' % (sysaddon, systitle, imdb, tvdb)))

                if traktCredentials == True:
                    cm.append((traktManagerMenu, 'RunPlugin(%s?action=traktManager&name=%s&tvdb=%s&content=tvshow)' % (sysaddon, sysname, tvdb)))

                if isOld == True:
                    cm.append((control.lang2(19033).encode('utf-8'), 'Action(Info)'))


                item = control.item(label=label)

                item.setArt({'icon': poster, 'thumb': poster, 'poster': poster, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})

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

                item.addContextMenuItems(cm)
                item.setInfo(type='Video', infoLabels = meta)

                control.addItem(handle=syshandle, url=url, listitem=item, isFolder=True)
            except:
                pass

        try:
            url = items[0]['next']
            if url == '': raise Exception()

            icon = control.addonNext()
            url = '%s?action=tvshowPage&url=%s' % (sysaddon, urllib.quote_plus(url))

            item = control.item(label=nextMenu)

            item.setArt({'icon': icon, 'thumb': icon, 'poster': icon, 'tvshow.poster': icon, 'season.poster': icon, 'banner': icon, 'tvshow.banner': icon, 'season.banner': icon})
            if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)

            control.addItem(handle=syshandle, url=url, listitem=item, isFolder=True)
        except:
            pass

        control.content(syshandle, 'tvshows')
        #control.do_block_check(False)
        control.directory(syshandle, cacheToDisc=True)
        views.setView('tvshows', {'skin.confluence': 500})
    def addDirectory(self, items, queue=False):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        addonPoster = addonBanner = control.addonInfo('icon')
        addonFanart = control.addonInfo('fanart')

        playlist = control.playlist
        if not queue == False: playlist.clear()

        try:
            devmode = True if 'testings.xml' in control.listDir(
                control.dataPath)[1] else False
        except:
            devmode = False

        mode = [i['content'] for i in items if 'content' in i]
        if 'movies' in mode: mode = 'movies'
        elif 'tvshows' in mode: mode = 'tvshows'
        elif 'seasons' in mode: mode = 'seasons'
        elif 'episodes' in mode: mode = 'episodes'
        elif 'videos' in mode: mode = 'videos'
        else: mode = 'addons'

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

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

                if i['action'] == 'plugin' and 'url' in i: url = i['url']

                try:
                    devurl = dict(
                        urlparse.parse_qsl(
                            urlparse.urlparse(url).query))['action']
                except:
                    devurl = None
                if devurl == 'developer' and not devmode == True:
                    raise Exception()

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

                content = i['content'] if 'content' in i else '0'

                folder = i['folder'] if 'folder' in i else True

                meta = dict((k, v) for k, v in i.iteritems() if not v == '0')

                cm = []

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

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

                if (folder == False and not '|regex=' in str(i.get('url'))
                    ) or (folder == True
                          and content in ['tvshows', 'seasons']):
                    cm.append((control.lang(30723).encode('utf-8'),
                               'RunPlugin(%s?action=queueItem)' % sysaddon))

                if content == 'movies':
                    try:
                        dfile = '%s (%s)' % (i['title'], i['year'])
                    except:
                        dfile = name
                    try:
                        cm.append((control.lang(30722).encode(
                            'utf-8'
                        ), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)'
                                   % (sysaddon, urllib.quote_plus(dfile),
                                      urllib.quote_plus(i['url']),
                                      urllib.quote_plus(poster))))
                    except:
                        pass
                elif content == 'episodes':
                    try:
                        dfile = '%s S%02dE%02d' % (i['tvshowtitle'],
                                                   int(i['season']),
                                                   int(i['episode']))
                    except:
                        dfile = name
                    try:
                        cm.append((control.lang(30722).encode(
                            'utf-8'
                        ), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)'
                                   % (sysaddon, urllib.quote_plus(dfile),
                                      urllib.quote_plus(i['url']),
                                      urllib.quote_plus(poster))))
                    except:
                        pass
                elif content == 'songs':
                    try:
                        cm.append((control.lang(30722).encode(
                            'utf-8'
                        ), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)'
                                   % (sysaddon, urllib.quote_plus(name),
                                      urllib.quote_plus(i['url']),
                                      urllib.quote_plus(poster))))
                    except:
                        pass

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

                if devmode == True:
                    try:
                        cm.append(('Open in browser',
                                   'RunPlugin(%s?action=browser&url=%s)' %
                                   (sysaddon, urllib.quote_plus(i['url']))))
                    except:
                        pass

                item = control.item(label=name,
                                    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 not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                if queue == False:
                    item.setInfo(type='Video', infoLabels=meta)
                    item.addContextMenuItems(cm)
                    control.addItem(handle=int(sys.argv[1]),
                                    url=url,
                                    listitem=item,
                                    isFolder=folder)
                else:
                    item.setInfo(type='Video', infoLabels=meta)
                    playlist.add(url=url, listitem=item)
            except:
                pass

        if not queue == False:
            return control.player.play(playlist)

        try:
            i = items[0]
            if i['next'] == '': raise Exception()
            url = '%s?action=%s&url=%s' % (sysaddon, i['nextaction'],
                                           urllib.quote_plus(i['next']))
            item = control.item(label=control.lang(30500).encode('utf-8'))
            item.setArt({
                'addonPoster': addonPoster,
                'thumb': addonPoster,
                'poster': addonPoster,
                'tvshow.poster': addonPoster,
                'season.poster': addonPoster,
                'banner': addonPoster,
                'tvshow.banner': addonPoster,
                'season.banner': addonPoster
            })
            item.setProperty('addonFanart_Image', addonFanart)
            control.addItem(handle=int(sys.argv[1]),
                            url=url,
                            listitem=item,
                            isFolder=True)
        except:
            pass

        if not mode == None: control.content(int(sys.argv[1]), mode)
        control.directory(int(sys.argv[1]), cacheToDisc=True)
        if mode in ['movies', 'tvshows', 'seasons', 'episodes']:
            views.setView(mode, {'skin.estuary': 55})
Exemple #58
0
    def addDirectory(self, items, mode=True):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        addonPoster = addonBanner = control.addonInfo('icon')
        addonFanart = control.addonInfo('fanart')

        try: devmode = True if 'testings.xml' in control.listDir(control.dataPath)[1] else False
        except: devmode = False

        if mode == True: mode = [i['content'] for i in items if 'content' in i]
        else: mode = []
        if 'movies' in mode: mode = 'movies'
        elif 'tvshows' in mode: mode = 'tvshows'
        elif 'seasons' in mode: mode = 'seasons'
        elif 'episodes' in mode: mode = 'episodes'
        else: mode = None

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

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

                if i['action'] == 'plugin' and 'url' in i: url = i['url']
                if i['action'] == 'developer' and not devmode == True: raise Exception()

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

                content = i['content'] if 'content' in i else '0'
                replaceItems = False if content == '0' else True

                folder = i['folder'] if 'folder' in i else True

                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

                cm = []

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

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

                if content == 'movies':
                    try: dfile = '%s (%s)' % (data['title'], data['year'])
                    except: dfile = name
                    try: cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(dfile), urllib.quote_plus(i['url']), urllib.quote_plus(poster))))
                    except: pass
                elif content == 'episodes':
                    try: dfile = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode']))
                    except: dfile = name
                    try: cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(dfile), urllib.quote_plus(i['url']), urllib.quote_plus(poster))))
                    except: pass

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

                if devmode == True:
                    try: cm.append(('Open in browser', 'RunPlugin(%s?action=browser&url=%s)' % (sysaddon, urllib.quote_plus(i['url']))))
                    except: pass

                if replaceItems == True:
                    cm.append((control.lang(30725).encode('utf-8'), 'RunPlugin(%s?action=openSettings)' % sysaddon))


                item = control.item(label=name, 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 not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

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

        if not mode == None: control.content(int(sys.argv[1]), mode)
        #control.do_block_check(False)
        control.directory(int(sys.argv[1]), cacheToDisc=True)
        if not mode == None: views.setView(mode)
Exemple #59
0
    def addItem(self, title, year, imdb, tvdb, season, episode, tvshowtitle,
                premiered, meta):
        try:
            if 'super.fav' in control.infoLabel('Container.PluginName'):
                return control.dialog.ok('Exodus',
                                         control.lang(30518).encode('utf-8'),
                                         '', '')

            self.sources = self.getSources(title, year, imdb, tvdb, season,
                                           episode, tvshowtitle, premiered)
            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(' '))

            content = 'movies' if tvshowtitle == None else 'episodes'

            trailerMenu = control.lang(30516).encode(
                'utf-8') if tvshowtitle == None else control.lang(
                    30517).encode('utf-8')

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

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

            meta = json.loads(meta)

            try:
                del meta['duration']
            except:
                pass

            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()

            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 = urllib.quote_plus(
                '%s (%s)' % (title, year) if tvshowtitle == None or season ==
                None or episode == None else tvshowtitle)
            sysimage, sysaddon = urllib.quote_plus(poster), sys.argv[0]

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

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

                    label = self.sources[i]['label']

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

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

                    cm = []
                    cm.append((control.lang(30504).encode('utf-8'),
                               'RunPlugin(%s?action=queueItem)' % sysaddon))

                    if downloads == True:
                        cm.append((control.lang(30505).encode(
                            'utf-8'
                        ), 'RunPlugin(%s?action=download&name=%s&image=%s&source=%s)'
                                   %
                                   (sysaddon, systitle, sysimage, syssource)))

                    cm.append(
                        (trailerMenu, 'RunPlugin(%s?action=trailer&name=%s)' %
                         (sysaddon, sysname)))
                    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.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]), content)
            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
Exemple #60
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)