Exemple #1
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
Exemple #2
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')
Exemple #3
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.')
Exemple #4
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)
Exemple #5
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 #6
0
def cleanUp():
    try:
        containerObj = Container()
        containerObj.cleanUpForService()
        del containerObj
        httpClient = HttpUtils.HttpClient()
        httpClient.cleanUp()
        del httpClient
    except:
        pass
Exemple #7
0
def start(addon_id):
    try:
        global __addon_id__
        __addon_id__ = addon_id
        
        containerObj = Container(addon_id=addon_id)
        action_id = containerObj.getTurtleRequest().get_action_id()
        containerObj.performAction(action_id)
    except Exception, e:
        ExceptionHandler.handle(e)
Exemple #8
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 #9
0
def __processAndAddVideoInfo__(item, data):
    video_info = findVideoInfo(data)
    if video_info is None:
        raise Exception(ExceptionHandler.VIDEO_PARSER_NOT_FOUND, 'Video information is not found. Please check other sources.')
    if video_info.is_video_stopped():
        raise Exception(ExceptionHandler.VIDEO_STOPPED, 'Video is either Removed by hosting website. Please check other links.')
    if video_info.get_video_link(DataObjects.XBMC_EXECUTE_PLUGIN) is not None:
        item.get_moving_data()['pluginUrl'] = video_info.get_video_link(DataObjects.XBMC_EXECUTE_PLUGIN)
    else:
        if Container().getAddonContext().addon.getSetting('ga_video_title') == 'true':
            Container().ga_client.reportContentUsage(video_info.get_video_hosting_info().get_video_hosting_name(), video_info.get_video_name())
        XBMCInterfaceUtils.updateListItem_With_VideoInfo(video_info, item.get_xbmc_list_item_obj())
        qual_set = Container().getAddonContext().addon.getSetting('playbackqual')
        if qual_set == '':
            qual_set = '0'
        qual = int(qual_set)
        video_strm_link = video_info.get_video_link(DataObjects.VIDEO_QUAL_HD_1080)
        if video_strm_link is None or qual != 0:
            video_strm_link = video_info.get_video_link(DataObjects.VIDEO_QUAL_HD_720)
            if video_strm_link is None or qual == 2:
                video_strm_link = video_info.get_video_link(DataObjects.VIDEO_QUAL_SD)
                if video_strm_link is None:
                    video_strm_link = video_info.get_video_link(DataObjects.VIDEO_QUAL_LOW)
        item.get_moving_data()['videoStreamUrl'] = video_strm_link
Exemple #10
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)
Exemple #11
0
def start(addon_id, addon_ver=None):
    try:
        Logger.logDebug(sys.argv)
        global __addon_id__
        __addon_id__ = addon_id
        __addon_ver__ = addon_ver

        containerObj = Container(addon_id=addon_id, addon_ver=addon_ver)
        action_id = containerObj.getTurtleRequest().get_action_id()
        containerObj.performAction(action_id)
    except urllib2.URLError, e:
        Logger.logFatal(e)
        XBMCInterfaceUtils.displayDialogMessage(
            'Unable to connect',
            'Please choose a different source if available in add-on.',
            'Website used in add-on is down, try to access using web browser.',
            'Please share logs with developer if problem keeps coming!')
Exemple #12
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.')
Exemple #13
0
def __findPlayNowStream__(new_items):
    if Container().getAddonContext().addon.getSetting(
            'autoplayback') == 'false':
        return None
    selectedIndex = None
    selectedSource = None
    for item in new_items:
        if item.get_moving_data().has_key(
                'isContinuousPlayItem') and item.get_moving_data(
                )['isContinuousPlayItem']:
            try:
                preference = PREFERRED_DIRECT_PLAY_ORDER.index(
                    item.get_moving_data()['videoSourceName'])
                if preference == 0:
                    selectedSource = item
                    selectedIndex = 0
                    break
                elif selectedIndex is None or selectedIndex > preference:
                    selectedSource = item
                    selectedIndex = preference
            except ValueError:
                continue
    return selectedSource
Exemple #14
0
def retieveMovieStreams(request_obj, response_obj):
    if (request_obj.get_data().has_key('videoInfo')):
        title = request_obj.get_data()['videoInfo']['title']
        Container().ga_client.reportContentUsage('movie', title)
    soup = None
    if request_obj.get_data().has_key('movieInfo'):
        soup = BeautifulSoup.BeautifulSoup(request_obj.get_data()['movieInfo'])
    elif request_obj.get_data().has_key('moviePageUrl'):
        soup = HttpUtils.HttpClient().getBeautifulSoup(
            url=request_obj.get_data()['moviePageUrl'])
    if soup is None:
        return
    videoSources = []
    videoSourceLinks = None
    tags = soup.findAll('p')
    if len(tags) < 5:
        tags.extend(soup.findAll('span'))
    Logger.logDebug(soup.prettify())
    Logger.logDebug(
        '   -------------------------------------------------------       ')
    for tag in tags:
        Logger.logDebug(tag)
        if re.search('^(Source|ONLINE|Server)', tag.getText(), re.IGNORECASE):
            if videoSourceLinks is not None and len(videoSourceLinks) > 0:
                videoSources.append(videoSourceLinks)
            videoSourceLinks = []
        else:
            aTags = tag.findAll(
                'a',
                attrs={
                    'href':
                    re.compile(
                        '(desiflicks.com|desionlinetheater.com|wp.me|cine.sominaltvfilms.com|media.thesominaltv.com|mediaplaybox.com)'
                    )
                },
                recursive=True)
            if aTags is None or len(aTags) != 1:
                continue
            aTag = aTags[0]
            if aTag is not None:
                infoLink = str(aTag['href']).replace('http://adf.ly/377117/',
                                                     '')
                if videoSourceLinks == None:
                    videoSourceLinks = []
                if infoLink not in videoSourceLinks:
                    videoSourceLinks.append(infoLink)
    if videoSourceLinks is not None and len(videoSourceLinks) > 0:
        videoSources.append(videoSourceLinks)
    new_items = []
    sourceCount = 0
    for videoSource in videoSources:
        sourceCount = sourceCount + 1
        new_items.extend(
            __prepareVideoSourceLinks__(videoSource, str(sourceCount)))

    if (request_obj.get_data().has_key('videoInfo')):
        __addVideoInfo__(new_items, request_obj.get_data()['videoInfo'])
    response_obj.set_item_list(new_items)

    playNowItem = __findPlayNowStream__(response_obj.get_item_list())
    if playNowItem is not None:
        request_obj.set_data({
            'videoPlayListItems':
            playNowItem.get_request_data()['videoPlayListItems']
        })
Exemple #15
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 #16
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)