Skip to content

Commit

Permalink
Ignore python errors in update checker
Browse files Browse the repository at this point in the history
  • Loading branch information
sballin committed May 4, 2020
1 parent 7d699e8 commit 78ac23c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 33 deletions.
42 changes: 21 additions & 21 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,26 @@
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>applescript</key>
<string>use framework "Foundation"property NSString : a reference to current application's NSString
property NSCharacterSet : a reference to current application's NSCharacterSet
on alfred_script(q) tell application "Notes" set noteName to name of note id q set noteName to (NSString's stringWithString:noteName) set noteName to (noteName's stringByAddingPercentEncodingWithAllowedCharacters:(NSCharacterSet's URLPathAllowedCharacterSet)) as text
set noteName to "notes://" &amp; noteName end tell
end alfred_script</string>
<key>cachescript</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.action.applescript</string>
<key>uid</key>
<string>6740BCB6-6818-49E2-A88A-9D19EA132F08</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
Expand Down Expand Up @@ -267,26 +287,6 @@ fi
<key>version</key>
<integer>3</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>applescript</key>
<string>use framework "Foundation"property NSString : a reference to current application's NSString
property NSCharacterSet : a reference to current application's NSCharacterSet
on alfred_script(q) tell application "Notes" set noteName to name of note id q set noteName to (NSString's stringWithString:noteName) set noteName to (noteName's stringByAddingPercentEncodingWithAllowedCharacters:(NSCharacterSet's URLPathAllowedCharacterSet)) as text
set noteName to "notes://" &amp; noteName end tell
end alfred_script</string>
<key>cachescript</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.action.applescript</string>
<key>uid</key>
<string>6740BCB6-6818-49E2-A88A-9D19EA132F08</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
Expand Down Expand Up @@ -612,7 +612,7 @@ For further info and troubleshooting, visit https://github.com/sballin/alfred-se
<string>1</string>
</dict>
<key>version</key>
<string>2.2.0</string>
<string>2.2.1</string>
<key>webaddress</key>
<string>https://github.com/sballin/alfred-search-notes-app</string>
</dict>
Expand Down
28 changes: 16 additions & 12 deletions update.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,19 @@ def update(updateUrl):
os.system('open ' + updateFile)


if oneDaySinceLastCheck():
latestUrl = 'https://api.github.com/repos/sballin/alfred-search-notes-app/releases/latest'
r = request.urlopen(latestUrl, timeout=60)
if r.status == 200:
body = r.read()
latest = json.loads(body.decode('utf-8'))
latestVersion = latest['tag_name']
updateUrl = latest['assets'][0]['browser_download_url']

if updateAvailable(latestVersion):
if userWantsUpdate(updateUrl):
update(updateUrl)
try:
if oneDaySinceLastCheck():
latestUrl = 'https://api.github.com/repos/sballin/alfred-search-notes-app/releases/latest'
r = request.urlopen(latestUrl, timeout=60)
if r.status == 200:
body = r.read()
latest = json.loads(body.decode('utf-8'))
latestVersion = latest['tag_name']
updateUrl = latest['assets'][0]['browser_download_url']

if updateAvailable(latestVersion):
if userWantsUpdate(updateUrl):
update(updateUrl)
except:
pass

0 comments on commit 78ac23c

Please sign in to comment.