当前位置: 首页>>代码示例>>Python>>正文


Python Server.connect方法代码示例

本文整理汇总了Python中server.Server.connect方法的典型用法代码示例。如果您正苦于以下问题:Python Server.connect方法的具体用法?Python Server.connect怎么用?Python Server.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在server.Server的用法示例。


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

示例1: ProcessRequest

# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import connect [as 别名]
def ProcessRequest(title, params, offset = 0, id = -1, type = "default"):
	sc = Server(hostname=Prefs['lms_server_address'], port=Prefs['lms_server_cli_port'], username="", password="")
	sc.connect()
	
	player = sc.get_player(title);
	oc = ObjectContainer(title2 = player.get_name())
	
	for item in player.playlist_get_info():
		track_title = player.request("songinfo 1 1 track_id:"+str(item['id']))[8:]
		track_url = player.request("songinfo 2 1 track_id:"+str(item['id'])+" tags:u")[21:]

		oc.add(DirectoryObject(key = track_url,
				       title = track_title,
				       duration = int(item['duration'])
				   )
		       )

	return oc
开发者ID:robertheath,项目名称:plex-squeeze-controller,代码行数:20,代码来源:__init__.py

示例2: MainMenu

# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import connect [as 别名]
def MainMenu():
    sc = Server(hostname=Prefs['lms_server_address'], port=Prefs['lms_server_cli_port'], username="", password="")
    sc.connect()

    oc = ObjectContainer()
    for player in sc.get_players():
	    player_id = str(player.get_ref())
	    current_time = str(time.time())

	    oc.add(DirectoryObject(key = Callback(ProcessRequest, title = player_id, params = {'order': 'hotness'}),
 				   title = player.get_name(), 
				   tagline=player.get_track_artist(), 
				   summary=player.get_track_current_title(), 
				   duration=player.get_track_duration(), 
				   thumb = Resource.ContentsOfURLWithFallback("http://"+Prefs['lms_server_address']+":"+Prefs['lms_server_port']+"/music/current/cover.jpg?player="+player_id+"&time="+current_time)
				   )
		   )
    
    return oc
开发者ID:robertheath,项目名称:plex-squeeze-controller,代码行数:21,代码来源:__init__.py


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