Skip to content

Commit

Permalink
final fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danielecook committed Jun 1, 2018
1 parent fdaf780 commit bae6ba2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
33 changes: 20 additions & 13 deletions gist.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,39 @@ def main(wf):

# Get last update
last_update = wf.stored_data('last_update')
diff = (datetime.now() - last_update).seconds
if last_update:
diff = (datetime.now() - last_update).seconds

# Update daily
if diff > 60*60*24:
if not is_running(u"update_gists"):
run_in_background('update_gists',['/usr/bin/python', wf.workflowfile('update_gists.py')])
wf.add_item('Gist Update Triggered', icon="icons/download.png")
# Update daily
if diff > 60*60*24:
if not is_running(u"update_gists"):
run_in_background('update_gists',['/usr/bin/python', wf.workflowfile('update_gists.py')])
wf.add_item('Gist Update Triggered', icon="icons/download.png")

if is_running(u"update_gists"):
# Initial Load
if wf.stored_data('gists') is None:
n = wf.stored_data('current_gist')
total = wf.stored_data('total_gists')
if n:
status = 'Gists are being updated ({}/{}; {}%)'.format(n, total, int((n*1.0/total)*100))
else:
status = "Gists are being updated"
wf.add_item(status, icon="icons/download.png")


# Initial Load
if wf.stored_data('gists') is None:
wf.add_item(status, icon="icons/download.png")
wf.send_feedback()
if not is_running(u"update_gists"):
run_in_background(u"update_gists",['/usr/bin/python', wf.workflowfile('update_gists.py')])
# Exit for initial
sys.exit()
sys.exit()

elif is_running(u"update_gists"):
n = wf.stored_data('current_gist')
total = wf.stored_data('total_gists')
if n:
status = 'Gists are being updated ({}/{}; {}%)'.format(n, total, int((n*1.0/total)*100))
else:
status = "Gists are being updated"
wf.add_item(status, icon="icons/download.png")



gists = wf.stored_data('gists')
Expand Down
Binary file removed icons/Perl.png
Binary file not shown.
4 changes: 2 additions & 2 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@
<key>escaping</key>
<integer>102</integer>
<key>keyword</key>
<string>gg_set_token</string>
<string>gg_set</string>
<key>queuedelaycustom</key>
<integer>3</integer>
<key>queuedelayimmediatelyinitially</key>
Expand All @@ -658,7 +658,7 @@
<key>subtext</key>
<string></string>
<key>title</key>
<string>gg_set_token &lt;token&gt;</string>
<string>gg_set &lt;token&gt;</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
Expand Down
2 changes: 1 addition & 1 deletion update_gists.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def main(wf):
gh = Github(login_or_token=token)
gh_user = gh.get_user()
gist_set = []
user_gists = list(gh_user.get_gists())[0:20]
user_gists = list(gh_user.get_gists())
for n, gist in enumerate(user_gists):
log.info(gist)
gist_item = {}
Expand Down

0 comments on commit bae6ba2

Please sign in to comment.