def episode(): xbmc.log("Eposide") url = h.extract_var(args, 'url') xbmc.log("Eposide URL 1 : " + url) currentDisplayCounter = int(param2) if param1 == "old": url = CHANNEL_EPISODE_URL + url + "/" + str(currentDisplayCounter) + "/50/oldest/" else: url = CHANNEL_EPISODE_URL + url + "/" + str(currentDisplayCounter) + "/50/newest/" xbmc.log("Episode URL 2 : " + url) JSONObjs = json.loads(h.make_request(url, cookie_file, cookie_jar)) for JSONObj in JSONObjs: title = JSONObj["video_title"] img_src = JSONObj["video_image"] h.add_dir(addon_handle, base_url, title, JSONObj["slug"], 'show', img_src, img_src) if len(JSONObjs) >= 50 : currentDisplayCounter = currentDisplayCounter + 50 h.add_dir(addon_handle, base_url, 'Next >>', h.extract_var(args, 'url'), 'episode~' + param1 + '~' + str(currentDisplayCounter), img_src, img_src) elif len(JSONObjs) < 50 : currentDisplayCounter = -1
def show(): url = h.extract_var(args, 'url') url = '%s%s' % (ZEEMARATHI_REFERRER, url) soup = BeautifulSoup(h.make_request(url, cookie_file, cookie_jar)) ul = soup.find('ul', {'class': lambda x: x and 'show-videos-list' in x.split()}) for li in ul: div = li.find('div', {'class': lambda x: x and 'video-watch' in x.split()}) episode_url = div.find('a')['href'] name = li.find('div', {'class': 'video-episode'}).text img_src = 'DefaultFolder.png' img = li.find('img') if img: img_src = img['src'] h.add_dir(addon_handle, base_url, name, episode_url, 'episode', img_src, img_src) pager = soup.find('ul', {'class': lambda x: x and 'pager' in x.split()}) if pager: next_link = pager.find( 'li', {'class': lambda x: x and 'pager-next' in x.split()}) if next_link: next_url = next_link.find('a')['href'] if next_url: h.add_dir(addon_handle, base_url, 'Next >>', next_url, 'show')
def show(): url = h.extract_var(args, 'url') url = '%s%s' % (ZEEMARATHI_REFERRER, url) soup = BeautifulSoup(h.make_request(url, cookie_file, cookie_jar)) ul = soup.find('ul', {'class': lambda x: x and 'show-videos-list' in x.split()}) for li in ul: div = li.find('div', {'class': lambda x: x and 'video-watch' in x.split()}) episode_url = div.find('a')['href'] name = li.find('div', {'class': 'video-episode'}).text img_src = 'DefaultFolder.png' img = li.find('img') if img: img_src = img['src'] h.add_dir(addon_handle, base_url, name, episode_url, 'episode', img_src, img_src) pager = soup.find('ul', {'class': lambda x: x and 'pager' in x.split()}) if pager: next_link = pager.find('li', {'class': lambda x: x and 'pager-next' in x.split()}) if next_link: next_url = next_link.find('a')['href'] if next_url: h.add_dir(addon_handle, base_url, 'Next >>', next_url, 'show')
def current_shows(): url = h.extract_var(args, 'url') soup = BeautifulSoup(h.make_request(url, cookie_file, cookie_jar)) # XXX: If want sorted # import operator # shows = {} # shows[a_attrs['href']] = a_attrs['title'] # shows = sorted(shows.items(), key=operator.itemgetter(1)) # XXX: View mode thumbnail supported in xbmcswift2 h2 = soup.findAll('h2') for h2 in soup.findAll('h2'): if h2.text == 'Shows': for li in h2.nextSibling.find('ul').findAll('li'): a = li.find('a') a_attrs = dict(a.attrs) title = '%s (%s)' % ( h.bs_find_with_class(a, 'div', 'zc-show-title').text, h.bs_find_with_class(a, 'div', 'zc-air-time').text) img_src = dict(a.find('img').attrs)['src'] h.add_dir(addon_handle, base_url, title, '%s/video/' % a_attrs['href'], 'show', img_src, img_src) break
def todays_show(): url = h.extract_var(args, 'url') soup = BeautifulSoup(h.make_request(url, cookie_file, cookie_jar)) ul = soup.find('ul', {'class': lambda x: x and 'videos-list' in x.split()}) for li in ul.nextSibling.findAll('li'): episode_url = li.find('a')['href'] title = li.find('a')['title'] img_src = li.find('a').find('img')['src'] h.add_dir(addon_handle, base_url, title, episode_url, 'todays_episode', img_src, img_src)
def main_index(): d = { 'Hollywood': 'category/latest-hollywood-movies/', 'Bollywood': 'category/hindi-movies/', 'Dubbed: English in Hindi': 'category/english-in-hindi/', 'Dubbed: South in Hindi': 'category/south-indian-in-hindi/', 'Telugu': 'category/telugu-movies/', 'Tamil': 'category/tamil-movies/', } for name, url in d.items(): h.add_dir(addon_handle, base_url, name, ROOT_URL + url, 'movies_list')
def archive_shows(): url = h.extract_var(args, 'url') soup = BeautifulSoup(h.make_request(url, cookie_file, cookie_jar)) h2 = soup.findAll('h2') for h2 in soup.findAll('h2'): if h2.text == 'Archive Shows': for div in h.bs_find_all_with_class(h2.nextSibling, 'div', 'archive-show'): a = div.find('a') a_attrs = dict(a.attrs) h.add_dir(addon_handle, base_url, a_attrs['title'], '%s/video/' % a_attrs['href'], 'show') break
def current_shows(): url = h.extract_var(args, 'url') soup = BeautifulSoup(h.make_request(url, cookie_file, cookie_jar)) h2 = soup.findAll('h2') for h2 in soup.findAll('h2'): if h2.text == 'Shows': for li in h2.nextSibling.find('ul').findAll('li'): a = li.find('a') a_attrs = dict(a.attrs) title = '%s (%s)' % (h.bs_find_with_class(a, 'div', 'zc-show-title').text, h.bs_find_with_class(a, 'div', 'zc-air-time').text) img_src = dict(a.find('img').attrs)['src'] h.add_dir(addon_handle, base_url, title, '%s/video/' % a_attrs['href'], 'show', img_src, img_src) break
def current_shows(): url = h.extract_var(args, 'url') soup = BeautifulSoup(h.make_request(url, cookie_file, cookie_jar)) h2 = soup.findAll('h2') for h2 in soup.findAll('h2'): if h2.text == 'Shows': for li in h2.nextSibling.find('ul').findAll('li'): a = li.find('a') a_attrs = dict(a.attrs) title = '%s (%s)' % ( h.bs_find_with_class(a, 'div', 'zc-show-title').text, h.bs_find_with_class(a, 'div', 'zc-air-time').text) img_src = dict(a.find('img').attrs)['src'] h.add_dir(addon_handle, base_url, title, '%s/video/' % a_attrs['href'], 'show', img_src, img_src) break
def main_index(): h.add_dir(addon_handle, base_url, 'Todays Shows', SHOWS_URL, 'TodaysShows') h.add_dir(addon_handle, base_url, 'Current Shows', SHOWS_URL, 'CurrentShows') h.add_dir(addon_handle, base_url, 'Archive Shows', SHOWS_URL, 'ArchiveShows')
def show_episodes(): xbmc.log("Show Episodes Menu") showname = h.extract_var(args, 'url') v_data = "{\"detailsType\":\"basic\",\"searchSet\":[{\"pageSize\":50,\"pageNumber\":" + param1 + ",\"sortOrder\":\"START_DATE:DESC\",\"type\":\"search\",\"id\":\"Episodes\",\"data\":\"exact=true&all=type:Episodes&all=showname:" + showname + "\"}, {\"pageSize\":50,\"pageNumber\":" + param1 + ",\"sortOrder\":\"START_DATE:DESC\",\"type\":\"search\",\"id\":\"video\",\"data\":\"exact=true&all=type:video&all=showname:" + showname + "\"}],\"deviceDetails\":{\"mfg\":\"Google Chrome\",\"os\":\"others\",\"osVer\":\"XXX\",\"model\":\"Google Chrome\"}}" JSONObjs = json.loads(h.make_request_post(SHOW_EPISODE_URL, v_data, cookie_file, cookie_jar, TOKEN)) for searchSet in JSONObjs: for rows in searchSet["assets"]: title = rows["title"] if rows["releaseDate"] != "": title = title + " (" + str(rows["releaseDate"]) + ")" h.add_dir_video(addon_handle, title, rows["hlsUrl"], img_src, rows["shortDesc"], int(rows["duration"])/1000) currentDisplayCounter = int(param1) if len(JSONObjs[0]["assets"]) >= 50 : currentDisplayCounter = currentDisplayCounter + 1 h.add_dir(addon_handle, base_url, 'Next >>', showname, "episodemenu~" + str(currentDisplayCounter)) elif len(JSONObjs[0]["assets"]) < 50 : currentDisplayCounter = -1
def topic(): topic_id = h.extract_var(args, 'elem_id') posts = proxy.get_thread(topic_id)['posts'] post_content = posts[0]['post_content'].data if '\r\n' in post_content: content = post_content.split('\r\n\r\n') else: content = post_content.split('\n\n') links = [] current_links = [] for c in content: c = c.strip() if c.startswith('['): if c.upper().startswith('[URL'): links_content = c.split('\n') for link_content in links_content: idx1 = link_content.upper().find('[URL=') idx2 = link_content.find(']') url = link_content[idx1 + 5: idx2] if url: if url[0] == '"': url = url[1:] if url[-1] == '"': url = url[:-1] idx3 = link_content.find('[', idx2) name = link_content[idx2 + 1: idx3] current_links.append({'name': name, 'url': url}) else: current_links = [] links.append({'name': c, 'links': current_links}) for link in links: title = link['name'] + ' (links: ' + str(len(link['links'])) + ')' h.add_dir(addon_handle, base_url, title, json.dumps(link['links']), 'links')
def movies_list(): url = h.extract_var(args, 'url') resp = h.make_request(url, cookie_file, cookie_jar) soup = BeautifulSoup(resp) div = h.bs_find_with_class(soup, 'div', 'loop-content') post_divs = h.bs_find_all_with_class(div, 'div', 'item-post') for post_div in post_divs: thumb = dict(post_div.find('img').attrs)['src'] a = h.bs_find_with_class(post_div, 'h2', 'entry-title').find('a') title = a.text u = dict(a.attrs)['href'] h.add_dir(addon_handle, base_url, title, u, 'movie', thumbnail=thumb) div_nav = h.bs_find_with_class(soup, 'div', 'loop-nav') if div_nav: a_next = h.bs_find_with_class(div_nav, 'a', 'nextpostslink') if a_next: u = dict(a_next.attrs)['href'] title = 'Next >> (%s)' % h.bs_find_with_class(div_nav, 'span', 'pages').text h.add_dir(addon_handle, base_url, title, u, 'movies_list')
def forum(): forum_id = h.extract_var(args, 'elem_id') forums = proxy.get_forum(False, forum_id) for forum in forums: h.add_dir(addon_handle, base_url, forum['forum_name'].data, forum['forum_id'], 'forum', thumbnail=forum['logo_url']) if not forums: n = 19 topics = proxy.get_topic(forum_id, 0, n, 'TOP')['topics'] for topic in topics: h.add_dir(addon_handle, base_url, topic['topic_title'].data, topic['topic_id'], 'topic', thumbnail=topic['icon_url']) n -= 1 if n > 0: topics = proxy.get_topic(forum_id, 0, n)['topics'] for topic in topics: h.add_dir(addon_handle, base_url, topic['topic_title'].data, topic['topic_id'], 'topic', thumbnail=topic['icon_url'])
def shows_serials(): xbmc.log("Show_Serials") url = h.extract_var(args, 'url') xbmc.log("URL : " + url) if param1 == "shows": JSONObjs = json.loads(h.make_request(url, cookie_file, cookie_jar)) for JSONObj in JSONObjs: title = JSONObj["title"] img_src = JSONObj["listing_image_small"] h.add_dir(addon_handle, base_url, title, JSONObj["slug"], "episodemenu", img_src, img_src) elif param1 == "music": for Music in MusicLanguages: xbmc.log(Music["URL"]) h.add_dir(addon_handle, base_url, Music["Language"], Music["URL"], "Music~0") else: for Movie in MoviesLanguages: xbmc.log(Movie["URL"]) h.add_dir(addon_handle, base_url, Movie["Language"], Movie["URL"], "Movies~0")
def main_branch(): v_data = "{\"searchSet\":[ {\"type\":\"search\", \"pageSize\":50, \"pageNumber\":" + str(param1) + ", \"id\":\"Episodes\", \"sortOrder\":\"START_DATE:DESC\", \"data\":\"all=type:show\" }],\"detailsType\":\"basic\", \"deviceDetails\":{\"mfg\":\"Google Chrome\", \"os\":\"others\", \"osVer\":\"XXX\", \"model\":\"Google Chrome\"}}" xbmc.log("main_branch") JSONObjs = json.loads(h.make_request_post(SHOW_EPISODE_URL, v_data, cookie_file, cookie_jar, TOKEN)) for rows in JSONObjs[0]["assets"]: title = rows["title"] showname = rows["title"] img_src = rows["thumbnailUrl"] if 'posterUrl' in rows: h.add_dir(addon_handle, base_url, title, showname, "episodemenu~0", img_src, rows["posterUrl"]) else: h.add_dir(addon_handle, base_url, title, showname, "episodemenu~0", img_src, img_src) currentDisplayCounter = int(param1) if len(JSONObjs[0]["assets"]) >= 50 : currentDisplayCounter = currentDisplayCounter + 1 h.add_dir(addon_handle, base_url, 'Next >>', "Next >>", 'main~' + str(currentDisplayCounter)) elif len(JSONObjs[0]["assets"]) < 50 : currentDisplayCounter = -1
def shows_movies(): xbmc.log("Shows_Movies") url = h.extract_var(args, 'url') xbmc.log("URL : " + url) if mode == "Movies": JSONObjs = json.loads(h.make_request(url, cookie_file, cookie_jar)) else: JSONObjs = json.loads(h.make_request(url, cookie_file, cookie_jar)) for JSONObj in JSONObjs: title = JSONObj["title"] if mode == "Movies": img_src = JSONObj["image_medium"] h.add_dir(addon_handle, base_url, title, JSONObj["slug"], "Show_Movies", img_src, img_src) else: img_src = JSONObj["listing_image_medium"] h.add_dir(addon_handle, base_url, title, JSONObj["slug"], "Show_Music", img_src, img_src) currentDisplayCounter = int(param1) if len(JSONObjs) >= 50 : currentDisplayCounter = currentDisplayCounter + 50 h.add_dir(addon_handle, base_url, 'Next >>', h.extract_var(args, 'url'), mode + '~' + param1 + '~' + str(currentDisplayCounter), img_src, img_src) elif len(JSONObjs) < 50 : currentDisplayCounter = -1
def main_branch(): xbmc.log("Main_Branch") for Channel in Channels: xbmc.log(Channel['Name']) h.add_dir(addon_handle, base_url, Channel["Name"], Channel["URL"], Channel["Type"], Channel["icon_src"], Channel["icon_src"])
def shows_serials_menu(): xbmc.log("Show_Serials_Menu") url = h.extract_var(args, 'url') xbmc.log("Serial URL : " + url) h.add_dir(addon_handle, base_url, "Newest", url, 'episode~new~' + str(currentDisplayCounter)) h.add_dir(addon_handle, base_url, "Oldest", url, 'episode~old~' + str(currentDisplayCounter))
def main_index(): forums = proxy.get_forum() for forum in forums: h.add_dir(addon_handle, base_url, forum['forum_name'].data, forum['forum_id'], 'forum', thumbnail=forum['logo_url'])