Exemple #1
0
def ping(request_obj, response_obj):
    Container().ga_client.reportAction('ping')
    response_obj.addServiceResponseParam("response", "pong")
    response_obj.addServiceResponseParam("message", "Hi there, I am PlayIt")

    item = ListItem()
    item.set_next_action_name('pong')
    response_obj.addListItem(item)
Exemple #2
0
def displayMovies(request_obj, response_obj):
    url = request_obj.get_data()['movieCategoryUrl']
    print "indisplay" + url
    if request_obj.get_data().has_key('page'):
        url_parts = url.split('?')
        
        url_part_A = ''
        url_part_B = ''
        if len(url_parts) == 2:
            url_part_A = url_parts[0]
            url_part_B = '?' + url_parts[1]
        else:
            url_part_A = url
        if url_part_A[len(url_part_A) - 1] != '/':
            url_part_A = url_part_A + '/'
        url = url_part_A + 'page/' + request_obj.get_data()['page'] + url_part_B

    contentDiv = BeautifulSoup.SoupStrainer('div', {'id':'content'})
    soup = HttpClient().getBeautifulSoup(url=url, parseOnlyThese=contentDiv)

    movieTags = soup.findChildren('div', {'class':'post'})
    print "intags" + str(movieTags)
    if len(movieTags) == 0:
        movieTags = soup.findChildren('div', {'class':'videopost'})
    for movieTag in movieTags:
        item = __retrieveAndCreateMovieItem__(movieTag)
        response_obj.addListItem(item)
    
    response_obj.set_xbmc_content_type('movies')
    try:
        pagesInfoTag = soup.findChild('div', {'class':'navigation'})

        current_page = int(pagesInfoTag.find('span', {'class':'page current'}).getText())
        #print current_page
        pages = pagesInfoTag.findChildren('a', {'class':'page'})
        #print pages
        last_page = int(pages[len(pages) - 1].getText())
    
        if current_page < last_page:
            for page in range(current_page + 1, last_page + 1):
                createItem = False
                if page == last_page:
                    pageName = AddonUtils.getBoldString('              ->              Last Page #' + str(page))
                    createItem = True
                elif page <= current_page + 4:
                    pageName = AddonUtils.getBoldString('              ->              Page #' + str(page))
                    createItem = True
                if createItem:
                    item = ListItem()
                    item.add_request_data('movieCategoryUrl', request_obj.get_data()['movieCategoryUrl'])
                    item.add_request_data('page', str(page))
                
                    
                    item.set_next_action_name('Movies_List_Next_Page')
                    xbmcListItem = xbmcgui.ListItem(label=pageName)
                    item.set_xbmc_list_item_obj(xbmcListItem)
                    response_obj.addListItem(item)
    except: pass
Exemple #3
0
def addYeahLiveItem(request_obj, response_obj):
    yeahfilepath = AddonUtils.getCompleteFilePath(baseDirPath=AddonContext().addonProfile, extraDirPath=AddonUtils.ADDON_SRC_DATA_FOLDER, filename=CHANNELS_JSON_FILE, makeDirs=False)
    if AddonUtils.doesFileExist(yeahfilepath):
        yeah_icon_filepath = AddonUtils.getCompleteFilePath(baseDirPath=AddonContext().addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='YEAH.png')
        item = ListItem()
        item.set_next_action_name('Yeah_TV')
        xbmcListItem = xbmcgui.ListItem(label='[B]YEAH[/B] STREAMS', iconImage=yeah_icon_filepath, thumbnailImage=yeah_icon_filepath)
        item.set_xbmc_list_item_obj(xbmcListItem)
        response_obj.addListItem(item)
Exemple #4
0
def retrieveIndVideoLinks(request_obj, response_obj):
    video_source_id = 0
    video_source_img = None
    video_part_index = 0
    video_playlist_items = []
    
    
    contentDiv = BeautifulSoup.SoupStrainer('p', {'style':re.compile(r'\bcenter\b')})
    soup = HttpClient().getBeautifulSoup(url=request_obj.get_data()['episodeUrl'], parseOnlyThese=contentDiv)
    for child in soup.findChildren():

        if child.name == 'img':
            if len(video_playlist_items) > 0:
                response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_playlist_items))
            video_source_id = video_source_id + 1
            video_source_img = child['src']
            video_part_index = 0
            video_playlist_items = []
        elif child.name == 'a':
            video_part_index = video_part_index + 1
            video_link = {}
            video_link['videoTitle'] = 'Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) + ' | ' + child.getText()
            video_link['videoLink'] = str(child['href'])
            video_playlist_items.append(video_link)
            
            item = ListItem()
            item.add_request_data('videoLink', video_link['videoLink'])
            item.add_request_data('videoTitle', video_link['videoTitle'])
            item.set_next_action_name('SnapAndPlayVideo')
            xbmcListItem = xbmcgui.ListItem(label='Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) , iconImage=video_source_img, thumbnailImage=video_source_img)
            item.set_xbmc_list_item_obj(xbmcListItem)
            response_obj.addListItem(item)
            
    if len(video_playlist_items) > 0:
        response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_playlist_items))
def displayFavouriteTVShows(request_obj, response_obj):
    addonContext = Container().getAddonContext()
    
    filepath = AddonUtils.getCompleteFilePath(baseDirPath=addonContext.addonProfile, extraDirPath=AddonUtils.ADDON_SRC_DATA_FOLDER, filename=FAV_TV_SHOWS_JSON_FILE, makeDirs=True)

    try:
        if AddonUtils.doesFileExist(filepath):
            favTVShowsJsonObj = AddonUtils.getJsonFileObj(filepath)
            if len(favTVShowsJsonObj) == 0:
                d = xbmcgui.Dialog()
                d.ok('No Favourites added yet!', 'Please use context menu on TV Show to add new favourite.', '')
    
            for tvShowName in favTVShowsJsonObj:
                tvShowInfo = favTVShowsJsonObj[tvShowName]
                item = ListItem()
                item.add_request_data('tvShowName', tvShowInfo['tvShowName'])
                item.add_request_data('tvShowUrl', tvShowInfo['tvShowUrl'])
                item.set_next_action_name('Show_Episodes')
                xbmcListItem = xbmcgui.ListItem(label=unicode(tvShowInfo['tvShowName']).encode("utf-8"))
                
                contextMenuItems = []
                data = '?actionId=' + urllib.quote_plus("remove_Fav_TVShow") + '&data=' + urllib.quote_plus(AddonUtils.encodeData({"tvShowName":tvShowInfo['tvShowName'], "tvShowUrl":tvShowInfo['tvShowUrl']}))
                contextMenuItems.append(('Remove favourite', 'XBMC.RunPlugin(%s?%s)' % (sys.argv[0], data)))
                xbmcListItem.addContextMenuItems(contextMenuItems, replaceItems=True)
                item.set_xbmc_list_item_obj(xbmcListItem)
                response_obj.addListItem(item)
        else:
            d = xbmcgui.Dialog()
            d.ok('No favourites added yet!', 'Please use context menu on TV Show to add new favourite.', '')
        
    except:
        AddonUtils.deleteFile(filepath)
        d = xbmcgui.Dialog()
        d.ok('FAILED to display TV Shows', 'Please add favorite again.')
def retrieveVideoLinks(request_obj, response_obj):
    video_source_id = 1
    video_source_img = None
    video_source_name = None
    video_part_index = 0
    video_playlist_items = []
    ignoreAllLinks = False
    
    content = BeautifulSoup.SoupStrainer('blockquote', {'class':re.compile(r'\bpostcontent\b')})
    soup = HttpClient().getBeautifulSoup(url=request_obj.get_data()['episodeUrl'], parseOnlyThese=content)
    for e in soup.findAll('br'):
        e.extract()
    Logger.logDebug(soup)
    if soup.has_key('div'):
        soup = soup.findChild('div', recursive=False)
    prevChild = ''
    prevAFont = None
    for child in soup.findChildren():
        if (child.name == 'img' or child.name == 'b' or (child.name == 'font' and not child.findChild('a'))):
            if (child.name == 'b' and prevChild == 'a') or (child.name == 'font' and child == prevAFont):
                continue
            else:
                if len(video_playlist_items) > 0:
                    response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_source_name, video_playlist_items))
                if video_source_img is not None:
                    video_source_id = video_source_id + 1
                    video_source_img = None
                    video_source_name = None
                    video_part_index = 0
                    video_playlist_items = []
                ignoreAllLinks = False
        elif not ignoreAllLinks and child.name == 'a' and not re.search('multi', str(child['href']), re.IGNORECASE):
            video_part_index = video_part_index + 1
            video_link = {}
            video_link['videoTitle'] = 'Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) + ' | ' + child.getText()
            video_link['videoLink'] = str(child['href'])
            try:
                try:
                    __prepareVideoLink__(video_link)
                except Exception, e:
                    Logger.logFatal(e)
                    video_hosting_info = SnapVideo.findVideoHostingInfo(video_link['videoLink'])
                    if video_hosting_info is None or video_hosting_info.get_video_hosting_name() == 'UrlResolver by t0mm0':
                        raise
                    video_link['videoSourceImg'] = video_hosting_info.get_video_hosting_image()
                    video_link['videoSourceName'] = video_hosting_info.get_video_hosting_name()
                video_playlist_items.append(video_link)
                video_source_img = video_link['videoSourceImg']
                video_source_name = video_link['videoSourceName']
                
                item = ListItem()
                item.add_request_data('videoLink', video_link['videoLink'])
                item.add_request_data('videoTitle', video_link['videoTitle'])
                item.set_next_action_name('SnapAndPlayVideo')
                xbmcListItem = xbmcgui.ListItem(label='Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) , iconImage=video_source_img, thumbnailImage=video_source_img)
                item.set_xbmc_list_item_obj(xbmcListItem)
                response_obj.addListItem(item)
                prevAFont = child.findChild('font')
            except:
def __preparePlayListItem__(video_source_id, video_source_img, video_playlist_items):
    item = ListItem()
    item.add_request_data('videoPlayListItems', video_playlist_items)
    item.set_next_action_name('SnapAndDirectPlayList')
    item.add_moving_data('isContinuousPlayItem', True)
    xbmcListItem = xbmcgui.ListItem(label='[COLOR blue]' + AddonUtils.getBoldString('Continuous Play') + '[/COLOR]' + ' | ' + 'Source #' + str(video_source_id) + ' | ' + 'Parts = ' + str(len(video_playlist_items)) , iconImage=video_source_img, thumbnailImage=video_source_img)
    item.set_xbmc_list_item_obj(xbmcListItem)
    return item
Exemple #8
0
def __preparePlayListItem__(video_source_id, video_source_img, video_playlist_items):
    item = ListItem()
    item.add_request_data('videoPlayListItems', video_playlist_items)
    item.set_next_action_name('SnapAndDirectPlayList')
    xbmcListItem = xbmcgui.ListItem(label=AddonUtils.getBoldString('DirectPlay') + ' | ' + 'Source #' + str(video_source_id) + ' | ' + 'Parts = ' + str(len(video_playlist_items)) , iconImage=video_source_img, thumbnailImage=video_source_img)
    item.set_xbmc_list_item_obj(xbmcListItem)
    return item
Exemple #9
0
def prepareVideoItem(request_obj, response_obj):
    item = ListItem()
    item.add_moving_data('videoUrl', request_obj.get_data()['videoLink'])
    item.set_next_action_name('Play')
    xbmcListItem = xbmcgui.ListItem(label=request_obj.get_data()['videoTitle'])
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)
Exemple #10
0
def playChannel(request_obj, response_obj):
    item = ListItem()
    item.set_next_action_name('Play')
    item.add_moving_data('videoStreamUrl', request_obj.get_data()['channelUrl'])
    xbmcListItem = xbmcgui.ListItem(label=request_obj.get_data()['channelName'], iconImage=request_obj.get_data()['channelLogo'], thumbnailImage=request_obj.get_data()['channelLogo'])
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)
Exemple #11
0
def __retrieveAndCreateMovieItem__(movieTag):
    thumbTag = movieTag.findChild('div', {'class':'thumbnail'})
    imgUrl = ''
    if thumbTag is not None:    
        aTag = thumbTag.findChild('a')
        imgTag = aTag.findChild('img')
        imgUrl = imgTag['src']
    
    titleTag = movieTag.findChild('h2')
    aTag = titleTag.findChild('a')
    movieUrl = str(aTag['href'])
    title = unicode(titleTag.getText()).encode('utf8').replace('&#8217;', '\'').replace('&#038;', '&').replace('&#8230;', '...')
    
    descTag = movieTag.findChild('div', {'class':'entry'})
    desc = ''
    if descTag is not None:
        desc = unicode(descTag.getText()).encode('utf8').replace('&#8217;', '\'').replace('&#038;', '&').replace('&#8230;', '...')
    rating = 0.0
    ratingTag = movieTag.findChild('div', {'class':'post-ratings'})
    if ratingTag is not None:
        ratingInfo = ratingTag.getText()
        ratingFound = re.compile('average:(.+?)out of 5').findall(ratingInfo)
        if len(ratingFound) > 0:
            rating = float(ratingFound[0])
            rating = (rating / 5) * 10
    item = ListItem()
    item.set_next_action_name('Movie_VLinks')
    item.add_request_data('movieUrl', movieUrl)
    xbmcListItem = xbmcgui.ListItem(label=title, iconImage=imgUrl, thumbnailImage=imgUrl)
    xbmcListItem.setInfo('video', {'plot':desc, 'plotoutline':desc, 'title':title, 'originaltitle':title, 'rating':rating})
    item.set_xbmc_list_item_obj(xbmcListItem)
    return item
Exemple #12
0
def displayChannels(request_obj, response_obj):
    channels = request_obj.get_data()['channels']
    for channelName in channels:
        channelInfo = channels[channelName]
        channelUrl = channelInfo['channelUrl']
        channelLogo = channelInfo['channelLogo']
        item = ListItem()
        item.set_next_action_name('play_Live_Channel')
        item.add_request_data('channelName', channelName)
        item.add_request_data('channelLogo', channelLogo)
        item.add_request_data('channelUrl', channelUrl)
        xbmcListItem = xbmcgui.ListItem(label=channelName, iconImage=channelLogo, thumbnailImage=channelLogo)
        item.set_xbmc_list_item_obj(xbmcListItem)
        response_obj.addListItem(item)
    response_obj.set_xbmc_sort_method(xbmcplugin.SORT_METHOD_LABEL)
Exemple #13
0
def displayMenuItems(request_obj, response_obj):
    # TV Shows item
    onDemand_icon_filepath = AddonUtils.getCompleteFilePath(baseDirPath=AddonContext().addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='onDemand.png')
    item = ListItem()
    item.set_next_action_name('On_Demand')
    xbmcListItem = xbmcgui.ListItem(label='TV ON DEMAND', iconImage=onDemand_icon_filepath, thumbnailImage=onDemand_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)
Exemple #14
0
def retrieveVideoLinks(request_obj, response_obj):
    video_source_id = 1
    video_source_img = None
    video_part_index = 0
    video_playlist_items = []
    ignoreAllLinks = False
    
    content = BeautifulSoup.SoupStrainer('blockquote', {'class':re.compile(r'\bpostcontent\b')})
    soup = HttpClient().getBeautifulSoup(url=request_obj.get_data()['episodeUrl'], parseOnlyThese=content)
    if soup.has_key('div'):
        soup = soup.findChild('div', recursive=False)
    prevChild = ''
    for child in soup.findChildren():
        if child.name == 'img' or child.name == 'font'or child.name == 'b' :
            if child.name == 'b' and prevChild == 'a':
                continue
            else:
                if len(video_playlist_items) > 0:
                    response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_playlist_items))
                if video_source_img is not None:
                    video_source_id = video_source_id + 1
                    video_source_img = None
                    video_part_index = 0
                    video_playlist_items = []
                ignoreAllLinks = False
        elif not ignoreAllLinks and child.name == 'a' and not re.search('multi', str(child['href']), re.IGNORECASE):
            video_part_index = video_part_index + 1
            video_link = {}
            video_link['videoTitle'] = 'Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) + ' | ' + child.getText()
            video_link['videoLink'] = str(child['href'])
            try:
                __prepareVideoLink__(video_link)
                
                video_playlist_items.append(video_link)
                video_source_img = video_link['videoSourceImg']
                
                item = ListItem()
                item.add_request_data('videoLink', video_link['videoLink'])
                item.add_request_data('videoTitle', video_link['videoTitle'])
                item.set_next_action_name('SnapAndPlayVideo')
                xbmcListItem = xbmcgui.ListItem(label='Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) , iconImage=video_source_img, thumbnailImage=video_source_img)
                item.set_xbmc_list_item_obj(xbmcListItem)
                response_obj.addListItem(item)
            except:
                print 'Unable to recognize a source = ' + video_link['videoLink']
                video_source_img = None
                video_part_index = 0
                video_playlist_items = []
                ignoreAllLinks = True
        prevChild = child.name
    if len(video_playlist_items) > 0:
        response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_playlist_items))
Exemple #15
0
def playChannel(request_obj, response_obj):
    item = ListItem()
    item.set_next_action_name('Play')
    item.add_moving_data('videoStreamUrl', request_obj.get_data()['channelUrl'])
    xbmcListItem = xbmcgui.ListItem(label=request_obj.get_data()['channelName'], iconImage=request_obj.get_data()['channelLogo'], thumbnailImage=request_obj.get_data()['channelLogo'])
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)
def displayMovies(request_obj, response_obj):
    url = request_obj.get_data()["movieCategoryUrl"]
    if request_obj.get_data().has_key("page"):
        url_parts = url.split("?")

        url_part_A = ""
        url_part_B = ""
        if len(url_parts) == 2:
            url_part_A = url_parts[0]
            url_part_B = "?" + url_parts[1]
        else:
            url_part_A = url
        if url_part_A[len(url_part_A) - 1] != "/":
            url_part_A = url_part_A + "/"
        url = url_part_A + "page/" + request_obj.get_data()["page"] + url_part_B
    contentDiv = BeautifulSoup.SoupStrainer("div", {"id": "content"})
    soup = HttpClient().getBeautifulSoup(url=url, parseOnlyThese=contentDiv)
    movieTags = soup.findChildren("div", {"class": "post"})
    for movieTag in movieTags:
        item = __retrieveAndCreateMovieItem__(movieTag)
        response_obj.addListItem(item)

    response_obj.set_xbmc_content_type("movies")

    pagesInfoTag = soup.findChild("div", {"class": "navigation"})
    print pagesInfoTag
    current_page = int(pagesInfoTag.find("span", {"class": "page current"}).getText())
    print current_page
    pages = pagesInfoTag.findChildren("a", {"class": "page"})
    print pages
    last_page = int(pages[len(pages) - 1].getText())

    if current_page < last_page:
        for page in range(current_page + 1, last_page + 1):
            createItem = False
            if page == last_page:
                pageName = AddonUtils.getBoldString("              ->              Last Page #" + str(page))
                createItem = True
            elif page <= current_page + 4:
                pageName = AddonUtils.getBoldString("              ->              Page #" + str(page))
                createItem = True
            if createItem:
                item = ListItem()
                item.add_request_data("movieCategoryUrl", request_obj.get_data()["movieCategoryUrl"])
                item.add_request_data("page", str(page))

                item.set_next_action_name("Movies_List_Next_Page")
                xbmcListItem = xbmcgui.ListItem(label=pageName)
                item.set_xbmc_list_item_obj(xbmcListItem)
                response_obj.addListItem(item)
def prepareVideoItem(request_obj, response_obj):
    item = ListItem()
    item.add_moving_data('videoUrl', request_obj.get_data()['videoLink'])
    item.set_next_action_name('Play')
    xbmcListItem = xbmcgui.ListItem(label=request_obj.get_data()['videoTitle'])
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)
def displayChannels(request_obj, response_obj):
    channels = request_obj.get_data()['channels']
    for channelName in channels:
        channelInfo = channels[channelName]
        channelUrl = channelInfo['channelUrl']
        channelLogo = channelInfo['channelLogo']
        item = ListItem()
        item.set_next_action_name('play_Live_Channel')
        item.add_request_data('channelName', channelName)
        item.add_request_data('channelLogo', channelLogo)
        item.add_request_data('channelUrl', channelUrl)
        xbmcListItem = xbmcgui.ListItem(label=channelName, iconImage=channelLogo, thumbnailImage=channelLogo)
        item.set_xbmc_list_item_obj(xbmcListItem)
        response_obj.addListItem(item)
    response_obj.set_xbmc_sort_method(xbmcplugin.SORT_METHOD_LABEL)
Exemple #19
0
def displayChannels(request_obj, response_obj):
    filepath = AddonUtils.getCompleteFilePath(baseDirPath=AddonContext().addonProfile, extraDirPath=AddonUtils.ADDON_SRC_DATA_FOLDER, filename=CHANNELS_JSON_FILE)
    channelsList = AddonUtils.getJsonFileObj(filepath)
    for channelUrl in channelsList:
        if request_obj.get_data()['category'] == channelsList[channelUrl]['category']:
            channelName = channelsList[channelUrl]['channel']
            channelLogo = channelsList[channelUrl]['thumb']
            item = ListItem()
            item.set_next_action_name('play_Live_Channel')
            item.add_request_data('channelName', channelName)
            item.add_request_data('channelLogo', channelLogo)
            item.add_request_data('channelUrl', channelUrl)
            xbmcListItem = xbmcgui.ListItem(label=channelName, iconImage=channelLogo, thumbnailImage=channelLogo)
            item.set_xbmc_list_item_obj(xbmcListItem)
            response_obj.addListItem(item)
    response_obj.set_xbmc_sort_method(xbmcplugin.SORT_METHOD_LABEL)
Exemple #20
0
def __processPlaylistAndAddVideoItem__(item):
    playlist = findPlaylistInfo(item.get_moving_data()['videoUrl'])
    if playlist is not None:
        videoItems = []
        part = 0
        for videoUrl in playlist:
            part = part + 1
            item = ListItem()
            item.add_moving_data('videoUrl', videoUrl)
            item.set_next_action_name('Play')
            xbmcListItem = xbmcgui.ListItem(label='Video ' + str(part))
            item.set_xbmc_list_item_obj(xbmcListItem)
            videoItems.append(item)
        return videoItems
Exemple #21
0
def playRawVideo(request_obj, response_obj):
    video_url = request_obj.get_data()['videoLink']
    Container().ga_client.reportAction('video')
    item = ListItem()
    item.get_moving_data()['videoStreamUrl'] = video_url
    item.set_next_action_name('Play')
    xbmcListItem = xbmcgui.ListItem(label='Streaming Video')
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)
    response_obj.addServiceResponseParam("status", "success")
    response_obj.addServiceResponseParam("message", "Enjoy the video!")
def prepareVideoItem(request_obj, response_obj):
    item = ListItem()
    item.add_moving_data('videoUrl', request_obj.get_data()['videoLink'])
    item.set_next_action_name('Play')
    xbmcListItem = xbmcgui.ListItem(label=request_obj.get_data()['videoTitle'])
    if(request_obj.get_data().has_key('videoInfo')):
        meta = request_obj.get_data()['videoInfo']
        xbmcListItem.setIconImage(meta['thumb_url'])
        xbmcListItem.setThumbnailImage(meta['cover_url'])
        xbmcListItem.setInfo('video', meta)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)
def retrievePakVideoLinks(request_obj, response_obj):
    video_source_id = 0
    video_source_img = None
    video_part_index = 0
    video_playlist_items = []
    html = HttpClient().getHtmlContent(url=request_obj.get_data()['episodeUrl'])
    videoFrameTags = re.compile('<iframe class\="(youtube|dailymotion)\-player" (.+?)src\="(.+?)"').findall(html)
    Logger.logDebug(videoFrameTags)
    for frameTagType, extra, videoLink in videoFrameTags:
        source_img = None
        if frameTagType == 'youtube':
            source_img = 'http://www.automotivefinancingsystems.com/images/icons/socialmedia_youtube_256x256.png'
        elif frameTagType == 'dailymotion':
            source_img = 'http://press.dailymotion.com/fr/wp-content/uploads/logo-Dailymotion.png'
            
        if video_source_img is None or video_source_img != source_img:
            if len(video_playlist_items) > 0:
                response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_playlist_items))
            video_source_id = video_source_id + 1
            video_source_img = source_img
            video_part_index = 0
            video_playlist_items = []
            
        video_part_index = video_part_index + 1
        video_link = {}
        video_link['videoTitle'] = 'Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index)
        video_link['videoLink'] = videoLink
        video_playlist_items.append(video_link)
        
        item = ListItem()
        item.add_request_data('videoLink', video_link['videoLink'])
        item.add_request_data('videoTitle', video_link['videoTitle'])
        item.set_next_action_name('SnapAndPlayVideo')
        xbmcListItem = xbmcgui.ListItem(label='Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) , iconImage=video_source_img, thumbnailImage=video_source_img)
        item.set_xbmc_list_item_obj(xbmcListItem)
        response_obj.addListItem(item)
            
    if len(video_playlist_items) > 0:
        response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_playlist_items))
        
    playNowItem = __findPlayNowStream__(response_obj.get_item_list())
    if playNowItem is not None:
        request_obj.set_data({'videoPlayListItems': playNowItem.get_request_data()['videoPlayListItems']})
Exemple #24
0
def __retrieveTVShowEpisodes__(threads, response_obj):
    if threads is None:
        return
    for aTag in threads.findAll('a', {'class':re.compile(r'\btitle\b')}):
        episodeName = aTag.getText()
        if not re.search(r'\b(Watch|Episode|Video|Promo)\b', episodeName, re.IGNORECASE):
            pass
        else:
            item = ListItem()
            item.add_request_data('episodeName', HttpUtils.unescape(episodeName))
            episodeUrl = str(aTag['href'])
            if not episodeUrl.lower().startswith(BASE_WSITE_URL):
                if episodeUrl[0] != '/':
                    episodeUrl = '/' + episodeUrl
                episodeUrl = BASE_WSITE_URL + episodeUrl
            item.add_request_data('episodeUrl', episodeUrl)
            item.set_next_action_name('Episode_VLinks')
            xbmcListItem = xbmcgui.ListItem(label=episodeName)
            item.set_xbmc_list_item_obj(xbmcListItem)
            response_obj.addListItem(item)
Exemple #25
0
def retrievePakVideoLinks(request_obj, response_obj):
    video_source_id = 0
    video_source_img = None
    video_part_index = 0
    video_playlist_items = []
    
    contentDiv = BeautifulSoup.SoupStrainer('div', {'id':'restricted-content', 'class':'post-content'})
    soup = HttpClient().getBeautifulSoup(url=request_obj.get_data()['episodeUrl'], parseOnlyThese=contentDiv)
    videoFrameTags = soup.findAll('iframe', {'class':re.compile('(youtube|dailymotion)-player')})
    for frameTag in videoFrameTags:
        videoLink = str(frameTag['src'])
        source_img = None
        if re.search('youtube', videoLink):
            source_img = 'http://www.automotivefinancingsystems.com/images/icons/socialmedia_youtube_256x256.png'
        elif re.search('dailymotion', videoLink):
            source_img = 'http://aux.iconpedia.net/uploads/1687271053.png'
            
        if video_source_img is None or video_source_img != source_img:
            if len(video_playlist_items) > 0:
                response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_playlist_items))
            video_source_id = video_source_id + 1
            video_source_img = source_img
            video_part_index = 0
            video_playlist_items = []
            
        video_part_index = video_part_index + 1
        video_link = {}
        video_link['videoTitle'] = 'Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index)
        video_link['videoLink'] = videoLink
        video_playlist_items.append(video_link)
        
        item = ListItem()
        item.add_request_data('videoLink', video_link['videoLink'])
        item.add_request_data('videoTitle', video_link['videoTitle'])
        item.set_next_action_name('SnapAndPlayVideo')
        xbmcListItem = xbmcgui.ListItem(label='Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) , iconImage=video_source_img, thumbnailImage=video_source_img)
        item.set_xbmc_list_item_obj(xbmcListItem)
        response_obj.addListItem(item)
            
    if len(video_playlist_items) > 0:
        response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_playlist_items))
Exemple #26
0
def __retrieveEventMatches__(eventTarget):
    url = FIXTURE_URL + 'target=' + eventTarget
    print url
    soup = HttpUtils.HttpClient().getBeautifulSoup(url)
    items = []
    for row in soup.findChildren(name='tr'):
        rowClass = row['class']
        if re.search('tableHeading', rowClass):
            continue
        title = ''
        matchLinks = {}
        next_action_name = ''
        if((not row.has_key('toggler')) or (row['toggler'] != 'yes')):
            matchCols = row.findChildren('td')
            localMatchDate = 'Date Not Fixed!!'
            try:
                matchDate = re.compile('CXGetLocalDateTime(.+?);').findall(matchCols[0].getText())[0]
                datetime_obj = None
                try:
                    datetime_obj = time.strptime(matchDate, "('%m/%d/%Y %H:%M:%S %Z')")
                except ValueError:
                    datetime_obj = time.strptime(matchDate, "('%d %b %Y %H:%M %Z')")
                localMatchDate = time.strftime('(%a, %b %d %Y %I:%M %p)', time.localtime(calendar.timegm(datetime_obj)))
            except Exception, e:
                logging.exception(e)
            
            title = '  ' + localMatchDate + '  ' + unicode(matchCols[1].getText()).encode('utf-8')
            
            next_action_name = 'Match_Links'
            
            for matchLink in  matchCols[2].findChildren('a'):
                iconSrc = unicode(matchLink.img['src']).encode('utf-8')
                if re.search('live.png', iconSrc):
                    matchLinks['LIVE'] = unicode(matchLink['href']).encode('utf-8')
                elif  re.search('replay.png', iconSrc):
                    matchLinks['Replay'] = unicode(matchLink['href']).encode('utf-8')
                elif  re.search('Scorebaord.png', iconSrc):
                    matchLinks['Scoreboard'] = unicode(matchLink['href']).encode('utf-8')
                elif  re.search('highlights.png', iconSrc):
                    matchLinks['Highlights'] = unicode(matchLink['href']).encode('utf-8')
        else:
            title = '[COLOR blue][B]' + row.findChild('td').getText() + '[/B][/COLOR]'
            next_action_name = 'Series'
        cricket_icon_filepath = AddonUtils.getCompleteFilePath(baseDirPath=Container().getAddonContext().addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='cricket-icon.png')
        item = ListItem()
        item.add_request_data('matchLinks', matchLinks)
        item.set_next_action_name(next_action_name)
        xbmcListItem = xbmcgui.ListItem(label=title, iconImage=cricket_icon_filepath, thumbnailImage=cricket_icon_filepath)
        item.set_xbmc_list_item_obj(xbmcListItem)
        items.append(item)
def __processPlaylistAndAddVideoItem__(item):
    playlist = findPlaylistInfo(item.get_moving_data()['videoUrl'])
    if playlist is not None:
        videoItems = []
        part = 0
        for videoUrl in playlist:
            part = part + 1
            item = ListItem()
            item.add_moving_data('videoUrl', videoUrl)
            item.set_next_action_name('Play')
            xbmcListItem = xbmcgui.ListItem(label='Video ' + str(part))
            item.set_xbmc_list_item_obj(xbmcListItem)
            videoItems.append(item)
        return videoItems
Exemple #28
0
def displayMatchUrls(request_obj, response_obj):
    match = request_obj.get_data()['match']
    items = []
    for urlDetail in match['UrlDetails']:
        videoId = urlDetail['VideoId']
        if videoId != 'NA':
            name = '[B]' + urlDetail['Type'] + '[/B] : ' + urlDetail['VideoName']
            imageUrl = urlDetail['Thumbnail']
            videoUrl = None
            if videoId.startswith('PL'):
                videoUrl = 'www.youtube.com/playlist?list=' + urlDetail['VideoId'] + '&'
            else:
                videoUrl = 'www.youtube.com/watch?v=' + urlDetail['VideoId'] + '&'
            
            item = ListItem()
            item.add_request_data('videoLink', videoUrl)
            item.add_request_data('videoTitle', urlDetail['VideoName'])
            item.set_next_action_name('Play_URL')
            xbmcListItem = xbmcgui.ListItem(label=name, iconImage=imageUrl, thumbnailImage=imageUrl)
            item.set_xbmc_list_item_obj(xbmcListItem)
            items.append(item)
    response_obj.set_item_list(items)
Exemple #29
0
def retrieveLiveLink(request_obj, response_obj):
    channelInfo = request_obj.get_data()['channelInfo']
    params = {'channel_id':channelInfo[0], 'server_type':channelInfo[1], 'timezone':channelInfo[2]}
    content = HttpClient().getHtmlContent(url='http://www.watchsuntv.com/play/pages/playOn/', params=params)
    streamUrl = re.compile('<param name="flashvars" value="streamer=(.+?)"').findall(content)[0]
    swfUrl = 'http://www.watchsuntv.com/play/' + re.compile('<param name="movie" value="(.+?)"').findall(content)[0]
    urlParams = streamUrl.split('&')
    videoStreamUrl = urlParams[0] + ' ' + urlParams[1].replace('file', 'playpath') + ' swfUrl=' + swfUrl + ' swfVfy=true live=true pageUrl=' + swfUrl
    
    item = ListItem()
    item.set_next_action_name('Play')
    item.add_moving_data('videoStreamUrl', videoStreamUrl)
    xbmcListItem = xbmcgui.ListItem(label=request_obj.get_data()['channelName'], iconImage=request_obj.get_data()['channelLogo'], thumbnailImage=request_obj.get_data()['channelLogo'])
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)
Exemple #30
0
def playZappyVideo(request_obj, response_obj):
    Logger.logDebug(request_obj.get_data());
    Container().ga_client.reportAction('zappyvideo')
    video_id = request_obj.get_data()['videoId']
    port = request_obj.get_data()['port']
    ipaddress = request_obj.get_data()['client_ip']
    video_url = "http://" + ipaddress + ":" + str(port) + "/?videoId=" + video_id
    item = ListItem()
    item.get_moving_data()['videoStreamUrl'] = video_url
    item.set_next_action_name('Play')
    xbmcListItem = xbmcgui.ListItem(label='Streaming Video')
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)
    response_obj.addServiceResponseParam("status", "success")
    response_obj.addServiceResponseParam("message", "Enjoy the video!")
def displayTVChannels(request_obj, response_obj):
    channelsList = None
    if request_obj.get_data().has_key('tvChannels'):
        channelsList = request_obj.get_data()['tvChannels']
    else:
        filepath = AddonUtils.getCompleteFilePath(baseDirPath=Container().getAddonContext().addonProfile, extraDirPath=AddonUtils.ADDON_SRC_DATA_FOLDER, filename=CHANNELS_JSON_FILE)
        channelsList = AddonUtils.getJsonFileObj(filepath)
    if channelsList is None:
        raise Exception(ExceptionHandler.TV_CHANNELS_NOT_LOADED, 'Please delete data folder from add-on user data folder.')
    displayChannelType = int(Container().getAddonContext().addon.getSetting('dtChannelType'))
    for channelName in channelsList:
        channelObj = channelsList[channelName]
        if ((displayChannelType == 1 and channelObj['channelType'] == CHANNEL_TYPE_IND) 
            or (displayChannelType == 2 and channelObj['channelType'] == CHANNEL_TYPE_PAK) 
            or (displayChannelType == 0)):
            item = ListItem()
            item.add_request_data('channelName', channelName)
            item.add_request_data('channelType', channelObj['channelType'])
            item.set_next_action_name('TV_Shows')
            xbmcListItem = xbmcgui.ListItem(label=channelName, iconImage=channelObj['iconimage'], thumbnailImage=channelObj['iconimage'])
            item.set_xbmc_list_item_obj(xbmcListItem)
            response_obj.addListItem(item)
    response_obj.set_xbmc_sort_method(xbmcplugin.SORT_METHOD_LABEL)
Exemple #32
0
def retrieveLiveLink(request_obj, response_obj):
    videoStreamUrl = None
    channelName = request_obj.get_data()['channelId']
    if request_obj.get_data()['flash']:
        videoStreamUrl = retrieveFlashLiveLink(request_obj, response_obj)
        channelName = channelName + ' Flash HQ'
    else:
        videoStreamUrl = retrieveMMSLiveLink(request_obj, response_obj)
    
    
    item = ListItem()
    item.set_next_action_name('Play')
    item.add_moving_data('videoStreamUrl', videoStreamUrl)
    xbmcListItem = xbmcgui.ListItem(label=channelName, iconImage=request_obj.get_data()['channelLogo'], thumbnailImage=request_obj.get_data()['channelLogo'])
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)
def __retrieveAndCreateMovieItem__(movieTag):
    thumbTag = movieTag.findChild("div", {"class": "thumbnail"})
    imgUrl = ""
    if thumbTag is not None:
        aTag = thumbTag.findChild("a")
        imgTag = aTag.findChild("img")
        imgUrl = imgTag["src"]

    titleTag = movieTag.findChild("h2")
    aTag = titleTag.findChild("a")
    movieUrl = str(aTag["href"])
    title = (
        unicode(titleTag.getText())
        .encode("utf8")
        .replace("&#8217;", "'")
        .replace("&#038;", "&")
        .replace("&#8230;", "...")
    )

    descTag = movieTag.findChild("div", {"class": "entry"})
    desc = ""
    if descTag is not None:
        desc = (
            unicode(descTag.getText())
            .encode("utf8")
            .replace("&#8217;", "'")
            .replace("&#038;", "&")
            .replace("&#8230;", "...")
        )
    rating = 0.0
    ratingTag = movieTag.findChild("div", {"class": "post-ratings"})
    if ratingTag is not None:
        ratingInfo = ratingTag.getText()
        ratingFound = re.compile("average:(.+?)out of 5").findall(ratingInfo)
        if len(ratingFound) > 0:
            rating = float(ratingFound[0])
            rating = (rating / 5) * 10
    item = ListItem()
    item.set_next_action_name("Movie_VLinks")
    item.add_request_data("movieUrl", movieUrl)
    xbmcListItem = xbmcgui.ListItem(label=title, iconImage=imgUrl, thumbnailImage=imgUrl)
    xbmcListItem.setInfo(
        "video", {"plot": desc, "plotoutline": desc, "title": title, "originaltitle": title, "rating": rating}
    )
    item.set_xbmc_list_item_obj(xbmcListItem)
    return item
def __preparePlayListItem__(video_source_id, video_source_img, video_playlist_items):
    item = ListItem()
    item.add_request_data("videoPlayListItems", video_playlist_items)
    item.set_next_action_name("SnapAndDirectPlayList")
    xbmcListItem = xbmcgui.ListItem(
        label=AddonUtils.getBoldString("DirectPlay")
        + " | "
        + "Source #"
        + str(video_source_id)
        + " | "
        + "Parts = "
        + str(len(video_playlist_items)),
        iconImage=video_source_img,
        thumbnailImage=video_source_img,
    )
    item.set_xbmc_list_item_obj(xbmcListItem)
    return item
Exemple #35
0
def preparePlayListItems(request_obj, response_obj):
    if request_obj.get_data().has_key('videoPlayListItems'):
        playList = request_obj.get_data()['videoPlayListItems']
        for videoItem in playList:
            data = {}
            data['videoLink'] = videoItem['videoLink']
            data['videoTitle'] = videoItem['videoTitle']
            item = ListItem()
            item.add_moving_data(
                'videoStreamUrl',
                'plugin://plugin.video.filmibynaturex/?actionId=snap_and_resolve_video&data='
                + urllib.quote_plus(AddonUtils.encodeData(data)))
            item.set_next_action_name('Play')
            xbmcListItem = xbmcgui.ListItem(label=videoItem['videoTitle'])
            if (request_obj.get_data().has_key('videoInfo')):
                meta = request_obj.get_data()['videoInfo']
                xbmcListItem.setIconImage(meta['thumb_url'])
                xbmcListItem.setThumbnailImage(meta['cover_url'])
                xbmcListItem.setInfo('video', meta)
            item.set_xbmc_list_item_obj(xbmcListItem)
            response_obj.addListItem(item)
def preparePlayListItems(request_obj, response_obj):
    if request_obj.get_data().has_key('videoPlayListItems'):
        playList = request_obj.get_data()['videoPlayListItems']
        for videoItem in playList:
            data = {}
            data['videoLink'] = videoItem['videoLink']
            data['videoTitle'] = videoItem['videoTitle']
            item = ListItem()
            item.add_moving_data('videoStreamUrl', 'plugin://plugin.video.filmibynaturex/?actionId=snap_and_resolve_video&data=' + urllib.quote_plus(AddonUtils.encodeData(data)))
            item.set_next_action_name('Play')
            xbmcListItem = xbmcgui.ListItem(label=videoItem['videoTitle'])
            if(request_obj.get_data().has_key('videoInfo')):
                meta = request_obj.get_data()['videoInfo']
                xbmcListItem.setIconImage(meta['thumb_url'])
                xbmcListItem.setThumbnailImage(meta['cover_url'])
                xbmcListItem.setInfo('video', meta)
            item.set_xbmc_list_item_obj(xbmcListItem)
            response_obj.addListItem(item)
Exemple #37
0
def __prepareVideoLink__(videoSourceLink):
    new_items = []
    url = videoSourceLink
    if re.search('wp.me', url, re.I):
        url = HttpUtils.getRedirectedUrl(url)
    if not url.startswith('http://'):
        url = 'http://' + url
    Logger.logDebug(url)
    #     contentDiv = BeautifulSoup.SoupStrainer('div', {'class':'left_articles'})
    #     soup = BeautifulSoup.BeautifulSoup(html, contentDiv)

    if re.search('', videoSourceLink):
        video_hosting_info = SnapVideo.findVideoHostingInfo(videoSourceLink)
        if video_hosting_info is None:
            Logger.logDebug('Unrecognized video_url = ' + videoSourceLink)
        else:
            video_source_img = video_hosting_info.get_video_hosting_image()

            new_item = ListItem()
            new_item.add_request_data('videoTitle', 'Part #')
            new_item.add_request_data('videoLink', videoSourceLink)
            new_item.add_moving_data('videoSourceImg', video_source_img)
            new_item.add_moving_data(
                'videoSourceName', video_hosting_info.get_video_hosting_name())
            new_item.set_next_action_name('Play_Stream')
            xbmcListItem = xbmcgui.ListItem(label='Part #',
                                            iconImage=video_source_img,
                                            thumbnailImage=video_source_img)
            new_item.set_xbmc_list_item_obj(xbmcListItem)
            new_items.append(new_item)
            return new_items

    html = HttpUtils.HttpClient().getHtmlContent(url)
    dek = EnkDekoder.dekode(html)
    Logger.logDebug(dek)
    if dek is not None:
        html = dek

    html = html.replace('\n\r', '').replace('\r',
                                            '').replace('\n',
                                                        '').replace('\\', '')
    children = []
    if re.search('http://videos.stvflicks.com/', html):
        docId = re.compile('http://videos.stvflicks.com/(.+?).mp4"').findall(
            html)[0]
        children.append('src="http://videos.stvflicks.com/' + docId + '.mp4"')
    elif re.search('http://playcineflix.com/', html):
        docId = re.compile('http://playcineflix.com/(.+?).mp4"').findall(
            html)[0]
        children.append('src="http://playcineflix.com/' + docId + '.mp4"')
    elif re.search('https://video.google.com/get_player', html):
        docId = re.compile('docid=(.+?)"').findall(html)[0]
        children.append('src="https://docs.google.com/file/d/' + docId +
                        '/preview"')
    elif re.search('http://videos.videopress.com/', html):
        docId = re.compile(
            'type="video/mp4" href="http://videos.videopress.com/(.+?).mp4"'
        ).findall(html)[0]
        children.append('src="http://videos.videopress.com/' + docId + '.mp4"')
    elif re.search('http://videos.videopress.com/', html):
        docId = re.compile(
            'type="video/mp4" href="http://videos.videopress.com/(.+?).mp4"'
        ).findall(html)[0]
        children.append('src="http://videos.videopress.com/' + docId + '.mp4"')
    elif re.search('video_alt_url=http://www.mediaplaybox.com', html):
        docId = re.compile('video_alt_url=http://www.mediaplaybox.com(.+?).mp4'
                           ).findall(html)[0]
        children.append('src="http://www.mediaplaybox.com:81/' + docId +
                        '.mp4"')
    elif re.search('video_url=http://www.mediaplaybox.com', html):
        docId = re.compile(
            'video_url=http://www.mediaplaybox.com(.+?).mp4').findall(html)[0]
        children.append('src="http://www.mediaplaybox.com:81/' + docId +
                        '.mp4"')
    else:
        children = re.compile('<embed(.+?)>').findall(html)
        if children is None or len(children) == 0:
            children = re.compile('<iframe(.+?)>').findall(html)

    Logger.logDebug(children)
    for child in children:
        video_url = re.compile('src="(.+?)"').findall(child)[0]
        if (re.search('http://ads', video_url, re.I)
                or re.search('http://ax-d', video_url, re.I)):
            continue
        if video_url.startswith('http://goo.gl/'):
            Logger.logDebug('Found google short URL = ' + video_url)
            video_url = HttpUtils.getRedirectedUrl(video_url)
            Logger.logDebug('After finding out redirected URL = ' + video_url)
            if re.search('videos.desionlinetheater.com', video_url):
                XBMCInterfaceUtils.displayDialogMessage(
                    'Unable to parse',
                    'A new HTML Guardian is used to protect the page',
                    'Sounds technical!! hmm, it means cannot find video.',
                    'Fix: Find me JavaScript Interpreter online service')
        video_hosting_info = SnapVideo.findVideoHostingInfo(video_url)
        if video_hosting_info is None:
            Logger.logDebug('Unrecognized video_url = ' + video_url)
            continue
        video_source_img = video_hosting_info.get_video_hosting_image()

        new_item = ListItem()
        new_item.add_request_data('videoTitle', 'Part #')
        new_item.add_request_data('videoLink', video_url)
        new_item.add_moving_data('videoSourceImg', video_source_img)
        new_item.add_moving_data('videoSourceName',
                                 video_hosting_info.get_video_hosting_name())
        new_item.set_next_action_name('Play_Stream')
        xbmcListItem = xbmcgui.ListItem(label='Part #',
                                        iconImage=video_source_img,
                                        thumbnailImage=video_source_img)
        new_item.set_xbmc_list_item_obj(xbmcListItem)
        new_items.append(new_item)

    return new_items
Exemple #38
0
def __preparePlayListItem__(video_items, source):
    video_playlist_items = []
    video_source_img = None
    video_source_name = None
    for item in video_items:
        video_item = {}
        video_item['videoLink'] = item.get_request_data()['videoLink']
        video_item['videoTitle'] = item.get_request_data()['videoTitle']
        video_playlist_items.append(video_item)
        video_source_img = item.get_moving_data()['videoSourceImg']
        video_source_name = item.get_moving_data()['videoSourceName']
    Logger.logDebug('IMAGE :: ')
    Logger.logDebug(video_source_img)
    Logger.logDebug(type(video_source_img))
    item = ListItem()
    item.add_request_data('videoPlayListItems', video_playlist_items)
    item.add_moving_data('isContinuousPlayItem', True)
    item.add_moving_data('videoSourceName', video_source_name)
    item.set_next_action_name('Play_AllStreams')
    xbmcListItem = xbmcgui.ListItem(
        label='[COLOR blue]' + AddonUtils.getBoldString('Continuous Play') +
        '[/COLOR]' + ' | ' + 'Source #' + source + ' | ' + 'Parts = ' +
        str(len(video_playlist_items)),
        iconImage=video_source_img,
        thumbnailImage=video_source_img)
    item.set_xbmc_list_item_obj(xbmcListItem)
    return item
Exemple #39
0
def displayMenuItems(request_obj, response_obj):

    addonContext = Container().getAddonContext()

    # HD Movies
    hd_movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='HD_Movies_V1.png')
    item = ListItem()
    item.set_next_action_name('HDMovie')
    xbmcListItem = xbmcgui.ListItem(label='HD MOVIES',
                                    iconImage=hd_movie_icon_filepath,
                                    thumbnailImage=hd_movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)

    # Movies item
    movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='Movies_V1.png')
    item = ListItem()
    item.set_next_action_name('Movie')
    xbmcListItem = xbmcgui.ListItem(label='All Movies',
                                    iconImage=movie_icon_filepath,
                                    thumbnailImage=movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)

    # A-Z
    #     az_movie_icon_filepath = AddonUtils.getCompleteFilePath(baseDirPath=addonContext.addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='AZ_Dir_V1.png')
    #     item = ListItem()
    #     item.set_next_action_name('AZ')
    #     xbmcListItem = xbmcgui.ListItem(label='Movies A to Z', iconImage=az_movie_icon_filepath, thumbnailImage=az_movie_icon_filepath)
    #     item.set_xbmc_list_item_obj(xbmcListItem)
    #     response_obj.addListItem(item)

    # Movies By Year
    az_movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='Release_Decades_V1.png')
    item = ListItem()
    item.set_next_action_name('ByYear')
    xbmcListItem = xbmcgui.ListItem(label='Movies By Year',
                                    iconImage=az_movie_icon_filepath,
                                    thumbnailImage=az_movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)

    # Movies By Genre
    az_movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='Movies_V1.png')
    item = ListItem()
    item.set_next_action_name('ByGenre')
    xbmcListItem = xbmcgui.ListItem(label='Movies By Genre',
                                    iconImage=az_movie_icon_filepath,
                                    thumbnailImage=az_movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)

    # English Subtitles Movies
    punjabi_movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='Movies_V1.png')
    item = ListItem()
    item.set_next_action_name('listMovies')
    item.add_request_data('categoryUrlSuffix', 'English%20Subtitled')
    xbmcListItem = xbmcgui.ListItem(label='English Subtitles',
                                    iconImage=punjabi_movie_icon_filepath,
                                    thumbnailImage=punjabi_movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    #     response_obj.addListItem(item)

    # Hindi Dubbed Movies
    punjabi_movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='Movies_V1.png')
    item = ListItem()
    item.set_next_action_name('listMovies')
    item.add_request_data('categoryUrlSuffix', 'hindi-dubbed')
    xbmcListItem = xbmcgui.ListItem(label='Hindi Dubbed',
                                    iconImage=punjabi_movie_icon_filepath,
                                    thumbnailImage=punjabi_movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)

    # Trailers
    trailer_movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='Trailers.png')
    item = ListItem()
    item.set_next_action_name('Trailer')
    item.add_request_data('categoryUrlSuffix', 'Trailer')
    xbmcListItem = xbmcgui.ListItem(label='Trailers',
                                    iconImage=trailer_movie_icon_filepath,
                                    thumbnailImage=trailer_movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)

    # YouTube TV item
    youtube_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='YouTube_V1.png')
    item = ListItem()
    item.set_next_action_name('YouTube')
    xbmcListItem = xbmcgui.ListItem(label='YouTube Channels',
                                    iconImage=youtube_icon_filepath,
                                    thumbnailImage=youtube_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)
Exemple #40
0
def displayMainMenu(request_obj, response_obj):
    addonContext = Container().getAddonContext()

    # Hindi Movies
    hindi_movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='Hindi_Movies_V1.png')
    item = ListItem()
    item.set_next_action_name('listMovies')
    item.add_request_data('categoryUrlSuffix', 'hindi-movies')
    xbmcListItem = xbmcgui.ListItem(label='HINDI',
                                    iconImage=hindi_movie_icon_filepath,
                                    thumbnailImage=hindi_movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)

    # Telugu Movies
    telugu_movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='Telugu_Movies_V1.png')
    item = ListItem()
    item.set_next_action_name('listMovies')
    item.add_request_data('categoryUrlSuffix', 'telugu')
    xbmcListItem = xbmcgui.ListItem(label='TELUGU',
                                    iconImage=telugu_movie_icon_filepath,
                                    thumbnailImage=telugu_movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)

    # Tamil Movies
    tamil_movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='Tamil_Movies_V1.png')
    item = ListItem()
    item.set_next_action_name('listMovies')
    item.add_request_data('categoryUrlSuffix', 'tamil')
    xbmcListItem = xbmcgui.ListItem(label='TAMIL',
                                    iconImage=tamil_movie_icon_filepath,
                                    thumbnailImage=tamil_movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)

    # Punjabi Movies
    punjabi_movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='Movies_V1.png')
    item = ListItem()
    item.set_next_action_name('listMovies')
    item.add_request_data('categoryUrlSuffix', 'punjabi')
    xbmcListItem = xbmcgui.ListItem(label='PUNJABI',
                                    iconImage=punjabi_movie_icon_filepath,
                                    thumbnailImage=punjabi_movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)

    # Malayalam Movies
    malayalam_movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='Malayalam_Movies_V1.png')
    item = ListItem()
    item.set_next_action_name('listMovies')
    item.add_request_data('categoryUrlSuffix', 'malayalam')
    xbmcListItem = xbmcgui.ListItem(
        label='MALAYALAM',
        iconImage=malayalam_movie_icon_filepath,
        thumbnailImage=malayalam_movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)
Exemple #41
0
def displayHDMainMenu(request_obj, response_obj):
    addonContext = Container().getAddonContext()
    # All Movies
    hindi_movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='HD_Movies_V1.png')
    item = ListItem()
    item.set_next_action_name('listMovies')
    item.add_request_data('categoryUrlSuffix', 'bluray')
    xbmcListItem = xbmcgui.ListItem(label='All HD Movies',
                                    iconImage=hindi_movie_icon_filepath,
                                    thumbnailImage=hindi_movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)

    # Hindi Movies
    hindi_movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='Hindi_Movies_V1.png')
    item = ListItem()
    item.set_next_action_name('listMovies')
    item.add_request_data('categoryUrlSuffix', 'hindi-blurays')
    xbmcListItem = xbmcgui.ListItem(label='HINDI',
                                    iconImage=hindi_movie_icon_filepath,
                                    thumbnailImage=hindi_movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)

    # Telugu Movies
    telugu_movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='Telugu_Movies_V1.png')
    item = ListItem()
    item.set_next_action_name('listMovies')
    item.add_request_data('categoryUrlSuffix', 'telugu-blurays')
    xbmcListItem = xbmcgui.ListItem(label='TELUGU',
                                    iconImage=telugu_movie_icon_filepath,
                                    thumbnailImage=telugu_movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)

    # Tamil Movies
    tamil_movie_icon_filepath = AddonUtils.getCompleteFilePath(
        baseDirPath=addonContext.addonPath,
        extraDirPath=AddonUtils.ADDON_ART_FOLDER,
        filename='Tamil_Movies_V1.png')
    item = ListItem()
    item.set_next_action_name('listMovies')
    item.add_request_data('categoryUrlSuffix', 'tamil-blurays')
    xbmcListItem = xbmcgui.ListItem(label='TAMIL',
                                    iconImage=tamil_movie_icon_filepath,
                                    thumbnailImage=tamil_movie_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)
Exemple #42
0
def displayChannels(request_obj, response_obj):
    addonContext = Container().getAddonContext()
    item = ListItem()
    item.set_next_action_name('add_Channel')
    youtube_icon_filepath = AddonUtils.getCompleteFilePath(baseDirPath=addonContext.addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='Add_New_YouTube_V1.png')
    xbmcListItem = xbmcgui.ListItem(label='Add New Channel', iconImage=youtube_icon_filepath, thumbnailImage=youtube_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)   
                
    filepath = AddonUtils.getCompleteFilePath(baseDirPath=addonContext.addonProfile, extraDirPath=AddonUtils.ADDON_SRC_DATA_FOLDER, filename=CHANNELS_JSON_FILE, makeDirs=True)
    if not AddonUtils.doesFileExist(filepath):
        new_items = XBMCInterfaceUtils.callBackDialogProgressBar(getattr(sys.modules[__name__], '__retrieveYouTubeUserInfo__'), PRE_LOADED_CHANNELS, 'Loading default list of channels...', 'Remove the channel you hate in default list using context menu.')
        index = 0
        channelsJsonObj = {}
        for username in PRE_LOADED_CHANNELS:
            channelsJsonObj[username] = new_items[index]
            index = index + 1
        AddonUtils.saveObjToJsonFile(filepath, channelsJsonObj)

    try:
        channelsJsonObj = AddonUtils.getJsonFileObj(filepath)
        print 'CHANNELS JSON LOADED'
        if len(channelsJsonObj) == 0:
            d = xbmcgui.Dialog()
            if d.yesno('NO channels added yet!', 'Would you like to add YouTube channel right now?', 'Get username from YouTube URL.'):
                isAdded = addNewChannel(request_obj, response_obj)
                if not isAdded:
                    return
                else:
                    channelsJsonObj = AddonUtils.getJsonFileObj(filepath)

        for channelUsername in channelsJsonObj:
            userInfo = channelsJsonObj[channelUsername]
            item = ListItem()
            item.add_request_data('userId', channelUsername)
            item.set_next_action_name('show_Channel')
            xbmcListItem = xbmcgui.ListItem(label=unicode(userInfo['title']).encode("utf-8"), iconImage=userInfo['thumbnail'], thumbnailImage=userInfo['thumbnail'])
            
            contextMenuItems = []
            data = '?actionId=' + urllib.quote_plus("remove_YouTube_Channel") + '&data=' + urllib.quote_plus(AddonUtils.encodeData({"userId":channelUsername}))
            contextMenuItems.append(('Remove channel', 'XBMC.RunPlugin(%s?%s)' % (sys.argv[0], data)))
            xbmcListItem.addContextMenuItems(contextMenuItems, replaceItems=False)
            item.set_xbmc_list_item_obj(xbmcListItem)
            response_obj.addListItem(item)
        
    except:
        raise
        AddonUtils.deleteFile(filepath)
        print 'MY CHANNELS CORRUPT FILE DELETED = ' + filepath
Exemple #43
0
def displayAllTVShows(request_obj, response_obj):
    url = request_obj.get_data()['tvChannelUrl']
    contentDiv = BeautifulSoup.SoupStrainer('div', {'class':'rightwidget'})
    soup = HttpClient().getBeautifulSoup(url=url, parseOnlyThese=contentDiv)
    tvshows = soup.findChildren('a')
    for tvshow in tvshows:
        tvshowName = tvshow.getText()
        tvshowUrl = str(tvshow['href'])
        
        item = ListItem()
        item.add_request_data('tvshowName', tvshowName)
        item.add_request_data('tvshowUrl', tvshowUrl)
        item.add_request_data('tvChannelUrl', tvshowUrl)
        item.set_next_action_name('Show_Episodes')
        xbmcListItem = xbmcgui.ListItem(label=tvshowName)
        item.set_xbmc_list_item_obj(xbmcListItem)
        response_obj.addListItem(item)
Exemple #44
0
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)
Exemple #45
0
def retrieveVideoLinks(request_obj, response_obj):

    url = request_obj.get_data()['movieUrl']
    contentDiv = BeautifulSoup.SoupStrainer('div', {'class':'video'})
    soup = HttpClient().getBeautifulSoup(url=url, parseOnlyThese=contentDiv)
    if len(str(soup)) ==0:
        contentDiv = BeautifulSoup.SoupStrainer('div', {'id':'content'})
        soup = HttpClient().getBeautifulSoup(url=url, parseOnlyThese=contentDiv)
    decodedSoup = urllib.unquote(str(soup))

    videoFrameLinks = re.compile('http://www.pinoymovie.c(o|a)/ajaxtabs/(.+?).htm').findall(decodedSoup)
    if len(videoFrameLinks) > 0:
        video_source_id = 1
        for ignoreIt, videoFrameLink in videoFrameLinks: #@UnusedVariable
            try:
                soup = HttpClient().getBeautifulSoup(url='http://www.pinoymovie.co/ajaxtabs/' + videoFrameLink + '.htm')
                video_url = str(soup.find('iframe')['src'])
                video_hosting_info = SnapVideo.findVideoHostingInfo(video_url)
                if video_hosting_info is None:
                    print 'UNKNOWN streaming link found: ' + video_url
                else:
                    video_source_img = video_hosting_info.get_video_hosting_image()
                    video_title = 'Source #' + str(video_source_id) + ' :: ' + video_hosting_info.get_video_hosting_name()
                    
                    item = ListItem()
                    item.add_request_data('videoLink', video_url)
                    item.add_request_data('videoTitle', video_title)
                    item.set_next_action_name('SnapAndPlayVideo')
                    xbmcListItem = xbmcgui.ListItem(label=video_title, iconImage=video_source_img, thumbnailImage=video_source_img)
                    item.set_xbmc_list_item_obj(xbmcListItem)
                    response_obj.addListItem(item)
                    video_source_id = video_source_id + 1
            except:
                print 'UNKNOWN streaming link found'
    else:
        videoLinks = re.compile('flashvars=(.+?)file=(.+?)&').findall(decodedSoup)
        
        moreLinks = re.compile('<iframe(.+?)src="(.+?)"', flags=re.I).findall(decodedSoup)
        if len(moreLinks) > 0:
            videoLinks.extend(moreLinks)
        
        moreLinks = re.compile('<a(.+?)href="(.+?)"', flags=re.I).findall(decodedSoup)
        if len(moreLinks) > 0:
            videoLinks.extend(moreLinks)
        if len(videoLinks) > 0:
            
            video_source_id = 1
            video_source_img = None
            video_part_index = 0
            video_playlist_items = []
            for ignoreIt, videoLink in videoLinks: #@UnusedVariable
                try:
                    if re.search('http://media.pinoymovie.ca/playlist/(.+?).xml', videoLink, re.I):
                        soupXml = HttpClient().getBeautifulSoup(url=videoLink)
                        for media in soupXml.findChildren('track'):
                            video_url = media.findChild('location').getText()
                            video_hosting_info = SnapVideo.findVideoHostingInfo(video_url)
                            if video_hosting_info is None:
                                print 'UNKNOWN streaming link found: ' + video_url
                            else:
                                
                                video_part_index = video_part_index + 1
                                video_link = {}
                                video_link['videoTitle'] = 'Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index)
                                video_link['videoLink'] = video_url
                                video_link['videoSourceImg'] = video_hosting_info.get_video_hosting_image()
                                
                                video_playlist_items.append(video_link)
                                video_source_img = video_link['videoSourceImg']
                                
                                
                                item = ListItem()
                                item.add_request_data('videoLink', video_link['videoLink'])
                                item.add_request_data('videoTitle', video_link['videoTitle'])
                                item.set_next_action_name('SnapAndPlayVideo')
                                xbmcListItem = xbmcgui.ListItem(label=video_link['videoTitle'], iconImage=video_source_img, thumbnailImage=video_source_img)
                                item.set_xbmc_list_item_obj(xbmcListItem)
                                response_obj.addListItem(item)
                        
                        if len(video_playlist_items) > 0:
                            response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_playlist_items))
                            video_source_id = video_source_id + 1
                            video_source_img = None
                            video_part_index = 0
                            video_playlist_items = []
                    
                    else:
                        print "insecond"
                        if re.search('http://media.pinoymovie.ca/playlist/(.+?).htm', videoLink, re.I):
                            html = HttpClient().getHtmlContent(url=videoLink).replace('\'', '"')
                            videoLink = re.compile('<iframe(.+?)src="(.+?)"', flags=re.I).findall(html)[0][0]

                        video_hosting_info = SnapVideo.findVideoHostingInfo(videoLink)

                        if video_hosting_info is None:
                            print 'UNKNOWN streaming link found: ' + videoLink
                            
                        else:
                            item = ListItem()
                            item.add_request_data('videoLink', videoLink)
                            print "source:" + videoLink
                            item.add_request_data('videoTitle', 'Source #' + str(video_source_id))
                            item.set_next_action_name('SnapAndPlayVideo')
                            xbmcListItem = xbmcgui.ListItem(label='Source #' + str(video_source_id), iconImage=video_hosting_info.get_video_hosting_image(), thumbnailImage=video_hosting_info.get_video_hosting_image())
                            item.set_xbmc_list_item_obj(xbmcListItem)
                            response_obj.addListItem(item)
                            
                            video_source_id = video_source_id + 1
                except:
                    print 'UNKNOWN streaming link found'
                    video_source_img = None
                    video_part_index = 0
                    video_playlist_items = []
Exemple #46
0
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)
Exemple #47
0
def listMovies(request_obj, response_obj):
    categoryUrlSuffix = request_obj.get_data()['categoryUrlSuffix']
    page = 1
    if request_obj.get_data().has_key('page'):
        page = int(request_obj.get_data()['page'])

    titles = retrieveMovies(categoryUrlSuffix, page)

    items = []
    for entry in titles:
        titleInfo = entry['title']

        if re.compile('Hindi Dubbed').findall(titleInfo) is not None:
            titleInfo = titleInfo.replace('(Hindi Dubbed)',
                                          '').replace('Hindi Dubbed', '')

        movieInfo = re.compile("(.+?)\((\d+)\) (.*)").findall(titleInfo)
        if (len(movieInfo) == 0):
            movieInfo = re.compile("(.+?)\((\d+)\)").findall(titleInfo)
        if (len(movieInfo) == 0):
            movieInfo = [[titleInfo]]
        title = unicode(movieInfo[0][0].rstrip()).encode('utf-8').replace(
            '&#8211;', '-').replace('&amp;', '&')
        year = ''
        if (len(movieInfo[0]) >= 2):
            year = unicode(movieInfo[0][1]).encode('utf-8')
        quality = ''
        if categoryUrlSuffix != 'BluRay':
            if (len(movieInfo[0]) >= 3):
                quality = unicode(movieInfo[0][2]).encode('utf-8').strip()
                if quality == '*BluRay*' or quality == '*BluRay* (Hindi Dubbed)' or quality == '*BluRay* Hindi Dubbed':
                    quality = '[COLOR red]*HD*[/COLOR]'
                elif quality == 'DVD' or quality == 'DVD (Hindi Dubbed)' or quality == 'DVD Hindi Dubbed':
                    quality = '[COLOR orange]DVD[/COLOR]'
                quality = ' :: ' + quality

        movieInfo = entry['content']
        movieLabel = '[B]' + title + '[/B]' + ('(' + year + ')' + quality if
                                               (year != '') else '')
        item = ListItem()
        item.add_moving_data('movieTitle', title)
        item.add_moving_data('movieYear', year)
        item.add_request_data('movieInfo', unicode(movieInfo).encode('utf-8'))
        item.add_request_data('movieTitle', title)
        item.set_next_action_name('Movie_Streams')
        xbmcListItem = xbmcgui.ListItem(label=movieLabel,
                                        label2='(' + year + ') :: ' + quality)
        item.set_xbmc_list_item_obj(xbmcListItem)
        items.append(item)
        response_obj.addListItem(item)

    total_pages = 4
    count = 0
    next_page = page
    if count < total_pages:
        count = count + 1
        next_page = next_page + 1
        item = ListItem()
        item.add_request_data('page', next_page)
        item.add_request_data('categoryUrlSuffix',
                              request_obj.get_data()['categoryUrlSuffix'])
        item.set_next_action_name('Next_Page')
        xbmcListItem = xbmcgui.ListItem(label='  ---- NEXT PAGE #' +
                                        str(next_page) + ' --->')
        item.set_xbmc_list_item_obj(xbmcListItem)
        response_obj.addListItem(item)

    response_obj.set_xbmc_content_type('movies')
Exemple #48
0
def retrieveUserPlaylists(userId, pageNbr=0, maxCount=50):
    url = 'http://gdata.youtube.com/feeds/api/users/' + userId + '/playlists?alt=json&v=2&max-results=' + str(
        maxCount) + '&start-index=' + str((pageNbr * maxCount) + 1)

    jData = json.loads(HttpUtils.HttpClient().getHtmlContent(url))
    entries = jData['feed']['entry']
    items = []
    for entry in entries:

        playlistId = unicode(entry['yt$playlistId']['$t']).encode('utf-8')
        title = unicode(entry['title']['$t']).encode('utf-8')
        thumbnail = unicode(
            entry['media$group']['media$thumbnail'][1]['url']).encode('utf-8')

        item = ListItem()
        item.add_request_data('userId', userId)
        item.add_request_data('playlistId', playlistId)
        item.set_next_action_name('show_Playlist_Videos')
        xbmcListItem = xbmcgui.ListItem(label=title,
                                        iconImage=thumbnail,
                                        thumbnailImage=thumbnail)
        item.set_xbmc_list_item_obj(xbmcListItem)
        items.append(item)
    if (len(items) == maxCount):
        item = ListItem()
        item.add_request_data('userId', userId)
        item.add_request_data('pageNbr', pageNbr + 1)
        item.set_next_action_name('show_Playlists')
        xbmcListItem = xbmcgui.ListItem(label='---- Next Page ---->')
        item.set_xbmc_list_item_obj(xbmcListItem)
        items.append(item)
    return items
Exemple #49
0
def retrieveUserPlaylistVideos(playlistId, pageNbr=0, maxCount=50):
    url = 'http://gdata.youtube.com/feeds/api/playlists/' + playlistId + '?alt=json&v=2&max-results=' + str(
        maxCount) + '&start-index=' + str((pageNbr * maxCount) + 1)

    jData = json.loads(HttpUtils.HttpClient().getHtmlContent(url))
    entries = jData['feed']['entry']

    items = []
    for entry in entries:
        videoId = entry['media$group']['yt$videoid']['$t']
        title = unicode(entry['title']['$t']).encode('utf-8')
        thumbnail = 'http://i.ytimg.com/vi/' + videoId + '/default.jpg'

        item = ListItem()
        item.add_request_data(
            'videoLink', 'http://www.youtube.com/watch?v=' + videoId + '&')
        item.add_request_data('videoTitle', title)
        item.set_next_action_name('play_Video')
        xbmcListItem = xbmcgui.ListItem(label=title,
                                        iconImage=thumbnail,
                                        thumbnailImage=thumbnail)
        item.set_xbmc_list_item_obj(xbmcListItem)
        items.append(item)
    if (len(items) == maxCount):
        item = ListItem()
        item.add_request_data('playlistId', playlistId)
        item.add_request_data('pageNbr', pageNbr + 1)
        item.set_next_action_name('show_Playlist_Videos')
        xbmcListItem = xbmcgui.ListItem(label='---- Next Page ---->')
        item.set_xbmc_list_item_obj(xbmcListItem)
        items.append(item)
    return items
Exemple #50
0
def displayTVShowEpisodes(request_obj, response_obj):
    url = request_obj.get_data()['tvChannelUrl']
    contentDiv = GetContent(url)
    newcontent = ''.join(contentDiv.encode("utf-8").splitlines()).replace('\t','')
    contentDiv = BeautifulSoup.SoupStrainer('div', {'id':'content'})
    soup = HttpClient().getBeautifulSoup(url=url, parseOnlyThese=contentDiv)
    videoBoxes =re.compile("<div id='videobox'>(.+?)</h3><div style='clear: both;'>").findall(newcontent)
    for videoBox in videoBoxes:
        #imgTag = videoBox.findChild('img')
        imageUrl = re.compile('<img [^>]*src=["\']?([^>^"^\']+)["\']?[^>]*>').findall(str(videoBox))[0]
        match=re.compile('createSummaryThumb\("(.+?)","(.+?)","(.+?)",').findall(str(videoBox))
        if(len(match)>0):
            episodeName = match[0][1]
            episodeUrl = str(match[0][2])
            
            item = ListItem()
            item.add_request_data('episodeName', episodeName)
            item.add_request_data('episodeUrl', episodeUrl)
            item.set_next_action_name('Show_Episode_VLinks')
            xbmcListItem = xbmcgui.ListItem(label=episodeName, iconImage=imageUrl, thumbnailImage=imageUrl)
            item.set_xbmc_list_item_obj(xbmcListItem)
            response_obj.addListItem(item)
    pageTag = soup.findChild('div', {'class':'postnav'})
    if(pageTag !=None):
        olderPageTag = pageTag.findChild('a', {'class':'blog-pager-older-link'})
    else:
        olderPageTag = None
    if olderPageTag is not None:
        item = ListItem()
        item.add_request_data('tvChannelUrl', str(olderPageTag['href']))
        pageName = AddonUtils.getBoldString('              ->              Next Page')
        item.set_next_action_name('Show_Episodes_Next_Page')
        xbmcListItem = xbmcgui.ListItem(label=pageName)
        item.set_xbmc_list_item_obj(xbmcListItem)
        response_obj.addListItem(item)
Exemple #51
0
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)
Exemple #52
0
def retrieveVideoLinks(request_obj, response_obj):
    
    video_source_id = 1
    video_source_img = None
    video_part_index = 0
    video_playlist_items = []
    #ignoreAllLinks = False
    
    url = request_obj.get_data()['episodeUrl']
    contentDiv = BeautifulSoup.SoupStrainer('div', {'class':'entry'})
    soup = HttpClient().getBeautifulSoup(url=url, parseOnlyThese=contentDiv)
    soup = soup.findChild('div')
    for child in soup.findChildren():
        if child.name == 'img' or child.name == 'param' or child.name == 'object' or child.name == 'b' or child.name == 'font' or child.name == 'br':
            pass
        elif child.name == 'span' and re.search('ALTERNATIVE VIDEO', child.getText(), re.IGNORECASE):
            if len(video_playlist_items) > 0:
                response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_playlist_items))
                
            video_source_id = video_source_id + 1
            video_source_img = None
            video_part_index = 0
            video_playlist_items = []
            #ignoreAllLinks = False
        elif child.name == 'embed' or child.name == 'iframe':
            
            if re.search('http://gdata.youtube.com/feeds/api/playlists/', str(child)) or re.search('http://www.youtubereloaded.com/playlists/', str(child)):
                playlistId = re.compile('/playlists/(.+?)(\&|\.xml)').findall(str(child))[0][0]
                
                videoUrls = YouTube.retrievePlaylistVideoItems(playlistId)
                for videoUrl in videoUrls:
                    try:
                        video_part_index = video_part_index + 1
                        video_link = {}
                        video_link['videoTitle'] = 'Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index)
                        video_link['videoLink'] = videoUrl
                        print "myvidlink"+videoUrl
                        video_hosting_info = SnapVideo.findVideoHostingInfo(video_link['videoLink'])
                        video_link['videoSourceImg'] = video_hosting_info.get_video_hosting_image()
                        
                        video_playlist_items.append(video_link)
                        video_source_img = video_link['videoSourceImg']
                        
                        item = ListItem()
                        item.add_request_data('videoLink', video_link['videoLink'])
                        item.add_request_data('videoTitle', video_link['videoTitle'])
                        item.set_next_action_name('SnapAndPlayVideo')
                        xbmcListItem = xbmcgui.ListItem(label='Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) , iconImage=video_source_img, thumbnailImage=video_source_img)
                        item.set_xbmc_list_item_obj(xbmcListItem)
                        response_obj.addListItem(item)
                    except:
                        print 'Unable to recognize a source = ' + video_link['videoLink']
                        video_source_img = None
                        video_part_index = 0
                        video_playlist_items = []
                        #ignoreAllLinks = True
                    
            else:

                videoUrl = str(child['src'])
                
                try:
                    video_part_index = video_part_index + 1
                    video_link = {}
                    video_link['videoTitle'] = 'Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index)
                    video_link['videoLink'] = videoUrl
                    print "myvidlink"+videoUrl
                    video_hosting_info = SnapVideo.findVideoHostingInfo(video_link['videoLink'])
                    video_link['videoSourceImg'] = video_hosting_info.get_video_hosting_image()
                    
                    video_playlist_items.append(video_link)
                    video_source_img = video_link['videoSourceImg']
                    
                    item = ListItem()
                    item.add_request_data('videoLink', video_link['videoLink'])
                    item.add_request_data('videoTitle', video_link['videoTitle'])
                    item.set_next_action_name('SnapAndPlayVideo')
                    xbmcListItem = xbmcgui.ListItem(label='Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) , iconImage=video_source_img, thumbnailImage=video_source_img)
                    item.set_xbmc_list_item_obj(xbmcListItem)
                    response_obj.addListItem(item)
                except:
                    print 'Unable to recognize a source = ' + video_link['videoLink']
                    video_source_img = None
                    video_part_index = 0
                    video_playlist_items = []
                    #ignoreAllLinks = True
        else:
            print 'UNKNOWN child name'
            print child
            
    if len(video_playlist_items) > 0:
        response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_playlist_items))