Ejemplo n.º 1
0
    def __init__(self, handle, base_url, country, forceeng=False):
        HbogoHandler.__init__(self, handle, base_url)

        self.LICENSE_SERVER = ""

        self.API_CLIENT_VERSION = '3.10.15'
        self.API_DEVICE_ID = ''
        self.API_DEVICE_TOKEN = ''
        self.API_IDENTITY_GUID = ''
        self.API_ACCOUNT_GUID = ''

        self.NAMESPACES = {
            'clearleap': 'http://www.clearleap.com/namespace/clearleap/1.0/',
            'media': 'http://search.yahoo.com/mrss/',
        }

        if country[1] == 'es':
            self.API_HOST = 'api-hboe.hbo.clearleap.com'
        else:
            self.API_HOST = 'api-hbon.hbo.clearleap.com'

        self.API_HOST_GATEWAY = country[5]
        self.API_HOST_GATEWAY_REFERER = self.API_HOST_GATEWAY + '/sign-in'

        self.DEFAULT_LANGUAGE = country[4]
        self.LANGUAGE_CODE = self.language(30000)
        self.LANGUAGE_ENG = ''
        self.operator_name = ''

        if country[1] == 'es':
            self.LANGUAGE_ENG = 'en_hboespana'
            self.operator_name = 'HBO SPAIN'
        else:
            self.LANGUAGE_ENG = 'en_hbon'
            self.operator_name = 'HBO NORDIC'

        if self.LANGUAGE_CODE == 'ENG':  # only englih or the default language for the selected operator is allowed
            self.LANGUAGE_CODE = self.LANGUAGE_ENG

        # check if default language is forced
        if self.addon.getSetting('deflang') == 'true':
            self.LANGUAGE_CODE = self.DEFAULT_LANGUAGE

        if forceeng:
            self.LANGUAGE_CODE = self.LANGUAGE_ENG

        self.API_URL_BROWSE = 'https://' + self.API_HOST + '/cloffice/client/web/browse/'
        self.LANGUAGE_CODE = '?language=' + self.LANGUAGE_CODE
        self.API_URL_SEARCH = 'https://' + self.API_HOST + '/cloffice/client/web/search' + self.LANGUAGE_CODE + '&query='
        self.API_URL_AUTH_WEBBASIC = 'https://' + self.API_HOST + '/cloffice/client/device/login'
        self.API_URL_MYLIST_OPERATION = 'https://' + self.API_HOST + '/cloffice/client/web/savedAsset' + self.LANGUAGE_CODE + '&guid='

        if self.getCredential('username'):
            self.init_api()
        else:
            self.setup()
Ejemplo n.º 2
0
    def router(self, arguments):
        params = dict(parse.parse_qsl(arguments))

        url = None
        name = None
        content_id = None
        mode = None
        vote = None

        try:
            url = unquote(params["url"])
        except KeyError:
            pass
        except Exception:
            xbmc.log("[" + str(self.addon_id) + "] " + "ROUTER - url warning: " + traceback.format_exc(), xbmc.LOGDEBUG)
        try:
            name = unquote(params["name"])
        except KeyError:
            pass
        except Exception:
            xbmc.log("[" + str(self.addon_id) + "] " + "ROUTER - name warning: " + traceback.format_exc(),
                     xbmc.LOGDEBUG)
        try:
            mode = int(params["mode"])
        except KeyError:
            pass
        except Exception:
            xbmc.log("[" + str(self.addon_id) + "] " + "ROUTER - mode warning: " + traceback.format_exc(),
                     xbmc.LOGDEBUG)
        try:
            content_id = str(params["cid"])
        except KeyError:
            pass
        except Exception:
            xbmc.log("[" + str(self.addon_id) + "] " + "ROUTER - content_id warning: " + traceback.format_exc(),
                     xbmc.LOGDEBUG)
        try:
            vote = str(params["vote"])
        except KeyError:
            pass
        except Exception:
            xbmc.log("[" + str(self.addon_id) + "] " + "ROUTER - vote warning: " + traceback.format_exc(),
                     xbmc.LOGDEBUG)

        if mode is None or url is None or len(url) < 1:
            self.start()
            self.handler.categories()

        elif mode == HbogoConstants.ACTION_LIST:
            self.start()
            self.handler.setDispCat(name)
            self.handler.list(url)

        elif mode == HbogoConstants.ACTION_SEASON:
            self.start()
            self.handler.setDispCat(name)
            self.handler.season(url)

        elif mode == HbogoConstants.ACTION_EPISODE:
            self.start()
            self.handler.setDispCat(name)
            self.handler.episode(url)

        elif mode == HbogoConstants.ACTION_SEARCH:
            self.start()
            self.handler.setDispCat(self.language(30711))
            self.handler.search()

        elif mode == HbogoConstants.ACTION_PLAY:
            self.start()
            self.handler.play(content_id)

        elif mode == HbogoConstants.ACTION_RESET_SETUP:  # logout, destry setup
            # ask confirm
            if xbmcgui.Dialog().yesno(self.addon.getAddonInfo('name'), self.language(30692)):
                from hbogolib.handler import HbogoHandler
                handler = HbogoHandler(self.handle, self.base_url)
                handler.del_setup()
                xbmc.executebuiltin('Container.Refresh')

        elif mode == HbogoConstants.ACTION_RESET_SESSION:  # reset session
            from hbogolib.handler import HbogoHandler
            handler = HbogoHandler(self.handle, self.base_url)
            handler.del_login()
            xbmc.executebuiltin('Container.Refresh')

        elif mode == HbogoConstants.ACTION_VOTE:  # vote
            self.start()
            self.handler.procContext(HbogoConstants.ACTION_VOTE, content_id, vote)

        elif mode == HbogoConstants.ACTION_ADD_MY_LIST:  # add to my list
            self.start()
            self.handler.procContext(HbogoConstants.ACTION_ADD_MY_LIST, content_id)

        elif mode == HbogoConstants.ACTION_REMOVE_MY_LIST:  # remove from my list
            self.start()
            self.handler.procContext(HbogoConstants.ACTION_REMOVE_MY_LIST, content_id)

        elif mode == HbogoConstants.ACTION_MARK_WATCHED:  # remove from my list
            self.start()
            self.handler.procContext(HbogoConstants.ACTION_MARK_WATCHED, content_id)

        elif mode == HbogoConstants.ACTION_MARK_UNWATCHED:  # remove from my list
            self.start()
            self.handler.procContext(HbogoConstants.ACTION_MARK_UNWATCHED, content_id)
Ejemplo n.º 3
0
    def router(self, arguments):
        params = dict(parse.parse_qsl(arguments))

        url = None
        name = None
        content_id = None
        mode = None
        vote = None

        try:
            url = unquote(params["url"])
        except KeyError:
            pass
        except Exception:
            xbmc.log(
                "[" + str(self.addon_id) + "] " + "ROUTER - url warning: " +
                traceback.format_exc(), xbmc.LOGDEBUG)
        try:
            name = unquote(params["name"])
        except KeyError:
            pass
        except Exception:
            xbmc.log(
                "[" + str(self.addon_id) + "] " + "ROUTER - name warning: " +
                traceback.format_exc(), xbmc.LOGDEBUG)
        try:
            mode = int(params["mode"])
        except KeyError:
            pass
        except Exception:
            xbmc.log(
                "[" + str(self.addon_id) + "] " + "ROUTER - mode warning: " +
                traceback.format_exc(), xbmc.LOGDEBUG)
        try:
            content_id = str(params["cid"])
        except KeyError:
            pass
        except Exception:
            xbmc.log(
                "[" + str(self.addon_id) + "] " +
                "ROUTER - content_id warning: " + traceback.format_exc(),
                xbmc.LOGDEBUG)
        try:
            vote = str(params["vote"])
        except KeyError:
            pass
        except Exception:
            xbmc.log(
                "[" + str(self.addon_id) + "] " + "ROUTER - vote warning: " +
                traceback.format_exc(), xbmc.LOGDEBUG)

        if mode is None or url is None or len(url) < 1:
            self.start()
            self.handler.categories()

        elif mode == HbogoConstants.ACTION_LIST:
            self.start()
            self.handler.setDispCat(name)
            self.handler.list(url)

        elif mode == HbogoConstants.ACTION_SEASON:
            self.start()
            self.handler.setDispCat(name)
            self.handler.season(url)

        elif mode == HbogoConstants.ACTION_EPISODE:
            self.start()
            self.handler.setDispCat(name)
            self.handler.episode(url)

        elif mode == HbogoConstants.ACTION_SEARCH_LIST:
            self.start()
            self.handler.setDispCat(name)
            self.handler.searchlist()

        elif mode == HbogoConstants.ACTION_SEARCH_CLEAR_HISTORY:
            from hbogolib.handler import HbogoHandler
            handler = HbogoHandler(self.handle, self.base_url)
            handler.searchlist_del_history()
            xbmc.executebuiltin('Container.Refresh')

        elif mode == HbogoConstants.ACTION_SEARCH_REMOVE_HISTOY_ITEM:
            from hbogolib.handler import HbogoHandler
            handler = HbogoHandler(self.handle, self.base_url)
            itm = None
            try:
                itm = unquote(params["itm"])
            except KeyError:
                pass
            if itm is not None:
                handler.searchlist_del_history_item(itm)
            xbmc.executebuiltin('Container.Refresh')

        elif mode == HbogoConstants.ACTION_SEARCH:
            if url == "EXTERNAL_SEARCH_FORCE_ENG":
                self.start(True)
            else:
                self.start()
            self.handler.setDispCat(self.language(30711))
            query = None
            try:
                query = unquote(params["query"])
            except KeyError:
                pass
            if query is None:
                self.handler.search()
            else:
                self.handler.search(query)

        elif mode == HbogoConstants.ACTION_PLAY:
            self.start()
            self.handler.play(content_id)

        elif mode == HbogoConstants.ACTION_RESET_SETUP:  # logout, destry setup
            # ask confirm
            if xbmcgui.Dialog().yesno(self.addon.getAddonInfo('name'),
                                      self.language(30692)):
                from hbogolib.handler import HbogoHandler
                handler = HbogoHandler(self.handle, self.base_url)
                handler.del_setup()
                xbmc.executebuiltin('Container.Refresh')

        elif mode == HbogoConstants.ACTION_CLEAR_REQUEST_CACHE:  # reset request cache
            from hbogolib.handler import HbogoHandler
            handler = HbogoHandler(self.handle, self.base_url)
            handler.clear_request_cache()

        elif mode == HbogoConstants.ACTION_CLEAN_SUBTITLES_CACHE:  # clean subtitle cache
            from hbogolib.handler import HbogoHandler
            handler = HbogoHandler(self.handle, self.base_url)
            handler.clean_sub_cache(silent=False)

        elif mode == HbogoConstants.ACTION_RESET_SESSION:  # reset session
            from hbogolib.handler import HbogoHandler
            handler = HbogoHandler(self.handle, self.base_url)
            handler.del_login()
            xbmc.executebuiltin('Container.Refresh')

        elif mode == HbogoConstants.ACTION_VOTE:  # vote
            self.start()
            self.handler.procContext(HbogoConstants.ACTION_VOTE, content_id,
                                     vote)

        elif mode == HbogoConstants.ACTION_ADD_MY_LIST:  # add to my list
            self.start()
            self.handler.procContext(HbogoConstants.ACTION_ADD_MY_LIST,
                                     content_id)

        elif mode == HbogoConstants.ACTION_REMOVE_MY_LIST:  # remove from my list
            self.start()
            self.handler.procContext(HbogoConstants.ACTION_REMOVE_MY_LIST,
                                     content_id)

        elif mode == HbogoConstants.ACTION_MARK_WATCHED:  # remove from my list
            self.start()
            self.handler.procContext(HbogoConstants.ACTION_MARK_WATCHED,
                                     content_id)

        elif mode == HbogoConstants.ACTION_MARK_UNWATCHED:  # remove from my list
            self.start()
            self.handler.procContext(HbogoConstants.ACTION_MARK_UNWATCHED,
                                     content_id)
Ejemplo n.º 4
0
    def router(self, arguments):
        params = dict(parse.parse_qsl(arguments))

        url = None
        name = None
        thumbnail = None
        content_id = None
        mode = None
        vote = None

        try:
            url = urllib.unquote_plus(params["url"])
        except:
            pass
        try:
            name = urllib.unquote_plus(params["name"])
        except:
            pass
        try:
            thumbnail = str(params["thumbnail"])
        except:
            pass
        try:
            mode = int(params["mode"])
        except:
            pass
        try:
            content_id = str(params["cid"])
        except:
            pass
        try:
            vote = str(params["vote"])
        except:
            pass

        if mode == None or url == None or len(url) < 1:
            self.start()
            self.handler.categories()

        elif mode == 1:
            self.start()
            self.handler.setDispCat(name)
            self.handler.list(url)

        elif mode == 2:
            self.start()
            self.handler.setDispCat(name)
            self.handler.season(url)

        elif mode == 3:
            self.start()
            self.handler.setDispCat(name)
            self.handler.episode(url)

        elif mode == 4:
            self.start()
            self.handler.setDispCat(self.language(30711).encode('utf-8'))
            self.handler.search()

        elif mode == 5:
            self.start()
            self.handler.setDispCat(name)
            self.handler.play(url, content_id)

        elif mode == 6:  #logout, destry setup
            from hbogolib.handler import HbogoHandler
            handler = HbogoHandler(self.handle, self.base_url)
            handler.del_setup()
            xbmc.executebuiltin('Container.Refresh')

        elif mode == 7:  #reset session
            from hbogolib.handler import HbogoHandler
            handler = HbogoHandler(self.handle, self.base_url)
            handler.del_login()
            xbmc.executebuiltin('Container.Refresh')

        elif mode == 8:  # vote
            self.start()
            self.handler.procContext(8, content_id, vote)

        elif mode == 9:  # add to my list
            self.start()
            self.handler.procContext(9, content_id)

        elif mode == 10:  # remove from my list
            self.start()
            self.handler.procContext(10, content_id)