• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utils.window函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中utils.window函数的典型用法代码示例。如果您正苦于以下问题:Python window函数的具体用法?Python window怎么用?Python window使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了window函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: watchlater

def watchlater():
    """
    Listing for plex.tv Watch Later section (if signed in to plex.tv)
    """
    if window('plex_token') == '':
        log.error('No watch later - not signed in to plex.tv')
        return xbmcplugin.endOfDirectory(HANDLE, False)
    if window('plex_restricteduser') == 'true':
        log.error('No watch later - restricted user')
        return xbmcplugin.endOfDirectory(HANDLE, False)

    xml = downloadutils.DownloadUtils().downloadUrl(
        'https://plex.tv/pms/playlists/queue/all',
        authenticate=False,
        headerOptions={'X-Plex-Token': window('plex_token')})
    if xml in (None, 401):
        log.error('Could not download watch later list from plex.tv')
        return xbmcplugin.endOfDirectory(HANDLE, False)

    log.info('Displaying watch later plex.tv items')
    xbmcplugin.setContent(HANDLE, 'movies')
    for item in xml:
        __build_item(item)

    xbmcplugin.endOfDirectory(
        handle=HANDLE,
        cacheToDisc=settings('enableTextureCache') == 'true')
开发者ID:RickDB,项目名称:PlexKodiConnect,代码行数:27,代码来源:entrypoint.py


示例2: onPlayBackStopped

 def onPlayBackStopped( self ):
     # Will be called when user stops xbmc playing a file
     self.logMsg("ONPLAYBACK_STOPPED", 2)
     utils.window('emby_customPlaylist', clear=True)
     utils.window('emby_playbackProps', clear=True)
     self.logMsg("Clear playlist properties.", 1)
     self.stopAll()
开发者ID:Alwin-Hummels,项目名称:plugin.video.emby,代码行数:7,代码来源:player.py


示例3: __init__

 def __init__(self, header, errors):
     '''
     Sets title of the dialog and fills the tree with information stored
     in given list of ErrorBox instances.
     '''
     QtCore.QObject.__init__(self)
     elements = loadUi(self._DIALOG_UI, parent=window())
     self._dialog = elements["dialog"]
     self._dialog.setWindowTitle(header)
     tree = elements["treeWidgetErrors"]
     items = []
     for error in errors:
         item = QtGui.QTreeWidgetItem(tree)
         infos = []
         fields = vars(error)
         for name in sorted(fields):
             if name != "traceback":
                 infos.append(fields[name])
         item.setText(0, ", ".join(infos))
         QtGui.QTreeWidgetItem(item, [error.traceback])
         item.setExpanded(True)
         items.append(item)
     tree.resizeColumnToContents(0)
     size = QtCore.QSize(min(window().size().width(),
                             tree.columnWidth(0) + 40),
                         min(window().size().height(),
                             self._dialog.size().height()))
     self._dialog.resize(size)
     for item in items:
         item.setExpanded(False)
开发者ID:mlyko,项目名称:tadek-ui,代码行数:30,代码来源:testdialogs.py


示例4: externalSubs

    def externalSubs(self, playurl):

        externalsubs = []
        mapping = {}

        itemid = self.API.getRatingKey()
        mediastreams = self.API.getMediaStreams()

        kodiindex = 0
        for stream in mediastreams:

            index = stream['Index']
            # Since Emby returns all possible tracks together, have to pull only external subtitles.
            # IsTextSubtitleStream if true, is available to download from emby.
            if (stream['Type'] == "Subtitle" and 
                    stream['IsExternal'] and stream['IsTextSubtitleStream']):

                # Direct stream
                url = ("%s/Videos/%s/%s/Subtitles/%s/Stream.srt"
                        % (self.server, itemid, itemid, index))
                
                # map external subtitles for mapping
                mapping[kodiindex] = index
                externalsubs.append(url)
                kodiindex += 1
        
        mapping = json.dumps(mapping)
        utils.window('emby_%s.indexMapping' % playurl, value=mapping)

        return externalsubs
开发者ID:gdachs,项目名称:PlexKodiConnect,代码行数:30,代码来源:playbackutils.py


示例5: _action_menu

    def _action_menu(self):

        selected = self._selected_option

        if selected == OPTIONS['Transcode']:
            window('plex_forcetranscode', value='true')
            self._PMS_play()

        elif selected == OPTIONS['PMS_Play']:
            self._PMS_play()

        # elif selected == OPTIONS['Refresh']:
        #     self.emby.refreshItem(self.item_id)

        # elif selected == OPTIONS['AddFav']:
        #     self.emby.updateUserRating(self.item_id, favourite=True)

        # elif selected == OPTIONS['RemoveFav']:
        #     self.emby.updateUserRating(self.item_id, favourite=False)

        # elif selected == OPTIONS['RateSong']:
        #     self._rate_song()

        elif selected == OPTIONS['Addon']:
            xbmc.executebuiltin('Addon.OpenSettings(plugin.video.plexkodiconnect)')

        elif selected == OPTIONS['Delete']:
            self._delete_item()
开发者ID:RickDB,项目名称:PlexKodiConnect,代码行数:28,代码来源:context_entry.py


示例6: setUserPref

 def setUserPref(self):
     log.debug('Setting user preferences')
     # Only try to get user avatar if there is a token
     if self.currToken:
         url = PlexAPI.PlexAPI().GetUserArtworkURL(self.currUser)
         if url:
             window('PlexUserImage', value=url)
开发者ID:RickDB,项目名称:PlexKodiConnect,代码行数:7,代码来源:userclient.py


示例7: getXArgsDeviceInfo

def getXArgsDeviceInfo(options=None):
    """
    Returns a dictionary that can be used as headers for GET and POST
    requests. An authentication option is NOT yet added.

    Inputs:
        options:        dictionary of options that will override the
                        standard header options otherwise set.
    Output:
        header dictionary
    """
    xargs = {
        'Accept': '*/*',
        'Connection': 'keep-alive',
        "Content-Type": "application/x-www-form-urlencoded",
        # "Access-Control-Allow-Origin": "*",
        # 'X-Plex-Language': 'en',
        'X-Plex-Device': v.ADDON_NAME,
        'X-Plex-Client-Platform': v.PLATFORM,
        'X-Plex-Device-Name': v.DEVICENAME,
        'X-Plex-Platform': v.PLATFORM,
        # 'X-Plex-Platform-Version': 'unknown',
        # 'X-Plex-Model': 'unknown',
        'X-Plex-Product': v.ADDON_NAME,
        'X-Plex-Version': v.ADDON_VERSION,
        'X-Plex-Client-Identifier': getDeviceId(),
        'X-Plex-Provides': 'client,controller,player,pubsub-player',
    }
    if window('pms_token'):
        xargs['X-Plex-Token'] = window('pms_token')
    if options is not None:
        xargs.update(options)
    return xargs
开发者ID:RickDB,项目名称:PlexKodiConnect,代码行数:33,代码来源:clientinfo.py


示例8: _report_progress

    def _report_progress(self):
        # Update and report playback progress
        kodi_player = self.kodi_player
        try:
            play_time = kodi_player.getTime()
            filename = kodi_player.currentFile

            # Update positionticks
            if filename in kodi_player.played_info:
                kodi_player.played_info[filename]['currentPosition'] = play_time

            difference = datetime.today() - self.last_progress
            difference_seconds = difference.seconds

            # Report progress to Emby server
            if difference_seconds > 3:
                kodi_player.reportPlayback()
                self.last_progress = datetime.today()

            elif window('emby_command') == "true":
                # Received a remote control command that
                # requires updating immediately
                window('emby_command', clear=True)
                kodi_player.reportPlayback()
                self.last_progress = datetime.today()

        except Exception as error:
            log.exception(error)
开发者ID:kravone,项目名称:plugin.video.emby,代码行数:28,代码来源:service_entry.py


示例9: getDeviceId

    def getDeviceId(self):

        clientId = utils.window('emby_deviceId')
        if clientId:
            return clientId

        addon_path = self.addon.getAddonInfo('path').decode('utf-8')
        GUID_file = xbmc.translatePath("%s\machine_guid" % addon_path).decode('utf-8')

        try:
            GUID = open(GUID_file)
        
        except IOError: # machine_guid does not exists.
            clientId = str("%012X" % uuid4())
            GUID = open(GUID_file, 'w')
            GUID.write(clientId)

        else: # machine_guid already exists. Get guid.
            clientId = GUID.read()
        
        finally:
            GUID.close()

        self.logMsg("DeviceId loaded: %s" % clientId, 1)
        utils.window('emby_deviceId', value=clientId)
        
        return clientId
开发者ID:angelblue05,项目名称:plugin.video.emby,代码行数:27,代码来源:clientinfo.py


示例10: __init__

    def __init__(self):

        self.__dict__ = self._shared_state

        client_info = clientinfo.ClientInfo()
        self.emby = embyserver.Read_EmbyServer()

        version = client_info.get_version()
        device_name = client_info.get_device_name()
        device_id = client_info.get_device_id()
        self._connect = connectionmanager.ConnectionManager(appName="Kodi",
                                                            appVersion=version,
                                                            deviceName=device_name,
                                                            deviceId=device_id)
        path = xbmc.translatePath(
                   "special://profile/addon_data/plugin.video.emby/").decode('utf-8')

        if not xbmcvfs.exists(path):
            xbmcvfs.mkdirs(path)

        self._connect.setFilePath(path)

        if window('emby_state.json'):
            self.state = window('emby_state.json')

        elif not self.state:
            self.state = self._connect.connect()
            log.info("Started with: %s", self.state)
            window('emby_state.json', value=self.state)
开发者ID:kravone,项目名称:plugin.video.emby,代码行数:29,代码来源:connectmanager.py


示例11: setUserPref

 def setUserPref(self):
     self.logMsg('Setting user preferences', 0)
     # Only try to get user avatar if there is a token
     if self.currToken:
         url = PlexAPI.PlexAPI().GetUserArtworkURL(self.currUser)
         if url:
             utils.window('EmbyUserImage', value=url)
开发者ID:gdachs,项目名称:PlexKodiConnect,代码行数:7,代码来源:userclient.py


示例12: play_all

 def play_all(self):
     """
     Play all items contained in the xml passed in. Called by Plex Companion
     """
     log.info("Playbackutils play_all called")
     window('plex_playbackProps', value="true")
     self.currentPosition = 0
     for item in self.xml:
         api = API(item)
         successful = True
         if api.getType() == v.PLEX_TYPE_CLIP:
             self.add_trailer(item)
         else:
             with Get_Plex_DB() as plex_db:
                 db_item = plex_db.getItem_byId(api.getRatingKey())
             if db_item is not None:
                 successful = add_item_to_kodi_playlist(
                     self.playqueue,
                     self.currentPosition,
                     kodi_id=db_item[0],
                     kodi_type=db_item[4])
                 if successful is True:
                     self.currentPosition += 1
                     if len(item[0]) > 1:
                         self.add_part(item,
                                       api,
                                       db_item[0],
                                       db_item[4])
             else:
                 # Item not in Kodi DB
                 self.add_trailer(item)
         if successful is True:
             self.playqueue.items[self.currentPosition - 1].ID = item.get(
                 '%sItemID' % self.playqueue.kind)
开发者ID:RickDB,项目名称:PlexKodiConnect,代码行数:34,代码来源:playbackutils.py


示例13: run

    def run(self):

        # websocket.enableTrace(True)
        user_id = window('emby_currUser')
        server = window('emby_server%s' % user_id)
        token = window('emby_accessToken%s' % user_id)
        # Get the appropriate prefix for the websocket
        if "https" in server:
            server = server.replace('https', "wss")
        else:
            server = server.replace('http', "ws")

        websocket_url = "%s?api_key=%s&deviceId=%s" % (server, token, self.device_id)
        log.info("websocket url: %s", websocket_url)

        self._client = websocket.WebSocketApp(websocket_url,
                                              on_message=self.on_message,
                                              on_error=self.on_error,
                                              on_close=self.on_close)
        self._client.on_open = self.on_open
        log.warn("----===## Starting WebSocketClient ##===----")

        while not self.monitor.abortRequested():

            if window('emby_online') == "true":
                self._client.run_forever(ping_interval=10)

            if self._stop_websocket:
                break

            if self.monitor.waitForAbort(5):
                # Abort was requested, exit
                break

        log.warn("##===---- WebSocketClient Stopped ----===##")
开发者ID:kravone,项目名称:plugin.video.emby,代码行数:35,代码来源:websocket_client.py


示例14: getPlayUrlNew

    def getPlayUrlNew(self):
        '''
            New style to retrieve the best playback method based on sending the profile to the server
            Based on capabilities the correct path is returned, including livestreams that need to be opened by the server
            TODO: Close livestream if needed (RequiresClosing in livestream source)
        '''
        playurl = None
        pbinfo = self.getPlaybackInfo()
        if pbinfo:
            xbmc.log("getPlayUrl pbinfo: %s" %(pbinfo))
            
            if pbinfo["Protocol"] == "SupportsDirectPlay":
                playmethod = "DirectPlay"
            elif pbinfo["Protocol"] == "SupportsDirectStream":
                playmethod = "DirectStream"
            elif pbinfo.get('LiveStreamId'):
                playmethod = "LiveStream"
            else:
                playmethod = "Transcode"

            playurl = pbinfo["Path"]
            xbmc.log("getPlayUrl playmethod: %s - playurl: %s" %(playmethod, playurl))
            window('emby_%s.playmethod' % playurl, value=playmethod)
            if pbinfo["RequiresClosing"] and pbinfo.get('LiveStreamId'):
                window('emby_%s.livestreamid' % playurl, value=pbinfo["LiveStreamId"])

        return playurl
开发者ID:kravone,项目名称:plugin.video.emby,代码行数:27,代码来源:playutils.py


示例15: getPlayerProperties

    def getPlayerProperties(self, playerid):
        info = {}
        try:
            # get info from the player
            props = self.js.jsonrpc("Player.GetProperties", {"playerid": playerid, "properties": ["time", "totaltime", "speed", "shuffled", "repeat"]})
            self.logMsg(self.js.jsonrpc("Player.GetItem", {"playerid": playerid, "properties": ["file", "showlink", "episode", "season"]}), 2)
            info['time'] = timeToMillis(props['time'])
            info['duration'] = timeToMillis(props['totaltime'])
            info['state'] = ("paused", "playing")[int(props['speed'])]
            info['shuffle'] = ("0","1")[props.get('shuffled', False)]
            info['repeat'] = pf.getPlexRepeat(props.get('repeat'))
            # New PMS playQueue attributes
            cf = self.xbmcplayer.getPlayingFile()
            info['playQueueID'] = window('playQueueID')
            info['playQueueVersion'] = window('playQueueVersion')
            info['playQueueItemID'] = window('plex_%s.playQueueItemID' % cf)
            info['guid'] = window('plex_%s.guid' % cf)

        except:
            info['time'] = 0
            info['duration'] = 0
            info['state'] = "stopped"
            info['shuffle'] = False
        # get the volume from the application
        info['volume'] = self.volume
        info['mute'] = self.mute

        return info
开发者ID:aglv,项目名称:PlexKodiConnect,代码行数:28,代码来源:subscribers.py


示例16: onSettingsChanged

 def onSettingsChanged(self):
     """
     Monitor the PKC settings for changes made by the user
     """
     # settings: window-variable
     items = {
         'logLevel': 'plex_logLevel',
         'enableContext': 'plex_context',
         'plex_restricteduser': 'plex_restricteduser',
         'dbSyncIndicator': 'dbSyncIndicator',
         'remapSMB': 'remapSMB',
         'replaceSMB': 'replaceSMB',
         'force_transcode_pix': 'plex_force_transcode_pix',
         'fetch_pms_item_number': 'fetch_pms_item_number'
     }
     # Path replacement
     for typus in REMAP_TYPE_FROM_PLEXTYPE.values():
         for arg in ('Org', 'New'):
             key = 'remapSMB%s%s' % (typus, arg)
             items[key] = key
     # Reset the window variables from the settings variables
     for settings_value, window_value in items.iteritems():
         if window(window_value) != settings(settings_value):
             log.debug('PKC settings changed: %s is now %s'
                       % (settings_value, settings(settings_value)))
             window(window_value, value=settings(settings_value))
             if settings_value == 'fetch_pms_item_number':
                 log.info('Requesting playlist/nodes refresh')
                 window('plex_runLibScan', value="views")
开发者ID:RickDB,项目名称:PlexKodiConnect,代码行数:29,代码来源:kodimonitor.py


示例17: getDeviceId

    def getDeviceId(self):

        clientId = utils.window('emby_deviceId')
        if clientId:
            return clientId

        addon_path = self.addon.getAddonInfo('path').decode('utf-8')
        if os.path.supports_unicode_filenames:
            GUID_file = xbmc.translatePath(os.path.join(addon_path, "machine_guid")).decode('utf-8')
        else:
            GUID_file = xbmc.translatePath(os.path.join(addon_path.encode("utf-8"), "machine_guid")).decode('utf-8')

        GUID = xbmcvfs.File(GUID_file)
        clientId = GUID.read()
        if not clientId:
            self.logMsg("Generating a new deviceid...", 1)
            clientId = str("%012X" % uuid4())
            GUID = xbmcvfs.File(GUID_file, 'w')
            GUID.write(clientId)

        GUID.close()

        self.logMsg("DeviceId loaded: %s" % clientId, 1)
        utils.window('emby_deviceId', value=clientId)
        
        return clientId
开发者ID:Alwin-Hummels,项目名称:plugin.video.emby,代码行数:26,代码来源:clientinfo.py


示例18: onNotification

    def onNotification(self, sender, method, data):

        if method not in ('Playlist.OnAdd', 'Player.OnStop', 'Player.OnClear'):
            log.info("Method: %s Data: %s", method, data)

        try:
            if data:
                data = json.loads(data, 'utf-8')
        except:
            log.info("Error parsing message data: %s", data)
            return

        if method == 'Player.OnPlay':
            self._on_play_(data)

        elif method == 'VideoLibrary.OnUpdate':
            self._video_update(data)

        elif method == 'System.OnSleep':
            # Connection is going to sleep
            log.info("Marking the server as offline. System.OnSleep activated.")
            window('emby_online', value="sleep")

        elif method == 'System.OnWake':
            self._system_wake()

        elif method == 'GUI.OnScreensaverDeactivated':
            self._screensaver_deactivated()
开发者ID:kravone,项目名称:plugin.video.emby,代码行数:28,代码来源:kodimonitor.py


示例19: _video_update

 def _video_update(self, data):
     # Manually marking as watched/unwatched
     try:
         item = data['item']
         kodi_id = item['id']
         item_type = item['type']
     except (KeyError, TypeError):
         log.info("Item is invalid for playstate update")
     else:
         # Send notification to the server.
         item_id = self._get_item_id(kodi_id, item_type)
         if item_id:
             # Stop from manually marking as watched unwatched, with actual playback.
             if window('emby_skipWatched%s' % item_id) == "true":
                 # property is set in player.py
                 window('emby_skipWatched%s' % item_id, clear=True)
             else:
                 # notify the server
                 url = "{server}/emby/Users/{UserId}/PlayedItems/%s?format=json" % item_id
                 if data.get('playcount') != 0:
                     self.download(url, action_type="POST")
                     log.info("Mark as watched for itemid: %s", item_id)
                 else:
                     self.download(url, action_type="DELETE")
                     log.info("Mark as unwatched for itemid: %s", item_id)
开发者ID:kravone,项目名称:plugin.video.emby,代码行数:25,代码来源:kodimonitor.py


示例20: _playstate

    def _playstate(cls, data):

        command = data['Command']
        player = xbmc.Player()

        actions = {

            'Stop': player.stop,
            'Unpause': player.pause,
            'Pause': player.pause,
            'NextTrack': player.playnext,
            'PreviousTrack': player.playprevious
        }
        if command == 'Seek':

            if player.isPlaying():
                seek_to = data['SeekPositionTicks']
                seek_time = seek_to / 10000000.0
                player.seekTime(seek_time)
                log.info("Seek to %s", seek_time)

        elif command in actions:
            actions[command]()
            log.info("Command: %s completed", command)

        else:
            log.info("Unknown command: %s", command)
            return

        window('emby_command', value="true")
开发者ID:kravone,项目名称:plugin.video.emby,代码行数:30,代码来源:websocket_client.py



注:本文中的utils.window函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.workflowInfo函数代码示例发布时间:2022-05-26
下一篇:
Python utils.whoami函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap