libsaria: Clean up playlist init

I removed some code that really didn't need to be used.  I also moved
around some of the imports to make the file easier to follow.
This commit is contained in:
Bryan Schumaker 2011-05-13 08:03:00 -04:00
parent e6a7b94c57
commit 194b436886
1 changed files with 4 additions and 22 deletions

View File

@ -1,16 +1,13 @@
# Bryan Schumaker (11/07/2010)
import libsaria
import libsaria.path.files
from libsaria.sources import library
import playlist
library = None
source = None
rand = None
import random
filtered = False
visible = None
recent = None
recent = []
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 = None
@ -21,20 +18,7 @@ rm_ids = playlist.rm_ids
load = playlist.load
reset = playlist.reset
def init():
global library
global rand
global source
from libsaria.sources import library
import random as rand
source = libsaria.sources.Source()
source.get_attrs = library.get_attrs
source.set_attr = library.set_attr
source.get_cur_id = get_cur_id
def init_bg():
init()
load()
def startup():
@ -84,7 +68,7 @@ def seq_next():
return playlist.song_list[cur_index]
def rand_candidate(list, max):
index = rand.randint(0, max-1)
index = random.randint(0, max-1)
return list[index]
def rand_next():
@ -141,6 +125,4 @@ def next():
recent.append((artist, title))
if len(recent) > 50:
recent.pop(0)
source.set_current()
save()
return id