def get_ia_addon(required=False, install=True):
    addon_id = get_id()

    addon = get_addon(addon_id, required=False, install=install)

    if not addon and addon_id == IA_ADDON_ID and install and get_system_arch(
    )[0] == 'Linux':
        with gui.progress(_.INSTALLING_APT_IA,
                          heading=_.IA_WIDEVINE_DRM,
                          percent=20) as progress:
            try:
                subprocess.check_output(
                    'apt-get -y install {0} || sudo apt-get -y install {0}'.
                    format(IA_LINUX_PACKAGE),
                    shell=True)
                log.debug('{} installed'.format(IA_LINUX_PACKAGE))
                progress.update(70)
                xbmc.executebuiltin('UpdateLocalAddons()')

                max_wait = 5
                for i in range(max_wait):
                    xbmc.sleep(1000)
                    progress.update(70 + (i * (30 / max_wait)))
                    addon = get_addon(addon_id, required=False, install=False)
                    if addon:
                        break
            except Exception as e:
                log.exception(e)
                log.debug('{} failed to install'.format(IA_LINUX_PACKAGE))

    if not addon and required:
        raise InputStreamError(_(_.ADDON_REQUIRED, addon_id=addon_id))

    return addon
Ejemplo n.º 2
0
 def __init__(self, *args, **kwargs):
     # activate the text viewer window
     xbmc.executebuiltin("ActivateWindow(%d)" % (self.WINDOW, ))
     # get window
     self.win = xbmcgui.Window(self.WINDOW)
     # give window time to initialize
     xbmc.sleep(1000)
Ejemplo n.º 3
0
    def request(self,
                method,
                url,
                timeout=None,
                attempts=None,
                verify=None,
                error_msg=None,
                retry_not_ok=False,
                retry_delay=1000,
                **kwargs):
        method = method.upper()

        if not url.startswith('http'):
            url = self._base_url.format(url)

        timeout = self._timeout if timeout is None else timeout
        attempts = self._attempts if attempts is None else attempts
        kwargs['verify'] = self._verify if verify is None else verify

        if timeout is not None:
            kwargs['timeout'] = timeout

        #url = PROXY_PATH + url

        for i in range(1, attempts + 1):
            attempt = 'Attempt {}/{}: '.format(i, attempts)
            if i > 1 and retry_delay:
                xbmc.sleep(retry_delay)

            try:
                log('{}{} {} {}'.format(attempt, method, url,
                                        kwargs if method != 'POST' else ""))
            except:
                log('{}{} {}'.format(attempt, method, url))

            try:
                resp = super(Session, self).request(method, url, **kwargs)
            except:
                resp = None
                if i == attempts:
                    raise
                else:
                    continue

            if resp is None:
                raise SessionError(error_msg or _.NO_RESPONSE_ERROR)

            if retry_not_ok and not resp.ok:
                print("NOT OK!!")
                continue
            else:
                break

        resp.json = lambda func=resp.json, error_msg=error_msg: json_override(
            func, error_msg)

        if self.after_request:
            self.after_request(resp)

        return resp
Ejemplo n.º 4
0
def showDialog(lines, timeout=0):
    win = xbmcgui.WindowDialog()
    background_img = os.path.join(Const.addon_path, 'resources', 'media',
                                  'info_background.png')
    starty = 0
    h = 75 + 25 * len(lines)
    win.addControl(
        xbmcgui.ControlImage(x=0,
                             y=starty,
                             width=1920,
                             height=h,
                             filename=background_img,
                             colorDiffuse='0xEEEEEEEE'))
    y = starty
    for line in lines:
        y += 25
        win.addControl(
            xbmcgui.ControlLabel(x=50, y=y, width=1820, height=25, label=line))
    if timeout > 0:
        win.show()
        xbmc.sleep(5000)
        win.close()
    else:
        win.doModal()
    del win
Ejemplo n.º 5
0
    def submit(self):
        token = self.context.plex_network.sign_into_myplex(
            self.name_field.getText(), self.password_field.getText())

        if token is not None:
            self.display_failure(False)

            self.description.setVisible(False)
            self.name_label.setVisible(False)
            self.password_label.setVisible(False)
            self.name_field.setVisible(False)
            self.password_field.setVisible(False)
            self.manual_button.setVisible(False)
            self.cancel_button.setVisible(False)
            self.submit_button.setVisible(False)
            self.pin_button.setVisible(False)

            self.success_message.setVisible(True)
            self.tick.setVisible(True)

            xbmc.sleep(2000)

            LOG.debug(i18n('Successfully signed in'))
            self.close()
        else:
            LOG.debug(i18n('Sign in not successful'))
            self.display_manual(True)
Ejemplo n.º 6
0
def authorize():
    from .windows import signin, background

    background.setSplash(False)

    back = signin.Background.create()

    pre = signin.PreSignInWindow.open()
    try:
        if not pre.doSignin:
            return None
    finally:
        del pre

    try:
        while True:
            pinLoginWindow = signin.PinLoginWindow.create()
            try:
                pl = myplex.PinLogin()
            except requests.ConnectionError:
                util.ERROR()
                util.messageDialog(
                    util.T(32427, 'Failed'),
                    util.T(32449,
                           'Sign-in failed. Cound not connect to plex.tv'))
                return

            pinLoginWindow.setPin(pl.pin)

            try:
                pl.startTokenPolling()
                while not pl.finished():
                    if pinLoginWindow.abort:
                        util.DEBUG_LOG('SIGN IN: Pin login aborted')
                        pl.abort()
                        return None
                    xbmc.sleep(100)
                else:
                    if not pl.expired():
                        if pl.authenticationToken:
                            pinLoginWindow.setLinking()
                            return pl.authenticationToken
                        else:
                            return None
            finally:
                pinLoginWindow.doClose()
                del pinLoginWindow

            if pl.expired():
                util.DEBUG_LOG('SIGN IN: Pin expired')
                expiredWindow = signin.ExpiredWindow.open()
                try:
                    if not expiredWindow.refresh:
                        util.DEBUG_LOG('SIGN IN: Pin refresh aborted')
                        return None
                finally:
                    del expiredWindow
    finally:
        back.doClose()
        del back
Ejemplo n.º 7
0
def reset_thread(reset_func):
    log.debug('Settings Reset Thread: STARTED')

    monitor    = xbmc.Monitor()
    player     = xbmc.Player()
    sleep_time = 100#ms

    #wait upto 3 seconds for playback to start
    count = 0
    while not monitor.abortRequested():
        if player.isPlaying():
            break

        if count > 3*(1000/sleep_time):
            break

        count += 1
        xbmc.sleep(sleep_time)

    #wait upto 30 seconds for playback to start
    count = 0
    while not monitor.abortRequested():
        if not player.isPlaying() or player.getTime() > 0:
            break

        if count > 30*(1000/sleep_time):
            break

        count += 1
        xbmc.sleep(sleep_time)

    reset_func()

    log.debug('Settings Reset Thread: DONE')
Ejemplo n.º 8
0
def sign_in_to_plex(context, refresh=True):
    status = False
    try:
        with PlexSignin(i18n('myPlex Login'),
                        window=xbmcgui.Window(10000)) as dialog:
            dialog.set_context(context)
            dialog.start()
            status = dialog.signed_in()
    except AlreadyActiveException:
        pass
    except AttributeError:
        response = context.plex_network.get_signin_pin()
        message = \
            i18n('From your computer, go to [B]%s[/B] and enter the following code: [B]%s[/B]') % \
            ('https://www.plex.tv/link/', ' '.join(response.get('code', [])))
        DIALOG.ok(i18n('myPlex Login'), message)
        xbmc.sleep(500)
        result = context.plex_network.check_signin_status(
            response.get('id', ''))
        if result:
            status = True
            LOG.debug('Sign in successful ...')
        else:
            LOG.debug('Sign in failed ...')

        if refresh:
            xbmc.executebuiltin('Container.Refresh')

    return status
Ejemplo n.º 9
0
    def grabLockFile(self):
        log("FileLock: grabLockFile")

        # Wait a maximum of 20 seconds to grab file-lock file.  This long
        # timeout should help prevent issues with an old cache.
        for i in range(40):
            # Cycle file names in case one of them is sitting around in the directory
            self.lockName = os.path.join(globals.CACHE_LOC,"%s.lock"%(random.randint(1, 60000)))

            try:
                FileAccess.rename(self.lockFileName, self.lockName)
                fle = FileAccess.open(self.lockName, 'r')
                fle.close()
                return True
            except:
                xbmc.sleep(500)

        log("FileLock: Creating lock file")

        try:
            fle = FileAccess.open(self.lockName, 'w')
            fle.close()
        except:
            log("FileLock: Unable to create a lock file")
            return False

        return True
Ejemplo n.º 10
0
    def submit_pin(self):
        result = self.context.plex_network.check_signin_status(self.identifier)

        if result:
            self.display_failure(False)

            self.description.setVisible(False)
            self.digit_one.setVisible(False)
            self.digit_two.setVisible(False)
            self.digit_three.setVisible(False)
            self.digit_four.setVisible(False)
            self.manual_button.setVisible(False)
            self.cancel_button.setVisible(False)
            self.submit_button.setVisible(False)
            self.pin_button.setVisible(False)
            self.submit_pin_button.setVisible(False)

            self.success_message.setVisible(True)
            self.tick.setVisible(True)

            xbmc.sleep(2000)

            LOG.debug(i18n('Successfully signed in'))
            self.close()
        else:
            LOG.debug(i18n('Sign in not successful'))
            self.display_pin(True)
Ejemplo n.º 11
0
def textBox(heading, announce):
    class TextBox():

        def __init__(self, *args, **kwargs):
            self.WINDOW = 10147
            self.CONTROL_LABEL = 1
            self.CONTROL_TEXTBOX = 5
            xbmc.executebuiltin("ActivateWindow(%d)" % (self.WINDOW, ))
            self.win = xbmcgui.Window(self.WINDOW)
            xbmc.sleep(500)
            self.setControls()

        def setControls(self):
            self.win.getControl(self.CONTROL_LABEL).setLabel(heading)
            try:
                f = open(announce)
                text = f.read()
            except:
                text = announce
            self.win.getControl(self.CONTROL_TEXTBOX).setText(str(text))
            return

    TextBox()
    while xbmc.getCondVisibility('Window.IsVisible(10147)'):
        xbmc.sleep(500)
Ejemplo n.º 12
0
def doLock(lockfile, remove=False):
    PLog("doLock: " + str(remove))
    maxloops = 10  # 1 sec bei 10 x xbmc.sleep(100)

    if remove:
        if os.path.exists(lockfile):
            os.remove(lockfile)
            return True

    while os.path.exists(lockfile):
        i = i + 1
        if i >= maxloops:  # Lock brechen, vermutl. Ruine
            os.remove(lockfile)
            PLog("doLock_break: " + lockfile)
            break
        xbmc.sleep(100)

    try:  # Lock setzen
        open(JOBFILE_LOCK, 'w').close()
    except Exception as exception:
        msg = str(exception)
        PLog('doLock_Exception: ' + msg)
        return False

    return True
Ejemplo n.º 13
0
    def __init__(self):
        params = self.get_params()
        if params:
            color_picker = cp.ColorPicker(
                "script-skin_helper_service-ColorPicker.xml", ADDON_PATH,
                "Default", "1080i")
            color_picker.skinstring = params.get("SKINSTRING", "")
            color_picker.win_property = params.get("WINPROPERTY", "")
            color_picker.active_palette = params.get("PALETTE", "")
            color_picker.header_label = params.get("HEADER", "")
            propname = params.get("SHORTCUTPROPERTY", "")
            color_picker.shortcut_property = propname
            color_picker.doModal()

            #special action when we want to set our chosen color into a skinshortcuts property
            if propname and not isinstance(color_picker.result, int):
                self.wait_for_skinshortcuts_window()
                xbmc.sleep(400)
                current_window = xbmcgui.Window(
                    xbmcgui.getCurrentWindowDialogId())
                current_window.setProperty("customProperty", propname)
                current_window.setProperty("customValue",
                                           color_picker.result[0])
                xbmc.executebuiltin("SendClick(404)")
                xbmc.sleep(250)
                current_window.setProperty("customProperty",
                                           "%s.name" % propname)
                current_window.setProperty("customValue",
                                           color_picker.result[1])
                xbmc.executebuiltin("SendClick(404)")
            del color_picker
Ejemplo n.º 14
0
 def setSubtitles(self):
     subs = self.player.video.selectedSubtitleStream()
     if subs:
         xbmc.sleep(100)
         self.player.showSubtitles(False)
         path = subs.getSubtitleServerPath()
         if path:
             if self.mode == self.MODE_ABSOLUTE:
                 util.DEBUG_LOG('Setting subtitle path: {0}'.format(path))
                 self.player.setSubtitles(path)
                 self.player.showSubtitles(True)
             else:
                 util.DEBUG_LOG(
                     'Transcoded. Skipping subtitle path: {0}'.format(path))
         else:
             # u_til.TEST(subs.__dict__)
             # u_til.TEST(self.player.video.mediaChoice.__dict__)
             if self.mode == self.MODE_ABSOLUTE:
                 util.DEBUG_LOG(
                     'Enabling embedded subtitles at: {0}'.format(
                         subs.typeIndex))
                 util.DEBUG_LOG('Kodi reported subtitles: {0}'.format(
                     self.player.getAvailableSubtitleStreams()))
                 self.player.setSubtitleStream(subs.typeIndex)
                 self.player.showSubtitles(True)
     else:
         self.player.showSubtitles(False)
Ejemplo n.º 15
0
 def login(self, user, password):
     log('login')
     if len(user) > 0:
         if self.chkUser(user): return True
         data = self.postURL(BASE_API + '/user/login',
                             param='{"username":"******","password":"******"}')
         '''{u'token': u''}'''
         if data and 'token' in data:
             self.token = data['token']
             if REAL_SETTINGS.getSetting('User_Token') != self.token:
                 REAL_SETTINGS.setSetting('User_Token', self.token)
             if self.chkUser(user):
                 try:
                     REAL_SETTINGS.setSetting(
                         'User_Donate',
                         str(self.userdata.get('didDonate', 'False')))
                     REAL_SETTINGS.setSetting(
                         'User_totalDonations',
                         str(self.userdata.get('totalDonations', '0')))
                     REAL_SETTINGS.setSetting(
                         'User_LastLogin',
                         datetime.datetime.fromtimestamp(
                             float(
                                 str(self.userdata.get('lastlogin',
                                                       '')).rstrip('L')) /
                             1000).strftime("%Y-%m-%d %I:%M %p"))
                     REAL_SETTINGS.setSetting(
                         'User_DonateExpire',
                         datetime.datetime.fromtimestamp(
                             float(
                                 str(self.userdata.get(
                                     'donationExpire', '')).rstrip('L')) /
                             1000).strftime("%Y-%m-%d %I:%M %p"))
                 except:
                     pass
                 self.lastDMA = self.userdata.get('lastDmaUsed', '')
                 notificationDialog(
                     LANGUAGE(30021) % (self.userdata.get('name', '')))
                 return True
         elif data.get('message'):
             notificationDialog(data.get('message'))
         else:
             notificationDialog(LANGUAGE(30017))
     else:
         #firstrun wizard
         if yesnoDialog(LANGUAGE(30008),
                        nolabel=LANGUAGE(30009),
                        yeslabel=LANGUAGE(30010)):
             user = inputDialog(LANGUAGE(30006))
             password = inputDialog(LANGUAGE(30007),
                                    opt=xbmcgui.ALPHANUM_HIDE_INPUT)
             REAL_SETTINGS.setSetting('User_Email', user)
             REAL_SETTINGS.setSetting('User_Password', password)
             xbmc.sleep(2000)  #wait for setsetting write
             return self.reset()
         else:
             okDialog(LANGUAGE(30012))
     return False
Ejemplo n.º 16
0
 def buildSearch(self, tunerkey='All'):
     log('buildSearch')
     self.setDevice(tunerkey)
     kb = xbmc.Keyboard('', LANGUAGE(30109)%ADDON_NAME)
     xbmc.sleep(500)
     kb.doModal()
     if kb.isConfirmed():
         self.browseSearch(kb.getText(),tunerkey)
Ejemplo n.º 17
0
def getPVR():
    try: return xbmcaddon.Addon(PVR_CLIENT)
    except: # backend disabled?
        togglePVR('true')
        xbmc.sleep(1000)
        try:
            return xbmcaddon.Addon(PVR_CLIENT)
        except: return None
Ejemplo n.º 18
0
 def __init__(self, *args, **kwargs):
     self.WINDOW = 10147
     self.CONTROL_LABEL = 1
     self.CONTROL_TEXTBOX = 5
     xbmc.executebuiltin("ActivateWindow(%d)" % (self.WINDOW, ))
     self.win = xbmcgui.Window(self.WINDOW)
     xbmc.sleep(500)
     self.setControls()
Ejemplo n.º 19
0
 def _wait(self):
     while not xbmc.abortRequested and time.time() < self._endTime:
         xbmc.sleep(100)
     if xbmc.abortRequested:
         return
     if self._endTime == 0:
         return
     self._onTimeout()
Ejemplo n.º 20
0
 def _wait(self):
     while not MONITOR.abortRequested() and time.time() < self._endTime:
         xbmc.sleep(100)
     if MONITOR.abortRequested():
         return
     if self._endTime == 0:
         return
     self._onTimeout()
Ejemplo n.º 21
0
    def __init__(self, transcode=False, delete=False):

        try:
            self.kodi_id = sys.listitem.getVideoInfoTag().getDbId() or None
            self.media = self.get_media_type()
            self.server_id = sys.listitem.getProperty('jellyfinserver') or None
            self.api_client = Jellyfin(self.server_id).get_client().jellyfin
            item_id = sys.listitem.getProperty('jellyfinid')
        except AttributeError:
            self.server_id = None

            if xbmc.getInfoLabel('ListItem.Property(jellyfinid)'):
                item_id = xbmc.getInfoLabel('ListItem.Property(jellyfinid)')
            else:
                self.kodi_id = xbmc.getInfoLabel('ListItem.DBID')
                self.media = xbmc.getInfoLabel('ListItem.DBTYPE')
                item_id = None

        addon_data = translate_path(
            "special://profile/addon_data/plugin.video.jellyfin/data.json")
        with open(addon_data, 'rb') as infile:
            data = json.load(infile)

        try:
            server_data = data['Servers'][0]
            self.api_client.config.data['auth.server'] = server_data.get(
                'address')
            self.api_client.config.data['auth.server-name'] = server_data.get(
                'Name')
            self.api_client.config.data['auth.user_id'] = server_data.get(
                'UserId')
            self.api_client.config.data['auth.token'] = server_data.get(
                'AccessToken')
        except Exception as e:
            LOG.warning('Addon appears to not be configured yet: {}'.format(e))

        if self.server_id or item_id:
            self.item = self.api_client.get_item(item_id)
        else:
            self.item = self.get_item_id()

        if self.item:

            if transcode:
                self.transcode()

            elif delete:
                self.delete_item()

            elif self.select_menu():
                self.action_menu()

                if self._selected_option in (OPTIONS['Delete'],
                                             OPTIONS['AddFav'],
                                             OPTIONS['RemoveFav']):

                    xbmc.sleep(500)
                    xbmc.executebuiltin('Container.Refresh')
Ejemplo n.º 22
0
 def close(self):
     '''tell any tasks to stop immediately (as we can be called multithreaded) and cleanup objects'''
     self._exit = True
     # wait for all tasks to complete
     while self._busy_tasks:
         xbmc.sleep(25)
     del self._win
     del self._monitor
     self._log_msg("Closed")
Ejemplo n.º 23
0
def brutePVR(override=False):
    if bool(xbmc.getCondVisibility("Pvr.IsPlayingTv")): return
    elif not override:
        if not yesnoDialog('%s ?'%(LANGUAGE(30065)%(getPluginMeta(PVR_CLIENT).get('name','')))): return
    togglePVR('false')
    xbmc.sleep(2000)
    togglePVR('true')
    if override: return True
    return notificationDialog(LANGUAGE(30053))
Ejemplo n.º 24
0
def _reload_service():
    database.close()

    with gui.progress(_.RELOAD_SERVICE, percent=100) as progress:
        set_kodi_string('_gpio_reload', '1')

        for i in range(5):
            xbmc.sleep(1000)
            if not get_kodi_string('_gpio_reload'):
                break
Ejemplo n.º 25
0
    def refreshInfo(self):
        oldFocusId = self.getFocusId()

        util.setGlobalProperty('hide.resume',
                               '' if self.video.viewOffset.asInt() else '1')
        self.setInfo()
        self.updateRelated()
        xbmc.sleep(100)

        if oldFocusId == self.PLAY_BUTTON_ID:
            self.focusPlayButton()
Ejemplo n.º 26
0
 def _wait(self):
     ct = 0
     while ct < self.interval:
         xbmc.sleep(100)
         ct += 0.1
         if self.force.isSet():
             self.force.clear()
             return True
         if MONITOR.abortRequested() or self.stopped.isSet():
             return False
     return True
Ejemplo n.º 27
0
    def delete_watchlist(self, content_id):
        variables = {
            'preferredLanguage': [self._app_language],
            'contentIds': content_id,
        }

        endpoint = self.get_config()['services']['content']['client'][
            'endpoints']['dmcVideos']['href'].format(
                queryId='core/DeleteFromWatchlist')
        data = self._json_call(endpoint,
                               variables)['data']['DeleteFromWatchlist']
        xbmc.sleep(500)
        return data
    def _wait_for_playback(self):
        np_wait_time = 0.5
        np_waited = 0.0

        while not self.PLAYER.isPlaying() and not self.MONITOR.abortRequested(
        ):
            self.LOG.debug('Waiting for playback to start')

            xbmc.sleep(int(np_wait_time * 1000))
            if np_waited >= 5:
                self.stop()
                return

            np_waited += np_wait_time
Ejemplo n.º 29
0
def root():
    tvbus_url = plugin.args.get("url", [""])[-1]
    if tvbus_url:
        access_code = plugin.args.get("access_code", [""])[-1]
        timeout = int(plugin.args.get("timeout", ["90"])[-1])
        localport = int(plugin.args.get("localport", [find_free_port()])[-1])
        playerport = int(plugin.args.get("playerport", [find_free_port()])[-1])
        player_url = "http://127.0.0.1:{0}/mpegts_live".format(playerport)

        if xbmc.getCondVisibility("system.platform.android"):
            pass
        elif xbmc.getCondVisibility("system.platform.linux"):
            TVBUS_SCRIPT = XBMC_TVBUS_SCRIPT
        elif xbmc.getCondVisibility("system.platform.windows"):
            TVBUS_SCRIPT = XBMC_TVBUS_SCRIPT

        if TVBUS_SCRIPT:
            LIVE = False
            xbmc.executebuiltin("RunScript({0},{1},{2},{3},{4},{5})".format(
                TVBUS_SCRIPT, ADDON_DATA_DIR, tvbus_url, access_code,
                localport, playerport))
            pDialog = xbmcgui.DialogProgress()
            pDialog.create(plugin.name)
            session = requests.session()
            for i in range(timeout):
                pDialog.update(int(i / float(timeout) * 100))
                if pDialog.iscanceled():
                    break
                try:
                    _r = session.get(player_url, stream=True, timeout=1)
                    _r.raise_for_status()
                    LIVE = True
                    break
                except Exception:
                    xbmc.sleep(1000)

            session.close()
            pDialog.close()

            if LIVE:
                # wait 5 seconds for stream buffer
                xbmc.sleep(5 * 1000)
                li = xbmcgui.ListItem(path=player_url)
                xbmcplugin.setResolvedUrl(plugin.handle, True, li)
            else:
                xbmcplugin.setResolvedUrl(plugin.handle, False,
                                          xbmcgui.ListItem())
        else:
            li = xbmcgui.ListItem(path=tvbus_url)
            xbmcplugin.setResolvedUrl(plugin.handle, True, li)
Ejemplo n.º 30
0
    def generate(self):
        with ProgressDialog(i18n('Generating Playlist'), i18n('This may take a while...')) as \
                progress_dialog:

            progress_dialog.update(0, i18n('Retrieving server list...'))
            servers = self._get_servers()
            if progress_dialog.is_canceled():
                return None

            progress_dialog.update(10, i18n('Retrieving server sections...'))
            sections = self._get_sections(servers, progress_dialog)
            if progress_dialog.is_canceled():
                return None

            progress_dialog.update(20, i18n('Retrieving content metadata...'))
            item_collections = self._get_item_collections(
                sections, progress_dialog)
            if progress_dialog.is_canceled():
                return None

            progress_dialog.update(60, i18n('Retrieving final sample...'))
            items = self._get_sample(item_collections)
            if progress_dialog.is_canceled():
                return None

            progress_dialog.update(70, i18n('Adding items to playlist...'))
            playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
            playlist.clear()

            _divisor, _percent_value = self._get_progress_data(items, 29)
            _percent = progress_dialog.percent

            for index, item in enumerate(items):
                if progress_dialog.is_canceled():
                    return None

                if index % _divisor == 0:
                    _percent += _percent_value
                progress_dialog.update(
                    _percent,
                    i18n('Adding %s to playlist...') % item[1].getLabel())

                playlist.add(*item)

            if progress_dialog.is_canceled():
                return None

            progress_dialog.update(100, i18n('Completed.'))
            xbmc.sleep(500)
            return items[0]
Ejemplo n.º 31
0
 def exitCleanUp(self):
     if xbmc.Player().isPlayingVideo():
         xbmc.Player().stop()
         self.renderstop = False
         while self.state == videoState.playing:
             xbmc.sleep(100)
     import glob
     fileNames = glob.glob(xbmc.translatePath('special://temp') + 'knew5/emulate*.png' )
     for file in fileNames:
         try:
             os.remove(file)
         except:
             xbmc.log('Error deleting ' + file)
     self.exit = True
     self.close()
Ejemplo n.º 32
0
                                        use_debugger=False,
                                        use_evalex=True,
                                        passthrough_errors=False)
                    except Exception as e:
                        logger.error('KooliService port: %s Error: %s',
                                     self.port, e)
                        raise e
            time.sleep(1)


if __name__ == '__main__':
    monitor = Monitor()
    if is_service_enable():
        monitor.add_service(KooliService())
    else:
        notify_warn('Qobuz service / HTTPD',
                    'Service is disabled from configuration')
    monitor.start_all_service()
    alive = True
    while alive:
        abort = False
        try:
            abort = monitor.abortRequested
        except Exception as e:
            logger.error('Error while getting abortRequested %s', e)
        if abort:
            alive = False
            continue
        xbmc.sleep(1000)
    monitor.stop_all_service()
Ejemplo n.º 33
0
    def onAction(self, action):
        try:
            actionID = action.getId()
            buttonID = action.getButtonCode()
        except: return
        if buttonID & 0x1000000:
            #these are long presses
            if actionID not in CONTEXT_MENU and buttonID not in CONTEXT_MENU:
                return

        if actionID == ACTION_MOUSE_MOVE:
            return
        ignoreKeys = ( 61650, 61651, 127184, 127185, 323749, 323796 )
        if buttonID in ignoreKeys:
            return
        if not self.ready or self.renderstop:
            return
        dt = datetime.datetime.now()
        now = int(time.mktime(dt.timetuple()))
        if now == self.recent[0]:
            if self.recent[1] == 2:
                xbmc.log('too fast')
                return
            self.recent[1] = self.recent[1] + 1
        else:
            self.recent[0] = now
            self.recent[1] = 0
        retval = self.onLiveAction(actionID,buttonID)
        xbmc.log(str(retval))
        if retval == True:
            return

        self.renderstop = True
        self.inControl = True
        screenFile = xbmc.translatePath('special://temp') + 'knew5/emulate-'+ str(time.time()) + '.png'
        keyBase = self.base + '/control?time=' + str(now) + '&key='
        url = None
        pauseActivity = True
        if actionID == ACTION_PLAYER_PLAY:
            url = keyBase + str(80|0x20000)
        elif actionID == ACTION_STOP:
            url = keyBase + str(83|0x20000)
            self.state = videoState.stopped
        elif actionID == ACTION_NEXT_ITEM:
            if buttonID & 0xf046 == 0xf046 :
                # NextPVR Ctrl-F
                url = keyBase + str(70|0x20000)

            else:
                url = keyBase + str(39|0x20000)
        elif actionID == ACTION_PREV_ITEM:
            if '/live?channel=' not in xbmc.Player().getPlayingFile():
                url = keyBase + str(37|0x20000)
            else:
                # send ctrl-w
                url =  keyBase + str(87|0x20000)
        elif actionID == ACTION_PLAYER_FORWARD:
            url = keyBase + str(70|0x20000)
        elif actionID == ACTION_PLAYER_REWIND:
            url = keyBase + str(82|0x20000)
        elif actionID == ACTION_FIRST_PAGE or actionID == ACTION_INFO:
            #home
            if self.state == videoState.playing:
                # send ctrl-b
                url = keyBase + str(66|0x20000)
            else:
                url = keyBase + '36'
            pauseActivity = False
        elif buttonID >= 0x2f041 and buttonID <= 0x2f05a:
            url = keyBase + str(buttonID&0xff)
        elif buttonID & 0x10000:
            ctrl = buttonID&0xff
            if ctrl == 0x50:
                url = keyBase + str(ctrl|0x20000)
            elif ctrl == 0x53:
                url = keyBase + str(ctrl|0x20000)
                self.renderstop = False
                xbmc.Player().stop()
            elif ctrl == 0x4b:
                url = keyBase + str(ctrl|0x20000)
            elif ctrl == 0x52:
                url = keyBase + str(ctrl|0x20000)
            elif ctrl == 0x82:
                url = keyBase + str(37|0x20000)
            elif ctrl == 0x83:
                url = keyBase + str(39|0x20000)
            elif ctrl == 0x42:
                url = keyBase + str(80|0x20000)
            elif ctrl == 0x46:
                url = keyBase + str(70|0x20000)
            elif ctrl == 0x57:
                url =  keyBase + str(87|0x20000)
            elif ctrl == 0x47:
                url = keyBase + str(112)
            elif ctrl == 0x4d and buttonID & 0x30000:
                myKey = self.getContext()
                if myKey != None:
                    url = keyBase + myKey
            elif ctrl == 0x4f:
                url = keyBase + str(119)
            elif ctrl == 0x54:
                url = keyBase + str(113)
            else:
                pass
                #print actionID, buttonID, hex(ctrl), hex(actionID)
        elif actionID == ACTION_RECORD or actionID == ACTION_QUEUE_ITEM:
            url = keyBase + str(75|0x20000)
        elif actionID == ACTION_PAUSE:
            url = keyBase + '32'
        elif buttonID == 0xf02e:
            url = keyBase + '46'
        elif actionID in MOVEMENT_LEFT:
            url = keyBase + '37'
        elif actionID in MOVEMENT_UP:
            url = keyBase + '38'
            if xbmc.Player().isPlayingVideo():
                if '/live?channel=' not in xbmc.Player().getPlayingFile() and self.osdMode == False:
                    url = keyBase + str(70|0x20000)
            else:
                pauseActivity = False
        elif actionID in MOVEMENT_RIGHT:
            url = keyBase + '39'
        elif actionID in MOVEMENT_DOWN or buttonID == 0xf064:
            url = keyBase + '40'
            if xbmc.Player().isPlayingVideo():
                if '/live?channel=' not in xbmc.Player().getPlayingFile() and self.osdMode == False:
                    url = keyBase + str(82|0x20000)
            else:
                pauseActivity = False
        elif actionID in MOVEMENT_SCROLL_UP:
            url = keyBase + '33'
        elif actionID in MOVEMENT_SCROLL_DOWN:
            url = keyBase + '34'
        elif actionID >= 58 and actionID <= 67:
            url = keyBase + str(actionID-10)
        elif actionID >= 142 and actionID <= 149:
            url = keyBase + str(actionID-92)
        elif actionID == ACTION_SELECT_ITEM:
            url = keyBase + '13'
        elif actionID == KEYBOARD_BACK or buttonID == 61575:
            url = keyBase + '8'
        elif actionID in EXIT_SCRIPT:
            url = keyBase + '27'
        elif actionID in CONTEXT_MENU or buttonID in CONTEXT_MENU or actionID == ACTION_MOUSE_DOUBLE_CLICK:
            myKey = self.getContext()
            if myKey != None:
                url = keyBase + myKey
        elif actionID == ACTION_TELETEXT_RED:
            url = keyBase + str(82|0x40000)
        elif actionID == ACTION_TELETEXT_GREEN:
            url = keyBase + str(71|0x40000)
        elif actionID == ACTION_TELETEXT_YELLOW:
            url = keyBase + str(89|0x40000)
        elif actionID == ACTION_TELETEXT_BLUE:
            url = keyBase + str(66|0x40000)
        elif buttonID >= 0xf030 and buttonID <= 0xf039:
            url = keyBase + str(buttonID-0xf030+48)
        elif buttonID >= 0xf041 and buttonID <= 0xf05a:
            if self.state == videoState.playing and buttonID == 0xf05a:
                buttonID = 118
            url = keyBase + str(buttonID&0xff)
        elif buttonID >= 0xf090 and buttonID <= 0xf098:
            url = keyBase + str((buttonID&0xff)-32)
        elif buttonID == 0xf09b:
            #F12 exit
            self.exitCleanUp()
        elif buttonID == 0x4f092:
            #alt-f4'
            url = keyBase + str(0x40073)
        elif buttonID & 0x40000 or buttonID & 0x20000:
            buttonID = buttonID | 0x40000
            url = keyBase + str(buttonID&0x400ff)
        elif actionID == 122 or actionID == 999 :
            if buttonID == 50:
                #guide
                url = keyBase + '112'
            elif buttonID == 49 or buttonID == 101:
                # recordings
                url = keyBase + '119'
            elif buttonID == 24:
                #live tv
                url = keyBase + '113'
            elif buttonID == 7:
                #my videos
                url = keyBase + '114'
            elif buttonID == 9:
                #my music
                url = keyBase + '115'
            elif buttonID == 6:
                #my pictures
                url = keyBase + '116'
            elif buttonID == 248:
                #my radio
                url = keyBase + '117'
            elif buttonID == 44:
                #subtitle
                xbmc.executebuiltin('Action( NextSubtitle )')
            elif buttonID == 196:
                # power off
                self.exitCleanUp()
                pass
            elif buttonID == 213:
                #display
                url = keyBase + '119'
            else:
                xbmc.log('remote action unsupported {0} {1}'.format(actionID, buttonID))
                pass
        else:
            xbmc.log('action unsupported {0} {1}'.format(actionID, buttonID))
            pass
        if url :
            url = url + self.xnewa.client
            #while self.rendering:
            #    time.sleep(0.1)
            xbmc.log(url)
            try:
                jpgfile = urlopen(url)
                output = open(screenFile,'wb')
                output.write(jpgfile.read())
                output.close()
                jpgfile.close()
                self.setOSDMode(True)
                self.image.setImage(screenFile,False)
                xbmc.sleep(25)
            except HTTPError as err:
                xbmc.log(str(err.code))
                print(err)
            except URLError as err:
                print(err)
                self.exit = True
                self.close()
            except Exception as err:
                if err.errno != 104 and err.errno != 10054:
                    print(err)
                    self.exit = True
                    self.close()
                else:
                    xbmc.log('ignoring known error')
            if pauseActivity:
                    self.getActivity()
        self.renderstop = False
        self.inControl = False
        self.ready = True
Ejemplo n.º 34
0
    def render(self):
        fullRefresh = 0
        while xbmc.abortRequested == False and self.exit == False:
            if not xbmc.Player().isPlayingVideo():
                if self.state == videoState.started:
                    if isinstance(self.t1, Thread):
                        #print self.t1.is_alive(), self.renderstop, self.state, xbmc.Player().isPlayingVideo()
                        if self.t1.isAlive() == False:
                            self.state = videoState.error
                        elif xbmc.Player().isPlayingAudio():
                            self.state = videoState.inactive

                if self.renderstop == False:
                    fullRefresh += 1
                    if fullRefresh < 30 and self.state == videoState.inactive:
                        if self.inControl == False and self.xnewa.sid != None:
                            self.getActivity(True)
                            if self.renderstop == True:
                                self.renderstop = False
                                self.getScreen()
                                self.getActivity()

                    else:
                        fullRefresh = 0
                        import glob
                        fileNames = glob.glob(xbmc.translatePath('special://temp') + 'knew5/emulate*.png' )
                        for file in fileNames:
                            try:
                                os.remove(file)
                            except:
                                xbmc.log('Error deleting ' + file)

                        if self.state == videoState.playing or self.state == videoState.error or self.state == videoState.stopped:
                            if self.sdlmode != SDL.disabled:
                                if self.skipStop == False:
                                    try:
                                        url = self.base + '/control?media=stop'
                                        if self.state == videoState.error:
                                            url += '&message=Player%20error'
                                        url += self.xnewa.client
                                        screenFile1 = xbmc.translatePath('special://temp') + 'knew5/emulate-'+ str(time.time()) + '.png'
                                        xbmc.log(url)
                                        pngfile = urlopen(url)
                                        pngfile.close()
                                    except Exception as err:
                                        print(err)
                                else:
                                    self.skipStop = False

                            self.setOSDMode(True)
                            self.sidUpdate()
                            self.state = videoState.inactive

                            url = self.base + '/control?key=131188' + self.xnewa.client
                            xbmc.log(url)
                            try:
                                jpgfile = urlopen(url)
                                screenFile = xbmc.translatePath('special://temp') + 'knew5/emulate-'+ str(time.time()) + '.png'
                                output = open(screenFile,'wb')
                                output.write(jpgfile.read())
                                output.close()
                                self.image.setImage(screenFile,False)
                                self.getActivity()
                            except err:
                                print(err)

                xbmc.sleep(1000)

            else:
                self.state = videoState.playing
                if self.sdlmode == SDL.full:
                    if self.wasFullScreen:
                        if xbmc.getCondVisibility('videoplayer.isfullscreen') == 0:
                            self.wasFullScreen = False
                            url = self.base + '/control?move=49x57'  + self.xnewa.client
                            screenFile1 = xbmc.translatePath('special://temp') + 'knew5/emulate-a'+ str(time.time()) + '.png'
                            xbmc.log(url)
                            try:
                                pngfile = urlopen(url)
                                output = open(screenFile1,'wb')
                                output.write(pngfile.read())
                                output.close()
                                pngfile.close()
                                self.image.setImage(screenFile1,False)
                                self.getActivity()
                            except Exception as err:
                                print(err)
                    try:
                        url = self.base + '/control?media=' + str(xbmc.Player().getTime())  + self.xnewa.client
                        screenFile1 = xbmc.translatePath('special://temp') + 'knew5/emulate-'+ str(time.time()) + '.png'
                        xbmc.log(url)
                        request = Request(url)
                        pngfile = urlopen(request)
                        if pngfile.code == 200 and xbmc.getCondVisibility('videoplayer.isfullscreen') == 0:
                            output = open(screenFile1,'wb')
                            output.write(pngfile.read())
                            output.close()
                            self.image.setImage(screenFile1,False)
                            # needs rendering always true so just
                            self.getActivity()
                        elif pngfile.code == 204:
                            self.setOSDMode(False)
                        else:
                            print(pngfile.code)
                        pngfile.close()
                        self.skipStop = False
                    except Exception as err:
                        print(err)
                        pass

                xbmc.sleep(1000)
        return
Ejemplo n.º 35
0
    def getScreen(self, force=False):
        self.rendering = True
        self.errors = 0
        retval = True
        try:
            if force:
                if self.xnewa.AreYouThere(self.settings.usewol(), self.settings.NextPVR_MAC, self.settings.NextPVR_BROADCAST):
                    url = self.base + '/control?size=' + self.settings.XNEWA_CLIENT_SIZE
                    if self.settings.XNEWA_CLIENT_QUALITY == True:
                        url += '&quality=high'
                    url += self.xnewa.client
                    xbmc.log(url)
                    try:
                        jpgfile = urlopen(url)
                        jpgfile.close
                        if self.sdlmode != SDL.disabled:
                            try:
                                url = self.base + '/control?media=stop' + self.xnewa.client
                                xbmc.log(url)
                                pngfile = urlopen(url)
                                pngfile.close()
                            except Exception as err:
                                print(err)

                    except HTTPError as e:
                        print(e.code)
                        if e.code == 404:
                            xbmc.sleep(500)
                            url = self.base + '/control?media=stop' + self.xnewa.client
                            xbmc.log(url)
                            pngfile = urlopen(url)
                            pngfile.close()
                            self.errors = self.errors + 1
                        elif e.code == 403:
                            self.sidUpdate()
                            self.getSid()
                            self.errors = self.errors + 1
                        else:
                            print(e)
                            self.exit = True
                            self.close()
                            return False
                        if self.errors < 3:
                            self.getScreen(force)
                            return False
                    except URLError as err:
                        print(err)
                        self.exit = True
                        self.close()

                else:
                    self.exit = True
                    self.close()
                    return False


            screenFile = xbmc.translatePath('special://temp') + 'knew5/emulate-'+ str(time.time()) + '.png'

            url = self.base + '/control?format=json' + self.xnewa.client
            #xbmc.log(url)
            try:
                self.setOSDMode(True)
                jpgfile = urlopen(url)
                output = open(screenFile,'wb')
                output.write(jpgfile.read())
                output.close()
                self.image.setImage(screenFile,False)
            except HTTPError as e:
                xbmc.log(url)
                xbmc.log(str(e.code))
                retval = False
            except URLError as err:
                xbmc.log(url)
                print(err)
                xbmc.log('Abort emulation')
                self.exit = True
                self.close()
                retval = False

        except Exception as err:
            print(err)
            retval = False

        self.rendering = False
        return retval
Ejemplo n.º 36
0
 def getActivity(self, update=False):
     if update:
         url = self.base + '/activity?format=json&updates=1'  + self.xnewa.client
     else:
         url = self.base + '/activity?format=json' + self.xnewa.client
     import json
     print (url)
     try:
         json_file = urlopen(url)
         jsonActivity = json.load(json_file)
         json_file.close()
         print(jsonActivity)
         #xbmc.log(jsonActivity)
         if 'url' in jsonActivity:
             import re
             if jsonActivity['url'] != '':
                 self.nextUrl = re.sub('[^?&]*client[^&]+&*','',jsonActivity['url'],re.UNICODE)
                 m = re.search('seek=(\d+)&', self.nextUrl)
                 if m:
                     seek  = int(m.group(1))
                     self.nextUrl = re.sub('seek=(\d+)&','',self.nextUrl)
                     if 'recording_resume' not in jsonActivity:
                         if self.state == videoState.playing:
                             xbmc.Player().seekTime(seek)
                             return
                         else:
                             jsonActivity['recording_resume'] = seek
                 self.nextUrl = unquote(self.nextUrl)
                 if self.state == videoState.playing:
                     self.skipStop = True
                 self.quickPlayer(jsonActivity)
         elif 'playlist' in jsonActivity:
             self.quickPlayer(jsonActivity)
         elif 'action' in jsonActivity:
             if jsonActivity['action'] == 'exit':
                 self.exit = True
                 xbmc.sleep(250)
                 import glob
                 fileNames = glob.glob(xbmc.translatePath('special://temp') + 'knew5/emulate*.png' )
                 for file in fileNames:
                     try:
                         os.remove(file)
                     except:
                         xbmc.log('Leaving ' + file)
                 self.close()
                 return
         elif 'needsRendering' in jsonActivity:
             if jsonActivity['needsRendering'] ==  True:
                 if isinstance(self.t1, Thread):
                     if self.t1.is_alive()  and self.state == videoState.playing:
                         xbmc.log('player no render')
                         self.renderstop = False
                     else:
                         self.renderstop = True
                 else:
                     self.renderstop = True
         self.InControl = False
     except URLError as err:
         print(err)
         self.exit = True
         self.close()
     except Exception as err:
         print(err)
Ejemplo n.º 37
0
    def quickPlayer (self,activity):
        from . import details
        #print self.nextUrl
        Audio = False
        self.wasFullScreen = True
        windowed = self.settings.XNEWA_LIVE_SKIN
        if 'playlist' in activity:
            import os
            import re
            dd = {}
            xbmc.PlayList(0).clear()
            for playlist in activity['playlist']:
                nextUrl = re.sub('[^?&]*client[^&]+&*','',playlist['url'].encode('utf-8'))
                xbmc.log(nextUrl)
                url = nextUrl.split('=',1)[1]
                if url[0:2]=='\\\\':
                    url = 'smb:'+ url.replace('\\','/')
                if xbmcvfs.exists(url) == False:
                    s = self.base + playlist['url'].replace(' ','+').replace('&f=','&mode=http&f=')
                    xbmc.log(s)
                    xbmc.PlayList(0).add(s)
                else:
                    xbmc.PlayList(0).add(url)
            dd['movie'] = False
            dd['playlist'] = xbmc.PlayList(0)
            windowed = False
        elif self.nextUrl.startswith('/live?channel'):
            try:
                #v5
                if self.settings.XNEWA_INTERFACE == 'XML' or self.settings.XNEWA_INTERFACE == 'Version5':
                    url = self.base + '/services?method=channel.listings.current' + self.xnewa.client + '&channel_id=' + str (activity['channel_id'])
                    xbmc.log(url)
                    dd1 = self.xnewa._progs2array_xml(url)
                else:
                    url = self.base + '/public/GuideService/Listing' + self.xnewa.jsid + '&channelId=' + str (activity['channel_id'])
                    xbmc.log(url)
                    dd1 = self.xnewa._progs2array_json(url)
                dd = dd1[0]['progs'][0]
                dd['program_oid'] = dd['oid']
                #dd['season'] = 0
            except Exception as err:
                print(err)
                dd = {}
                dd['program_oid'] = 12346
                dd['title'] = activity['channel_name']
                dd['subtitle'] = str(activity['channel_number'])
                dd['end'] = ''
                dd['season'] = 0
                dd['desc'] = ''

            dd['channel_oid'] = activity['channel_id']
            channel = {}
            channel[0] = activity['channel_name']
            channel[1] = activity['channel_number']
            channel[2] = '0'
            self.prev_channel = self.channel_number
            self.channel_number = activity['channel_number']
            dd['channel'] = channel
            dd['bookmarkSecs'] = 0
            dd['movie'] = False
        elif self.nextUrl.startswith('/stream?'):
            dd = {}
            dd['title'] = 'title'
            dd['movie'] = False
            dd['filename'] = py2_decode(self.nextUrl.split('=',1)[1]).replace('http://plugin','plugin')
            dd['season'] = 0
            if 'duration' in activity:
                dd['library_duration'] = activity['duration']
            else:
                import re
                m = re.search('.*_(\d{2})(\d{2})(\d{2})(\d{2})(-\d)\.ts', dd['filename'])
                if m:
                    start = int(m.group(1)) * 60 + int(m.group(2))
                    end = int(m.group(3)) * 60 + int(m.group(4))
                    #print start
                    #print end
                    if start > end:
                        dd['library_duration'] = (start + end - 1440) * 60
                    else:
                        dd['library_duration'] = (end - start) * 60
            dd['filename'] = dd['filename'].replace('127.0.0.1',self.xnewa.ip)


            #self.getPlaybackPosition(dd['filename'])
            dd['nextUrl'] = self.nextUrl
            if 'recording_description' in activity:
                dd['desc'] = activity['recording_description']
            elif 'description' in activity:
                dd['desc'] = activity['description']
            else:
                dd['desc'] = ''

            if 'recording_title' in activity:
                dd['title'] = activity['recording_title']
            elif dd['filename'].startswith('http:'):
                if '.m3u8' not in  dd['filename']:
                    Audio = True
            elif 'title' in activity:
                dd['title'] = activity['title']

            if 'recording_subtitle' in activity:
                dd['subtitle'] = activity['recording_subtitle']
            elif 'subtitle' in activity:
                dd['subtitle'] = activity['subtitle']
            else:
                dd['subtitle'] = None

            if 'recording_resume' in activity:
                dd['bookmarkSecs'] = activity['recording_resume']
                dd['resume'] = activity['recording_resume']
            else:
                dd['bookmarkSecs'] = 0

            if 'album' in activity:
                Audio = True

            if 'recording_id' in activity:
                dd['recording_oid'] = activity['recording_id']
                dd['nextUrl'] = '/live?recording=' + dd['recording_oid']
                if self.settings.NextPVR_ICON_DL == 'Yes' and self.xnewa.getShowIcon(dd['title']) is None:
                    self.xnewa.getDetails(self.settings.NextPVR_USER,self.settings.NextPVR_PW,dd['recording_oid'],'R','Yes')
            else:
                dd['recording_oid'] = 0

            if 'Genres' in activity:
                dd['genres'] = activity['Genres']
                for  genre in dd['Genres']:
                    if genre == "Movie" or genre == "Movies" or genre == "Film":
                        dd['movie'] = True
                        break
        detailDialog = details.DetailDialog("nextpvr_recording_details.xml",  WHERE_AM_I,self.settings.XNEWA_SKIN, xnewa=self.xnewa, settings=self.settings, oid=123, epg=True, type="R")
        xbmc.log(str(windowed))
        if self.sdlmode == SDL.disabled:
            self.setOSDMode(False)
            windowed = False
        if isinstance(self.t1, Thread):
            xbmc.Player().stop()
            while self.t1.is_alive():
                xbmc.sleep(100)
            self.renderstop = False


        self.t1 = Thread(target=detailDialog._myPlayer, args=(dd,None,windowed,Audio,False))
        self.t1.start()
        self.state = videoState.started

        #xbmc.executebuiltin('XBMC.ActivateWindow(25)')
        #self.player = detailDialog.getPlayer()
        #self.player.overlay = self
        #xbmc.executebuiltin('ActivateWindow(visualisation)')
        #xbmc.executebuiltin('ActivateWindow(musicosd)')
        return