本文整理汇总了Python中mpd.MPDClient.iterate方法的典型用法代码示例。如果您正苦于以下问题:Python MPDClient.iterate方法的具体用法?Python MPDClient.iterate怎么用?Python MPDClient.iterate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpd.MPDClient
的用法示例。
在下文中一共展示了MPDClient.iterate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MPDClient
# 需要导入模块: from mpd import MPDClient [as 别名]
# 或者: from mpd.MPDClient import iterate [as 别名]
client = MPDClient() # create client object
# network timeout in seconds (floats allowed), default: None
client.timeout = 10
# timeout for fetching the result of the idle command is handled
# seperately, default: None
client.idletimeout = None
client.connect("localhost", 6600) # connect to localhost:6600
print(client.mpd_version) # print the MPD version
# print result of the command "find any house"
print(client.find("any", "house"))
# command list的机制现在还不理解,在把python-mpd2的动态方法改成静态方法的过程中,command list暂且还不能好好处理
# client.command_list_ok_begin() # start a command list
client.update() # insert the update command into the list
client.status() # insert the status command into the list
print(client.status())
print(client.stats())
# results = client.command_list_end() # results will be a list with the results
# print((results))
client.iterate = True
for song in client.playlistinfo():
#print( song["file"])
pass
client.iterate = False
client.send_idle()
events = client.fetch_idle()
print(events)
print(client.status())
client.close() # send the close command
client.disconnect() # disconnect from the server
# client.delete((1,)) # delete all songs, but the first.