The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Read perspective information from cache DB (http://forums.omnigroup.com/showthread.php?t=29538)

markokaestner 2013-05-12 03:33 AM

Read perspective information from cache DB
 
My Alfred 2 OF workflow is almost completely based on the OF cache database. This has the advantage that OmniFocus does not have to be running. The only case that requires me to open OF is when I want to show the tasks of a perspective.

I tried to get the perspective settings from the database to be able to re-create the query. At the moment I am stuck on how to handle the plist data read from DB. I tried to read the data with sqlite3 on the command line and write the result to a file. But PListBuddy or any other property list tool I tried always complains that the file is no plist file. But the magic number "bplist" indicates that it should be a binary property list.

Does someone has a hint what I am doing wrong?

RobTrew 2013-05-12 05:09 AM

I haven't tested this, but my first guess would be that you may need to do a type conversion of the blob data with a CAST expression.

Perhaps something like:

[CODE]select CAST(valueData as text) FROM Perspective ...[/CODE]

markokaestner 2013-05-12 11:13 AM

Thanks for your help. Unfortunately, the cast() did not work. There are not so many useful search results on Google on that topic. Seems that not so many people try to handle blob data from the cli. In the end, I found a solution that works:

[CODE]sqlite3 ~/Library/Caches/com.omnigroup.OmniFocus/OmniFocusDatabase2 "SELECT QUOTE(valueData) FROM Perspective ..." | sed -e "s/^X'//" -e "s/'$//" | xxd -r -p > test.plist[/CODE]

RobTrew 2013-05-12 11:44 AM

[QUOTE=markokaestner;123962]In the end, I found a solution that works:

[CODE]sqlite3 ~/Library/Caches/com.omnigroup.OmniFocus/OmniFocusDatabase2 "SELECT QUOTE(valueData) FROM Perspective ..." | sed -e "s/^X'//" -e "s/'$//" | xxd -r -p > test.plist[/CODE][/QUOTE]

Useful. Thanks !


All times are GMT -8. The time now is 12:55 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.