Beispiel #1
0
 def __init__(self, _tokenresolver):
     ''' Initialize Stream Service class '''
     install_opener(build_opener(ProxyHandler(get_proxies())))
     self._tokenresolver = _tokenresolver
     self._create_settings_dir()
     self._can_play_drm = can_play_drm()
     self._vualto_license_url = None
Beispiel #2
0
 def __init__(self):
     ''' Initialize resumepoints, relies on XBMC vfs and a special VRT token '''
     self._resumepoints = dict()  # Our internal representation
     install_opener(build_opener(ProxyHandler(get_proxies())))
 def __init__(self, _favorites, _resumepoints):
     ''' Constructor for the ApiHelper class '''
     self._favorites = _favorites
     self._resumepoints = _resumepoints
     self._metadata = Metadata(_favorites, _resumepoints)
     install_opener(build_opener(ProxyHandler(get_proxies())))
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""Implements static functions for scraping the VRT NU website(https://www.vrt.be/vrtnu/)"""

from __future__ import absolute_import, division, unicode_literals

try:  # Python 3
    from urllib.error import HTTPError
    from urllib.parse import unquote
    from urllib.request import build_opener, install_opener, urlopen, ProxyHandler
except ImportError:  # Python 2
    from urllib2 import build_opener, HTTPError, install_opener, ProxyHandler, unquote, urlopen

from kodiutils import get_cache, get_setting_bool, get_proxies, log, log_error, ttl, update_cache
from utils import assetpath_to_id, add_https_proto, strip_newlines

install_opener(build_opener(ProxyHandler(get_proxies())))


def valid_categories(categories):
    """Check if categories contain all necessary keys and values"""
    return bool(categories) and all(item.get('id') and item.get('name') for item in categories)


def get_categories():
    """Return a list of categories by scraping the VRT NU website"""

    cache_file = 'categories.json'
    categories = []

    # Try the cache if it is fresh
    categories = get_cache(cache_file, ttl=7 * 24 * 60 * 60)
Beispiel #5
0
 def __init__(self):
     """Initializes TV-guide object"""
     install_opener(build_opener(ProxyHandler(get_proxies())))
Beispiel #6
0
 def __init__(self):
     ''' Initializes TV-guide object '''
     self._favorites = Favorites()
     self._resumepoints = ResumePoints()
     self._metadata = Metadata(self._favorites, self._resumepoints)
     install_opener(build_opener(ProxyHandler(get_proxies())))
Beispiel #7
0
 def __init__(self):
     """Initialize favorites, relies on XBMC vfs and a special VRT token"""
     self._data = dict()  # Our internal representation
     install_opener(build_opener(ProxyHandler(get_proxies())))
Beispiel #8
0
 def __init__(self):
     """Initialize Token Resolver class"""
     self._proxies = get_proxies()
     install_opener(build_opener(ProxyHandler(self._proxies)))