def featured_menu(self, args):
     featured_url = base64.b64decode(
         'aHR0cDovL2VzcG4uZ28uY29tL3dhdGNoZXNwbi9hcHBsZXR2L2ZlYXR1cmVk')
     et = util.get_url_as_xml_cache(get_url(featured_url))
     for showcase in et.findall('.//showcase/items/showcasePoster'):
         name = showcase.get('accessibilityLabel')
         image = showcase.find('./image').get('src')
         url = util.parse_url_from_method(showcase.get('onPlay'))
         addDir(
             name,
             dict(SHOWCASE_URL=url,
                  MODE=self.make_mode(CATEGORY_SHOWCASE_MODE)), image,
             image)
     collections = et.findall('.//collectionDivider')
     shelfs = et.findall('.//shelf')
     for i in range(0, len(collections)):
         collection_divider = collections[i]
         shelf = shelfs[i]
         title = collection_divider.find('title').text
         name = shelf.get('id')
         addDir(
             title,
             dict(SHELF_ID=name, MODE=self.make_mode(CATEGORY_SHELF_MODE)),
             defaultlive)
     xbmcplugin.endOfDirectory(pluginhandle)
    def process_item_list(self, item_list):
        stashes = list()
        for item in item_list:
            stash_element = item.find('./stash/json')
            if item.get('id').startswith('loadMore'):
                method_info = util.parse_method_call(item.get('onSelect'))
                if method_info[0] == 'espn.page.loadMore':
                    label = item.find('./label')
                    label2 = item.find('./label2')
                    menu_label = ''
                    if label is not None:
                        menu_label = label.text
                    if label2 is not None:
                        menu_label = menu_label + ' ' + label2.text
                    if label is None and label2 is None:
                        menu_label = translation(30570)
                    url = method_info[3]
                    nav_id = method_info[2]
                    url = url + '&navigationItemId=' + nav_id
                    xbmc.log(TAG + 'Load more url %s' % url, xbmc.LOGDEBUG)
                    addDir(
                        menu_label,
                        dict(SHOWCASE_URL=url,
                             MODE=self.make_mode(CATEGORY_SHOWCASE_MODE)),
                        defaultimage)
            elif not item.get('id') == 'no-event':
                if stash_element is None:
                    # Assume goes to another onPlay with a url
                    name = item.get('accessibilityLabel')
                    image = item.find('./image').get('src')
                    url = util.parse_url_from_method(item.get('onPlay'))
                    addDir(
                        name,
                        dict(SHOWCASE_URL=url,
                             MODE=self.make_mode(CATEGORY_SHOWCASE_MODE)),
                        image, image)
                else:
                    stash = stash_element.text.encode('ISO-8859-1')
                    xbmc.log(TAG + 'Stash Data %s' % (stash), xbmc.LOGDEBUG)
                    # Some of the json is baddly formatted
                    stash = re.sub(r'\s+"', '"', stash)
                    stash_json = json.loads(stash)  #, 'utf-8')
                    stash_json['internal_item'] = item
                    stashes.append(stash_json)

        xbmc.log(TAG + ' sorting %s items' % len(stashes), xbmc.LOGDEBUG)
        stashes.sort(cmp=compare_appletv)
        for stash_json in stashes:
            if stash_json['type'] == 'upcoming':
                self.index_tv_shelf(stash_json, True)
            elif 'sessionUrl' in stash_json:
                self.index_tv_shelf(stash_json, False)
            else:
                self.index_item_shelf(stash_json)
Exemple #3
0
 def category_channels(self, args):
     channels_url = base64.b64decode('aHR0cDovL2VzcG4uZ28uY29tL3dhdGNoZXNwbi9hcHBsZXR2L2NoYW5uZWxz')
     et = util.get_url_as_xml_soup_cache(get_url(channels_url))
     for channel in et.findall('.//oneLineMenuItem'):
         name = channel.get('accessibilityLabel')
         image = channel.find('.//image').text
         url = util.parse_url_from_method(channel.get('onSelect'))
         addDir(name,
                dict(SHOWCASE_URL=url, MODE=self.make_mode(CATEGORY_SHOWCASE_MODE)),
                image, image)
     xbmcplugin.setContent(pluginhandle, 'episodes')
     xbmcplugin.endOfDirectory(pluginhandle, updateListing=False)
    def process_item_list(self, item_list):
        stashes = list()
        for item in item_list:
            stash_element = item.find('./stash/json')
            if item.get('id').startswith('loadMore'):
                method_info = util.parse_method_call(item.get('onSelect'))
                if method_info[0] == 'espn.page.loadMore':
                    label = item.find('./label')
                    label2 = item.find('./label2')
                    menu_label = ''
                    if label is not None:
                        menu_label = label.text
                    if label2 is not None:
                        menu_label = menu_label + ' ' + label2.text
                    if label is None and label2 is None:
                        menu_label = translation(30570)
                    url = method_info[3]
                    nav_id = method_info[2]
                    url = url + '&navigationItemId=' + nav_id
                    xbmc.log(TAG + 'Load more url %s' % url, xbmc.LOGDEBUG)
                    addDir(menu_label,
                           dict(SHOWCASE_URL=url, MODE=self.make_mode(CATEGORY_SHOWCASE_MODE)),
                           defaultimage)
            elif not item.get('id') == 'no-event':
                if stash_element is None:
                    # Assume goes to another onPlay with a url
                    name = item.get('accessibilityLabel')
                    image = item.find('./image').get('src')
                    url = util.parse_url_from_method(item.get('onPlay'))
                    addDir(name,
                           dict(SHOWCASE_URL=url, MODE=self.make_mode(CATEGORY_SHOWCASE_MODE)),
                           image, image)
                else:
                    stash = stash_element.text.encode('ISO-8859-1')
                    xbmc.log(TAG + 'Stash Data %s' % (stash), xbmc.LOGDEBUG)
                    # Some of the json is baddly formatted
                    stash = re.sub(r'\s+"', '"', stash)
                    stash_json = json.loads(stash) #, 'utf-8')
                    stash_json['internal_item'] = item
                    stashes.append(stash_json)

        xbmc.log(TAG + ' sorting %s items' % len(stashes), xbmc.LOGDEBUG)
        stashes.sort(cmp=compare_appletv)
        for stash_json in stashes:
            if stash_json['type'] == 'upcoming':
                self.index_tv_shelf(stash_json, True)
            elif 'sessionUrl' in stash_json:
                self.index_tv_shelf(stash_json, False)
            else:
                self.index_item_shelf(stash_json)
Exemple #5
0
 def category_sports(self, args):
     sports_url = base64.b64decode('aHR0cDovL2VzcG4uZ28uY29tL3dhdGNoZXNwbi9hcHBsZXR2L3Nwb3J0cw==')
     et = util.get_url_as_xml_soup_cache(get_url(sports_url))
     images = et.findall('.//image')
     sports = et.findall('.//oneLineMenuItem')
     for i in range(0, min(len(images), len(sports))):
         sport = sports[i]
         image = images[i]
         name = sport.get('accessibilityLabel')
         image = image.text
         url = util.parse_url_from_method(sport.get('onSelect'))
         addDir(name,
                dict(SHOWCASE_URL=url, MODE=self.make_mode(CATEGORY_SHOWCASE_MODE)),
                image, image)
     xbmcplugin.endOfDirectory(pluginhandle, updateListing=False)
Exemple #6
0
 def featured_menu(self, args):
     featured_url = base64.b64decode('aHR0cDovL2VzcG4uZ28uY29tL3dhdGNoZXNwbi9hcHBsZXR2L2ZlYXR1cmVk')
     et = util.get_url_as_xml_soup_cache(get_url(featured_url))
     for showcase in et.findall('.//showcase/items/showcasePoster'):
         name = showcase.get('accessibilityLabel')
         image = showcase.find('./image').get('src')
         url = util.parse_url_from_method(showcase.get('onPlay'))
         addDir(name,
                dict(SHOWCASE_URL=url, MODE=self.make_mode(CATEGORY_SHOWCASE_MODE)),
                image, image)
     collections = et.findall('.//collectionDivider')
     shelfs = et.findall('.//shelf')
     for i in range(0, len(collections)):
         collection_divider = collections[i]
         shelf = shelfs[i]
         title = collection_divider.find('title').text
         name = shelf.get('id')
         addDir(title,
                dict(SHELF_ID=name, MODE=self.make_mode(CATEGORY_SHELF_MODE)),
                defaultlive)
     xbmcplugin.endOfDirectory(pluginhandle)