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

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

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

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

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

                cm = []

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

        control.directory(int(sys.argv[1]), cacheToDisc=True)
Exemple #2
0
    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)
	def addDirectory(self, items, queue=False):
		if not items: # with reuselanguageinvoker on an empty directory must be loaded, do not use sys.exit()
			control.hide() ; control.notification(title=32001, 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=random&rtype=movie&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_moviesToLibrary&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:
				log_utils.error()
		control.content(syshandle, 'addons')
		control.directory(syshandle, cacheToDisc=True)
Exemple #4
0
    def addDirectory(self, items):
        if items == None or len(items) == 0: return

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

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

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

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

                cm = []

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

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

        sysaddon = sys.argv[0]
        isPlayable = False if control.setting('autoplay') == 'false' and control.setting('hosts.mode') == '1' else True
        addonFanart, addonThumb, artPath = control.addonFanart(), control.addonThumb(), control.artPath()

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

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

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

                cm = []

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

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

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

        sysaddon = sys.argv[0]
        isPlayable = False if control.setting('autoplay') == 'false' and control.setting('hosts.mode') == '1' else True
        addonFanart, addonThumb, artPath = control.addonFanart(), control.addonThumb(), control.artPath()

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

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

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

                cm = []

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

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

        control.directory(int(sys.argv[1]), cacheToDisc=True)
Exemple #7
0
    def addDirectory(self, items, queue=False, isFolder=True):
        if items is None or len(items) == 0:
            control.hide()
            control.notification(title=32002, message=33049)
            sys.exit()

        sysaddon = sys.argv[0]
        syshandle = int(sys.argv[1])
        addonThumb = control.addonThumb()
        artPath = control.artPath()
        queueMenu = control.lang(32065)
        playRandom = control.lang(32535)
        addToLibrary = 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

                item = control.item(label=name)

                if isFolder:
                    url = '%s?action=%s' % (sysaddon, i['action'])
                    try:
                        url += '&url=%s' % 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,
                    'fanart': control.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 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')

        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 = []

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

                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.do_block_check(False)
        control.directory(syshandle, cacheToDisc=True)
Exemple #9
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 #10
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 #11
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 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)
def downloader():

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

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

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

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

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

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

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

    control.directory(int(sys.argv[1]), cacheToDisc=True)
Exemple #14
0
def downloader():

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

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

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

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

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

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

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

    control.directory(int(sys.argv[1]), cacheToDisc=True)
	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 #16
0
    def getMeta(self, meta):
        try:
            if meta is None:
                raise Exception()

            poster1 = meta.get('poster')
            poster2 = meta.get('poster2')
            poster3 = meta.get('poster3')
            poster = poster3 or poster2 or poster1 or control.addonPoster()

            thumb = meta.get('thumb')
            thumb = thumb or poster or control.addonThumb()

            season_poster = meta.get('season_poster') or poster

            fanart1 = meta.get('fanart')
            fanart2 = meta.get('fanart2')
            fanart3 = meta.get('fanart3')
            fanart = fanart3 or fanart2 or fanart1 or control.addonFanart()

            banner = meta.get('banner')
            clearart = meta.get('clearart')
            clearlogo = meta.get('clearlogo')
            discart = meta.get('discart')

            if 'mediatype' not in meta:
                meta.update({
                    'mediatype':
                    'episode'
                    if 'episode' in meta and meta['episode'] else 'movie'
                })

            return (poster, thumb, season_poster, fanart, banner, clearart,
                    clearlogo, discart, meta)
        except:
            log_utils.error()
            pass

        try:
            raise Exception(
            )  #kodi seems to use scraped artwork so retrival from library not needed
            if self.media_type != 'movie':
                raise Exception()

            meta = control.jsonrpc(
                '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties" : ["title", "originaltitle", "year", "genre", "studio", "country", "runtime", "rating", "votes", "mpaa", "director", "writer", "plot", "plotoutline", "tagline", "thumbnail", "file"]}, "id": 1}'
                %
                (self.year, str(int(self.year) + 1), str(int(self.year) - 1)))
            meta = unicode(meta, 'utf-8', errors='ignore')
            meta = json.loads(meta)['result']['movies']

            t = cleantitle.get(self.title)
            meta = [
                i for i in meta
                if self.year == str(i['year']) and (t == cleantitle.get(
                    i['title']) or t == cleantitle.get(i['originaltitle']))
            ][0]
            if 'mediatype' not in meta:
                meta.update({'mediatype': 'movie'})

            for k, v in meta.iteritems():
                if type(v) == list:
                    try:
                        meta[k] = str(' / '.join(
                            [i.encode('utf-8') for i in v]))
                    except:
                        meta[k] = ''
                else:
                    try:
                        meta[k] = str(v.encode('utf-8'))
                    except:
                        meta[k] = str(v)

            if 'plugin' not in control.infoLabel('Container.PluginName'):
                self.DBID = meta.get('movieid')

            poster = thumb = meta.get('thumbnail')

            # return (poster, thumb, '', '', '', '', '', '', meta)
            return (poster, '', '', '', '', '', '', '', meta)
        except:
            log_utils.error()
            pass

        try:
            raise Exception(
            )  #kodi seems to use scraped artwork so retrival from library not needed
            if self.media_type != 'episode':
                raise Exception()

            meta = control.jsonrpc(
                '{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties" : ["title", "year", "thumbnail", "file"]}, "id": 1}'
                %
                (self.year, str(int(self.year) + 1), str(int(self.year) - 1)))
            meta = unicode(meta, 'utf-8', errors='ignore')
            meta = json.loads(meta)['result']['tvshows']

            t = cleantitle.get(self.title)
            meta = [
                i for i in meta if self.year == str(i['year'])
                and t == cleantitle.get(i['title'])
            ][0]

            tvshowid = meta['tvshowid']
            poster = meta['thumbnail']

            meta = control.jsonrpc(
                '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params":{ "tvshowid": %d, "filter":{"and": [{"field": "season", "operator": "is", "value": "%s"}, {"field": "episode", "operator": "is", "value": "%s"}]}, "properties": ["title", "season", "episode", "showtitle", "firstaired", "runtime", "rating", "director", "writer", "plot", "thumbnail", "file"]}, "id": 1}'
                % (tvshowid, self.season, self.episode))
            meta = unicode(meta, 'utf-8', errors='ignore')
            meta = json.loads(meta)['result']['episodes'][0]

            if 'mediatype' not in meta:
                meta.update({'mediatype': 'episode'})

            for k, v in meta.iteritems():
                if type(v) == list:
                    try:
                        meta[k] = str(' / '.join(
                            [i.encode('utf-8') for i in v]))
                    except:
                        meta[k] = ''
                else:
                    try:
                        meta[k] = str(v.encode('utf-8'))
                    except:
                        meta[k] = str(v)

            if 'plugin' not in control.infoLabel('Container.PluginName'):
                self.DBID = meta.get('episodeid')

            thumb = meta['thumbnail']
            # return (poster, thumb, '', '', '', '', '', '', meta) # poster gets dropped if also passed thumb from episode
            return (poster, '', '', '', '', '', '', '', meta)
        except:
            log_utils.error()
            pass
            poster, thumb, season_poster, fanart, banner, clearart, clearlogo, discart, meta = '', '', '', '', '', '', '', '', {
                'title': self.name
            }
            return (poster, thumb, season_poster, fanart, banner, clearart,
                    clearlogo, discart, meta)
Exemple #17
0
    def getMeta(self, meta):
        try:
            poster = '0'
            if 'poster3' in meta: poster = meta.get('poster3')
            elif 'poster2' in meta: poster = meta.get('poster2')
            elif 'poster' in meta: poster = meta.get('poster')

            thumb = '0'
            if 'thumb3' in meta: thumb = meta.get('thumb3')
            elif 'thumb2' in meta: thumb = meta.get('thumb2')
            elif 'thumb' in meta: thumb = meta.get('thumb')

            fanart = '0'
            if 'fanart3' in meta: fanart = meta.get('fanart3')
            elif 'fanart2' in meta: fanart = meta.get('fanart2')
            elif 'fanart' in meta: fanart = meta.get('fanart')

            # banner == '0':
            # if 'banner' in meta: banner = meta.get('banner')
            # if banner == '0': banner = poster

            clearart = '0'
            if 'clearart' in meta: clearart = meta.get('clearart')

            clearlogo = '0'
            if 'clearlogo' in meta: clearlogo = meta.get('clearlogo')

            discart = '0'
            if 'discart' in meta: discart = meta.get('discart')

            if poster == '0': poster = control.addonPoster()
            if thumb == '0': thumb = control.addonThumb()
            if fanart == '0': fanart = control.addonFanart()

            if not 'mediatype' in meta:
                meta.update({
                    'mediatype':
                    'episode'
                    if 'episode' in meta and meta['episode'] else 'movie'
                })

            return (poster, thumb, fanart, clearart, clearlogo, discart, meta)
        except:
            import traceback
            traceback.print_exc()
            pass

        try:
            if not self.media_type == 'movie':
                raise Exception()

            meta = control.jsonrpc(
                '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties" : ["title", "originaltitle", "year", "genre", "studio", "country", "runtime", "rating", "votes", "mpaa", "director", "writer", "plot", "plotoutline", "tagline", "thumbnail", "file"]}, "id": 1}'
                %
                (self.year, str(int(self.year) + 1), str(int(self.year) - 1)))
            meta = unicode(meta, 'utf-8', errors='ignore')
            meta = json.loads(meta)['result']['movies']

            t = cleantitle.get(self.title)
            meta = [
                i for i in meta
                if self.year == str(i['year']) and (t == cleantitle.get(
                    i['title']) or t == cleantitle.get(i['originaltitle']))
            ][0]
            if not 'mediatype' in meta:
                meta.update({'mediatype': 'movie'})

            for k, v in meta.iteritems():
                if type(v) == list:
                    try:
                        meta[k] = str(' / '.join(
                            [i.encode('utf-8') for i in v]))
                    except:
                        meta[k] = ''
                else:
                    try:
                        meta[k] = str(v.encode('utf-8'))
                    except:
                        meta[k] = str(v)

            if 'plugin' not in control.infoLabel('Container.PluginName'):
                self.DBID = meta.get('movieid')

            poster = thumb = meta.get('thumbnail')
            # return (poster, thumb, meta)
            return (poster, thumb, '', '', '', '', meta)
        except:
            import traceback
            traceback.print_exc()
            pass

        try:
            if not self.media_type == 'episode':
                raise Exception()

            meta = control.jsonrpc(
                '{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties" : ["title", "year", "thumbnail", "file"]}, "id": 1}'
                %
                (self.year, str(int(self.year) + 1), str(int(self.year) - 1)))
            meta = unicode(meta, 'utf-8', errors='ignore')
            meta = json.loads(meta)['result']['tvshows']

            t = cleantitle.get(self.title)
            meta = [
                i for i in meta if self.year == str(i['year'])
                and t == cleantitle.get(i['title'])
            ][0]

            tvshowid = meta.get('tvshowid')
            poster = meta.get('thumbnail')

            meta = control.jsonrpc(
                '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params":{ "tvshowid": %d, "filter":{"and": [{"field": "season", "operator": "is", "value": "%s"}, {"field": "episode", "operator": "is", "value": "%s"}]}, "properties": ["title", "season", "episode", "showtitle", "firstaired", "runtime", "rating", "director", "writer", "plot", "thumbnail", "file"]}, "id": 1}'
                % (tvshowid, self.season, self.episode))
            meta = unicode(meta, 'utf-8', errors='ignore')
            meta = json.loads(meta)['result']['episodes'][0]
            if not 'mediatype' in meta:
                meta.update({'mediatype': 'episode'})

            for k, v in meta.iteritems():
                if type(v) == list:
                    try:
                        meta[k] = str(' / '.join(
                            [i.encode('utf-8') for i in v]))
                    except:
                        meta[k] = ''
                else:
                    try:
                        meta[k] = str(v.encode('utf-8'))
                    except:
                        meta[k] = str(v)

            if 'plugin' not in control.infoLabel('Container.PluginName'):
                self.DBID = meta.get('episodeid')

            thumb = meta.get('thumbnail')

            return (poster, thumb, '', '', '', '', meta)
            # return (poster, thumb, meta)
        except:
            import traceback
            traceback.print_exc()
            poster, thumb, fanart, clearart, clearlogo, discart, meta = '', '', '', '', '', '', {
                'title': self.name
            }
            return (poster, thumb, fanart, clearart, clearlogo, discart, meta)
Exemple #18
0
    def getMeta(self, meta):
        try:
            poster = '0'
            if 'poster3' in meta: poster = meta['poster3']
            elif 'poster2' in meta: poster = meta['poster2']
            elif 'poster' in meta: poster = meta['poster']

            thumb = '0'
            if 'thumb3' in meta: thumb = meta['thumb3']
            elif 'thumb2' in meta: thumb = meta['thumb2']
            elif 'thumb' in meta: thumb = meta['thumb']

            if poster == '0': poster = control.addonPoster()
            if thumb == '0': thumb = control.addonThumb()

            return (poster, thumb, meta)
        except:
            pass

        try:
            if not self.content == 'movie': raise Exception()

            meta = control.jsonrpc(
                '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties" : ["title", "originaltitle", "year", "genre", "studio", "country", "runtime", "rating", "votes", "mpaa", "director", "writer", "plot", "plotoutline", "tagline", "thumbnail", "file"]}, "id": 1}'
                %
                (self.year, str(int(self.year) + 1), str(int(self.year) - 1)))
            meta = unicode(meta, 'utf-8', errors='ignore')
            meta = json.loads(meta)['result']['movies']

            t = cleantitle.get(self.title)
            meta = [
                i for i in meta
                if self.year == str(i['year']) and (t == cleantitle.get(
                    i['title']) or t == cleantitle.get(i['originaltitle']))
            ][0]

            for k, v in meta.iteritems():
                if type(v) == list:
                    try:
                        meta[k] = str(' / '.join(
                            [i.encode('utf-8') for i in v]))
                    except:
                        meta[k] = ''
                else:
                    try:
                        meta[k] = str(v.encode('utf-8'))
                    except:
                        meta[k] = str(v)

            if not 'plugin' in control.infoLabel('Container.PluginName'):
                self.DBID = meta['movieid']

            poster = thumb = meta['thumbnail']

            return (poster, thumb, meta)
        except:
            pass

        try:
            if not self.content == 'episode': raise Exception()

            meta = control.jsonrpc(
                '{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties" : ["title", "year", "thumbnail", "file"]}, "id": 1}'
                %
                (self.year, str(int(self.year) + 1), str(int(self.year) - 1)))
            meta = unicode(meta, 'utf-8', errors='ignore')
            meta = json.loads(meta)['result']['tvshows']

            t = cleantitle.get(self.title)
            meta = [
                i for i in meta if self.year == str(i['year'])
                and t == cleantitle.get(i['title'])
            ][0]

            tvshowid = meta['tvshowid']
            poster = meta['thumbnail']

            meta = control.jsonrpc(
                '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params":{ "tvshowid": %d, "filter":{"and": [{"field": "season", "operator": "is", "value": "%s"}, {"field": "episode", "operator": "is", "value": "%s"}]}, "properties": ["title", "season", "episode", "showtitle", "firstaired", "runtime", "rating", "director", "writer", "plot", "thumbnail", "file"]}, "id": 1}'
                % (tvshowid, self.season, self.episode))
            meta = unicode(meta, 'utf-8', errors='ignore')
            meta = json.loads(meta)['result']['episodes'][0]

            for k, v in meta.iteritems():
                if type(v) == list:
                    try:
                        meta[k] = str(' / '.join(
                            [i.encode('utf-8') for i in v]))
                    except:
                        meta[k] = ''
                else:
                    try:
                        meta[k] = str(v.encode('utf-8'))
                    except:
                        meta[k] = str(v)

            if not 'plugin' in control.infoLabel('Container.PluginName'):
                self.DBID = meta['episodeid']

            thumb = meta['thumbnail']

            return (poster, thumb, meta)
        except:
            pass

        poster, thumb, meta = '', '', {'title': self.name}
        return (poster, thumb, meta)
Exemple #19
0
    def getMeta(self, meta):
        try:
            if not meta or ('videodb'
                            in control.infoLabel('ListItem.FolderPath')):
                raise Exception()
            poster = meta.get('poster3') or meta.get('poster2') or meta.get(
                'poster')  #poster2 and poster3 may not be passed anymore
            thumb = meta.get('thumb')
            thumb = thumb or poster or control.addonThumb()
            season_poster = meta.get('season_poster') or poster
            fanart = meta.get('fanart')
            banner = meta.get('banner')
            clearart = meta.get('clearart')
            clearlogo = meta.get('clearlogo')
            discart = meta.get('discart')
            if 'mediatype' not in meta:
                meta.update(
                    {'mediatype': 'episode' if self.episode else 'movie'})
                if self.episode:
                    meta.update({
                        'tvshowtitle': self.title,
                        'season': self.season,
                        'episode': self.episode
                    })
            return (poster, thumb, season_poster, fanart, banner, clearart,
                    clearlogo, discart, meta)
        except:
            log_utils.error()
        try:

            def cleanLibArt(art):
                from urllib.parse import unquote
                if not art: return ''
                art = unquote(art.replace('image://', ''))
                if art.endswith('/'): art = art[:-1]
                return art

            def sourcesDirMeta(
                    metadata):  # pass player minimal meta needed from lib pull
                if not metadata: return metadata
                allowed = [
                    'mediatype', 'imdb', 'tmdb', 'tvdb', 'poster',
                    'season_poster', 'fanart', 'banner', 'clearart',
                    'clearlogo', 'discart', 'thumb', 'title', 'tvshowtitle',
                    'year', 'premiered', 'rating', 'plot', 'duration', 'mpaa',
                    'season', 'episode', 'castandrole'
                ]
                return {
                    k: v
                    for k, v in iter(metadata.items()) if k in allowed
                }

            poster, thumb, season_poster, fanart, banner, clearart, clearlogo, discart, meta = '', '', '', '', '', '', '', '', {
                'title': self.name
            }
            if self.media_type != 'movie': raise Exception()
            # do not add IMDBNUMBER as tmdb scraper puts their id in the key value
            meta = control.jsonrpc(
                '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties" : ["title", "originaltitle", "uniqueid", "year", "premiered", "genre", "studio", "country", "runtime", "rating", "votes", "mpaa", "director", "writer", "cast", "plot", "plotoutline", "tagline", "thumbnail", "art", "file"]}, "id": 1}'
                %
                (self.year, str(int(self.year) + 1), str(int(self.year) - 1)))
            meta = jsloads(meta)['result']['movies']
            meta = [
                i for i in meta
                if i.get('uniqueid', []).get('imdb', '') == self.imdb
            ]
            if meta: meta = meta[0]
            else: raise Exception()
            if 'mediatype' not in meta: meta.update({'mediatype': 'movie'})
            if 'duration' not in meta:
                meta.update({
                    'duration': meta.get('runtime')
                })  # Trakt scrobble resume needs this for lib playback
            if 'castandrole' not in meta:
                meta.update({
                    'castandrole':
                    [(i['name'], i['role']) for i in meta.get('cast')]
                })
            thumb = cleanLibArt(meta.get('art').get('thumb', ''))
            poster = cleanLibArt(meta.get('art').get('poster',
                                                     '')) or self.poster
            fanart = cleanLibArt(meta.get('art').get('fanart',
                                                     '')) or self.fanart
            banner = cleanLibArt(meta.get('art').get(
                'banner', ''))  # not sure this is even used by player
            clearart = cleanLibArt(meta.get('art').get('clearart', ''))
            clearlogo = cleanLibArt(meta.get('art').get('clearlogo', ''))
            discart = cleanLibArt(meta.get('art').get('discart'))
            if 'plugin' not in control.infoLabel('Container.PluginName'):
                self.DBID = meta.get('movieid')
            meta = sourcesDirMeta(meta)
            return (poster, thumb, '', fanart, banner, clearart, clearlogo,
                    discart, meta)
        except:
            log_utils.error()
        try:
            if self.media_type != 'episode': raise Exception()
            # do not add IMDBNUMBER as tmdb scraper puts their id in the key value
            show_meta = control.jsonrpc(
                '{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties" : ["title", "originaltitle", "uniqueid", "mpaa", "year", "genre", "runtime", "thumbnail", "file"]}, "id": 1}'
                %
                (self.year, str(int(self.year) + 1), str(int(self.year) - 1)))
            show_meta = jsloads(show_meta)['result']['tvshows']
            show_meta = [
                i for i in show_meta if i['uniqueid']['imdb'] == self.imdb
            ]
            show_meta = [
                i for i in show_meta
                if i.get('uniqueid', []).get('imdb', '') == self.imdb
            ]
            if show_meta: show_meta = show_meta[0]
            else: raise Exception()
            tvshowid = show_meta['tvshowid']
            meta = control.jsonrpc(
                '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params":{"tvshowid": %d, "filter":{"and": [{"field": "season", "operator": "is", "value": "%s"}, {"field": "episode", "operator": "is", "value": "%s"}]}, "properties": ["showtitle", "title", "season", "episode", "firstaired", "runtime", "rating", "director", "writer", "cast", "plot", "thumbnail", "art", "file"]}, "id": 1}'
                % (tvshowid, self.season, self.episode))
            meta = jsloads(meta)['result']['episodes']
            if meta: meta = meta[0]
            else: raise Exception()
            if 'mediatype' not in meta: meta.update({'mediatype': 'episode'})
            if 'tvshowtitle' not in meta:
                meta.update({'tvshowtitle': meta.get('showtitle')})
            if 'castandrole' not in meta:
                meta.update({
                    'castandrole':
                    [(i['name'], i['role']) for i in meta.get('cast')]
                })
            if 'genre' not in meta:
                meta.update({'genre': show_meta.get('genre')})
            if 'duration' not in meta:
                meta.update(
                    {'duration': meta.get('runtime')}
                )  # Trakt scrobble resume needs this for lib playback but Kodi lib returns "0" for shows or episodes
            if 'mpaa' not in meta: meta.update({'mpaa': show_meta.get('mpaa')})
            if 'premiered' not in meta:
                meta.update({'premiered': meta.get('firstaired')})
            if 'year' not in meta:
                meta.update({'year': show_meta.get('year')
                             })  # shows year not year episode aired
            thumb = cleanLibArt(meta.get('art').get('thumb', ''))
            season_poster = poster = cleanLibArt(
                meta.get('art').get('season.poster', '')) or self.poster
            fanart = cleanLibArt(meta.get('art').get('tvshow.fanart',
                                                     '')) or self.poster
            banner = cleanLibArt(meta.get('art').get(
                'tvshow.banner', ''))  # not sure this is even used by player
            clearart = cleanLibArt(meta.get('art').get('tvshow.clearart', ''))
            clearlogo = cleanLibArt(
                meta.get('art').get('tvshow.clearlogo', ''))
            discart = cleanLibArt(meta.get('art').get('discart'))
            if 'plugin' not in control.infoLabel('Container.PluginName'):
                self.DBID = meta.get('episodeid')
            meta = sourcesDirMeta(meta)
            return (poster, thumb, season_poster, fanart, banner, clearart,
                    clearlogo, discart, meta)
        except:
            log_utils.error()
            return (poster, thumb, season_poster, fanart, banner, clearart,
                    clearlogo, discart, meta)
Exemple #20
0
# -*- coding: utf-8 -*-
# --[ hightimes v1.0 ]--|--[ From JewBMX ]--
# PotHead Indexer made with HighTimes podcasts so far.

import re, os, sys, urllib
import xbmcgui, xbmcplugin
from resources.lib.modules import client
from resources.lib.modules import control
from resources.lib.modules import log_utils

sysaddon = sys.argv[0]
syshandle = int(sys.argv[1])
addonFanart = control.addonFanart()
addonThumb = control.addonThumb()
artPath = control.artPath()
eDlog = xbmcgui.Dialog()


class hightimes:  # High Times Podcast Network
    def __init__(self):
        self.list = []
        self.htpn_link = 'https://hightimes.com/htpn/'
        self.artHTPN = 'https://github.com/jewbmx/xml/blob/master/img/hightimes.png?raw=true'
        self.artFreeWeed = 'https://3ncb884ou5e49t9eb3fpeur1-wpengine.netdna-ssl.com/wp-content/uploads/2018/06/Free-Weed-Danny-1.jpg'

    def root(self):
        self.addDirectoryItem('High Times Podcast Network - FreeWeed',
                              'getFreeWeed', self.artFreeWeed,
                              'DefaultVideoPlaylists.png')
        self.endDirectory()
Exemple #21
0
    def addDirectory(self, items, content):
        if items == None or len(items) == 0:
            return  #control.idle() ; sys.exit()

        sysaddon = sys.argv[0]

        syshandle = int(sys.argv[1])

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

        playRandom = control.lang(32535)

        nextMenu = control.lang(32053)

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

                plot = i['plot'] or '[CR]'

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

                try:
                    item = control.item(label=name, offscreen=True)
                except:
                    item = control.item(label=name)

                item.setArt({
                    'icon': thumb,
                    'thumb': thumb,
                    'poster': thumb,
                    'fanart': addonFanart
                })
                item.setInfo(type='video', infoLabels={'plot': plot})

                cm = []

                if content == 'movies':
                    link = urllib_parse.quote_plus(self.person_movie_link %
                                                   i['id'])
                    cm.append(
                        (playRandom,
                         'RunPlugin(%s?action=random&rtype=movie&url=%s)' %
                         (sysaddon, link)))
                    url = '%s?action=movies&url=%s' % (sysaddon, link)
                elif content == 'tvshows':
                    link = urllib_parse.quote_plus(self.person_tv_link %
                                                   i['id'])
                    cm.append(
                        (playRandom,
                         'RunPlugin(%s?action=random&rtype=show&url=%s)' %
                         (sysaddon, link)))
                    url = '%s?action=tvshows&url=%s' % (sysaddon, link)
                else:
                    url = '%s?action=personsSelect&name=%s&url=%s' % (
                        sysaddon, urllib_parse.quote_plus(name),
                        urllib_parse.quote_plus(i['id']))

                if cm:
                    item.addContextMenuItems(cm)

                control.addItem(handle=syshandle,
                                url=url,
                                listitem=item,
                                isFolder=True)
            except:
                log_utils.log('people_dir', 1)
                pass

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

            icon = control.addonNext()
            url = '%s?action=persons&url=%s&content=%s' % (
                sysaddon, urllib_parse.quote_plus(next), content)

            try:
                item = control.item(label=nextMenu, offscreen=True)
            except:
                item = control.item(label=nextMenu)

            item.setArt({
                'icon': icon,
                'thumb': icon,
                'poster': icon,
                'banner': icon,
                'fanart': addonFanart
            })
            item.setProperty('SpecialSort', 'bottom')

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

        control.content(syshandle, '')
        control.directory(syshandle, cacheToDisc=True)
Exemple #22
0
 def getMeta(self, meta):
     try:
         if not meta: raise Exception()
         poster = meta.get('poster3') or meta.get('poster2') or meta.get(
             'poster')  #poster2 and poster3 may not be passed anymore
         thumb = meta.get('thumb')
         thumb = thumb or poster or control.addonThumb()
         season_poster = meta.get('season_poster') or poster
         fanart = meta.get('fanart')
         banner = meta.get('banner')
         clearart = meta.get('clearart')
         clearlogo = meta.get('clearlogo')
         discart = meta.get('discart')
         if 'mediatype' not in meta:
             meta.update(
                 {'mediatype': 'episode' if self.episode else 'movie'})
             if self.episode:
                 meta.update({'season': self.season})
                 meta.update({'episode': self.episode})
                 meta.update({'tvshowtitle': self.title})
         return (poster, thumb, season_poster, fanart, banner, clearart,
                 clearlogo, discart, meta)
     except:
         log_utils.error()
     try:
         if self.media_type != 'movie': raise Exception()
         meta = control.jsonrpc(
             '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties" : ["title", "originaltitle", "year", "genre", "studio", "country", "runtime", "rating", "votes", "mpaa", "director", "writer", "plot", "plotoutline", "tagline", "thumbnail", "file"]}, "id": 1}'
             %
             (self.year, str(int(self.year) + 1), str(int(self.year) - 1)))
         meta = py_tools.ensure_text(meta, errors='ignore')
         meta = jsloads(meta)['result']['movies']
         t = cleantitle.get(self.title)
         meta = [
             i for i in meta
             if self.year == str(i['year']) and (t == cleantitle.get(
                 i['title']) or t == cleantitle.get(i['originaltitle']))
         ][0]
         if 'mediatype' not in meta:
             meta.update({'mediatype': 'movie'})
         if 'duration' not in meta:
             meta.update({'duration': meta.get('runtime') / 60
                          })  # this doesn't make sense
         for k, v in control.iteritems(meta):
             if type(v) == list:
                 try:
                     meta[k] = str(' / '.join([i for i in v]))
                 except:
                     meta[k] = ''
             else:
                 try:
                     meta[k] = str(v)
                 except:
                     meta[k] = str(v)
         if 'plugin' not in control.infoLabel('Container.PluginName'):
             self.DBID = meta.get('movieid')
         poster = thumb = meta.get('thumbnail')
         return (poster, thumb, '', '', '', '', '', '', meta)
     except:
         log_utils.error()
     try:
         if self.media_type != 'episode': raise Exception()
         meta = control.jsonrpc(
             '{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties" : ["title", "year", "thumbnail", "file"]}, "id": 1}'
             %
             (self.year, str(int(self.year) + 1), str(int(self.year) - 1)))
         meta = py_tools.ensure_text(meta, errors='ignore')
         meta = jsloads(meta)['result']['tvshows']
         t = cleantitle.get(self.title)
         meta = [
             i for i in meta if self.year == str(i['year'])
             and t == cleantitle.get(i['title'])
         ][0]
         tvshowid = meta['tvshowid']
         poster = meta['thumbnail']
         meta = control.jsonrpc(
             '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params":{ "tvshowid": %d, "filter":{"and": [{"field": "season", "operator": "is", "value": "%s"}, {"field": "episode", "operator": "is", "value": "%s"}]}, "properties": ["title", "season", "episode", "showtitle", "firstaired", "runtime", "rating", "director", "writer", "plot", "thumbnail", "file"]}, "id": 1}'
             % (tvshowid, self.season, self.episode))
         meta = py_tools.ensure_text(meta, errors='ignore')
         meta = jsloads(meta)['result']['episodes'][0]
         if 'mediatype' not in meta:
             meta.update({'mediatype': 'episode'})
         if 'duration' not in meta:
             meta.update({'duration': meta.get('runtime') / 60
                          })  # this doesn't make sense
         for k, v in control.iteritems(meta):
             if type(v) == list:
                 try:
                     meta[k] = str(' / '.join([i for i in v]))
                 except:
                     meta[k] = ''
             else:
                 try:
                     meta[k] = str(v)
                 except:
                     meta[k] = str(v)
         if 'plugin' not in control.infoLabel('Container.PluginName'):
             self.DBID = meta.get('episodeid')
         thumb = meta['thumbnail']
         return (poster, thumb, '', '', '', '', '', '', meta)
     except:
         log_utils.error()
         poster, thumb, season_poster, fanart, banner, clearart, clearlogo, discart, meta = '', '', '', '', '', '', '', '', {
             'title': self.name
         }
         return (poster, thumb, season_poster, fanart, banner, clearart,
                 clearlogo, discart, meta)
Exemple #23
0
	def getMeta(self, meta):
		try:
			if not meta: raise Exception()
			poster = meta.get('poster3') or meta.get('poster2') or meta.get('poster') #poster2 and poster3 may not be passed anymore
			thumb = meta.get('thumb')
			thumb = thumb or poster or control.addonThumb()
			season_poster = meta.get('season_poster') or poster
			fanart = meta.get('fanart')
			banner = meta.get('banner')
			clearart = meta.get('clearart')
			clearlogo = meta.get('clearlogo')
			discart = meta.get('discart')
			if 'mediatype' not in meta:
				meta.update({'mediatype': 'episode' if self.episode else 'movie'})
				if self.episode: meta.update({'tvshowtitle': self.title, 'season': self.season, 'episode': self.episode})
			return (poster, thumb, season_poster, fanart, banner, clearart, clearlogo, discart, meta)
		except:
			log_utils.error()
		try:
			def cleanLibArt(art):
				from urllib.parse import unquote
				if not art: return ''
				art = unquote(art.replace('image://', ''))
				if art.endswith('/'): art = art[:-1]
				return art
			poster, thumb, season_poster, fanart, banner, clearart, clearlogo, discart, meta = '', '', '', '', '', '', '', '', {'title': self.name}
			if self.media_type != 'movie': raise Exception()
			meta = control.jsonrpc('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties" : ["title", "originaltitle", "year", "premiered", "genre", "studio", "country", "runtime", "rating", "votes", "mpaa", "director", "writer", "plot", "plotoutline", "tagline", "thumbnail", "art", "file"]}, "id": 1}' % (self.year, str(int(self.year) + 1), str(int(self.year) - 1)))
			meta = jsloads(meta)['result']['movies']
			t = cleantitle.get(self.title.replace('&', 'and'))
			years = [str(self.year), str(int(self.year)+1), str(int(self.year)-1)]
			meta = [i for i in meta if str(i['year']) in years and (t == cleantitle.get(i['title'].replace('&', 'and')) or t == cleantitle.get(i['originaltitle'].replace('&', 'and')))]
			if meta: meta = meta[0]
			else: raise Exception()
			if 'mediatype' not in meta: meta.update({'mediatype': 'movie'})
			if 'duration' not in meta: meta.update({'duration': meta.get('runtime')}) # Trakt scrobble resume needs this for lib playback
			thumb = cleanLibArt(meta.get('art').get('thumb', ''))
			poster = cleanLibArt(meta.get('art').get('poster', '')) or self.poster
			fanart = cleanLibArt(meta.get('art').get('fanart', '')) or self.fanart
			banner = cleanLibArt(meta.get('art').get('banner', ''))
			clearart = cleanLibArt(meta.get('art').get('clearart', ''))
			clearlogo = cleanLibArt(meta.get('art').get('clearlogo', ''))
			discart = cleanLibArt(meta.get('art').get('discart'))
			for k, v in iter(meta.items()):
				if type(v) == list:
					try: meta[k] = str(' / '.join([i for i in v]))
					except: meta[k] = ''
				else:
					try: meta[k] = str(v)
					except: meta[k] = str(v)
			if 'plugin' not in control.infoLabel('Container.PluginName'):
				self.DBID = meta.get('movieid')
			return (poster, thumb, '', fanart, banner, clearart, clearlogo, discart, meta)
		except:
			log_utils.error()
		try:
			if self.media_type != 'episode': raise Exception()
			show_meta = control.jsonrpc('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties" : ["title", "originaltitle", "mpaa", "year", "runtime", "thumbnail", "file"]}, "id": 1}' % (self.year, str(int(self.year)+1), str(int(self.year)-1)))
			show_meta = jsloads(show_meta)['result']['tvshows']
			t = cleantitle.get(self.title.replace('&', 'and'))
			show_meta = [i for i in show_meta if self.year == str(i['year']) and (t == cleantitle.get(i['title'].replace('&', 'and')) or t == cleantitle.get(i['originaltitle'].replace('&', 'and')))]
			if show_meta: show_meta = show_meta[0]
			else: raise Exception()
			tvshowid = show_meta['tvshowid']
			meta = control.jsonrpc('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params":{ "tvshowid": %d, "filter":{"and": [{"field": "season", "operator": "is", "value": "%s"}, {"field": "episode", "operator": "is", "value": "%s"}]}, "properties": ["title", "season", "episode", "showtitle", "firstaired", "runtime", "rating", "director", "writer", "plot", "thumbnail", "art", "file"]}, "id": 1}' % (tvshowid, self.season, self.episode))
			meta = jsloads(meta)['result']['episodes']
			if meta: meta = meta[0]
			else: raise Exception()
			if 'mediatype' not in meta: meta.update({'mediatype': 'episode'})
			if 'duration' not in meta: meta.update({'duration': meta.get('runtime')}) # Trakt scrobble resume needs this for lib playback
			if 'mpaa' not in meta: meta.update({'mpaa': show_meta.get('mpaa')})
			if 'premiered' not in meta: meta.update({'premiered': meta.get('firstaired')})
			if 'year' not in meta: meta.update({'year': meta.get('firstaired')[:4]})
			thumb = cleanLibArt(meta.get('art').get('thumb', ''))
			season_poster = poster = cleanLibArt(meta.get('art').get('season.poster', '')) or self.poster
			fanart = cleanLibArt(meta.get('art').get('tvshow.fanart', '')) or self.poster
			banner = cleanLibArt(meta.get('art').get('tvshow.banner', ''))
			clearart = cleanLibArt(meta.get('art').get('tvshow.clearart', ''))
			clearlogo = cleanLibArt(meta.get('art').get('tvshow.clearlogo', ''))
			discart = cleanLibArt(meta.get('art').get('discart'))
			for k, v in iter(meta.items()):
				if type(v) == list:
					try: meta[k] = str(' / '.join([i for i in v]))
					except: meta[k] = ''
				else:
					try: meta[k] = str(v)
					except: meta[k] = str(v)
			if 'plugin' not in control.infoLabel('Container.PluginName'):
				self.DBID = meta.get('episodeid')
			return (poster, thumb, season_poster, fanart, banner, clearart, clearlogo, discart, meta)
		except:
			log_utils.error()
			return (poster, thumb, season_poster, fanart, banner, clearart, clearlogo, discart, meta)