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


Python MPDClient.volume方法代码示例

本文整理汇总了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)
开发者ID:NilsNoreyson,项目名称:phoneBookServer,代码行数:32,代码来源:test_mpd_client.py

示例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
开发者ID:brunosmmm,项目名称:aggregate,代码行数:104,代码来源:__init__.py


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