优化循环模式设置

master
yutent 2023-09-04 20:41:19 +08:00
parent 563fa8c733
commit 27f1ff704e
1 changed files with 2 additions and 4 deletions

View File

@ -177,17 +177,14 @@ class SonistWindow(Gtk.Window):
elif btn == 'mode_btn':
# repeat all
if self.ctrl_box.curr_mode == 0:
self.mpd.repeat(1)
self.mpd.random(0)
self.mpd.single(0)
# random
elif self.ctrl_box.curr_mode == 1:
self.mpd.repeat(0)
self.mpd.random(1)
self.mpd.single(0)
# single
else:
self.mpd.repeat(0)
self.mpd.random(0)
self.mpd.single(1)
@ -262,6 +259,7 @@ class SonistWindow(Gtk.Window):
# 首次启动时, 更新数据库
if first:
self.mpd.update()
self.mpd.repeat(1)
song_num = int(self.mpd.stats().get('songs') or 0)
playlist = [it['file'] for it in self.mpd.playlistinfo()]
@ -331,7 +329,7 @@ class SonistWindow(Gtk.Window):
self.timebar.update_time()
self.update_album()
@idle
def update_album(self, filepath = None):
self.set_background_image(filepath or image_dict['disk'])
self.disk.update_album(filepath)