Skip to content

Commit

Permalink
mpd: support disabling crossfade in MPD >= 0.18
Browse files Browse the repository at this point in the history
Previous to 0.18, disabling crossfade in MPD meant setting its value to
0, which was happily reported by MPD's 'status' command.

Now, setting the value to '0' still means 'deactivate crossfade', but
MPD also doesn't show the 'xfade' value anymore in the status output:

    $ nc localhost 6600
    OK MPD 0.18.0
    status
    volume: 100
    repeat: 0
    random: 0
    single: 0
    consume: 0
    playlist: 1
    playlistlength: 0
    mixrampdb: 0.000000
    state: stop
    OK
    crossfade 10
    OK
    status
    volume: 100
    repeat: 0
    random: 0
    single: 0
    consume: 0
    playlist: 1
    playlistlength: 0
    mixrampdb: 0.000000
    state: stop
    xfade: 10
    OK
    crossfade 0
    OK
    status
    volume: 100
    repeat: 0
    random: 0
    single: 0
    consume: 0
    playlist: 1
    playlistlength: 0
    mixrampdb: 0.000000
    state: stop
    OK

Thanks to the users from https://bugs.archlinux.org/task/37580 for the
initial patch.

Fixes #50
  • Loading branch information
multani committed Nov 2, 2013
1 parent 728e30b commit 6bea8bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -31,6 +31,7 @@ Bug fixes
* Fix hiding/showing the main window even if it's not the active widget:
https://github.com/multani/sonata/issues/43
* Deleting a track doesn't toggle the filter bar anymore in the current playlist.
* Better support for MPD 0.18

Internal changes
''''''''''''''''
Expand Down
18 changes: 11 additions & 7 deletions sonata/main.py
Expand Up @@ -993,13 +993,17 @@ def update_status(self):
self.status['random'] == '1')
if not self.last_consume or self.last_consume != self.status['consume']:
self.consumemenu.set_active(self.status['consume'] == '1')
if self.status['xfade'] == '0':
self.config.xfade_enabled = False
else:
self.config.xfade_enabled = True
self.config.xfade = int(self.status['xfade'])
if self.config.xfade > 30:
self.config.xfade = 30

self.config.xfade_enabled = False
if 'xfade' in self.status:
xfade = int(self.status['xfade'])

if xfade != 0:
self.config.xfade_enabled = True
self.config.xfade = xfade
if self.config.xfade > 30:
self.config.xfade = 30

self.last_repeat = self.status['repeat']
self.last_random = self.status['random']
self.last_consume = self.status['consume']
Expand Down

0 comments on commit 6bea8bb

Please sign in to comment.