Skip to content

Commit

Permalink
Merge pull request beetbox#985 from IndiGit/master
Browse files Browse the repository at this point in the history
added bpd option for initial volume setting
  • Loading branch information
Adrian Sampson committed Sep 30, 2014
2 parents 6348164 + 2ead4d3 commit 5c2ca2b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions beetsplug/bpd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1149,16 +1149,19 @@ def __init__(self):
'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", '
Expand All @@ -1179,8 +1182,9 @@ def func(lib, opts, args):
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]
4 changes: 3 additions & 1 deletion docs/plugins/bpd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------------
Expand Down

0 comments on commit 5c2ca2b

Please sign in to comment.