def addCategoryItem(name, action, image, isFolder=True): u = sys.argv[0]+"?action="+str(action) image = control.addonInfo('path') + '/art/' + image item = control.item(name, iconImage=image, thumbnailImage=image) item.addContextMenuItems([], replaceItems=False) item.setProperty('Fanart_Image', control.addonInfo('fanart')) control.addItem(handle=int(sys.argv[1]),url=u,listitem=item,isFolder=isFolder)
def addCategoryItem(name, action, image, isFolder=True): u = sys.argv[0] + "?action=" + str(action) image = control.addonInfo('path') + '/art/' + image item = control.item(name, iconImage=image, thumbnailImage=image) item.addContextMenuItems([], replaceItems=False) item.setProperty('Fanart_Image', control.addonInfo('fanart')) control.addItem(handle=int(sys.argv[1]), url=u, listitem=item, isFolder=isFolder)
def addDirectoryItem(name, url, action, image, image2, fanart, audio, content, data, tvshow='0', totalItems=0, isFolder=True): if not str(image).lower().startswith('http'): image = control.addonInfo('icon') if not str(image2).lower().startswith('http'): image2 = control.addonInfo('icon') if not str(fanart).lower().startswith('http'): fanart = control.addonInfo('fanart') if content in ['movies', 'episodes']: playable = 'true' else: playable = 'false' sysaddon = sys.argv[0] u = sysaddon + "?name=" + urllib.quote_plus( name ) + "&url=" + urllib.quote_plus(url) + "&audio=" + urllib.quote_plus( audio) + "&image=" + urllib.quote_plus( image) + "&fanart=" + urllib.quote_plus( fanart) + "&playable=" + urllib.quote_plus( playable) + "&tvshow=" + str(tvshow) + "&content=" + str( content) + "&action=" + str(action) cm = [] if content in ['movies', 'tvshows']: data.update({ 'trailer': '%s?action=trailer&name=%s' % (sysaddon, urllib.quote_plus(name)) }) cm.append(('[COLOR gold]Watch Trailer[/COLOR]', 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, urllib.quote_plus(name)))) if not 'plot' in data: data.update({'plot': 'Discover Great Streaming Playlists!'}) if content == 'movies': cm.append( ('[COLOR gold]Movie Information[/COLOR]', 'XBMC.Action(Info)')) elif content in ['tvshows', 'seasons']: cm.append( ('[COLOR gold]TV Show Information[/COLOR]', 'XBMC.Action(Info)')) elif content == 'episodes': cm.append( ('[COLOR gold]Episode Information[/COLOR]', 'XBMC.Action(Info)')) if content == 'movies' and not isFolder == True: downloadFile = name try: downloadFile = '%s (%s)' % (data['title'], data['year']) except: pass cm.append(('[COLOR gold]Download This File[/COLOR]', 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(downloadFile), urllib.quote_plus(url), urllib.quote_plus(image)))) elif content == 'episodes' and not isFolder == True: downloadFile = name try: downloadFile = '%s S%02dE%02d' % ( data['tvshowtitle'], int(data['season']), int(data['episode'])) except: pass cm.append(('[COLOR gold]Download This File[/COLOR]', 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(downloadFile), urllib.quote_plus(url), urllib.quote_plus(image)))) if content == 'movies': cm.append(('[COLOR gold]Set Movies view[/COLOR]', 'RunPlugin(%s?action=addView&content=movies)' % sysaddon)) elif content == 'tvshows': cm.append(('[COLOR gold]Set TV Shows view[/COLOR]', 'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon)) elif content == 'seasons': cm.append(('[COLOR gold]Set Seasons view[/COLOR]', 'RunPlugin(%s?action=addView&content=seasons)' % sysaddon)) elif content == 'episodes': cm.append(('[COLOR gold]Set Episodes view[/COLOR]', 'RunPlugin(%s?action=addView&content=episodes)' % sysaddon)) item = control.item(name, iconImage='DefaultFolder.png', thumbnailImage=image) try: item.setArt({ 'poster': image2, 'tvshow.poster': image2, 'season.poster': image2, 'banner': image, 'tvshow.banner': image, 'season.banner': image }) except: pass item.addContextMenuItems(cm, replaceItems=False) item.setProperty('Fanart_Image', fanart) if playable == 'true': item.setProperty('IsPlayable', 'true') item.setInfo(type='Video', infoLabels=data) control.addItem(handle=int(sys.argv[1]), url=u, listitem=item, totalItems=totalItems, isFolder=isFolder)
import re import os import sys import urllib import json import datetime import subprocess from jars import FuckNeulionClient from modules.libraries import control from modules.libraries import client import xbmc addonPath = control.addonPath addonFanart = control.addonInfo('fanart') addonIcon = os.path.join(addonPath, 'art/hockey.jpg') jarFile = os.path.join(addonPath, 'jars/FuckNeulionV2.jar') def nhlDirectory(): dt = procTimezone(5) datex = int(dt.strftime('%Y%m%d')) url = 'http://live.nhl.com/GameData/SeasonSchedule-20142015.json' result = client.request(url) items = json.loads(result) items = sorted(items, key=lambda k: k['est']) addDirectoryItem('[COLOR red]Archived Games Click Here[/COLOR]', 'Archived', 'nhlArchives', '0', '0')
def addDirectoryItem(name, url, action, image, image2, fanart, audio, content, data, tvshow='0', totalItems=0, isFolder=True): if not str(image).lower().startswith('http'): image = control.addonInfo('icon') if not str(image2).lower().startswith('http'): image2 = control.addonInfo('icon') if not str(fanart).lower().startswith('http'): fanart = control.addonInfo('fanart') if content in ['movies', 'episodes']: playable = 'true' else: playable = 'false' sysaddon = sys.argv[0] u=sysaddon+"?name="+urllib.quote_plus(name)+"&url="+urllib.quote_plus(url)+"&audio="+urllib.quote_plus(audio)+"&image="+urllib.quote_plus(image)+"&fanart="+urllib.quote_plus(fanart)+"&playable="+urllib.quote_plus(playable)+"&tvshow="+str(tvshow)+"&content="+str(content)+"&action="+str(action) cm = [] if content in ['movies', 'tvshows']: data.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, urllib.quote_plus(name))}) cm.append(('[COLOR gold]Watch Trailer[/COLOR]', 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, urllib.quote_plus(name)))) if not 'plot' in data: data.update({'plot': 'Discover Great Streaming Playlists!'}) if content == 'movies': cm.append(('[COLOR gold]Movie Information[/COLOR]', 'XBMC.Action(Info)')) elif content in ['tvshows', 'seasons']: cm.append(('[COLOR gold]TV Show Information[/COLOR]', 'XBMC.Action(Info)')) elif content == 'episodes': cm.append(('[COLOR gold]Episode Information[/COLOR]', 'XBMC.Action(Info)')) if content == 'movies' and not isFolder == True: downloadFile = name try: downloadFile = '%s (%s)' % (data['title'], data['year']) except: pass cm.append(('[COLOR gold]Download This File[/COLOR]', 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(downloadFile), urllib.quote_plus(url), urllib.quote_plus(image)))) elif content == 'episodes' and not isFolder == True: downloadFile = name try: downloadFile = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) except: pass cm.append(('[COLOR gold]Download This File[/COLOR]', 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(downloadFile), urllib.quote_plus(url), urllib.quote_plus(image)))) if content == 'movies': cm.append(('[COLOR gold]Set Movies view[/COLOR]', 'RunPlugin(%s?action=addView&content=movies)' % sysaddon)) elif content == 'tvshows': cm.append(('[COLOR gold]Set TV Shows view[/COLOR]', 'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon)) elif content == 'seasons': cm.append(('[COLOR gold]Set Seasons view[/COLOR]', 'RunPlugin(%s?action=addView&content=seasons)' % sysaddon)) elif content == 'episodes': cm.append(('[COLOR gold]Set Episodes view[/COLOR]', 'RunPlugin(%s?action=addView&content=episodes)' % sysaddon)) item = control.item(name, iconImage='DefaultFolder.png', thumbnailImage=image) try: item.setArt({'poster': image2, 'tvshow.poster': image2, 'season.poster': image2, 'banner': image, 'tvshow.banner': image, 'season.banner': image}) except: pass item.addContextMenuItems(cm, replaceItems=False) item.setProperty('Fanart_Image', fanart) if playable == 'true': item.setProperty('IsPlayable', 'true') item.setInfo(type='Video', infoLabels=data) control.addItem(handle=int(sys.argv[1]),url=u,listitem=item,totalItems=totalItems,isFolder=isFolder)