# HG changeset patch # User Atul Varma # Date 1269820839 25200 # Node ID 557f0edc2ca4fc2d14d830780bdd3c48c3ce982a # Parent 1fee5287e9560a8bf67eb203b70f3b1a75e290dd added daily-edition commands diff -r 1fee5287e956 -r 557f0edc2ca4 my-enso-commands.py --- a/my-enso-commands.py Sat Mar 27 16:12:36 2010 -0700 +++ b/my-enso-commands.py Sun Mar 28 17:00:39 2010 -0700 @@ -932,3 +932,34 @@ """ + +def _gen_daily_edition(ensoapi, args=""): + logfile = open('/tmp/daily-edition.log', 'w') + popen = subprocess.Popen([ + "ssh", "labs.toolness.com", + "/home/varmaa/bin/publish-edition %s" % args + ], stdout=logfile, stderr=subprocess.STDOUT) + ensoapi.display_message("Please wait, this may take a while.") + while popen.poll() is None: + yield + logfile.close() + if popen.returncode: + ensoapi.display_message("Failed to generate edition!") + else: + retval = subprocess.call([ + "open", + "-a", "/Applications/Safari.app", + "http://labs.toolness.com/daily-edition/" + ]) + if retval: + ensoapi.display_message("Opening web browser failed.") + +def cmd_publish_new_daily_edition(ensoapi): + "Generates a new issue of The Daily Edition with new news." + + return _gen_daily_edition(ensoapi, "--refresh-feeds") + +def cmd_publish_old_daily_edition(ensoapi): + "Generates a new issue of The Daily Edition with old news." + + return _gen_daily_edition(ensoapi)