Example #1
0
 def trending_mode(self, args):
     url = base64.b64decode('aHR0cDovL3dhdGNoLmFwaS5lc3BuLmNvbS92MS90cmVuZGluZw==')
     json_data = util.get_url_as_json_cache(get_url(url))
     for listing in json_data['listings']:
         index_listing(listing)
     for video in json_data['videos']:
         index_video(video)
Example #2
0
def check_event_blackout(event_id):
    xbmc.log(TAG + ' Checking blackout for ' + event_id, xbmc.LOGDEBUG)
    url = base64.b64decode(
        'aHR0cDovL2Jyb2FkYmFuZC5lc3BuLmdvLmNvbS9lc3BuMy9hdXRoL3dhdGNoZXNwbi91dGlsL2lzVXNlckJsYWNrZWRPdXQ/ZXZlbnRJZD0=') + event_id
    xbmc.log(TAG + 'Blackout url %s' % url, xbmc.LOGDEBUG)
    blackout_data = util.get_url_as_json_cache(url)
    blackout = blackout_data['E3BlackOut']
    if not blackout == 'true':
        blackout = blackout_data['LinearBlackOut']
    return blackout == 'true'
Example #3
0
 def parse_json(self, args, url):
     xbmc.log(TAG + 'Looking at url %s %s' % (url, args), xbmc.LOGDEBUG)
     selected_bucket = args.get(BUCKET, None)
     if selected_bucket is not None:
         selected_bucket = selected_bucket[0].split('/')
         xbmc.log(TAG + 'Looking at bucket %s' % selected_bucket, xbmc.LOGDEBUG)
     json_data = util.get_url_as_json_cache(get_url(url))
     if 'buckets' in json_data['page']:
         buckets = json_data['page']['buckets']
         self.process_buckets(url, buckets, selected_bucket, list())
Example #4
0
 def parse_json(self, args, url):
     xbmc.log(TAG + 'Looking at url %s %s' % (url, args), xbmc.LOGDEBUG)
     selected_bucket = args.get(BUCKET, None)
     if selected_bucket is not None:
         selected_bucket = selected_bucket[0].split('/')
         xbmc.log(TAG + 'Looking at bucket %s' % selected_bucket,
                  xbmc.LOGDEBUG)
     json_data = util.get_url_as_json_cache(get_url(url))
     if 'buckets' in json_data['page']:
         buckets = json_data['page']['buckets']
         self.process_buckets(url, buckets, selected_bucket, list())
Example #5
0
 def list_live_content(self):
     url = base64.b64decode(
         'aHR0cDovL3dhdGNoLnByb2R1Y3QuYXBpLmVzcG4uY29tL2FwaS9wcm9kdWN0L3YxL3R2b3Mvd2F0Y2hlc3BuL2hvbWU=')
     json_data = util.get_url_as_json_cache(get_url(url))
     if 'buckets' in json_data['page']:
         buckets = json_data['page']['buckets']
         for bucket in buckets:
             if bucket['name'] == 'Live':
                 xbmc.log(TAG + 'Chose bucket %s' % bucket['id'])
                 bucket_arg = str(bucket['id']) + '/'
                 bucket_list = list()
                 bucket_list.append(bucket_arg)
                 self.parse_json(dict(BUCKET=bucket_list), url)
Example #6
0
 def list_live_content(self):
     url = base64.b64decode(
         'aHR0cDovL3dhdGNoLnByb2R1Y3QuYXBpLmVzcG4uY29tL2FwaS9wcm9kdWN0L3YxL3R2b3Mvd2F0Y2hlc3BuL2hvbWU='
     )
     json_data = util.get_url_as_json_cache(get_url(url))
     if 'buckets' in json_data['page']:
         buckets = json_data['page']['buckets']
         for bucket in buckets:
             if bucket['name'] == 'Live':
                 xbmc.log(TAG + 'Chose bucket %s' % bucket['id'])
                 bucket_arg = str(bucket['id']) + '/'
                 bucket_list = list()
                 bucket_list.append(bucket_arg)
                 self.parse_json(dict(BUCKET=bucket_list), url)
Example #7
0
 def url_mode(self, args):
     url = args.get(URL)[0]
     category_id = args.get(ID)
     if category_id:
         category_id = category_id[0]
     json_data = util.get_url_as_json_cache(get_url(url))
     if 'listings' in json_data:
         json_data['listings'].sort(cmp=compare_roku)
         for listing in json_data['listings']:
             index_listing(listing)
         xbmcplugin.setContent(pluginhandle, 'episodes')
     if 'videos' in json_data:
         for video in json_data['videos']:
             index_video(video)
         xbmcplugin.setContent(pluginhandle, 'episodes')
     if 'categories' in json_data:
         for category in json_data['categories']:
             if category_id is None:
                 if 'api' in category['links'] and 'subcategories' not in category:
                     addDir(category['name'],
                            dict(URL=category['links']['api']['video']['href'], MODE=self.make_mode(URL_MODE)),
                            self.get_thumbnail(category))
                 elif 'subcategories' in category:
                     # Collapse sub categories
                     for subcategory in category['subcategories']:
                         if 'api' in subcategory['links']:
                             addDir(category['name'] + ' - ' + subcategory['name'],
                                    dict(URL=subcategory['links']['api']['video']['href'],
                                         MODE=self.make_mode(URL_MODE)),
                                    self.get_thumbnail(category))
             elif category_id == str(category['id']):
                 if 'api' in category['links']:
                     addDir(category['name'] + ' - Clips',
                            dict(URL=category['links']['api']['video']['href'], MODE=self.make_mode(URL_MODE)),
                            self.get_thumbnail(category))
                 if 'subcategories' in category:
                     for subcategory in category['subcategories']:
                         if 'api' in subcategory['links']:
                             addDir(subcategory['name'],
                                    dict(URL=subcategory['links']['api']['video']['href'],
                                         MODE=self.make_mode(URL_MODE)),
                                    self.get_thumbnail(category))
     if 'clients' in json_data:
         for client in json_data['clients']:
             for channel in client['channels']:
                 addDir(channel['name'],
                        dict(URL=channel['links']['api']['listings']['href'], MODE=self.make_mode(URL_MODE)),
                        self.get_thumbnail(channel))
     xbmcplugin.endOfDirectory(pluginhandle)
Example #8
0
 def root_menu(self, args):
     # Roku config
     url = base64.b64decode(
         'aHR0cDovL2Fzc2V0cy5lc3BuLmdvLmNvbS9wcm9kL2Fzc2V0cy93YXRjaGVzcG4vcm9rdS9jb25maWcuanNvbg==')
     json_data = util.get_url_as_json_cache(get_url(url))
     for group in json_data['config']['featured']['groups']:
         if group['visibility'] == 'not authenticated':
             # This represents the duplicate Browse by Sport
             continue
         extra = ''
         if group['visibility'] == 'authenticated':
             if not adobe_activate_api.is_authenticated():
                 extra = '*'
         if len(group['contents']) > 1:
             extra += group['name'] + ' - '
         for content in group['contents']:
             addDir(extra + content['name'],
                    dict(URL=content['href'], MODE=self.make_mode(URL_MODE)), defaultlive)
     xbmcplugin.endOfDirectory(pluginhandle)
Example #9
0
 def root_menu(self, args):
     # Roku config
     url = base64.b64decode(
         'aHR0cDovL2Fzc2V0cy5lc3BuLmdvLmNvbS9wcm9kL2Fzc2V0cy93YXRjaGVzcG4vcm9rdS9jb25maWcuanNvbg==')
     json_data = util.get_url_as_json_cache(get_url(url))
     for group in json_data['config']['featured']['groups']:
         if group['visibility'] == 'not authenticated':
             # This represents the duplicate Browse by Sport
             continue
         extra = ''
         if group['visibility'] == 'authenticated':
             if not adobe_activate_api.is_authenticated():
                 extra = '*'
         if len(group['contents']) > 1:
             extra += group['name'] + ' - '
         for content in group['contents']:
             addDir(extra + content['name'],
                    dict(URL=content['href'], MODE=self.make_mode(URL_MODE)), defaultlive)
     xbmcplugin.endOfDirectory(pluginhandle)
Example #10
0
def get_user_data():
    return util.get_url_as_json_cache(USER_DATA_URL, USER_DATA_FILE, TIME_DIFFERENCE)
def get_user_data():
    return util.get_url_as_json_cache(USER_DATA_URL, USER_DATA_FILE,
                                      TIME_DIFFERENCE)