本文整理汇总了Python中mpd.MPDClient.volume方法的典型用法代码示例。如果您正苦于以下问题:Python MPDClient.volume方法的具体用法?Python MPDClient.volume怎么用?Python MPDClient.volume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpd.MPDClient
的用法示例。
在下文中一共展示了MPDClient.volume方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reconnect
# 需要导入模块: from mpd import MPDClient [as 别名]
# 或者: from mpd.MPDClient import volume [as 别名]
__author__ = 'peterb'
#!/root/PhoneBookProject/venv/bin/python
__author__ = 'peterb'
import datetime
from mpd import MPDClient
#import urllib2
mopidyAddress = '192.168.13.13'
mopidyPort = 6600
client=MPDClient()
def reconnect():
global client
global playlists
try:
client.disconnect()
except:
pass
client.timeout = 10
client.idletimeout = None
client.connect(mopidyAddress,mopidyPort)
client.password('IlPits2013')
reconnect()
print(client.volume(1))
#client.set_vol(1)
示例2: MPDClientDriver
# 需要导入模块: from mpd import MPDClient [as 别名]
# 或者: from mpd.MPDClient import volume [as 别名]
#.........这里部分代码省略.........
self.cli.random(0)
@catchsocketerror
def _get_repeat(self):
"""Returns repeat state
"""
if self._read_status_key('repeat') == '0':
return False
else:
return True
@connect_mpd
def _set_repeat(self, state):
"""Set repeat state
"""
if state:
self.cli.repeat(1)
else:
self.cli.repeat(0)
@catchsocketerror
def _get_single(self):
"""Returns single state
"""
if self._read_status_key('single') == '0':
return False
else:
return True
@connect_mpd
def _set_single(self, state):
"""Set single state
"""
if state:
self.cli.single(1)
else:
self.cli.single(0)
@catchsocketerror
def _get_volume(self):
"""Returns volume
"""
return self._read_status_key('volume')
@connect_mpd
def _set_volume(self, value):
"""Set volume
"""
self.cli.volume(value)
@catchsocketerror
def _get_state(self):
"""Get current state
"""
return self._read_status_key('state')
@connect_mpd
def _next(self):
"""Next song
"""
self.cli.next()
@connect_mpd
def _previous(self):
"""Previous song
"""
self.cli.previous()
@connect_mpd
def _stop(self):
"""Stop playback
"""
self.cli.stop()
@connect_mpd
def _pause(self, resume):
"""Pause / resume
"""
if resume:
self.cli.pause(1)
else:
self.cli.pause(0)
def _connect(self):
"""Connect to MPD server
"""
self.cli.connect(host=self._loaded_kwargs['address'],
port=self._loaded_kwargs['port'])
def _read_status_key(self, key_name):
"""Get some status
"""
try:
self._connect()
ret = self.cli.status()[key_name]
finally:
self.cli.disconnect()
return ret