From 4bf5316094d239b151962eaf84639c7f34b53a3a Mon Sep 17 00:00:00 2001 From: Chris Brown Date: Wed, 19 Sep 2018 19:30:45 -0400 Subject: [PATCH] updating sqlite location again --- README.md | 5 +- info.plist | 132 ++++++++++++++++++++++++++++++++--------------------- queries.py | 11 ++++- version | 2 +- 4 files changed, 95 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 8d3ef7e..0b50409 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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. diff --git a/info.plist b/info.plist index 5bc5f0b..db8922b 100644 --- a/info.plist +++ b/info.plist @@ -56,30 +56,13 @@ Bear objects - - config - - browser - - spaces - - url - bear://x-callback-url/open-note?id={query} - utf8 - - - type - alfred.workflow.action.openurl - uid - A5A16924-B144-4D1A-8E47-FBA4467F58A7 - version - 1 - config alfredfiltersresults + alfredfiltersresultsmatchmode + 0 argumenttrimmode 0 argumenttype @@ -120,11 +103,63 @@ version 2 + + config + + browser + + spaces + + url + bear://x-callback-url/open-note?id={query} + utf8 + + + type + alfred.workflow.action.openurl + uid + A5A16924-B144-4D1A-8E47-FBA4467F58A7 + version + 1 + + + config + + concurrently + + escaping + 102 + script + 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 + scriptargtype + 0 + scriptfile + + type + 0 + + type + alfred.workflow.action.script + uid + 34803D0C-B70E-4032-96FA-E0A5E179236A + version + 2 + config alfredfiltersresults + alfredfiltersresultsmatchmode + 0 argumenttrimmode 0 argumenttype @@ -165,42 +200,13 @@ version 2 - - config - - concurrently - - escaping - 102 - script - 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 - scriptargtype - 0 - scriptfile - - type - 0 - - type - alfred.workflow.action.script - uid - 34803D0C-B70E-4032-96FA-E0A5E179236A - version - 2 - config alfredfiltersresults + alfredfiltersresultsmatchmode + 0 argumenttrimmode 0 argumenttype @@ -264,6 +270,23 @@ fi version 2 + + config + + applescript + on alfred_script(q) + -- your script here +end alfred_script + cachescript + + + type + alfred.workflow.action.applescript + uid + 5ADEB109-2C47-4611-B75E-8B710AD3329D + version + 1 + readme # Bear Alfred Workflow @@ -297,6 +320,13 @@ To install, download a released alfred-bear.alfredworkflow and double-click to o ypos 180 + 5ADEB109-2C47-4611-B75E-8B710AD3329D + + xpos + 380 + ypos + 480 + 74B5AEA1-6AFC-4867-A76D-0FD11694A60D xpos @@ -327,7 +357,7 @@ To install, download a released alfred-bear.alfredworkflow and double-click to o version - 0.3.1 + 0.3.2 webaddress https://github.com/chrisbro/alfred-bear diff --git a/queries.py b/queries.py index c4b1def..057ca92 100644 --- a/queries.py +++ b/queries.py @@ -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 = ( @@ -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 diff --git a/version b/version index a2268e2..9fc80f9 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.3.1 \ No newline at end of file +0.3.2 \ No newline at end of file