From 4d419dea8b7543903b280dd7a25470c70471018c Mon Sep 17 00:00:00 2001 From: bjschuma Date: Tue, 9 Feb 2010 23:48:17 -0500 Subject: [PATCH] Moved check to see if the user has random on or off --- src/core/next.py | 3 --- src/extra/rand.py | 16 ++++++++-------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/core/next.py b/src/core/next.py index 85b906da..a702df7f 100644 --- a/src/core/next.py +++ b/src/core/next.py @@ -43,9 +43,6 @@ class Plugin(plugin.Plugin): nxttrk += 1 manager.run("next",[nxttrk]) - #sel = sql.Select("track","libtrack","library="+str(curlib)) - #rows = sel.execute().fetchall() - #manager.run("next",[rows[nxttrk][0], nxttrk]) diff --git a/src/extra/rand.py b/src/extra/rand.py index f3a17b6d..3fdb2b5c 100644 --- a/src/extra/rand.py +++ b/src/extra/rand.py @@ -24,15 +24,20 @@ class Plugin(plugin.Plugin): if settings.has("random") == False: settings.set("random",False) elif settings.get("random") == True: - signal.register("next",self.randNext,90) + signal.register("next",self.randLib,90) pass def close(self): - signal.remove("next",self.randNext) + signal.remove("next",self.randLib) - def randNext(self): + # Take a random song from the library + def randLib(self): + # Return if random is not enabled + if settings.get("random") == False: + return + count = db.countlib(str(settings.get("curlib"))) curtrk = settings.get("curtrk") id = curtrk @@ -44,17 +49,12 @@ class Plugin(plugin.Plugin): break manager.run("next",[id]) signal.stop("next") - pass def run(self, args=None): if args==None or len(args)==0: rand = not settings.get("random") settings.set("random",rand) - if rand == True: - signal.register("next",self.randNext,90) - else: - signal.remove("next",self.randNext) elif args[0] == "?": write(settings.get("random"))