From 19e6816dfcc991fd4f00e6f0f389975703c638f4 Mon Sep 17 00:00:00 2001 From: Greg Darke Date: Fri, 28 Nov 2008 13:22:05 +1100 Subject: [PATCH] Fixed the oneshot mode --- randombg.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/randombg.py b/randombg.py index 360c096..fff408f 100755 --- a/randombg.py +++ b/randombg.py @@ -245,7 +245,7 @@ class FolderRandomFileList(BaseFileList): class Cycler(object): - def init(self, options, paths): + def init(self, options, paths, oneshot=False): self.cycle_time = options.cycle_time self.history_filename = options.history_filename @@ -274,7 +274,10 @@ class Cycler(object): sys.exit(1) self.task = None - self.cmd_reload() + if oneshot: + self.cmd_next() + else: + self.cmd_reload() def finish(self): self.filelist.store_cache(self.history_filename) @@ -397,7 +400,7 @@ def do_client(options, args): def do_oneshot(options, paths): cycler = Cycler() - cycler.init(options, paths) + cycler.init(options, paths, oneshot=True) def build_parser(): parser = OptionParser(version="%prog " + VERSION, @@ -450,11 +453,11 @@ def main(): if options.oneshot: do_oneshot(options, args) - - if os.path.exists(options.socket_filename): - do_client(options, args) else: - do_server(options, args) + if os.path.exists(options.socket_filename): + do_client(options, args) + else: + do_server(options, args) if __name__ == "__main__": -- 2.39.2