def __initializeSnappers(): snapper_filepath = AddonUtils.getCompleteFilePath(AddonContext().addonPath, 'snapvideo', 'snappers.xml') if not AddonUtils.doesFileExist(snapper_filepath): snapper_filepath = AddonUtils.getCompleteFilePath(AddonContext().turtle_addonPath, 'lib/snapvideo', 'snappers.xml') print 'Loading snappers.xml from turtle library... ' + snapper_filepath snappers_xml = AddonUtils.getBeautifulSoupObj(snapper_filepath) global snappers if snappers is not None: return snappers snappers = [] for snapperTag in snappers_xml.findAll('snapper', attrs={'enabled':'true'}): snappers.append(Snapper(snapperTag)) return snappers
def displayMoviesMenu(request_obj, response_obj): # ALL Movies movies_icon_filepath = AddonUtils.getCompleteFilePath(baseDirPath=AddonContext().addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='movies.png') item = ListItem() item.set_next_action_name('Movies_List') item.add_request_data('movieCategoryUrl', 'http://www.pinoymovie.co/video') xbmcListItem = xbmcgui.ListItem(label='All Movies', iconImage=movies_icon_filepath, thumbnailImage=movies_icon_filepath) item.set_xbmc_list_item_obj(xbmcListItem) response_obj.addListItem(item) # Recently Added item = ListItem() item.set_next_action_name('Recent_Movies_List') item.add_request_data('movieCategoryUrl', 'http://www.pinoymovie.co/video') xbmcListItem = xbmcgui.ListItem(label='Recently Added', iconImage=movies_icon_filepath, thumbnailImage=movies_icon_filepath) item.set_xbmc_list_item_obj(xbmcListItem) #response_obj.addListItem(item) contentDiv = BeautifulSoup.SoupStrainer('div', {'id':'sub-sidebar'}) soup = HttpClient().getBeautifulSoup(url='http://www.pinoymovie.co/video', parseOnlyThese=contentDiv) soup = soup.findChild('div', {'class':'right'}) for liItemTag in soup.findChildren('li', {'class':re.compile(r'\bcat-item\b')}): aTag = liItemTag.findChild('a') categoryUrl = aTag['href'] categoryName = aTag.getText() item = ListItem() item.set_next_action_name('Movies_List') item.add_request_data('movieCategoryUrl', categoryUrl) xbmcListItem = xbmcgui.ListItem(label=categoryName, iconImage=movies_icon_filepath, thumbnailImage=movies_icon_filepath) item.set_xbmc_list_item_obj(xbmcListItem) response_obj.addListItem(item) # Search TV search_icon_filepath = AddonUtils.getCompleteFilePath(baseDirPath=AddonContext().addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='search.png') item = ListItem() item.set_next_action_name('Search_Movies_List') item.add_request_data('movieCategoryUrl', 'http://www.pinoymovie.co/?s=') xbmcListItem = xbmcgui.ListItem(label='Search Movies', iconImage=search_icon_filepath, thumbnailImage=search_icon_filepath) item.set_xbmc_list_item_obj(xbmcListItem) response_obj.addListItem(item)
def selectChannelsCategory(request_obj, response_obj): filepath = AddonUtils.getCompleteFilePath(baseDirPath=AddonContext().addonPath, extraDirPath=AddonUtils.ADDON_SRC_DATA_FOLDER, filename=CHANNELS_JSON_FILE) freeChannels = AddonUtils.getJsonFileObj(filepath) if len(freeChannels.keys()) > 1: d = xbmcgui.Dialog() catSelect = d.select('SELECT Category', freeChannels.keys()) else: catSelect = 0 if catSelect == -1: raise Exception(ExceptionHandler.CATEGORY_NOT_SELECTED, 'Please select the category correctly') category = freeChannels.keys()[catSelect] request_obj.set_data({'channels': freeChannels[category]})
def displayTVShowsMenu(request_obj, response_obj): # GMA item = ListItem() item.set_next_action_name('TV_Channel_GMA') item.add_request_data('tvChannelUrl', 'http://mypinoytvonline.blogspot.com/search/label/GMA') xbmcListItem = xbmcgui.ListItem(label='GMA', iconImage='http://www.lyngsat-logo.com/logo/tv/gg/gma.jpg', thumbnailImage='http://www.lyngsat-logo.com/logo/tv/gg/gma.jpg') item.set_xbmc_list_item_obj(xbmcListItem) response_obj.addListItem(item) # ABS-CBN item = ListItem() item.set_next_action_name('TV_Channel_ABS_CBN') item.add_request_data('tvChannelUrl', 'http://mypinoytvonline.blogspot.com/search/label/ABS-CBN') xbmcListItem = xbmcgui.ListItem(label='ABS-CBN', iconImage='http://www.lyngsat-logo.com/logo/tv/aa/abs_cbn.jpg', thumbnailImage='http://www.lyngsat-logo.com/logo/tv/aa/abs_cbn.jpg') item.set_xbmc_list_item_obj(xbmcListItem) response_obj.addListItem(item) # TV5 item = ListItem() item.set_next_action_name('TV_Channel_TV5') item.add_request_data('tvChannelUrl', 'http://mypinoytvonline.blogspot.com/search/label/TV%205') xbmcListItem = xbmcgui.ListItem(label='TV 5', iconImage='http://www.lyngsat-logo.com/logo/tv/tt/tv5_ph.jpg', thumbnailImage='http://www.lyngsat-logo.com/logo/tv/tt/tv5_ph.jpg') item.set_xbmc_list_item_obj(xbmcListItem) response_obj.addListItem(item) # ALL tvshows_icon_filepath = AddonUtils.getCompleteFilePath(baseDirPath=AddonContext().addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='tvShows.png') item = ListItem() item.set_next_action_name('TV_Channel_ALL') item.add_request_data('tvChannelUrl', 'http://mypinoytvonline.blogspot.com/') xbmcListItem = xbmcgui.ListItem(label='All TV Shows', iconImage=tvshows_icon_filepath, thumbnailImage=tvshows_icon_filepath) item.set_xbmc_list_item_obj(xbmcListItem) response_obj.addListItem(item) # Search TV search_icon_filepath = AddonUtils.getCompleteFilePath(baseDirPath=AddonContext().addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='search.png') item = ListItem() item.set_next_action_name('TV_Channel_Search') item.add_request_data('tvChannelUrl', 'http://mypinoytvonline.blogspot.com/search?q=') xbmcListItem = xbmcgui.ListItem(label='Search TV', iconImage=search_icon_filepath, thumbnailImage=search_icon_filepath) item.set_xbmc_list_item_obj(xbmcListItem) response_obj.addListItem(item)
def displayMenuItems(request_obj, response_obj): # TV Shows item tvshows_icon_filepath = AddonUtils.getCompleteFilePath( baseDirPath=AddonContext().addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='tvShows.png') item = ListItem() item.set_next_action_name('TV_Shows') xbmcListItem = xbmcgui.ListItem(label='TV SHOWS', iconImage=tvshows_icon_filepath, thumbnailImage=tvshows_icon_filepath) item.set_xbmc_list_item_obj(xbmcListItem) response_obj.addListItem(item) # Movies item movies_icon_filepath = AddonUtils.getCompleteFilePath( baseDirPath=AddonContext().addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='movies.png') item = ListItem() item.set_next_action_name('Movies') xbmcListItem = xbmcgui.ListItem(label='MOVIES', iconImage=movies_icon_filepath, thumbnailImage=movies_icon_filepath) item.set_xbmc_list_item_obj(xbmcListItem) response_obj.addListItem(item) # LIVE TV item live_icon_filepath = AddonUtils.getCompleteFilePath( baseDirPath=AddonContext().addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='live.png') item = ListItem() item.set_next_action_name('Live') xbmcListItem = xbmcgui.ListItem(label='LIVE TV', iconImage=live_icon_filepath, thumbnailImage=live_icon_filepath) item.set_xbmc_list_item_obj(xbmcListItem) response_obj.addListItem(item)
def __processAndAddVideoInfo__(item, data): video_info = findVideoInfo(data) if video_info is None: raise Exception(ExceptionHandler.VIDEO_PARSER_NOT_FOUND, 'Video information is not found. Please check other sources.') if video_info.is_video_stopped(): raise Exception(ExceptionHandler.VIDEO_STOPPED, 'Video is either removed or not found. Please check other links.') XBMCInterfaceUtils.updateListItem_With_VideoInfo(video_info, item.get_xbmc_list_item_obj()) qual = int(AddonContext().addon.getSetting('playbackqual')) video_strm_link = video_info.get_video_link(DataObjects.VIDEO_QUAL_HD_1080) if video_strm_link == None or qual != 0: video_strm_link = video_info.get_video_link(DataObjects.VIDEO_QUAL_HD_720) if video_strm_link == None or qual == 2: video_strm_link = video_info.get_video_link(DataObjects.VIDEO_QUAL_SD) if video_strm_link == None: video_strm_link = video_info.get_video_link(DataObjects.VIDEO_QUAL_LOW) item.get_moving_data()['videoStreamUrl'] = video_strm_link