优化循环模式设置

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