Save recently played songs
In addition to the playlist, I am also saving the list of recently played songs between sessions.
This commit is contained in:
parent
558ee3dabe
commit
82e3698a2b
|
@ -13,7 +13,7 @@ song_set = set(song_list)
|
|||
|
||||
filtered = False
|
||||
visible = None
|
||||
recent = []
|
||||
recent = None
|
||||
recent_msg = "Skipping %s by %s because it has played recently"
|
||||
skip_msg = "Skipping %s by %s because I don't think you like it"
|
||||
cur_index = -1
|
||||
|
@ -32,18 +32,23 @@ def rm_id(id):
|
|||
def reset():
|
||||
global song_list
|
||||
global song_set
|
||||
global recent
|
||||
recent = []
|
||||
song_list = []
|
||||
song_set = set()
|
||||
|
||||
def load():
|
||||
global song_list
|
||||
global song_set
|
||||
global recent
|
||||
global visible
|
||||
song_list = libsaria.path.files.load("playlist", ".list")
|
||||
if song_list == None:
|
||||
objects = libsaria.path.files.load("playlist", ".list")
|
||||
if objects == None or len(objects) != 2:
|
||||
reset()
|
||||
else:
|
||||
song_set = set(song_list)
|
||||
song_list = objects[0]
|
||||
recent = objects[1]
|
||||
song_set = set(song_list)
|
||||
|
||||
def load_bg2(callback):
|
||||
load()
|
||||
|
@ -56,7 +61,7 @@ def load_bg(callback):
|
|||
thr.start()
|
||||
|
||||
def save():
|
||||
libsaria.path.files.save(song_list, "playlist", ".list")
|
||||
libsaria.path.files.save( (song_list, recent), "playlist", ".list")
|
||||
|
||||
def walk():
|
||||
global song_list
|
||||
|
|
Loading…
Reference in New Issue
Block a user