Skip to content

Commit

Permalink
updating sqlite location again
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbro committed Sep 19, 2018
1 parent d45d10c commit 4bf5316
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 55 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[Alfred 3 workflow](https://www.alfredapp.com/workflows/) to search and create notes in [Bear](http://www.bear-writer.com/). View it on [Packal](http://www.packal.org/workflow/bear), or [join in the discussion on the Alfred forums](https://www.alfredforum.com/topic/10403-bear-workflow-search-and-create-notes/).

## Install
To install, download a [released alfred-bear workflow](https://github.com/chrisbro/alfred-bear/releases/download/0.3.1/alfred-bear.alfredworkflow) and double-click to open in Alfred 3. Easy-peasy.
To install, download a [released alfred-bear workflow](https://github.com/chrisbro/alfred-bear/releases/download/0.3.2/alfred-bear.alfredworkflow) and double-click to open in Alfred 3. Easy-peasy.

## Searching and opening results
`bs` -- Search for a note by title/content and open it in Bear.
Expand Down Expand Up @@ -36,6 +36,9 @@ To install, download a [released alfred-bear workflow](https://github.com/chrisb
- [Rhyd Lewis](https://github.com/rhydlewis) for giving me an excellent example to work off of in his [Omnifocus Alfred workflow](https://github.com/rhydlewis/search-omnifocus).

## Versions
### 0.3.2
* Fixed database location that changed with a Bear update. Again.

### 0.3.1
* Fixed database location that changed with a Bear update.

Expand Down
132 changes: 81 additions & 51 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,13 @@
<string>Bear</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>browser</key>
<string></string>
<key>spaces</key>
<string></string>
<key>url</key>
<string>bear://x-callback-url/open-note?id={query}</string>
<key>utf8</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.action.openurl</string>
<key>uid</key>
<string>A5A16924-B144-4D1A-8E47-FBA4467F58A7</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>alfredfiltersresults</key>
<false/>
<key>alfredfiltersresultsmatchmode</key>
<integer>0</integer>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
Expand Down Expand Up @@ -120,11 +103,63 @@
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>browser</key>
<string></string>
<key>spaces</key>
<string></string>
<key>url</key>
<string>bear://x-callback-url/open-note?id={query}</string>
<key>utf8</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.action.openurl</string>
<key>uid</key>
<string>A5A16924-B144-4D1A-8E47-FBA4467F58A7</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>orig_query={query}
echo $orig_query
if [[ $orig_query == ":t:"* ]]; then
new_query=${orig_query:3}
open "bear://x-callback-url/open-tag?name=$new_query"
else
new_query=${orig_query:3}
open "bear://x-callback-url/open-note?id=$new_query"
fi</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>34803D0C-B70E-4032-96FA-E0A5E179236A</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>alfredfiltersresults</key>
<false/>
<key>alfredfiltersresultsmatchmode</key>
<integer>0</integer>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
Expand Down Expand Up @@ -165,42 +200,13 @@
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>orig_query={query}
echo $orig_query
if [[ $orig_query == ":t:"* ]]; then
new_query=${orig_query:3}
open "bear://x-callback-url/open-tag?name=$new_query"
else
new_query=${orig_query:3}
open "bear://x-callback-url/open-note?id=$new_query"
fi</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>34803D0C-B70E-4032-96FA-E0A5E179236A</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>alfredfiltersresults</key>
<false/>
<key>alfredfiltersresultsmatchmode</key>
<integer>0</integer>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
Expand Down Expand Up @@ -264,6 +270,23 @@ fi</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q)
-- your script here
end alfred_script</string>
<key>cachescript</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.action.applescript</string>
<key>uid</key>
<string>5ADEB109-2C47-4611-B75E-8B710AD3329D</string>
<key>version</key>
<integer>1</integer>
</dict>
</array>
<key>readme</key>
<string># Bear Alfred Workflow
Expand Down Expand Up @@ -297,6 +320,13 @@ To install, download a released alfred-bear.alfredworkflow and double-click to o
<key>ypos</key>
<integer>180</integer>
</dict>
<key>5ADEB109-2C47-4611-B75E-8B710AD3329D</key>
<dict>
<key>xpos</key>
<integer>380</integer>
<key>ypos</key>
<integer>480</integer>
</dict>
<key>74B5AEA1-6AFC-4867-A76D-0FD11694A60D</key>
<dict>
<key>xpos</key>
Expand Down Expand Up @@ -327,7 +357,7 @@ To install, download a released alfred-bear.alfredworkflow and double-click to o
</dict>
</dict>
<key>version</key>
<string>0.3.1</string>
<string>0.3.2</string>
<key>webaddress</key>
<string>https://github.com/chrisbro/alfred-bear</string>
</dict>
Expand Down
11 changes: 9 additions & 2 deletions queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
import sqlite3
import os

DB_LOCATION_OLD = (
DB_LOCATION_OLD_OLD = (
"/Library/Containers/net.shinyfrog.bear/Data/Library/Application Support/"
"net.shinyfrog.bear/database.sqlite")
DB_LOCATION = (
DB_LOCATION_OLD = (
"/Library/Containers/net.shinyfrog.bear/Data/Documents/Application Data/"
"database.sqlite")
DB_LOCATION = (
"/Library/Group Containers/9K33E3U3T4.net.shinyfrog.bear/Application Data/"
"database.sqlite")
DB_KEY = 'db_path'

NOTES_BY_TITLE = (
Expand Down Expand Up @@ -147,6 +150,10 @@ def find_bear_db(log):
if not os.path.isfile(db_file):
log.debug(
"Bear db not found at {0}".format(db_file))
db_file = "{0}{1}".format(home, DB_LOCATION_OLD_OLD)
if not os.path.isfile(db_file):
log.debug(
"Bear db not found at {0}".format(db_file))

log.debug(db_file)
return db_file
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.1
0.3.2

0 comments on commit 4bf5316

Please sign in to comment.