From ab5c5dcfd5ad4a5604f00079874da7a2ded93d72 Mon Sep 17 00:00:00 2001 From: Ralf Sieger Date: Tue, 30 Sep 2014 09:34:04 +0200 Subject: [PATCH 1/2] added option for initial volume setting --- beetsplug/bpd/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/beetsplug/bpd/__init__.py b/beetsplug/bpd/__init__.py index 5218cb9fc..7b550487c 100644 --- a/beetsplug/bpd/__init__.py +++ b/beetsplug/bpd/__init__.py @@ -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] From 2ead4d352a60806e03dafae888e3bef00073ce33 Mon Sep 17 00:00:00 2001 From: Ralf Sieger Date: Tue, 30 Sep 2014 19:14:33 +0200 Subject: [PATCH 2/2] Added documentation about the new volume option --- docs/plugins/bpd.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/plugins/bpd.rst b/docs/plugins/bpd.rst index 81736ae30..919a45ec3 100644 --- a/docs/plugins/bpd.rst +++ b/docs/plugins/bpd.rst @@ -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 --------------------