Mercurial > my-enso-commands
comparison my-enso-commands.py @ 17:557f0edc2ca4
added daily-edition commands
| author | Atul Varma <varmaa@toolness.com> |
|---|---|
| date | Sun, 28 Mar 2010 17:00:39 -0700 |
| parents | 1fee5287e956 |
| children | 400a9edd79ad |
comparison
equal
deleted
inserted
replaced
| 16:1fee5287e956 | 17:557f0edc2ca4 |
|---|---|
| 930 | 930 |
| 931 </body> | 931 </body> |
| 932 <script src=""></script> | 932 <script src=""></script> |
| 933 </html> | 933 </html> |
| 934 """ | 934 """ |
| 935 | |
| 936 def _gen_daily_edition(ensoapi, args=""): | |
| 937 logfile = open('/tmp/daily-edition.log', 'w') | |
| 938 popen = subprocess.Popen([ | |
| 939 "ssh", "labs.toolness.com", | |
| 940 "/home/varmaa/bin/publish-edition %s" % args | |
| 941 ], stdout=logfile, stderr=subprocess.STDOUT) | |
| 942 ensoapi.display_message("Please wait, this may take a while.") | |
| 943 while popen.poll() is None: | |
| 944 yield | |
| 945 logfile.close() | |
| 946 if popen.returncode: | |
| 947 ensoapi.display_message("Failed to generate edition!") | |
| 948 else: | |
| 949 retval = subprocess.call([ | |
| 950 "open", | |
| 951 "-a", "/Applications/Safari.app", | |
| 952 "http://labs.toolness.com/daily-edition/" | |
| 953 ]) | |
| 954 if retval: | |
| 955 ensoapi.display_message("Opening web browser failed.") | |
| 956 | |
| 957 def cmd_publish_new_daily_edition(ensoapi): | |
| 958 "Generates a new issue of The Daily Edition with new news." | |
| 959 | |
| 960 return _gen_daily_edition(ensoapi, "--refresh-feeds") | |
| 961 | |
| 962 def cmd_publish_old_daily_edition(ensoapi): | |
| 963 "Generates a new issue of The Daily Edition with old news." | |
| 964 | |
| 965 return _gen_daily_edition(ensoapi) |
