Skip to content

Commit

Permalink
fix for mpd < 0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Horowitz committed Oct 17, 2007
1 parent 21ef18e commit 50be68d
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions sonata.py
Expand Up @@ -1145,7 +1145,7 @@ def parse_currentformat(self):
if len(self.columnformat) > 1:
column.set_resizable(True)
try:
column.set_fixed_width(max(int(self.columnwidths[i-1]), 10))
column.set_fixed_width(max(self.columnwidths[i-1], 10))
except:
column.set_fixed_width(150)
column.connect('clicked', self.on_current_column_click)
Expand Down Expand Up @@ -1610,6 +1610,8 @@ def settings_load(self):
self.art_location_custom_filename = conf.get('player', 'art_location_custom_filename')
if conf.has_option('player', 'columnwidths'):
self.columnwidths = conf.get('player', 'columnwidths').split(",")
for col in range(len(self.columnwidths)):
self.columnwidths[col] = int(self.columnwidths[col])
if conf.has_option('player', 'show_header'):
self.show_header = conf.getboolean('player', 'show_header')
if conf.has_section('currformat'):
Expand Down Expand Up @@ -2675,7 +2677,7 @@ def handle_change_status(self):
# Display current playlist
if self.prevstatus == None or self.prevstatus.playlist != self.status.playlist:
self.update_playlist(False)
elif self.prevstatus.playlistqueue != self.status.playlistqueue:
elif self.mpd_major_version() >= 0.14 and self.prevstatus.playlistqueue != self.status.playlistqueue:
self.update_playlist(True)

# Update progress frequently if we're playing
Expand Down Expand Up @@ -3008,14 +3010,15 @@ def playlistqueue_get_mapping(self):
# Returns the mapping of songid to queueid for all songs
# in the playlistqueue.
map = []
playlistqueue = self.conn.do.queueinfo()
queueid = 0
for song in playlistqueue:
dict = {}
dict["id"] = song.id
dict["queueid"] = queueid
map.append(dict)
queueid += 1
if self.mpd_major_version() >= 0.14:
playlistqueue = self.conn.do.queueinfo()
queueid = 0
for song in playlistqueue:
dict = {}
dict["id"] = song.id
dict["queueid"] = queueid
map.append(dict)
queueid += 1
return map

def update_playlist(self, update_queuelist_only):
Expand Down

0 comments on commit 50be68d

Please sign in to comment.