def search(self): if self.search_term is None or self.search_term == '': t = control.lang(30201).encode('utf-8') k = control.keyboard('', t) k.doModal() self.search_term = k.getText() if k.isConfirmed() else None if self.search_term is None or self.search_term == '': return skip = (self.current_page-1) * self.per_page take = self.per_page select_filter = utils.create_filter_criteria(self.section, self.group, self.search_term) results_count = utils.get_course_meta(select_filter)["totalResultCount"] courses = utils.get_course_data(select_filter, skip, take) for course in courses: name = course["courseName"].encode('utf-8') thumb = course["courseImage"] if thumb is None or thumb == '': thumb = self.icon cid = course["id"] utils.add_directory(name, thumb, thumb, "%s?action=view-course&id=%s&url=%s" % (sys.argv[0], cid, utils.url_course % cid)) has_more = (results_count - (skip+self.per_page)) > 0 if has_more: next_url = "%s?action=search&group=%s§ion=%s&page=%i&query=%s" % ( sys.argv[0], urllib.quote_plus(self.group, safe=':/'), urllib.quote_plus(self.section, safe=':/'), self.current_page + 1, self.search_term) utils.add_next_page(next_url, self.current_page + 1) control.directory_end(False) return
def browse(self): url = self.browse_url % (utils.url_root, urllib.quote_plus( self.sort), self.current_page, utils.selected_languages()) html_data = http_request.get(url) soup_strainer = SoupStrainer("main") beautiful_soup = BeautifulSoup( html_data, soup_strainer, convertEntities=BeautifulSoup.HTML_ENTITIES) articles = beautiful_soup.findAll("article") if articles is None: control.directory_end() return for article in articles: action_url = ("%s?action=list-show&show-url=" % (sys.argv[0])) + "%s" utils.add_show_directory(article, action_url) next_url = "%s?action=browse-shows&page=%i&sort=%s" % ( sys.argv[0], self.current_page + 1, urllib.quote_plus(self.sort_method)) utils.add_next_page(beautiful_soup, next_url, self.current_page + 1) control.directory_end() return
def browse(self): threads = utils.get_board(self.board, self.page)["threads"] for t in threads: post = t["posts"][0] if int(post["images"]) <= 0: continue if "sub" in post: title = "%s | images: %s" % (post["sub"], post["images"] + 1) elif "com" in post: title = "%s | images: %s" % (post["com"], post["images"] + 1) else: title = "%s | images: %s" % (post["filename"], post["images"] + 1) icon = utils.get_thumb_url(self.board, post["tim"]) utils.add_directory(title, icon, icon, "%s?action=thread&board=%s&id=%s" % (sys.argv[0], urllib.quote_plus(self.board), post["no"])) if self.page < self.totalPages: next_page = self.page + 1 utils.add_next_page("%s?action=%s&page=%s&total_pages=%s&board=%s" % (sys.argv[0], self.action, next_page, self.totalPages, self.board), next_page) control.directory_end() return
def __init__(self): utils.set_no_sort() utils.add_directory(utils.text_green % control.lang(30502), utils.icon_settings, None, "%s?action=settings" % (sys.argv[0])) boards = utils.get_boards()["boards"] nsfw = control.setting("enable_nsfw") == 'true' for b in boards: is_nsfw = b["ws_board"] == 0 if not nsfw and is_nsfw: continue if is_nsfw: title = utils.text_board_nsfw % (b["board"], b["title"]) else: title = utils.text_board % (b["board"], b["title"]) utils.add_directory( title, utils.icon_board, utils.icon_board, "%s?action=board&board=%s&total_pages=%s" % (sys.argv[0], urllib.quote_plus(b["board"]), b["pages"])) control.directory_end(force_thumb=False) return
def live(self): url = self.browse_url % (utils.url_root, urllib.quote_plus(self.sort), self.current_page, utils.selected_languages()) html_data = http_request.get(url) print url soup_strainer = SoupStrainer("div", {"class": "tab-content"}) beautiful_soup = BeautifulSoup(html_data, soup_strainer, convertEntities=BeautifulSoup.HTML_ENTITIES) ul_entries = beautiful_soup.find("ul", {"class": "entries"}) if ul_entries is None: # nothing is live control.directory_end() return li_entries = ul_entries.findAll("li") for li_entry in li_entries: action_url = ("%s?action=list-event&event-url=" % (sys.argv[0])) + "%s" utils.add_show_directory(li_entry, action_url) next_url = "%s?action=browse-shows&page=%i&sort=%s" % ( sys.argv[0], self.current_page + 1, urllib.quote_plus(self.sort_method)) utils.add_next_page(beautiful_soup, next_url, self.current_page + 1) control.directory_end() return
def browse_gallery(self): api = imgur.Api() data = api.get_meme_gallery(self.sort, "all", self.page) for g in data["memes"]: utils.add_gallery_item(g) control.directory_end(force_thumb=True)
def list(self): url = "%s/%s/posts?page=%u&%s" % (utils.url_root, self.author_url, self.current_page, utils.selected_languages()) html_data = http_request.get(url) soup_strainer = SoupStrainer("main") beautiful_soup = BeautifulSoup( html_data, soup_strainer, convertEntities=BeautifulSoup.HTML_ENTITIES) articles = beautiful_soup.findAll("article") if articles is None: control.directory_end() return for article in articles: utils.add_entry_video(article) next_url = "%s?action=list-author&page=%i&author-url=%s" % ( sys.argv[0], self.current_page + 1, urllib.quote_plus(self.author_url)) utils.add_next_page(beautiful_soup, next_url, self.current_page + 1) control.directory_end() return
def browse(self): url = self.browse_url % (utils.url_root, urllib.quote_plus( self.sort), self.current_page, urllib.quote_plus( self.search_term), utils.selected_languages()) html_data = http_request.get(url) soup_strainer = SoupStrainer("main") beautiful_soup = BeautifulSoup( html_data, soup_strainer, convertEntities=BeautifulSoup.HTML_ENTITIES) ul_entries = beautiful_soup.find("ol", {"class": "authorsByLetter"}) if ul_entries is None: control.directory_end() return li_entries = ul_entries.findAll("li") for li_entry in li_entries: self.add_author_directory(li_entry) if self.search_term == "": next_url = "%s?action=browse-authors&page=%i&sort=%s" % ( sys.argv[0], self.current_page + 1, urllib.quote_plus(self.sort_method)) else: next_url = "%s?action=search-authors&page=%i&query=%s" % ( sys.argv[0], self.current_page + 1, urllib.quote_plus(self.search_term)) print next_url utils.add_next_page(beautiful_soup, next_url, self.current_page + 1) control.directory_end() return
def search(self): if self.search_query is None or self.search_query == '': t = control.lang(30201).encode('utf-8') k = control.keyboard('', t) k.doModal() self.search_query = k.getText() if k.isConfirmed() else None if self.search_query is None or self.search_query == '': return base_url = "https://c9search.azurewebsites.net/content/search?text=%s&$top=100&$skip=0&$inlinecount=allpages" \ % (urllib.quote_plus(self.search_query)) data = http_request.get(base_url) start_index = data.index('"documents":') + 12 if start_index <= 12: return json_data = data[start_index:-3] json_media = json.loads(json_data) for media in json_media: title = media["title"] url = media["permalink"] genre = media["published"] thumbnail = media["previewImage"] plot = media["summaryBody"] list_item = control.item(title, iconImage="DefaultVideo.png", thumbnailImage=thumbnail) list_item.setInfo("video", {"Title": title, "Studio": "Microsoft Channel 9", "Plot": plot, "Genre": genre}) plugin_play_url = '%s?action=play&video_page_url=%s' % (sys.argv[0], urllib.quote_plus(url)) control.addItem(handle=int(sys.argv[1]), url=plugin_play_url, listitem=list_item, isFolder=False) # End of directory... control.directory_end() return
def slideshow(self): utils.add_image(self.title, self.image_url, self.image_url, slideshow=True) control.directory_end() return
def browse_group(self): skip = (self.current_page - 1) * self.per_page take = self.per_page select_filter = utils.create_filter_criteria(self.section, self.group) results_count = utils.get_course_meta( select_filter)["totalResultCount"] courses = utils.get_course_data(select_filter, skip, take) utils.add_directory( utils.text_green % control.lang(30501), utils.icon_search, utils.icon_search, "%s?action=search§ion=%s&group=%s" % (sys.argv[0], self.section, self.group)) for course in courses: name = course["courseName"].encode('utf-8') thumb = course["courseImage"] if thumb is None or thumb == '': thumb = self.icon cid = course["id"] utils.add_directory( name, thumb, thumb, "%s?action=view-course&id=%s&url=%s" % (sys.argv[0], cid, utils.url_course % cid)) has_more = (results_count - (skip + self.per_page)) > 0 if has_more: next_url = "%s?action=browse-group&group=%s§ion=%s&page=%i" % ( sys.argv[0], urllib.quote_plus(self.group, safe=':/'), urllib.quote_plus(self.section, safe=':/'), self.current_page + 1) utils.add_next_page(next_url, self.current_page + 1) control.directory_end(False) return
def __init__(self): # params = dict(part.split('=') for part in sys.argv[2][1:].split('&')) # self.action = params.get("action", None) utils.set_no_sort() meta = utils.get_course_meta()["sections"] for m in meta: header = m["header"] title = header if title in utils.ignore_sections: continue for sid in utils.section_ids: if title == control.lang(sid): title = control.lang(sid + 100) icon = os.path.join(control.imagesPath, "%s.png" % header) utils.add_directory(title, icon, icon, "%s?action=browse-section§ion=%s" % (sys.argv[0], urllib.quote_plus(header))) utils.add_directory(utils.text_green % control.lang(30501), utils.icon_search, utils.icon_search, "%s?action=search" % sys.argv[0]) utils.add_directory(utils.text_green % control.lang(30502), utils.icon_settings, None, "%s?action=settings" % (sys.argv[0])) control.directory_end() return
def browse_group(self): skip = (self.current_page - 1) * self.per_page take = self.per_page select_filter = utils.create_filter_criteria(self.section, self.group) results_count = utils.get_course_meta(select_filter)["totalResultCount"] courses = utils.get_course_data(select_filter, skip, take) utils.add_directory(utils.text_green % control.lang(30501), utils.icon_search, utils.icon_search, "%s?action=search§ion=%s&group=%s" % (sys.argv[0], self.section, self.group)) for course in courses: name = course["courseName"].encode('utf-8') thumb = course["courseImage"] if thumb is None or thumb == '': thumb = self.icon cid = course["id"] utils.add_directory(name, thumb, thumb, "%s?action=view-course&id=%s&url=%s" % (sys.argv[0], cid, utils.url_course % cid)) has_more = (results_count - (skip+self.per_page)) > 0 if has_more: next_url = "%s?action=browse-group&group=%s§ion=%s&page=%i" % ( sys.argv[0], urllib.quote_plus(self.group, safe=':/'), urllib.quote_plus(self.section, safe=':/'), self.current_page + 1) utils.add_next_page(next_url, self.current_page + 1) control.directory_end(False) return
def browse(self): url = self.browse_url % ( utils.url_root, urllib.quote_plus(self.sort), self.current_page, urllib.quote_plus(self.search_term), utils.selected_languages()) html_data = http_request.get(url) soup_strainer = SoupStrainer("div", {"class": "tab-content"}) beautiful_soup = BeautifulSoup(html_data, soup_strainer, convertEntities=BeautifulSoup.HTML_ENTITIES) ul_authors = beautiful_soup.find("ul", {"class": "authors"}) if ul_authors is None: control.directory_end() return li_entries = ul_authors.findAll("li") for li_entry in li_entries: self.add_author_directory(li_entry) if self.search_term == "": next_url = "%s?action=browse-authors&page=%i&sort=%s" % ( sys.argv[0], self.current_page + 1, urllib.quote_plus(self.sort_method)) else: next_url = "%s?action=search-authors&page=%i&query=%s" % ( sys.argv[0], self.current_page + 1, urllib.quote_plus(self.search_term)) print next_url utils.add_next_page(beautiful_soup, next_url, self.current_page + 1) control.directory_end() return
def list(self): url = "" if not re.match("^https?:", self.event_url): url = "%s%s" % (utils.url_root, self.event_url) else: url = self.event_url url = "%s?sort=%s&page=%i&direction=asc&%s" % ( url, self.sort, self.current_page, utils.selected_languages()) html_data = http_request.get(url) soup_strainer = SoupStrainer("main") beautiful_soup = BeautifulSoup( html_data, soup_strainer, convertEntities=BeautifulSoup.HTML_ENTITIES) articles = beautiful_soup.findAll("article") if articles is None: control.directory_end() return for article in articles: utils.add_entry_video(article) next_url = "%s?action=list-event&page=%i&sort=%s&event-url=%s" % ( sys.argv[0], self.current_page + 1, urllib.quote_plus( self.sort_method), urllib.quote_plus(self.event_url)) utils.add_next_page(beautiful_soup, next_url, self.current_page + 1) control.directory_end() return
def tags_alpha(self): tag_list = control.lang(30601) for tag in tag_list: utils.add_directory("[B][COLOR green][UPPERCASE]%s[/UPPERCASE][/COLOR][/B]" % tag, "%s/%s.png" % (control.imagesPath, tag), None, "%s?action=browse-tag-item&&tag=%s" % (sys.argv[0], tag)) control.directory_end() return
def browse(self): url = self.browse_url % (utils.url_root, self.tag) json_data = http_request.get(url) tags = json.loads(json_data) for tag in tags: utils.add_directory("%s (%s)" % (tag['name'], tag['entries']), utils.icon_tag, utils.icon_tag, "%s?action=list-tag&tag-url=%s" % (sys.argv[0], tag['href'])) control.directory_end() return
def show_sort(self): # recent utils.add_directory(control.lang(30701), utils.icon_folder, None, "%s?action=browse-series&page=%i&sort=%s" % ( sys.argv[0], 1, urllib.quote_plus(control.lang(30701)))) # A to Z utils.add_directory(control.lang(30704), utils.icon_folder, None, "%s?action=browse-series&page=%i&sort=%s" % ( sys.argv[0], 1, urllib.quote_plus(control.lang(30704)))) control.directory_end() return
def show_sort(self): # recent utils.add_directory(control.lang(30701), utils.icon_folder, None, "%s?action=browse-events&page=%i&sort=%s" % ( sys.argv[0], 1, urllib.quote_plus(control.lang(30701)))) # A to Z utils.add_directory(control.lang(30704), utils.icon_folder, None, "%s?action=browse-events&page=%i&sort=%s" % ( sys.argv[0], 1, urllib.quote_plus(control.lang(30704)))) control.directory_end() return
def browse(self): # recent utils.add_directory(control.lang(30701), utils.icon_folder, None, "%s?action=list-all&page=%i&sort=%s" % ( sys.argv[0], 1, urllib.quote_plus(control.lang(30701)))) # viewed utils.add_directory(control.lang(30702), utils.icon_folder, None, "%s?action=list-all&page=%i&sort=%s" % ( sys.argv[0], 1, urllib.quote_plus(control.lang(30702)))) # rating utils.add_directory(control.lang(30703), utils.icon_folder, None, "%s?action=list-all&page=%i&sort=%s" % ( sys.argv[0], 1, urllib.quote_plus(control.lang(30703)))) control.directory_end() return
def __init__(self): params = dict(part.split('=') for part in sys.argv[2][1:].split('&')) album_id = params["id"] utils.set_no_sort() api = imgur.Api() data = api.get_album(album_id)["album"] images = data["images"] for img in images: utils.add_gallery_item(img) control.directory_end(force_thumb=True) return
def browse_gallery(self): epoch_time = int(time.time()) api = imgur.Api() data = api.get_random_gallery(self.page) for g in data["galleries"]: utils.add_gallery_item(g) next_page = self.page + 1 utils.add_next_page( "%s%s?action=random&page=%s" % (sys.argv[0], epoch_time, next_page), next_page + 1) control.directory_end(force_thumb=True)
def show_sort(self): # search utils.add_directory(control.lang(30409), utils.icon_search, None, "%s?action=search-authors" % (sys.argv[0])) # episodes utils.add_directory(control.lang(30705), utils.icon_folder, None, "%s?action=browse-authors&page=%i&sort=%s" % ( sys.argv[0], 1, urllib.quote_plus(control.lang(30705)))) # A to Z utils.add_directory(control.lang(30704), utils.icon_folder, None, "%s?action=browse-authors&page=%i&sort=%s" % ( sys.argv[0], 1, urllib.quote_plus(control.lang(30704)))) control.directory_end() return
def display_section_choice(self, close_directory=True): epoch_time = int(time.time()) utils.add_directory( utils.text_blue % control.lang(30601), utils.icon_folder, None, "%s%s?action=gallery§ion=hot" % (sys.argv[0], epoch_time)) utils.add_directory( utils.text_blue % control.lang(30602), utils.icon_folder, None, "%s%s?action=gallery§ion=top" % (sys.argv[0], epoch_time)) utils.add_directory( utils.text_blue % control.lang(30603), utils.icon_folder, None, "%s%s?action=gallery§ion=user" % (sys.argv[0], epoch_time)) if close_directory: control.directory_end(force_thumb=False) return
def render_reddit_list(self): utils.set_no_sort() epoch_time = int(time.time()) utils.add_directory(utils.text_green % control.lang(30502), utils.icon_settings, None, "%s?action=settings" % (sys.argv[0])) utils.add_directory(utils.text_heading % (control.lang(30508)), utils.icon_folder, None, "%s?action=reddit_add" % (sys.argv[0])) reddits = utils.get_subreddits() for sr in reddits: utils.add_directory(sr.title(), utils.icon_folder, None, "%s%s?action=gallery§ion=%s&type=reddit" % ( sys.argv[0], epoch_time, urllib.quote_plus(sr.title()))) control.directory_end(force_thumb=False) return
def display_sort_choice(self, close_directory=True): epoch_time = int(time.time()) utils.add_directory( utils.text_blue % control.lang(30604), utils.icon_folder, None, "%s%s?action=meme&sort=viral" % (sys.argv[0], epoch_time)) utils.add_directory( utils.text_blue % control.lang(30605), utils.icon_folder, None, "%s%s?action=meme&sort=top" % (sys.argv[0], epoch_time)) utils.add_directory( utils.text_blue % control.lang(30606), utils.icon_folder, None, "%s%s?action=meme&sort=time" % (sys.argv[0], epoch_time)) if close_directory: control.directory_end(force_thumb=False) return
def show_sort(self): # search utils.add_directory(control.lang(30409), utils.icon_search, None, "%s?action=search-authors" % (sys.argv[0])) # episodes utils.add_directory( control.lang(30705), utils.icon_folder, None, "%s?action=browse-authors&page=%i&sort=%s" % (sys.argv[0], 1, urllib.quote_plus(control.lang(30705)))) # A to Z utils.add_directory( control.lang(30704), utils.icon_folder, None, "%s?action=browse-authors&page=%i&sort=%s" % (sys.argv[0], 1, urllib.quote_plus(control.lang(30704)))) control.directory_end() return
def search(self): if self.search_query is None or self.search_query == '': t = control.lang(30201).encode('utf-8') k = control.keyboard('', t) k.doModal() self.search_query = k.getText() if k.isConfirmed() else None if self.search_query is None or self.search_query == '': return base_url = "https://c9search.azurewebsites.net/content/search?text=%s&$top=100&$skip=0&$inlinecount=allpages" \ % (urllib.quote_plus(self.search_query)) data = http_request.get(base_url) start_index = data.index('"documents":') + 12 if start_index <= 12: return json_data = data[start_index:-3] json_media = json.loads(json_data) for media in json_media: title = media["title"] url = media["permalink"] genre = media["published"] thumbnail = media["previewImage"] plot = media["summaryBody"] list_item = control.item(title, iconImage="DefaultVideo.png", thumbnailImage=thumbnail) list_item.setInfo( "video", { "Title": title, "Studio": "Microsoft Channel 9", "Plot": plot, "Genre": genre }) plugin_play_url = '%s?action=play&video_page_url=%s' % ( sys.argv[0], urllib.quote_plus(url)) control.addItem(handle=int(sys.argv[1]), url=plugin_play_url, listitem=list_item, isFolder=False) # End of directory... control.directory_end() return
def list(self): url = "%s%s?sort=%s&page=%i&%s" % ( utils.url_root, self.series_url, self.sort, self.current_page, utils.selected_languages()) html_data = http_request.get(url) print url soup_strainer = SoupStrainer("main") beautiful_soup = BeautifulSoup(html_data, soup_strainer, convertEntities=BeautifulSoup.HTML_ENTITIES) articles = beautiful_soup.findAll("article") for article in articles: utils.add_entry_video(article) next_url = "%s?action=list-series&page=%i&sort=%s&series-url=%s" % ( sys.argv[0], self.current_page + 1, urllib.quote_plus(self.sort_method), urllib.quote_plus(self.series_url)) utils.add_next_page(beautiful_soup, next_url, self.current_page + 1) control.directory_end() return
def show_list_sort(self): # recent utils.add_directory(control.lang(30701), utils.icon_folder, None, "%s?action=list-tag&page=%i&sort=%s&tag-url=%s" % ( sys.argv[0], 1, urllib.quote_plus(control.lang(30701)), urllib.quote_plus(self.tag_url))) # viewed utils.add_directory(control.lang(30702), utils.icon_folder, None, "%s?action=list-tag&page=%i&sort=%s&tag-url=%s" % ( sys.argv[0], 1, urllib.quote_plus(control.lang(30702)), urllib.quote_plus(self.tag_url))) # rating utils.add_directory(control.lang(30703), utils.icon_folder, None, "%s?action=list-tag&page=%i&sort=%s&tag-url=%s" % ( sys.argv[0], 1, urllib.quote_plus(control.lang(30703)), urllib.quote_plus(self.tag_url))) control.directory_end() return
def browse_section(self): meta = utils.get_course_meta() utils.add_directory(utils.text_green % control.lang(30501), utils.icon_search, utils.icon_search, "%s?action=search§ion=%s" % (sys.argv[0], self.section)) for m in meta["sections"]: header = m["header"] if header == self.section: infos = m["narrowByInfos"] for info in infos: count = info["count"] name = info["name"].encode('utf-8') utils.add_directory("%s (%i)" % (name, count), self.icon, self.icon, "%s?action=browse-group&group=%s§ion=%s&page=1" % ( sys.argv[0], urllib.quote_plus(name, safe=':/'), urllib.quote_plus(self.section, safe=':/'))) control.directory_end(False) return
def list(self): url = "%s%s?sort=%s&page=%i&%s" % ( utils.url_root, self.series_url, self.sort, self.current_page, utils.selected_languages()) html_data = http_request.get(url) print url soup_strainer = SoupStrainer("div", {"class": "tab-content"}) beautiful_soup = BeautifulSoup(html_data, soup_strainer, convertEntities=BeautifulSoup.HTML_ENTITIES) ul_entries = beautiful_soup.find("ul", {"class": "entries"}) li_entries = ul_entries.findAll("li") for li_entry in li_entries: utils.add_entry_video(li_entry) next_url = "%s?action=list-series&page=%i&sort=%s&series-url=%s" % ( sys.argv[0], self.current_page + 1, urllib.quote_plus(self.sort_method), urllib.quote_plus(self.series_url)) utils.add_next_page(beautiful_soup, next_url, self.current_page + 1) control.directory_end() return
def browse(self): posts = utils.get_thread(self.board, self.threadId)["posts"] for p in posts: if ('ext' not in p) or ("filename" not in p): continue if p["ext"] in utils.image_ext: thumb = utils.get_thumb_url(self.board, p["tim"]) img_url = utils.get_image_url(self.board, p["tim"], p["ext"]) utils.add_image(p['filename'], thumb, img_url) else: thumb = utils.get_thumb_url(self.board, p["tim"]) vid_url = utils.get_image_url(self.board, p["tim"], p["ext"]) utils.add_video(p['filename'], thumb, vid_url) control.directory_end() return
def show_list_sort(self): # recent utils.add_directory(control.lang(30701), utils.icon_folder, None, utils.action_list_blog % ( sys.argv[0], 1, urllib.quote_plus(control.lang(30701)), urllib.quote_plus(self.blog_url))) # viewed utils.add_directory(control.lang(30702), utils.icon_folder, None, utils.action_list_blog % ( sys.argv[0], 1, urllib.quote_plus(control.lang(30702)), urllib.quote_plus(self.blog_url))) # rating utils.add_directory(control.lang(30703), utils.icon_folder, None, utils.action_list_blog % ( sys.argv[0], 1, urllib.quote_plus(control.lang(30703)), urllib.quote_plus(self.blog_url))) control.directory_end() return
def browse_gallery(self, gallery_type=None): epoch_time = int(time.time()) api = imgur.Api() if gallery_type == 'reddit': data = api.get_reddit_gallery(self.section, self.sort, "all", self.page) else: data = api.get_gallery(self.section, self.sort, "all", self.page, False) for g in data["galleries"]: utils.add_gallery_item(g) next_page = self.page + 1 utils.add_next_page( "%s%s?action=gallery&page=%s§ion=%s&sort=%s&type=%s" % (sys.argv[0], epoch_time, next_page, self.section, self.sort, self.gallery_type), next_page + 1) control.directory_end(force_thumb=True)
def show_list_sort(self): # recent utils.add_directory( control.lang(30701), utils.icon_folder, None, utils.action_list_blog % (sys.argv[0], 1, urllib.quote_plus( control.lang(30701)), urllib.quote_plus(self.blog_url))) # viewed utils.add_directory( control.lang(30702), utils.icon_folder, None, utils.action_list_blog % (sys.argv[0], 1, urllib.quote_plus( control.lang(30702)), urllib.quote_plus(self.blog_url))) # rating utils.add_directory( control.lang(30703), utils.icon_folder, None, utils.action_list_blog % (sys.argv[0], 1, urllib.quote_plus( control.lang(30703)), urllib.quote_plus(self.blog_url))) control.directory_end() return
def browse_section(self): meta = utils.get_course_meta() utils.add_directory( utils.text_green % control.lang(30501), utils.icon_search, utils.icon_search, "%s?action=search§ion=%s" % (sys.argv[0], self.section)) for m in meta["sections"]: header = m["header"] if header == self.section: infos = m["narrowByInfos"] for info in infos: count = info["count"] name = info["name"].encode('utf-8') utils.add_directory( "%s (%i)" % (name, count), self.icon, self.icon, "%s?action=browse-group&group=%s§ion=%s&page=1" % (sys.argv[0], urllib.quote_plus(name, safe=':/'), urllib.quote_plus(self.section, safe=':/'))) control.directory_end(False) return
def list(self): url = "%s/%s/posts?page=%u&%s" % ( utils.url_root, self.author_url, self.current_page, utils.selected_languages()) html_data = http_request.get(url) soup_strainer = SoupStrainer("div", {"class": "user-content"}) beautiful_soup = BeautifulSoup(html_data, soup_strainer, convertEntities=BeautifulSoup.HTML_ENTITIES) ul_entries = beautiful_soup.find("ul", {"class": "entries"}) if ul_entries is None: control.directory_end() return li_entries = ul_entries.findAll("li") for li_entry in li_entries: utils.add_entry_video(li_entry) next_url = "%s?action=list-author&page=%i&author-url=%s" % ( sys.argv[0], self.current_page + 1, urllib.quote_plus(self.author_url)) utils.add_next_page(beautiful_soup, next_url, self.current_page + 1) control.directory_end() return
def __init__(self): utils.set_no_sort() utils.add_directory(utils.text_green % control.lang(30502), utils.icon_settings, None, "%s?action=settings" % (sys.argv[0])) utils.add_directory(utils.text_heading % (control.lang(30503)), utils.icon_folder, None, "%s?action=gallery" % (sys.argv[0])) utils.add_directory(utils.text_heading % control.lang(30504), utils.icon_folder, None, "%s?action=meme" % (sys.argv[0])) utils.add_directory(utils.text_heading % control.lang(30505), utils.icon_folder, None, "%s?action=reddit" % (sys.argv[0])) utils.add_directory(utils.text_heading % control.lang(30506), utils.icon_folder, None, "%s?action=random" % (sys.argv[0])) control.directory_end(force_thumb=False) return
def display_sort_choice(self, close_directory=True): if not self.gallery_type == 'reddit': utils.add_directory( utils.text_blue % control.lang(30604), utils.icon_folder, None, "%s?action=gallery§ion=%s&sort=viral" % (sys.argv[0], self.section)) utils.add_directory( utils.text_blue % control.lang(30605), utils.icon_folder, None, "%s?action=gallery§ion=%s&sort=top&type=%s" % (sys.argv[0], self.section, self.gallery_type)) utils.add_directory( utils.text_blue % control.lang(30606), utils.icon_folder, None, "%s?action=gallery§ion=%s&sort=time&type=%s" % (sys.argv[0], self.section, self.gallery_type)) if self.section == 'user': utils.add_directory( utils.text_blue % control.lang(30607), utils.icon_folder, None, "%s?action=gallery§ion=%s&sort=rising" % (sys.argv[0], self.section)) if close_directory: control.directory_end(force_thumb=False) return
def __init__(self): utils.set_no_sort() # All utils.add_directory(control.lang(30401), utils.icon_all, None, "%s?action=list-all" % (sys.argv[0])) # Live utils.add_directory(control.lang(30407), utils.icon_event, None, "%s?action=browse-live" % (sys.argv[0])) # Events utils.add_directory(control.lang(30405), utils.icon_event, None, "%s?action=browse-events" % (sys.argv[0])) # Shows utils.add_directory(control.lang(30403), utils.icon_tv, None, "%s?action=browse-shows" % (sys.argv[0])) # Series utils.add_directory(control.lang(30404), utils.icon_tv, None, "%s?action=browse-series" % (sys.argv[0])) # Tags utils.add_directory(control.lang(30402), utils.icon_tag, None, "%s?action=browse-tags" % (sys.argv[0])) # Blogs utils.add_directory(control.lang(30406), utils.icon_blog, None, "%s?action=browse-blogs" % (sys.argv[0])) # Authors utils.add_directory(control.lang(30408), utils.icon_user, None, "%s?action=browse-authors" % (sys.argv[0])) # Search utils.add_directory(control.lang(30409), utils.icon_search, None, "%s?action=search" % (sys.argv[0])) # Search utils.add_directory("[B][COLOR green]%s[/COLOR][/B]" % control.lang(30410), utils.icon_cog, None, "%s?action=settings" % (sys.argv[0])) control.directory_end() return