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

Python utils.lang函数代码示例

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

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



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

示例1: musicvideos

    def musicvideos(self, embycursor, kodicursor, pdialog):

        # Get musicvideos from emby
        emby_db = embydb.Embydb_Functions(embycursor)
        mvideos = MusicVideos(embycursor, kodicursor, pdialog)

        views = emby_db.getView_byType('musicvideos')
        log.info("Media folders: %s" % views)

        for view in views:
            log.info("Processing: %s", view)

            # Get items per view
            viewId = view['id']
            viewName = view['name']

            if pdialog:
                pdialog.update(
                        heading=lang(29999),
                        message="%s %s..." % (lang(33019), viewName))

            # Initial or repair sync
            all_mvideos = self.emby.getMusicVideos(viewId, dialog=pdialog)
            mvideos.add_all("MusicVideo", all_mvideos, view)

        else:
            log.debug("MusicVideos finished.")

        return True
开发者ID:kravone,项目名称:plugin.video.emby,代码行数:29,代码来源:librarysync.py


示例2: _play

    def _play(cls, data):

        item_ids = data['ItemIds']
        command = data['PlayCommand']

        playlist_ = playlist.Playlist()

        if command == 'PlayNow':
            startat = data.get('StartPositionTicks', 0)
            playlist_.play_all(item_ids, startat)
            dialog(type_="notification",
                   heading="{emby}",
                   message="%s %s" % (len(item_ids), lang(33004)),
                   icon="{emby}",
                   sound=False)

        elif command == 'PlayNext':
            new_playlist = playlist_.modify_playlist(item_ids)
            dialog(type_="notification",
                   heading="{emby}",
                   message="%s %s" % (len(item_ids), lang(33005)),
                   icon="{emby}",
                   sound=False)
            player = xbmc.Player()
            if not player.isPlaying():
                # Only start the playlist if nothing is playing
                player.play(new_playlist)
开发者ID:kravone,项目名称:plugin.video.emby,代码行数:27,代码来源:websocket_client.py


示例3: _AutoPickPMS

    def _AutoPickPMS(self):
        """
        Will try to pick PMS based on machineIdentifier saved in file settings
        but only once

        Returns server or None if unsuccessful
        """
        httpsUpdated = False
        checkedPlexTV = False
        server = None
        while True:
            if httpsUpdated is False:
                serverlist = self._getServerList()
                for item in serverlist:
                    if item.get('machineIdentifier') == self.serverid:
                        server = item
                if server is None:
                    name = settings('plex_servername')
                    log.warn('The PMS you have used before with a unique '
                             'machineIdentifier of %s and name %s is '
                             'offline' % (self.serverid, name))
                    # "PMS xyz offline"
                    self.dialog.notification(addonName,
                                             '%s %s'
                                             % (name, lang(39213)),
                                             xbmcgui.NOTIFICATION_ERROR,
                                             7000,
                                             False)
                    return
            chk = self._checkServerCon(server)
            if chk == 504 and httpsUpdated is False:
                # Not able to use HTTP, try HTTPs for now
                server['scheme'] = 'https'
                httpsUpdated = True
                continue
            if chk == 401:
                log.warn('Not yet authorized for Plex server %s'
                         % server['name'])
                if self.CheckPlexTVSignIn() is True:
                    if checkedPlexTV is False:
                        # Try again
                        checkedPlexTV = True
                        httpsUpdated = False
                        continue
                    else:
                        log.warn('Not authorized even though we are signed '
                                 ' in to plex.tv correctly')
                        self.dialog.ok(addonName, '%s %s'
                                       % lang(39214) + server['name'])
                        return
                else:
                    return
            # Problems connecting
            elif chk >= 400 or chk is False:
                log.warn('Problems connecting to server %s. chk is %s'
                         % (server['name'], chk))
                return
            log.info('We found a server to automatically connect to: %s'
                     % server['name'])
            return server
开发者ID:piotrsmolinski,项目名称:PlexKodiConnect,代码行数:60,代码来源:initialsetup.py


示例4: tvshows

    def tvshows(self, embycursor, kodicursor, pdialog):

        # Get shows from emby
        emby_db = embydb.Embydb_Functions(embycursor)
        tvshows = TVShows(embycursor, kodicursor, pdialog)

        views = emby_db.getView_byType('tvshows')
        views += emby_db.getView_byType('mixed')
        log.info("Media folders: %s" % views)

        for view in views:

            # Get items per view
            if pdialog:
                pdialog.update(
                        heading=lang(29999),
                        message="%s %s..." % (lang(33020), view['name']))

            all_tvshows = self.emby.getShows(view['id'], dialog=pdialog)
            tvshows.add_all("Series", all_tvshows, view)

        else:
            log.debug("TVShows finished.")

        return True
开发者ID:kravone,项目名称:plugin.video.emby,代码行数:25,代码来源:librarysync.py


示例5: compare_songs

    def compare_songs(self):

        if self.pdialog:
            self.pdialog.update(heading=lang(29999), message="%s Songs..." % lang(33031))

        songs = dict(self.emby_db.get_checksum('Audio'))
        emby_songs = self.emby.getSongs(basic=True, dialog=self.pdialog)

        return self.compare("Audio", emby_songs['Items'], songs)
开发者ID:kravone,项目名称:plugin.video.emby,代码行数:9,代码来源:music.py


示例6: __set_tag

 def __set_tag(self, progress):
     progress.start_module(lang(30702), self.SET_TAG_STEPS)
     try:
         if not self.movieid:
             raise Exception(lang(30604))
         progress.update(lang(30597))  # setting tag
         utilxbmc.set_movie_tag(self.movieid, self.tag)
     except Exception, e:
         dialog.error(e.message)
开发者ID:jvandenbroek,项目名称:script.service.afterwatch,代码行数:9,代码来源:movie.py


示例7: compare_albums

    def compare_albums(self):

        if self.pdialog:
            self.pdialog.update(heading=lang(29999), message="%s Albums..." % lang(33031))

        albums = dict(self.emby_db.get_checksum('MusicAlbum'))
        emby_albums = self.emby.getAlbums(basic=True, dialog=self.pdialog)

        return self.compare("MusicAlbum", emby_albums['Items'], albums)
开发者ID:kravone,项目名称:plugin.video.emby,代码行数:9,代码来源:music.py


示例8: __preserve_playcount

 def __preserve_playcount(self, progress):
     progress.start_module(lang(30701), self.PRESERVE_PLAYCOUNT_STEPS)
     try:
         if not self.movieid:
             raise Exception(lang(30604))
         progress.update(lang(30598))  # setting old playcount
         utilxbmc.set_movie_playcount(self.movieid, self.playcount)
     except Exception, e:
         dialog.error(e.message)
开发者ID:jvandenbroek,项目名称:script.service.afterwatch,代码行数:9,代码来源:movie.py


示例9: __rate_lib

	def __rate_lib(self, progress):
		progress.start_module(lang(30204), self.RATE_LIB_STEPS)
		try:
			if not self.episodeid:
				raise Exception(lang(30601))
			progress.update(lang(30522)) # updating rating
			utilxbmc.set_episode_rating(self.episodeid, self.rating)
		except Exception, e:
			dialog.error(e.message)
开发者ID:jvandenbroek,项目名称:script.service.afterwatch,代码行数:9,代码来源:episode.py


示例10: __rate_lib

 def __rate_lib(self, progress):
     progress.start_module(lang(30204), self.RATE_LIB_STEPS)
     try:
         if not self.movieid:
             raise Exception(lang(30604))
         progress.update(lang(30522))  # updating rating
         log("Movie ID is %d" % self.movieid)
         utilxbmc.set_movie_rating(self.movieid, self.rating)
     except Exception, e:
         dialog.error(e.message)
开发者ID:jvandenbroek,项目名称:script.service.afterwatch,代码行数:10,代码来源:movie.py


示例11: __move

	def __move(self, progress):
		progress.start_module(lang(30132), self.MOVE_STEPS)
		try:
			progress.update(lang(30590)) # detecting library place
	 		lib_source = os.path.dirname(os.path.dirname(os.path.dirname(self.path)))
		 	if self.destination == lib_source:
		 		raise Exception(lang(30602))
			progress.update(lang(30506)) # moving files
			source = os.path.dirname(self.path)
			match = os.path.splitext(os.path.basename(self.path))[0]
			count = utilfile.count_manage_files(self.alt_method, source, match)
			if not dialog.warning(lang(30132), count):
				raise Exception(lang(30609))
			log("Episode: move source path: %s" % source)
			if setting('fm_episodes_structure') == '0': # multiple folders
				destination = os.path.join(self.destination, self.path.split(os.sep)[-3], self.path.split(os.sep)[-2])
				log("Episode: move destination (multiple) |alt_method=%s|: %s" % (self.alt_method, destination))
			else: # single folder
				destination = os.path.join(self.destination, self.path.split(os.sep)[-2])
				log("Episode: move destination (single) |alt_method=%s|: %s" % (self.alt_method, destination))
			utilfile.move_files(self.alt_method, source, destination, match, True)
			progress.update(lang(30513)) # updating library
			progress.update_library(self.path)
			self.path = os.path.join(destination, os.path.basename(self.path))
			self.episodeid = utilxbmc.get_episodeid_by_path(self.path)
			if self.episodeid: # if still in lib source folders
				progress.update(lang(30514)) # setting watched
				utilxbmc.set_episode_playcount(self.episodeid, self.playcount+1)
		except OSError:
			dialog.error(lang(30610))
		except ValueError as err:
			ValueErrorHandler(err)
		except Exception, e:
			dialog.error(e.message)
开发者ID:jvandenbroek,项目名称:script.service.afterwatch,代码行数:34,代码来源:episode.py


示例12: __rate_tag

 def __rate_tag(self, progress):
     progress.start_module(lang(30205), self.RATE_TAG_STEPS)
     try:
         if not self.movieid:
             raise Exception(lang(30604))
         progress.update(lang(30524))  # setting tag
         tag = setting("rt_movies_tag_text")
         if "%s" in tag:
             tag = tag % self.rating
         utilxbmc.set_movie_tag(self.movieid, tag)
     except Exception, e:
         dialog.error(e.message)
开发者ID:jvandenbroek,项目名称:script.service.afterwatch,代码行数:12,代码来源:movie.py


示例13: _connect_to_server

    def _connect_to_server(self, server, port):

        server_address = "%s:%s" % (server, port)
        self._message("%s %s..." % (lang(30610), server_address))
        result = self.connect_manager.connectToAddress(server_address)

        if result['State'] == CONN_STATE['Unavailable']:
            self._message(lang(30609))
            return False
        else:
            self._server = result['Servers'][0]
            return True
开发者ID:RickDB,项目名称:PlexKodiConnect,代码行数:12,代码来源:servermanual.py


示例14: compare_mvideos

    def compare_mvideos(self, view):

        view_id = view['id']
        view_name = view['name']

        if self.pdialog:
            self.pdialog.update(heading=lang(29999), message="%s %s..." % (lang(33028), view_name))

        mvideos = dict(self.emby_db.get_checksum_by_view('MusicVideo', view_id))
        emby_mvideos = self.emby.getMusicVideos(view_id, basic=True, dialog=self.pdialog)

        return self.compare("MusicVideo", emby_mvideos['Items'], mvideos, view)
开发者ID:kravone,项目名称:plugin.video.emby,代码行数:12,代码来源:musicvideos.py


示例15: _delete_item

    def _delete_item(self):

        delete = True
        if settings('skipContextMenu') != "true":

            if not dialog("yesno", heading=lang(29999), line1=lang(33041)):
                log.info("User skipped deletion for: %s", self.item_id)
                delete = False

        if delete:
            log.info("Deleting Plex item with id %s", self.item_id)
            if delete_item_from_pms(self.item_id) is False:
                dialog("ok", heading="{plex}", line1=lang(30414))
开发者ID:RickDB,项目名称:PlexKodiConnect,代码行数:13,代码来源:context_entry.py


示例16: fastSync

    def fastSync(self):

        lastSync = settings('LastIncrementalSync')
        if not lastSync:
            lastSync = "2010-01-01T00:00:00Z"

        lastSyncTime = utils.convertDate(lastSync)
        log.info("Last sync run: %s" % lastSyncTime)

        # get server RetentionDateTime
        try:
            result = self.doUtils("{server}/emby/Emby.Kodi.SyncQueue/GetServerDateTime?format=json")
            retention_time = result['RetentionDateTime']
        except Exception as error:
            log.error(error)
            retention_time = "2010-01-01T00:00:00Z"

        retention_time = utils.convertDate(retention_time)
        log.info("RetentionDateTime: %s" % retention_time)

        # if last sync before retention time do a full sync
        if retention_time > lastSyncTime:
            log.info("Fast sync server retention insufficient, fall back to full sync")
            return False

        params = {'LastUpdateDT': lastSync}
        if settings('enableMusic') != "true":
            params['filter'] = "music"
        url = "{server}/emby/Emby.Kodi.SyncQueue/{UserId}/GetItems?format=json"

        try:
            result = self.doUtils(url, parameters=params)
            processlist = {

                'added': result['ItemsAdded'],
                'update': result['ItemsUpdated'],
                'userdata': result['UserDataChanged'],
                'remove': result['ItemsRemoved']
            }

        except Exception as error: # To be reviewed to only catch specific errors.
            log.error(error)
            log.error("Failed to retrieve latest updates using fast sync.")
            xbmcgui.Dialog().ok(lang(29999), lang(33095))
            return False

        else:
            log.info("Fast sync changes: %s" % result)
            for action in processlist:
                self.triage_items(action, processlist[action])
            return True
开发者ID:kravone,项目名称:plugin.video.emby,代码行数:51,代码来源:librarysync.py


示例17: _set_access

    def _set_access(self):

        try:
            self.doutils.downloadUrl("{server}/emby/Users?format=json")
        except Exception as error:
            if self._has_access and "restricted" in error:
                self._has_access = False
                log.info("access is restricted")
        else:
            if not self._has_access:
                self._has_access = True
                window('emby_serverStatus', clear=True)
                log.info("access is granted")
                xbmcgui.Dialog().notification(lang(29999), lang(33007))
开发者ID:kravone,项目名称:plugin.video.emby,代码行数:14,代码来源:userclient.py


示例18: deviceid

 def deviceid(self):
     deviceId_old = window('plex_client_Id')
     from clientinfo import getDeviceId
     try:
         deviceId = getDeviceId(reset=True)
     except Exception as e:
         log.error('Failed to generate a new device Id: %s' % e)
         dialog('ok', lang(29999), lang(33032))
     else:
         log.info('Successfully removed old device ID: %s New deviceId:'
                  '%s' % (deviceId_old, deviceId))
         # 'Kodi will now restart to apply the changes'
         dialog('ok', lang(29999), lang(33033))
         executebuiltin('RestartApp')
开发者ID:RickDB,项目名称:PlexKodiConnect,代码行数:14,代码来源:default.py


示例19: __delete

 def __delete(self, progress):
     progress.start_module(lang(30133), self.DELETE_STEPS)
     try:
         progress.update(lang(30516))  # deleting files
         source = os.path.dirname(self.path)
         remove_empty = setting("fm_movie_remove_empty") == "true"
         if setting("fm_movies_structure") == "0":  # multiple folders
             count = utilfile.count_manage_directory(self.alt_method, source)
             if not dialog.warning(lang(30133), count):
                 raise Exception(lang(30609))
             utilfile.delete_directory(self.alt_method, source)
         else:  # single folder
             match = os.path.splitext(os.path.basename(self.path))[0]
             count = utilfile.count_manage_files(self.alt_method, source, match)
             log("Movie: delete match: %s" % match)
             if not dialog.warning(lang(30133), count):
                 raise Exception(lang(30609))
             utilfile.delete_files(self.alt_method, source, match, remove_empty)
         progress.update(lang(30513))  # updating library
         progress.update_library(self.path)
         self.movieid = None
         self.path = None
     except OSError:
         dialog.error(lang(30610))
     except ValueError as err:
         ValueErrorHandler(err)
     except Exception, e:
         dialog.error(e.message)
开发者ID:jvandenbroek,项目名称:script.service.afterwatch,代码行数:28,代码来源:movie.py


示例20: isDirectPlay

    def isDirectPlay(self):

        # Requirement: Filesystem, Accessible path
        if settings('playFromStream') == "true":
            # User forcing to play via HTTP
            log.info("Can't direct play, play from HTTP enabled.")
            return False

        videotrack = self.item['MediaSources'][0]['Name']
        transcodeH265 = settings('transcodeH265')
        videoprofiles = [x['Profile'] for x in self.item['MediaSources'][0]['MediaStreams'] if 'Profile' in x]
        transcodeHi10P = settings('transcodeHi10P')        

        if transcodeHi10P == "true" and "H264" in videotrack and "High 10" in videoprofiles:
            return False   

        if transcodeH265 in ("1", "2", "3") and ("HEVC" in videotrack or "H265" in videotrack):
            # Avoid H265/HEVC depending on the resolution
            resolution = int(videotrack.split("P", 1)[0])
            res = {

                '1': 480,
                '2': 720,
                '3': 1080
            }
            log.info("Resolution is: %sP, transcode for resolution: %sP+"
                % (resolution, res[transcodeH265]))
            if res[transcodeH265] <= resolution:
                return False

        canDirectPlay = self.item['MediaSources'][0]['SupportsDirectPlay']
        # Make sure direct play is supported by the server
        if not canDirectPlay:
            log.info("Can't direct play, server doesn't allow/support it.")
            return False

        location = self.item['LocationType']
        if location == "FileSystem":
            # Verify the path
            if not self.fileExists():
                log.info("Unable to direct play.")
                log.info(self.directPlay())
                xbmcgui.Dialog().ok(
                            heading=lang(29999),
                            line1=lang(33011),
                            line2=(self.directPlay()))                            
                sys.exit()

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python utils.leer函数代码示例发布时间:2022-05-26
下一篇:
Python utils.kodiSQL函数代码示例发布时间: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