Esempio n. 1
0
def displayLiveTvSources(request_obj, response_obj):
    
    dts_icon_filepath = AddonUtils.getCompleteFilePath(baseDirPath=AddonContext().addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='DTS.png')
    item = ListItem()
    item.set_next_action_name('Desi_TV_Streams')
    xbmcListItem = xbmcgui.ListItem(label='[B]DESI TV[/B] STREAMS', iconImage=dts_icon_filepath, thumbnailImage=dts_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)
    
    mnt_icon_filepath = AddonUtils.getCompleteFilePath(baseDirPath=AddonContext().addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='MNT.png')
    item = ListItem()
    item.set_next_action_name('Movies_n_TV')
    xbmcListItem = xbmcgui.ListItem(label='MOVIESnTV', iconImage=mnt_icon_filepath, thumbnailImage=mnt_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)
    
    wst_icon_filepath = AddonUtils.getCompleteFilePath(baseDirPath=AddonContext().addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='WST.png')
    item = ListItem()
    item.set_next_action_name('Watch_Sun_TV')
    xbmcListItem = xbmcgui.ListItem(label='WATCH SUN TV', iconImage=wst_icon_filepath, thumbnailImage=wst_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    #Hide WatchSunTV.com until it is not working.
    #response_obj.addListItem(item)

    free_icon_filepath = AddonUtils.getCompleteFilePath(baseDirPath=AddonContext().addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='FREE.png')
    item = ListItem()
    item.set_next_action_name('Free_TV')
    xbmcListItem = xbmcgui.ListItem(label='FREE TV', iconImage=free_icon_filepath, thumbnailImage=free_icon_filepath)
    item.set_xbmc_list_item_obj(xbmcListItem)
    response_obj.addListItem(item)
Esempio n. 2
0
def __loginAndSaveCookieStore__(cookieStore):
    AddonUtils.deleteFile(cookieStore)
    email = Container().getAddonContext().addon.getSetting("email")
    password = Container().getAddonContext().addon.getSetting("password")
    if email == None or email == "" or password == None or password == "":
        d = xbmcgui.Dialog()
        d.ok(
            "Welcome to Willow TV",
            "Watch LIVE CRICKET on your favorite Willow TV.",
            "Please provide your login details for both",
            "Willow TV and YouTube.",
        )
        Container().getAddonContext().addon.openSettings(sys.argv[0])
        return False
    params = {"Email": email, "Password": password, "KeepSigned": "true", "LoginFormSubmit": "true"}
    html = HttpUtils.HttpClient().getHtmlContent(LOGIN_URL, params)
    HttpUtils.HttpClient().saveCookiesToFile(cookieStore)
    match = re.compile("Error: Your email or password is incorrect").findall(html)
    if len(match) > 0:
        XBMCInterfaceUtils.displayDialogMessage(
            "Login Failure", "Error: Your email or password is incorrect.", "Please verify your login details."
        )
        return False
    else:
        return True
Esempio n. 3
0
def serviceMethod(name, **params):
    actionId = __registered_services__[name]
    data = {'data': AddonUtils.encodeData(params)}
    service_response_obj = None
    try:
        containerObj = Container(addon_id=__addon_id__)

        iconimage = AddonUtils.getCompleteFilePath(
            baseDirPath=containerObj.getAddonContext().addonPath,
            filename='icon.png')
        XBMCInterfaceUtils.displayNotification(
            __service_name__ + ' Service',
            'Processing received request...',
            iconimage=iconimage)

        containerObj.reloadTurtleRequest(data)
        containerObj.performAction(actionId)
        service_response_obj = containerObj.getTurtleResponse(
        ).get_service_response_obj()
    except Exception, e:
        print __service_name__ + ' Service :: ERROR OCCURRED: ' + str(e)
        ExceptionHandler.handle(e)
        service_response_obj = {
            "status": "exception",
            "message": "an unexpected error occurred, please check your input"
        }
        XBMCInterfaceUtils.displayNotification(
            __service_name__ + ' Service',
            'Error while processing your request',
            time='5000')
Esempio n. 4
0
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.')
Esempio n. 5
0
 def loadTurtleMap(self):
     turtle_filepath = AddonUtils.getCompleteFilePath(
         self.addonPath, 'config', 'turtle.xml')
     if not AddonUtils.doesFileExist(turtle_filepath):
         turtle_filepath = AddonUtils.getCompleteFilePath(
             self.turtle_addonPath, 'lib/config', 'turtle.xml')
     return AddonUtils.getBeautifulSoupObj(turtle_filepath)
Esempio n. 6
0
def displayAtoZMenu(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('ChooseChar')
    item.add_request_data('categorySuffix', '_H')
    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('ChooseChar')
    item.add_request_data('categorySuffix', '_T')
    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('ChooseChar')
    item.add_request_data('categorySuffix', '_TT')
    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)
Esempio n. 7
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
Esempio n. 8
0
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)
    d = xbmcgui.Dialog()
    catSelect = d.select('SELECT Category', freeChannels.keys())
    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]})
Esempio n. 9
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)
Esempio n. 10
0
def selectChannelsCategory(request_obj, response_obj):
    Container().ga_client.reportAction('live_FREE')
    filepath = AddonUtils.getCompleteFilePath(baseDirPath=Container().getAddonContext().addonPath, extraDirPath=AddonUtils.ADDON_SRC_DATA_FOLDER, filename=CHANNELS_JSON_FILE)
    freeChannels = AddonUtils.getJsonFileObj(filepath)
    
    filepath = AddonUtils.getCompleteFilePath(baseDirPath=Container().getAddonContext().addonProfile, extraDirPath=AddonUtils.ADDON_SRC_DATA_FOLDER, filename='M.json')
    if AddonUtils.doesFileExist(filepath):
        freeChannels.update(AddonUtils.getJsonFileObj(filepath))
    request_obj.set_data({'channels': freeChannels})
Esempio n. 11
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)
Esempio n. 12
0
def displayTVShows(request_obj, response_obj):
    filepath = AddonUtils.getCompleteFilePath(baseDirPath=Container().getAddonContext().addonProfile, extraDirPath=AddonUtils.ADDON_SRC_DATA_FOLDER, filename=CHANNELS_JSON_FILE)
    channelsList = AddonUtils.getJsonFileObj(filepath)
    channelObj = channelsList[request_obj.get_data()['channelName']]
    channelType = request_obj.get_data()['channelType']
    if channelObj.has_key('running_tvshows'):
        items = __displayTVShows__(channelObj['running_tvshows'], channelType)
        response_obj.extendItemList(items)
    if channelObj.has_key('finished_tvshows'):
        items = __displayTVShows__(channelObj['finished_tvshows'], channelType, True)
        response_obj.extendItemList(items)
Esempio n. 13
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/")
    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/")
    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": "sidebar"})
    soup = HttpClient().getBeautifulSoup(url="http://www.pinoymovie.co/", 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)
Esempio n. 14
0
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]})
Esempio n. 15
0
def __initializeSnappers():
    snapper_filepath = AddonUtils.getCompleteFilePath(Container().getAddonContext().addonPath, 'snapvideo', 'snappers.xml')
    if not AddonUtils.doesFileExist(snapper_filepath):
        snapper_filepath = AddonUtils.getCompleteFilePath(Container().getAddonContext().turtle_addonPath, 'lib/snapvideo', 'snappers.xml')
    global snappers
    if snappers is not None:
        return snappers
    snappers = []
    Logger.logDebug('Loading snappers.xml from path... ' + snapper_filepath)
    snappers_xml = AddonUtils.getBeautifulSoupObj(snapper_filepath)
    for snapperTag in snappers_xml.findAll('snapper', attrs={'enabled':'true'}):
        snappers.append(Snapper(snapperTag))
    return snappers
Esempio n. 16
0
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)
Esempio n. 17
0
 def __initialize__(self, addon_id):
     
     #Addon information
     self.addon = xbmcaddon.Addon(id=addon_id)
     self.addonPath = self.addon.getAddonInfo('path')
     self.addonProfile = self.addon.getAddonInfo('profile')
     
     self.turtle_addon = xbmcaddon.Addon(id='script.module.turtle')
     self.turtle_addonPath = self.turtle_addon.getAddonInfo('path')
     self.turtle_addonProfile = self.turtle_addon.getAddonInfo('profile')
     
     turtle_filepath = AddonUtils.getCompleteFilePath(self.addonPath, 'config', 'turtle.xml')
     if not AddonUtils.doesFileExist(turtle_filepath):
         turtle_filepath = AddonUtils.getCompleteFilePath(self.turtle_addonPath, 'lib/config', 'turtle.xml')
     self.turtle_map = AddonUtils.getBeautifulSoupObj(turtle_filepath)
Esempio n. 18
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)
Esempio n. 19
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
Esempio n. 20
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://movzap.com/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        
        paramSet = re.compile("return p\}\(\'(.+?)\',(\d\d),(\d\d),\'(.+?)\'").findall(html)
        if len(paramSet) > 0:
            video_info_link = AddonUtils.parsePackedValue(paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'')
            
            img_data = re.compile(r"image:\'(.+?)\'").findall(video_info_link)
            if len(img_data) == 1:
                video_info.set_video_image(img_data[0])
            video_link = re.compile(r"file:\'(.+?)\'").findall(video_info_link)[0]
        else:
            video_link = re.compile("'file': '(.+?)'").findall(html)[0]
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        
    except Exception, e:
        Logger.logError(e)
        video_info.set_video_stopped(True)
Esempio n. 21
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)
Esempio n. 22
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
Esempio n. 23
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = "http://www.vidpe.com/" + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)

        paramSet = re.compile("return p\}\('(.+?)',(\d\d),(\d\d),'(.+?)'").findall(html)
        video_info_link = (
            AddonUtils.parsePackedValue(
                paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split("|")
            )
            .replace("\\", "")
            .replace('"', "'")
        )

        img_data = re.compile(r"addVariable\(\'image\',\'(.+?)\'\);").findall(video_info_link)
        if len(img_data) == 1:
            video_info.set_video_image(img_data[0])
        video_link = re.compile("addVariable\('file','(.+?)'\);").findall(video_info_link)[0]

        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)

    except:
        video_info.set_video_stopped(True)
    return video_info
Esempio n. 24
0
def displayTVShowEpisodes(request_obj, response_obj):
    url = request_obj.get_data()['tvChannelUrl']
    contentDiv = BeautifulSoup.SoupStrainer('div', {'id':'content'})
    soup = HttpClient().getBeautifulSoup(url=url, parseOnlyThese=contentDiv)
    videoBoxes = soup.findChildren('div', {'id':'videobox'})
    for videoBox in videoBoxes:
        imgTag = videoBox.findChild('img')
        imageUrl = str(imgTag['src'])
        metaTag = videoBox.findChild('div', {'class':'meta'})
        aTag = metaTag.findChild('a')
        episodeName = aTag.getText()
        episodeUrl = str(aTag['href'])
        
        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'})
    olderPageTag = pageTag.findChild('a', {'class':'blog-pager-older-link'})
    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)
Esempio n. 25
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
Esempio n. 26
0
def retrieveVideoInfo(video_id):
    
    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        HttpUtils.HttpClient().enableCookies()
        video_info_link = 'http://www.vidxden.com/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        if re.search(r'Video bandwidth is expensive. We appreciate Your patience!', html):
            data = {'method_free': 'Continue to Video', 'op' : 'download1', 'usr_login' : '', 'id':str(video_id)}
            html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link, params=data)
        HttpUtils.HttpClient().disableCookies()
        paramSet = re.compile("return p\}\(\'(.+?)\',(\d\d),(\d\d),\'(.+?)\'").findall(html)
        video_info_link = AddonUtils.parsePackedValue(paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]), paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'')
        img_data = re.compile(r"addVariable\(\'image\',\'(.+?)\'\);").findall(video_info_link)
        if len(img_data) == 1:
            video_info.set_video_image(img_data[0])
        video_link = re.compile("addVariable\(\'file\',\'(.+?)\'\);").findall(video_info_link)[0]
        
        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)
        
    except: 
        video_info.set_video_stopped(True)
    return video_info
Esempio n. 27
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)
Esempio n. 28
0
def __loginAndSaveCookieStore__(cookieStore):
    AddonUtils.deleteFile(cookieStore)
    email = Container().getAddonContext().addon.getSetting('yt_email')
    password = Container().getAddonContext().addon.getSetting('yt_password')
    if email == None or email == '' or password == None or password == '':
        d = xbmcgui.Dialog()
        d.ok('Welcome to Willow TV', 'Watch LIVE CRICKET on your favorite Willow TV.', 'Please provide your login details for YouTube Account.')
        Container().getAddonContext().addon.openSettings(sys.argv[ 0 ])
        email = Container().getAddonContext().addon.getSetting('yt_email')
        password = Container().getAddonContext().addon.getSetting('yt_password')
    successInd = __loginYouTube__(LOGIN_URL, email, password)
    if successInd:
        HttpUtils.HttpClient().saveCookiesToFile(cookieStore)
    else:
        raise Exception(ExceptionHandler.DONOT_DISPLAY_ERROR);
    return successInd
Esempio n. 29
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        video_info_link = 'http://www.vidpe.com/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)

        paramSet = re.compile(
            "return p\}\(\'(.+?)\',(\d\d),(\d\d),\'(.+?)\'").findall(html)
        video_info_link = AddonUtils.parsePackedValue(
            paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]),
            paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'')

        img_data = re.compile(r"addVariable\(\'image\',\'(.+?)\'\);").findall(
            video_info_link)
        if len(img_data) == 1:
            video_info.set_video_image(img_data[0])
        video_link = re.compile("addVariable\(\'file\',\'(.+?)\'\);").findall(
            video_info_link)[0]

        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)

    except:
        video_info.set_video_stopped(True)
    return video_info
Esempio n. 30
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)
def addFolderItem(item, item_next_action_id, is_folder=True):
    u = sys.argv[0] + '?actionId=' + urllib.quote_plus(
        item_next_action_id) + '&data=' + urllib.quote_plus(
            AddonUtils.encodeData(item.get_request_data()))
    xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),
                                url=u,
                                listitem=item.get_xbmc_list_item_obj(),
                                isFolder=is_folder)
Esempio n. 32
0
def removeChannel(request_obj, response_obj):
    channelName = request_obj.get_data()['userId']
    d = xbmcgui.Dialog()
    if not d.yesno('Remove Channel : [B]' + channelName + '[/B]', 'Do you want to continue?', 'Note: This action will not delete channel from YouTube.'):
        return
    filepath = AddonUtils.getCompleteFilePath(baseDirPath=Container().getAddonContext().addonProfile, extraDirPath=AddonUtils.ADDON_SRC_DATA_FOLDER, filename=CHANNELS_JSON_FILE, makeDirs=True)
    if AddonUtils.doesFileExist(filepath):
        try:
            channelsJsonObj = AddonUtils.getJsonFileObj(filepath)
            try:
                del channelsJsonObj[channelName]
                print 'CHANNEL DELETED = ' + channelName
                AddonUtils.saveObjToJsonFile(filepath, channelsJsonObj)
                d = xbmcgui.Dialog()
                d.ok('Channel removed SUCCESSFULLY', 'You can add this channel again using same way.', 'ENJOY!')
                xbmc.executebuiltin("Container.Refresh()")
            except KeyError:
                d = xbmcgui.Dialog()
                d.ok('FAILED to remove channel', 'Please try again.')
                
        except ValueError:
            AddonUtils.deleteFile(filepath)
            print 'MY CHANNELS CORRUPT FILE DELETED = ' + filepath
    else:
        d = xbmcgui.Dialog()
        d.ok('NO channels added yet', 'Add new channel using YouTube username.', 'Get username from YouTube URL.')
Esempio n. 33
0
def start(addon_id, service_name, context_root, default_port,
          allowed_port_range):
    try:
        global __addon_id__
        global __registered_services__
        global __context_root__
        global __port__
        global __port_range__
        global __service_name__
        __addon_id__ = addon_id
        __context_root__ = context_root
        __port__ = default_port
        __port_range__ = allowed_port_range
        __service_name__ = service_name
        containerObj = Container(addon_id=addon_id)
        iconimage = AddonUtils.getCompleteFilePath(
            baseDirPath=containerObj.getAddonContext().addonPath,
            filename='icon.png')
        serviceport = int(
            containerObj.getAddonContext().addon.getSetting('serviceport'))

        XBMCInterfaceUtils.setSuppressDialogMsg(True)

        if serviceport < __port_range__[0] or serviceport > __port_range__[1]:
            containerObj.getAddonContext().addon.setSetting(
                'serviceport', str(__port__))
            serviceport = __port__
            XBMCInterfaceUtils.displayNotification(
                __service_name__ + ' Service: Port updated',
                'Service port set to default value 8181',
                iconimage=iconimage)

        server = JSONRPCServer(context_root=__context_root__,
                               server_port=serviceport)
        server.registerService('serviceName', serviceMethod)
        defined_services = containerObj.getAddonContext().getTurtleServices()
        if len(defined_services) == 0:
            print __service_name__ + ' Service :: There are no services defined for registration, end this service program now.'
            return
        for service in defined_services:
            server.registerService(service.get_service_name(), serviceMethod)
            __registered_services__[
                service.get_service_name()] = service.get_action_id()
            print __service_name__ + ' Service :: service registered = %s @ %s' % (
                service.get_service_name(), __context_root__)
        server.start()
        XBMCInterfaceUtils.displayNotification(
            __service_name__ + ' Service has started',
            'Use safari extension to play video remotely',
            iconimage=iconimage)

        while not xbmc.abortRequested:
            time.sleep(5)
        print __service_name__ + ' Service :: ABORT request received from XBMC. PlayIt service will stop now.'
    except Exception, e:
        print __service_name__ + ' Service :: ERROR OCCURRED: ' + str(e)
        ExceptionHandler.handle(e)
Esempio n. 34
0
def __preparePlayListItem__(video_source_id, video_source_img, video_source_name, 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)
    item.add_moving_data('videoSourceName', video_source_name)
    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
Esempio n. 35
0
def serviceMethod(name, **params):
    actionId = __registered_services__[name]
    data = {'data':AddonUtils.encodeData(params)}
    service_response_obj = None
    try:
        containerObj = Container(addon_id=__addon_id__)
        
        iconimage = AddonUtils.getCompleteFilePath(baseDirPath=containerObj.getAddonContext().addonPath, filename='icon.png')
        XBMCInterfaceUtils.displayNotification(__service_name__ + ' Service', 'Processing received request...', iconimage=iconimage)
    
        containerObj.reloadTurtleRequest(data)
        containerObj.performAction(actionId)
        service_response_obj = containerObj.getTurtleResponse().get_service_response_obj()
    except Exception, e:
        print __service_name__ + ' Service :: ERROR OCCURRED: ' + str(e)
        ExceptionHandler.handle(e)
        service_response_obj = {"status":"exception", "message":"an unexpected error occurred, please check your input"}
        XBMCInterfaceUtils.displayNotification(__service_name__ + ' Service', 'Error while processing your request', time='5000')
Esempio n. 36
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
Esempio n. 37
0
def __checkAndLoadCookieStore__(cookieStore):
    relogin = False
    if AddonUtils.doesFileExist(cookieStore):
        HttpUtils.HttpClient().loadCookiesToFile(cookieStore)
        now = time.time()
        for cookie in HttpUtils.HttpClient().get_cookiejar():
            if (cookie.name == "CXUserId" or cookie.name == "CXUserName") and cookie.is_expired(now):
                relogin = True
    else:
        relogin = True
    return relogin
Esempio n. 38
0
def __checkAndLoadCookieStore__(cookieStore):
    relogin = False
    if AddonUtils.doesFileExist(cookieStore):
        HttpUtils.HttpClient().loadCookiesFromFile(cookieStore)
        HttpUtils.HttpClient().enableCookies()
        html = HttpUtils.HttpClient().getHtmlContent("http://www.youtube.com/")
        if len(re.compile('My channel').findall(html)) == 0:
            relogin = True
    else:
        relogin = True
    return relogin
Esempio n. 39
0
def addContextMenuItem(item, label, action_id, data=None):
    if data is None:
        data = item.get_request_data()
    contextMenuItems = []
    data = '?actionId=' + urllib.quote_plus(
        action_id) + '&data=' + urllib.quote_plus(
            AddonUtils.encodeData(item.get_request_data()))
    contextMenuItems.append(
        (label, 'XBMC.RunPlugin(%s?%s)' % (sys.argv[0], data)))
    item.get_xbmc_list_item_obj().addContextMenuItems(contextMenuItems,
                                                      replaceItems=False)
Esempio n. 40
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)
Esempio n. 41
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)
Esempio n. 42
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)
Esempio n. 43
0
 def __initialize__(self, params=None):
     print params
     self.set_action_id('__start__')
     if params is None:
         self.set_params({})
     elif type(params) is str:
         self.set_params(HttpUtils.getUrlParams(params))
     elif type(params) is dict:
         self.set_params(params)
     if self.get_params().has_key('actionId') and self.get_params()['actionId'] != '':
         self.set_action_id(self.get_params()['actionId'])
     if self.get_params().has_key('data') and self.get_params()['data'] != '':
         self.set_data(AddonUtils.decodeData(self.get_params()['data']))
Esempio n. 44
0
def start(addon_id, service_name, context_root, default_port, allowed_port_range):
    server = None
    try:
        sys.argv = None  # To handle the situations where some library expects system arguments. Main change made for t0mm0 urlresolver library.
        
        global __addon_id__
        global __registered_services__
        global __context_root__
        global __port__
        global __port_range__
        global __service_name__
        __addon_id__ = addon_id
        __context_root__ = context_root
        __port__ = default_port
        __port_range__ = allowed_port_range
        __service_name__ = service_name
        containerObj = Container(addon_id=addon_id)
        iconimage = AddonUtils.getCompleteFilePath(baseDirPath=containerObj.getAddonContext().addonPath, filename='icon.png')
        serviceport = int(containerObj.getAddonContext().addon.getSetting('serviceport'))
        
        XBMCInterfaceUtils.setSuppressDialogMsg(True)
        
        if serviceport < __port_range__[0] or serviceport > __port_range__[1] :
            containerObj.getAddonContext().addon.setSetting('serviceport', str(__port__))
            serviceport = __port__
            XBMCInterfaceUtils.displayNotification(__service_name__ + ' Service: Port updated', 'Service port set to default value 8181', iconimage=iconimage)

        server = JSONRPCServer(context_root=__context_root__, server_port=serviceport)
        server.registerService('serviceName', serviceMethod)
        defined_services = containerObj.getAddonContext().getTurtleServices()
        if len(defined_services) == 0:
            Logger.logError(__service_name__ + ' Service :: There are no services defined for registration, end this service program now.')
            return
        for service in defined_services:
            server.registerService(service.get_service_name(), serviceMethod)
            __registered_services__[service.get_service_name()] = service.get_action_id()
            Logger.logInfo(__service_name__ + ' Service :: service registered = %s @ %s' % (service.get_service_name(), __context_root__))
        server.start()
#         XBMCInterfaceUtils.displayNotification(__service_name__ + ' Service has started', 'Use web browser PlayIt extension to play video.', iconimage=iconimage)
        
        while not xbmc.abortRequested:
            time.sleep(1)
        Logger.logInfo(__service_name__ + ' Service :: ABORT request received from XBMC. PlayIt service will stop now.')
    except Exception, e:
        Logger.logFatal(__service_name__ + ' Service :: ERROR OCCURRED: ' + str(e))
        ExceptionHandler.handle(e)
Esempio n. 45
0
def retrieveVideoInfo(video_id):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(video_id)
    try:
        HttpUtils.HttpClient().enableCookies()
        video_info_link = 'http://www.vidbux.com/' + str(video_id)
        html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link)
        if re.search(
                r'Video bandwidth is expensive. We appreciate Your patience!',
                html):
            data = {
                'method_free': 'Continue to Video',
                'op': 'download1',
                'usr_login': '',
                'id': str(video_id)
            }
            html = HttpUtils.HttpClient().getHtmlContent(url=video_info_link,
                                                         params=data)

        HttpUtils.HttpClient().disableCookies()
        paramSet = re.compile(
            "return p\}\(\'(.+?)\',(\d\d),(\d\d),\'(.+?)\'").findall(html)
        video_info_link = AddonUtils.parsePackedValue(
            paramSet[0][0], int(paramSet[0][1]), int(paramSet[0][2]),
            paramSet[0][3].split('|')).replace('\\', '').replace('"', '\'')

        img_data = re.compile(r"addVariable\(\'image\',\'(.+?)\'\);").findall(
            video_info_link)
        if len(img_data) == 1:
            video_info.set_video_image(img_data[0])
        video_link = re.compile("addVariable\(\'file\',\'(.+?)\'\);").findall(
            video_info_link)[0]

        video_info.set_video_stopped(False)
        video_info.add_video_link(VIDEO_QUAL_SD, video_link)

    except:
        video_info.set_video_stopped(True)
    return video_info
Esempio n. 46
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)
Esempio n. 47
0
def addNewChannel(request_obj, response_obj):
    keyb = xbmc.Keyboard('', 'Enter [B]YouTube[/B] username')
    keyb.doModal()
    if (keyb.isConfirmed()):
        username = keyb.getText()
        if username == None or username == '':
            d = xbmcgui.Dialog()
            d.ok('Username not entered', 'Please enter the YouTube username correctly.', 'Get username from YouTube URL.')
        else:
            try:
                channelsJsonObj = {}
                filepath = AddonUtils.getCompleteFilePath(baseDirPath=Container().getAddonContext().addonProfile, extraDirPath=AddonUtils.ADDON_SRC_DATA_FOLDER, filename=CHANNELS_JSON_FILE, makeDirs=True)
                if AddonUtils.doesFileExist(filepath):
                    try:
                        channelsJsonObj = AddonUtils.getJsonFileObj(filepath)
                        print 'CHANNELS JSON LOADED'
                    except ValueError:
                        AddonUtils.deleteFile(filepath)
                        print 'CORRUPT FILE DELETED = ' + filepath
                                
                try:
                    if channelsJsonObj[username] != None:
                        d = xbmcgui.Dialog()
                        d.ok('Channel already exists', 'Please enter the YouTube username correctly.', 'Get username from YouTube URL.')
                        
                except KeyError:
                    print 'Search for YouTube username now = ' + username
                        
                userInfo = YouTubeBrowser.retrieveYouTubeUserInfo(username)
                if userInfo != None:
                    channelsJsonObj[username] = userInfo
                    AddonUtils.saveObjToJsonFile(filepath, channelsJsonObj)
                    d = xbmcgui.Dialog()
                    d.ok('Channel added SUCCESSFULLY', 'ENJOY!')
                    xbmc.executebuiltin("Container.Refresh()")
            except urllib2.HTTPError:
                d = xbmcgui.Dialog()
                d.ok('Username doesn\'t exist', 'Please enter the YouTube username correctly.', 'Get username from YouTube URL.')
Esempio n. 48
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)
Esempio n. 49
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)