]> code.delx.au - bg-scripts/blobdiff - bin/randombg.py
RandomBG: Make server grab socket faster.
[bg-scripts] / bin / randombg.py
index 57d08991ebea778ff113cc275060cabd074f4859..f47d684b7fa04357a570bdb9baeda4d9651b1c73 100755 (executable)
@@ -190,7 +190,7 @@ class FolderRandomFileList(BaseFileList):
 
 
 class Cycler(object):
-       def __init__(self, options, paths):
+       def init(self, options, paths):
                self.filelist = self.find_files(options, paths)
                if not self.filelist.is_empty():
                        error("No images were found. Exiting...")
@@ -298,8 +298,10 @@ class Listener(asyncore.dispatcher):
 def do_server(options, paths):
        try:
                try:
-                       cycler = Cycler(options, paths)
+                       cycler = Cycler()
                        listener = Listener(options.socket_filename, cycler)
+                       # Initialisation of Cycler delayed so we grab the socket quickly
+                       cycler.init(options, paths)
                        asyncsched.loop()
                except KeyboardInterrupt:
                        print