libsaria: Remove unused global statements and imports

With my recent cleanups, I don't need these statements anymore.  To do
this, I also had to move tracking recent songs to next.py
This commit is contained in:
Bryan Schumaker 2011-05-15 10:54:44 -04:00
parent 6d5ca5d416
commit 32a1e96af0
2 changed files with 6 additions and 13 deletions

View File

@ -4,14 +4,9 @@ import libsaria
from libsaria.sources import library
import playlist
import next
import random
filtered = False
visible = 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
# Function pointers for convenience
add_ids = playlist.add_ids
@ -25,9 +20,6 @@ def list_ids():
yield id
def filter(text):
global visible
global song_set
global filtered
if len(text) > 0:
visible = playlist.as_set().intersection(library.test_filter(text))
filtered = True
@ -36,8 +28,6 @@ def filter(text):
filtered = False
def is_visible(id):
global visible
global filtered
if filtered == True:
return id in visible
return True
@ -60,7 +50,5 @@ def get_next(cur_id):
id = playlist.get(index)
if id != None:
artist, title, file = library.get_attrs(id, "artist", "title", "filepath")
next.recent.append((artist, title))
if len(recent) > 50:
recent.pop(0)
next.track_recent(artist, title)
return id

View File

@ -6,6 +6,11 @@ from libsaria.sources import library
recent = []
def track_recent(artist, title):
recent.append((artist, title))
if len(recent) > 50:
recent.pop(0)
def incr_index(cur_index, max_index):
cur_index += 1
if cur_index == max_index: