def VideoSeries(all=False): dir = MediaContainer(FILE_DEFAULT_ART, title1=TEXT_IGN, title2=TEXT_VIDEO_SERIES) if all: # From Video Series page for series in LoadUrl( URL_VIDEO_SERIES, CACHE_INT_SERIES_LIST).xpath(XPATH_ALL_VIDEO_SERIES): thumb = series.find("a/img").get("src") title = series.find("a/img").get("alt") url = series.find("a").get("href") dir.AppendItem( DirectoryItem(_E(url) + "||" + _E(title), title, thumb)) else: # From Home page for series in HomePageXml().xpath(XPATH_VIDEO_SERIES): url = series.get("href") name = series.find("img").get("alt") thumb = series.find("img").get("src") dir.AppendItem( DirectoryItem(_E(url) + "||" + _E(name), name, thumb)) dir.AppendItem(DirectoryItem("all", TEXT_ALL_SERIES, None)) return dir.ToXML()
def RecentVideos(): dir = MediaContainer(FILE_DEFAULT_ART, title1=TEXT_IGN, title2=TEXT_RECENT_VIDEOS) first = True for row in LoadUrl(URL_ALL, CACHE_INT_RECENT).xpath(XPATH_RECENT_VIDEOS): if first: # Need to skip header row (Hey IGN, use a thead like the rest of us!) first = False continue url = row.find("td//a").get("href") name = row.find("td//a").text.strip() # Need to label category icon = row.find("td/img").get("src") # Again, IGN, how about some alt text? begin = icon.find("icon_") + 5 end = icon.find(".gif") label = icon[begin:end] if label == "video": nameLabeled = name else: nameLabeled = "[" + _L(label) + "] " + name dir.AppendItem(DirectoryItem(_E(url) + "||" + name, nameLabeled, None)) return dir.ToXML()
def RecentVideos(): dir = MediaContainer(FILE_DEFAULT_ART, title1=TEXT_IGN, title2=TEXT_RECENT_VIDEOS) first = True for row in LoadUrl(URL_ALL, CACHE_INT_RECENT).xpath(XPATH_RECENT_VIDEOS): if first: # Need to skip header row (Hey IGN, use a thead like the rest of us!) first = False continue url = row.find("td//a").get("href") name = row.find("td//a").text.strip() # Need to label category icon = row.find("td/img").get( "src") # Again, IGN, how about some alt text? begin = icon.find("icon_") + 5 end = icon.find(".gif") label = icon[begin:end] if label == "video": nameLabeled = name else: nameLabeled = "[" + _L(label) + "] " + name dir.AppendItem(DirectoryItem(_E(url) + "||" + name, nameLabeled, None)) return dir.ToXML()
def VideoSeries(all=False): dir = MediaContainer(FILE_DEFAULT_ART, title1=TEXT_IGN, title2=TEXT_VIDEO_SERIES) if all: # From Video Series page for series in LoadUrl(URL_VIDEO_SERIES, CACHE_INT_SERIES_LIST).xpath(XPATH_ALL_VIDEO_SERIES): thumb = series.find("a/img").get("src") title = series.find("a/img").get("alt") url = series.find("a").get("href") dir.AppendItem(DirectoryItem(_E(url) + "||" + _E(title), title, thumb)) else: # From Home page for series in HomePageXml().xpath(XPATH_VIDEO_SERIES): url = series.get("href") name = series.find("img").get("alt") thumb = series.find("img").get("src") dir.AppendItem(DirectoryItem(_E(url) + "||" + _E(name), name, thumb)) dir.AppendItem(DirectoryItem("all", TEXT_ALL_SERIES, None)) return dir.ToXML()
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 SelectedVideoSeries(url, title, limit=9999): dir = MediaContainer(FILE_DEFAULT_ART, title1=TEXT_IGN, title2=_D(title)) xml = LoadUrl(url, CACHE_INT_VIDEO_SERIES) for episode in xml.xpath(XPATH_VIDEO_SERIES_EP): limit = limit - 1 if limit < 0: dir.AppendItem(DirectoryItem(_E(url) + "||" + title, TEXT_ALL_EPISODES, None)) break thumb = episode.find("a/img").get("src") desc = episode.find("a/img").get("alt") epUrl = episode.find("a").get("href") dir.AppendItem(CreateVideoItemFromPage(epUrl, thumb, desc)) return dir.ToXML()
def SelectedVideoSeries(url, title, limit=9999): dir = MediaContainer(FILE_DEFAULT_ART, title1=TEXT_IGN, title2=_D(title)) xml = LoadUrl(url, CACHE_INT_VIDEO_SERIES) for episode in xml.xpath(XPATH_VIDEO_SERIES_EP): limit = limit - 1 if limit < 0: dir.AppendItem( DirectoryItem(_E(url) + "||" + title, TEXT_ALL_EPISODES, None)) break thumb = episode.find("a/img").get("src") desc = episode.find("a/img").get("alt") epUrl = episode.find("a").get("href") dir.AppendItem(CreateVideoItemFromPage(epUrl, thumb, desc)) return dir.ToXML()
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 BuildArgs(key, url='', title=''): return "%s||%s||%s" % (key, _E(url), title)