Merge pull request #985 from IndiGit/master

added bpd option for initial volume setting
This commit is contained in:
Adrian Sampson 2014-09-30 11:28:01 -07:00
commit 5c2ca2ba59
2 changed files with 10 additions and 4 deletions

View file

@ -1149,16 +1149,19 @@ class BPDPlugin(BeetsPlugin):
'host': u'',
'port': 6600,
'password': u'',
'volume': VOLUME_MAX,
})
def start_bpd(self, lib, host, port, password, debug):
def start_bpd(self, lib, host, port, password, volume, debug):
"""Starts a BPD server."""
if debug:
log.setLevel(logging.DEBUG)
else:
log.setLevel(logging.WARNING)
try:
Server(lib, host, port, password).run()
server = Server(lib, host, port, password)
server.cmd_setvol(None, volume)
server.run()
except NoGstreamerError:
global_log.error(u'Gstreamer Python bindings not found.')
global_log.error(u'Install "python-gst0.10", "py27-gst-python", '
@ -1179,8 +1182,9 @@ class BPDPlugin(BeetsPlugin):
if args:
raise beets.ui.UserError('too many arguments')
password = self.config['password'].get(unicode)
volume = self.config['volume'].get(int)
debug = opts.debug or False
self.start_bpd(lib, host, int(port), password, debug)
self.start_bpd(lib, host, int(port), password, volume, debug)
cmd.func = func
return [cmd]

View file

@ -71,12 +71,14 @@ on your headless server box. Rad!
To configure the BPD server, add a ``bpd:`` section to your ``config.yaml``
file. The configuration values, which are pretty self-explanatory, are ``host``,
``port``, and ``password``. Here's an example::
``port``, ``password`` and ``volume``. The volume option sets the initial
volume (in percent, default: 100). Here's an example::
bpd:
host: 127.0.0.1
port: 6600
password: seekrit
volume: 100
Implementation Notes
--------------------