def GetPartyYears(id): result = GetJsonQuery("partyyears&id_party=" + id) dir = MediaContainer("art-default.png", title1="demoscene.tv", title2=GetJsonQueryTitle("partyyears&id_party=" + id)) dir.AppendItem(DirectoryItem("all_years", "all years", _R("icon-default.png"), "all years")) for item in result["items"]: dir.AppendItem(DirectoryItem(item, item, _R("icon-default.png"), item)) return dir
def GetList(listname): result = GetJsonQuery(listname) list = result["items"] dir = MediaContainer("art-default.png", title1="demoscene.tv", title2=GetJsonQueryTitle(listname)) for id, name in list: Debug("item: ", id +"->" + name) dir.AppendItem(DirectoryItem(id, name, _R("icon-default.png"), name)) return dir
def HandleRequest(pathNouns, count): try: title2 = pathNouns[count-1].split("||")[1] pathNouns[count-1] = pathNouns[count-1].split("||")[0] except: title2 = "" dir = MediaContainer("art-default.jpg", viewGroup="List", title1="Remedie", title2=title2.decode("utf-8")) if count == 0: dict = JSON.DictFromURL(FEED_URL + "rpc/channel/load"); for e in dict[u'channels']: id = e[u'id'] title = e[u'name'] if e[u'unwatched_count']: title += ' (' + str(e[u'unwatched_count']) + ')' thumb = "icon-default.png" if u'thumbnail' in e[u'props']: thumb = e[u'props'][u'thumbnail'][u'url'] Log.Add(thumb) dir.AppendItem(DirectoryItem("feed^" + str(id) + "||" + title, title, _R(thumb))) elif pathNouns[0].startswith("feed"): channel_id = pathNouns[0].split("^")[1] dict = JSON.DictFromURL(FEED_URL + "rpc/channel/show?id=" + channel_id) dir.SetViewGroup("InfoList") for e in dict[u'items']: type = e[u'props'][u'type'] id = PLUGIN_PREFIX + "/play^" + _E(e[u'ident']) + "^" + type title = e[u'name'] summary = e[u'props'][u'description'] duration = "" thumb = "" if u'thumbnail' in e[u'props']: thumb = e[u'props'][u'thumbnail'][u'url'] elif u'thumbnail' in dict[u'channel'][u'props']: thumb = dict[u'channel'][u'props'][u'thumbnail'][u'url'] # TODO maybe special case YouTube # TODO rtmp or mms seems not to work with Redirects if re.match('^video/', type): vidItem = VideoItem(id, e[u'name'], summary, duration, thumb) else: Log.Add(e[u'props'][u'link']) vidItem = WebVideoItem(e[u'props'][u'link'], e[u'name'], summary, duration, thumb) dir.AppendItem(vidItem) elif pathNouns[0].startswith("play"): # TODO mark it read paths = pathNouns[0].split("^") Log.Add(paths) url = _D(paths[1]) type = paths[2] Log.Add(url) return Plugin.Redirect(url) return dir.ToXML()
def Index(): dir = MediaContainer("art-default.png", "Details", "demoscene.tv") dir.AppendItem(DirectoryItem("cat/lastadded", GetJsonQueryTitle("lastadded"), _R("icon-default.png"), GetJsonQueryDescription("lastadded"))) dir.AppendItem(DirectoryItem("cat/lastreleased", GetJsonQueryTitle("lastreleased"), _R("icon-default.png"), GetJsonQueryDescription("lastreleased"))) dir.AppendItem(DirectoryItem("cat/topweek", GetJsonQueryTitle("topweek"), _R("icon-default.png"), GetJsonQueryDescription("topweek"))) dir.AppendItem(DirectoryItem("cat/topmonth", GetJsonQueryTitle("topmonth"), _R("icon-default.png"), GetJsonQueryDescription("topmonth"))) dir.AppendItem(DirectoryItem("cat/alltimetop", GetJsonQueryTitle("alltimetop"), _R("icon-default.png"), GetJsonQueryDescription("alltimetop"))) dir.AppendItem(DirectoryItem("cat/toprating", GetJsonQueryTitle("toprating"), _R("icon-default.png"), GetJsonQueryDescription("toprating"))) dir.AppendItem(DirectoryItem("cat/groups", GetJsonQueryTitle("listofgroups"), _R("icon-default.png"), GetJsonQueryDescription("listofgroups"))) dir.AppendItem(DirectoryItem("cat/parties", GetJsonQueryTitle("listofparties"), _R("icon-default.png"), GetJsonQueryDescription("listofparties"))) dir.AppendItem(WhatIsDemoScene()) return dir
def HandleRequest(pathNouns, count): try: title2 = pathNouns[count - 1].split("||")[1] pathNouns[count - 1] = pathNouns[count - 1].split("||")[0] except: title2 = "" dir = MediaContainer("art-default.jpg", viewGroup="List", title1="Remedie", title2=title2.decode("utf-8")) if count == 0: dict = JSON.DictFromURL(FEED_URL + "rpc/channel/load") for e in dict[u'channels']: id = e[u'id'] title = e[u'name'] if e[u'unwatched_count']: title += ' (' + str(e[u'unwatched_count']) + ')' thumb = "icon-default.png" if u'thumbnail' in e[u'props']: thumb = e[u'props'][u'thumbnail'][u'url'] Log.Add(thumb) dir.AppendItem( DirectoryItem("feed^" + str(id) + "||" + title, title, _R(thumb))) elif pathNouns[0].startswith("feed"): channel_id = pathNouns[0].split("^")[1] dict = JSON.DictFromURL(FEED_URL + "rpc/channel/show?id=" + channel_id) dir.SetViewGroup("InfoList") for e in dict[u'items']: type = e[u'props'][u'type'] id = PLUGIN_PREFIX + "/play^" + _E(e[u'ident']) + "^" + type title = e[u'name'] summary = e[u'props'][u'description'] duration = "" thumb = "" if u'thumbnail' in e[u'props']: thumb = e[u'props'][u'thumbnail'][u'url'] elif u'thumbnail' in dict[u'channel'][u'props']: thumb = dict[u'channel'][u'props'][u'thumbnail'][u'url'] # TODO maybe special case YouTube # TODO rtmp or mms seems not to work with Redirects if re.match('^video/', type): vidItem = VideoItem(id, e[u'name'], summary, duration, thumb) else: Log.Add(e[u'props'][u'link']) vidItem = WebVideoItem(e[u'props'][u'link'], e[u'name'], summary, duration, thumb) dir.AppendItem(vidItem) elif pathNouns[0].startswith("play"): # TODO mark it read paths = pathNouns[0].split("^") Log.Add(paths) url = _D(paths[1]) type = paths[2] Log.Add(url) return Plugin.Redirect(url) return dir.ToXML()
def MainMenu(): dir = MediaContainer("art-default.jpg", None, "Arcade") dir.SetAttr("content", "items") for console in os.listdir(GAMES_ROOT): fullpath = os.path.join(GAMES_ROOT, console) if os.path.isdir(fullpath): dir.AppendItem(DirectoryItem("%s/%s" % (PLUGIN_PREFIX,console), "%s" % console, thumb=_R("icon-default.png"))) return dir