<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brett Terpstrabookmarking - Brett Terpstra</title>
	<atom:link href="http://brettterpstra.com/tag/bookmarking/feed/" rel="self" type="application/rss+xml" />
	<link>http://brettterpstra.com</link>
	<description>Elegant solutions to complex problems.</description>
	<lastBuildDate>Thu, 09 Feb 2012 15:01:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Quick Link: historio.us</title>
		<link>http://brettterpstra.com/quick-link-historio-us/</link>
		<comments>http://brettterpstra.com/quick-link-historio-us/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 01:01:39 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[bookmarking]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[quicklink]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=1121</guid>
		<description><![CDATA[<p>I found a great new service via Smashing Magazine today: historio.us. It’s a bookmarking service with some seriously impressive twists. I’ve been using Delicious with Delibar for quite a while now. A while ago, I stopped archiving every web page I thought I might need someday (yes, I used to do that) because I’ve realized that Google’s current speed and&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/quick-link-historio-us/">Quick Link: historio.us</a></p>]]></description>
			<content:encoded><![CDATA[<p><img style=' display:none'  class="headerimg" src="http://cdn2.brettterpstra.com/wp-content/uploads/2010/10/historiouspostheaderimage.jpg?9d7bd4" alt="Header image" /></p>

<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2010/10/historiousscreenshot.jpg?9d7bd4" alt="Historious Screenshot" border="0" width="250" height="111" class="alignright shadow" />I found a great new service via <a href="http://www.smashingmagazine.com/2010/10/19/50-powerful-time-savers-for-designers/">Smashing Magazine</a> today: <a href="http://historio.us">historio.us</a>. It’s a bookmarking service with some seriously impressive twists.</p>

<p>I’ve been using <a href="http://delicious.com/">Delicious</a> with <a href="http://www.delibarapp.com/">Delibar</a> for quite a while now. A while ago, I stopped archiving every web page I thought I might need someday (yes, I used to do that) because I’ve realized that Google’s current speed and accuracy have made my local data store obsolete. That’s a longer post for another time. The problem that arises when relying purely on web search is knowing what information you need, knowing that you’ve seen it before, but not being able to piece together the search to lead to that specific post or page. Delicious tags help tremendously, but nothing beats a full-text search. Limit that search to selected items from your own history, and you’ve got an amazing memory enhancer.</p>

<p>Historio.us lets you bookmark and tag pages, and then stores a cached version of the page and a full-text index. It’s a lot like <a href="http://www.stclairsoft.com/HistoryHound/">HistoryHound</a>, which I <a href="http://www.tuaw.com/2009/10/16/friday-favorite-historyhound-bookmark-with-abandon/">wrote up for TUAW</a> a while back, but it offloads the bandwidth, processing and storage requirements to the cloud.</p>

<p>There are two things I’d love to see improve:</p>

<ul>
<li>I wish the search was a little more savvy. It does well, especially with “tags:” searches combined with keywords, but fails to handle fuzzy matches very well. Substituting “other” for “another” can lead to entirely different results.</li>
<li>I wish the API would let me pull recent bookmarks the way I do with Delicious for local tagging purposes — not a huge deal. </li>
</ul>

<p>The Historio.us bookmarklet is simple and effective, and the current API does have everything you need for creating extensions and addons for bookmarking. The bookmarklet functions much like the Instapaper bookmarklet, and you can trigger it on any page to effortlessly add the page to your index.</p>

<p>You can also publish a personal search so that others can search your bookmarked pages, and for paid subscribers there’s a “read later” feature that lets you mark pages as unread, much like <a href="http://pinboard.in/">Pinboard</a>.</p>

<p><a href="http://historio.us">Historio.us</a> has a free version, but it’s lacking many of the more interesting features (like Read Later). You can get the full version for $2.99/month or an annual fee of $19.95. Seems worth it to me, so I’m going to give it an extended trial and see how things go.</p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/i-adore-pinboard/' rel='bookmark' title='I adore Pinboard'>I adore Pinboard</a></li>
<li><a href='http://brettterpstra.com/auto-link-text-service-updated/' rel='bookmark' title='Auto-link text service updated'>Auto-link text service updated</a></li>
<li><a href='http://brettterpstra.com/automated-search-and-link-text-service/' rel='bookmark' title='Automated search and link text Service'>Automated search and link text Service</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/quick-link-historio-us/">Quick Link: historio.us</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/quick-link-historio-us/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Delicious, Spotlight and OpenMeta tags, revisited</title>
		<link>http://brettterpstra.com/delicious-spotlight-and-openmeta-tags-revisited/</link>
		<comments>http://brettterpstra.com/delicious-spotlight-and-openmeta-tags-revisited/#comments</comments>
		<pubDate>Tue, 25 May 2010 07:56:12 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[bookmarking]]></category>
		<category><![CDATA[delicious]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[openmeta]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[spotlight]]></category>
		<category><![CDATA[tagging]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=448</guid>
		<description><![CDATA[<p>I’ve taken a little time to improve the script I’d posted previously. It saves bookmarks you add to Delicious as webloc (Safari bookmark) files on your local hard drive, optionally with thumbnails and OpenMeta tags. Why would you want to do this? First, it adds Spotlight search abilities to your Delicious bookmarks, and, if you use OpenMeta tags, it integrates&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/delicious-spotlight-and-openmeta-tags-revisited/">Delicious, Spotlight and OpenMeta tags, revisited</a></p>]]></description>
			<content:encoded><![CDATA[<p>I’ve taken a little time to improve the script I’d <a href="http://brettterpstra.com/2010/05/11/delicious-bookmarks-and-openmeta-tags/">posted previously</a>. It saves bookmarks you add to <a href="http://delicious.com/">Delicious</a> as webloc (Safari bookmark) files on your local hard drive, optionally with thumbnails and <a href="http://code.google.com/p/openmeta/">OpenMeta tags</a>.</p>

<h3>Why would you want to do this?</h3>

<p><a rel="lightbox" href="http://cdn2.brettterpstra.com/wp-content/uploads/2010/05/tagsearchdelicious_lg.jpg?9d7bd4" title="Searching in Tags for CSS3 bookmarks from Delicious"><img style=' float: left; padding: 4px; margin: 0 7px 2px 0;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2010/05/tagsearchdelicious_lg-150x150.jpg?9d7bd4" alt="" title="tagsearchdelicious_lg" width="150" height="150" class="alignleft size-thumbnail wp-image-457" /></a>First, it adds Spotlight search abilities to your Delicious bookmarks, and, if you use OpenMeta tags, it integrates a tag-based search into any OpenMeta application. The second half of that is, in my case, I bookmark in different ways for different purposes, and it’s nice to have everything integrate into a full search in the end. For me, that search is primarily tag-based, thus the OpenMeta tagging. When I want to share a link, I use Delicious (<a href="http://www.delibarapp.com/">via Delibar</a>), and when I just want to save it for my own reference, I use OpenMeta (<a href="http://www.gravityapps.com/tags/index.html">via Tags.app</a>). This script is part of a system which blends the two, removing the need for redundant tagging and bringing my Spotlight searches together.</p>

<p>Read on for the new script, and installation instructions.</p>

<p><span id="more-448"></span>
At the top of the script, you’ll find a section that looks like this:</p>

<div>
<pre><code>
-- CONFIG
-- delicious username
property _user : "username"
-- delicious password
property _pass : "password"
-- POSIX path to *existing* folder, manually create the folder if needed or point to one that does exist
property targetFolder : "/Users/OSXUSERNAME/Library/Caches/Metadata/Delicious"
-- use Tags.app to apply OpenMeta tags based on Delicious tags
property useTagsApp : true
-- add thumbnails using http://hasseg.org/setWeblocThumb/
property useWebLocThumb : true
-- END CONFIG
</code></pre>
</div>

<p>You’ll need to set these properties to your own information, but after that the script should take care of itself. Username and password are your login info for Delicious.com. Obviously, it won’t work without those. The targetFolder property should be set to a folder that already exists or that you just created for the purpose. The script will <strong><em>not</em></strong> create a folder that doesn’t exist. I recommend creating one in <code>~/Library/Caches/Metadata/Delicious</code>, and just substituting your user name in the targetFolder config.</p>

<p>The last two configuration options determine whether posts are tagged with Tags.app and/or thumbnailed with setWeblocThumb. I recommend doing both, but if you have other purposes for the script, feel free to set these to false. In order to use either option, you’ll need to have the appropriate application installed. <a href="http://www.gravityapps.com/tags/index.html">Tags</a> is a $29US application that makes tagging everything from URL’s to iPhoto pictures, as well as files and folders, a breeze. Worth every penny, in my opinion. <a href="http://hasseg.org/setWeblocThumb/">setWeblocThumb</a> is a free utility that captures thumbnail images of the bookmarked page and applies it to the webloc file. It makes for very nice presentation of search results and bookmark folders.</p>

<p>The last thing you’ll probably want to alter is the first line <em>after</em> the end of the config. It sets the ‘date from’ parameter default to 1 hour prior, in Central Standard Time. If you’re not stuck in the middle of the country, you’ll want to edit the –v+4H part to a + or — number more indicative of your own GMT offset. It’s not a huge deal, this current script will grab everything after this date on the first run, but will record the date of the last bookmark it finds and use that for the next run, and so on. If you want to get <strong><em>all</em></strong> of your Delicious bookmarks on the first run, set this to something long, long ago.</p>

<p>I’ve smartened the script up a bit from the previous version, and solved some of the errors that caused the bookmark save to fail on certain filenames. It also checks for existing bookmarks before writing new ones to disk, avoiding duplicates.</p>

<p>As with the last script, you can use Lingon to set up an hourly run for the script in launchd, or even just set it as an alarm in iCal and use that to schedule it, but I’ve found a better solution. I use Delibar for bookmarking, and it writes out to an xml file in <code>~/Library/Application Support/Delibar</code>. I used Lingon to set up a launchd process that watches for changes in that file and runs the script. Seems to work really well, at least so far. However you choose to run it, it will keep storing the latest date at the time of retrieval, so you can even just run it once a day (or week, or month) and it will find just the newest bookmarks.</p>

<p>Without further ado, here’s the script in its entirety, commented for readability:</p>

<p><strong><em>Updated:</em></strong> Thanks to Matteo from Shiny Frog for tipping me off to the fact that the API rate limiting I was running into was due to the lack of a user agent. This has been added to the curl call in the script, testing will be much smoother now!</p>

<div>
<pre><code>
#!/usr/bin/osascript
-- CONFIG
-- delicious username
property _user : "username"
-- delicious password
property _pass : "password"
-- POSIX path to *existing* folder, manually create the folder if needed or point to one that does exist
property targetFolder : "/Users/OSXUSERNAME/Library/Caches/Metadata/Delicious"
-- use Tags.app to apply OpenMeta tags based on Delicious tags
property useTagsApp : true
-- add thumbnails using http://hasseg.org/setWeblocThumb/
property useWebLocThumb : true
-- END CONFIG

set _date to do shell script "date -v+4H '+%Y-%m-%dT%H:%M:%SZ'"
-- returns a date 1 hour ago (CST) in the format required by the twitter API.
-- you can adjust the date based on your time zone and the frequency that you run
-- the script by editing the -v+4H part of the date command (e.g. -v-1H for GMT - 1 hour)
-- Note that the Delicious dates run on GMT, so you have to account for your time offset
-- For me (CST), this means -v+4H if I want to go back one hour
try
    set _fromdt to do shell script "defaults read com.brettterpstra.getdelicious fromdt"
    -- if the last update time is stored in defaults, use it
on error
    set _fromdt to _date
    -- otherwise, use the date we just set
end try

set bookmarks to do shell script "curl -A \"OpenMetaTagger/1.1\" https://" &amp; _user &amp; ":" &amp; _pass &amp; "@api.del.icio.us/v1/posts/all?fromdt=" &amp; _fromdt

-- gets the bookmarks starting with the date specified in _date
set _folder to POSIX file targetFolder as alias
-- turns the POSIX path in CONFIG into an AppleScript alias
set _output to ""

tell application "System Events"
    set xmlDocument to make new XML data with data bookmarks
    -- set xmlDocument to contents of XML file "Users:ttscoff:Desktop:deliciousbookmarks.xml"
    -- create the XML object
    set {astid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, " "}
    -- store the current delimiter and set the new one to a space for breaking up the tags
    repeat with _post in XML elements of XML element 1 of xmlDocument
        set _url to value of XML attribute "href" of _post as string
        set _tags to text items of (value of XML attribute "tag" of _post as string)
        set end of _tags to "delicious"
        set _name to value of XML attribute "description" of _post as string
        set _title to do shell script "echo \"" &amp; _name &amp; "\"" &amp; "|tr -cs /[^A-Za-z]/ ' '"
        -- strips some bad characters from the page title, solves some errors
        set _date to value of XML attribute "time" of _post as string
        try
            tell application "Finder"
                set AppleScript's text item delimiters to ""
                if not exists alias ((_folder &amp; _title as string) &amp; ".webloc") then
                    set webloc to make new internet location file at _folder to _url with properties {name:_title}
                    -- makes a .webloc file in our target folder
                    set _output to _output &amp; "Grabbed " &amp; _title
                    set AppleScript's text item delimiters to " "
                    if useTagsApp then
                        tell application "Tags" to apply tags _tags to files {POSIX path of (webloc as string)}
                        -- adds OpenMeta tags to our newly created file
                        set _output to _output &amp; " and tagged with " &amp; _tags as string
                    end if
                    if useWebLocThumb then
                        do shell script "/usr/local/bin/setWeblocThumb " &amp; quoted form of (POSIX path of (webloc as string))
                        -- use setWeblocThumb to add a thumbnail to our webloc file
                        -- http://hasseg.org/setWeblocThumb/
                        set _output to _output &amp; ", applied thumbnail"
                    end if
                    set _output to _output &amp; "." &amp; return
                end if
            end tell
        on error myError
            set _output to _output &amp; "Error " &amp; myError &amp; return
        end try
        set {_url,_title,_tags,_name,_time} to {null,null,null,null,null}
    end repeat
    set AppleScript's text item delimiters to astid
    -- restore the delimiters
end tell
do shell script "defaults write com.brettterpstra.getdelicious fromdt " &amp; _date
-- store the date of the last bookmark in system defaults
return _output
</code></pre>
</div>

<p><a href="applescript://com.apple.scripteditor?action=new&amp;script=%23%21%2Fusr%2Fbin%2Fosascript%0A%2D%2D%20CONFIG%0A%2D%2D%20delicious%20username%0Aproperty%20_user%20%3A%20%22username%22%20%0A%2D%2D%20delicious%20password%0Aproperty%20_pass%20%3A%20%22password%22%20%0A%2D%2D%20POSIX%20path%20to%20%2Aexisting%2A%20folder%2C%20manually%20create%20the%20folder%20if%20needed%20or%20point%20to%20one%20that%20does%20exist%0Aproperty%20targetFolder%20%3A%20%22%2FUsers%2FOSXUSERNAME%2FLibrary%2FCaches%2FMetadata%2FDelicious%22%20%0A%2D%2D%20use%20Tags%2Eapp%20to%20apply%20OpenMeta%20tags%20based%20on%20Delicious%20tags%0Aproperty%20useTagsApp%20%3A%20true%20%0A%2D%2D%20add%20thumbnails%20using%20http%3A%2F%2Fhasseg%2Eorg%2FsetWeblocThumb%2F%0Aproperty%20useWebLocThumb%20%3A%20true%20%0A%2D%2D%20END%20CONFIG%0A%0Aset%20_date%20to%20do%20shell%20script%20%22date%20%2Dv%2B4H%20%27%2B%25Y%2D%25m%2D%25dT%25H%3A%25M%3A%25SZ%27%22%0A%2D%2D%20returns%20a%20date%201%20hour%20ago%20%28CST%29%20in%20the%20format%20required%20by%20the%20twitter%20API%2E%0A%2D%2D%20you%20can%20adjust%20the%20date%20based%20on%20your%20time%20zone%20and%20the%20frequency%20that%20you%20run%0A%2D%2D%20the%20script%20by%20editing%20the%20%2Dv%2B4H%20part%20of%20the%20date%20command%20%28e%2Eg%2E%20%2Dv%2D1H%20for%20GMT%20%2D%201%20hour%29%0A%2D%2D%20Note%20that%20the%20Delicious%20dates%20run%20on%20GMT%2C%20so%20you%20have%20to%20account%20for%20your%20time%20offset%0A%2D%2D%20For%20me%20%28CST%29%2C%20this%20means%20%2Dv%2B4H%20if%20I%20want%20to%20go%20back%20one%20hour%0Atry%0A%09set%20_fromdt%20to%20do%20shell%20script%20%22defaults%20read%20com%2Ebrettterpstra%2Egetdelicious%20fromdt%22%0A%09%2D%2D%20if%20the%20last%20update%20time%20is%20stored%20in%20defaults%2C%20use%20it%0Aon%20error%0A%09set%20_fromdt%20to%20_date%0A%09%2D%2D%20otherwise%2C%20use%20the%20date%20we%20just%20set%0Aend%20try%0A%0Aset%20bookmarks%20to%20do%20shell%20script%20%22curl%20https%3A%2F%2F%22%20%26%20_user%20%26%20%22%3A%22%20%26%20_pass%20%26%20%22%40api%2Edel%2Eicio%2Eus%2Fv1%2Fposts%2Fall%3Ffromdt%3D%22%20%26%20_fromdt%0A%0A%2D%2D%20gets%20the%20bookmarks%20starting%20with%20the%20date%20specified%20in%20_date%0Aset%20_folder%20to%20POSIX%20file%20targetFolder%20as%20alias%0A%2D%2D%20turns%20the%20POSIX%20path%20in%20CONFIG%20into%20an%20AppleScript%20alias%0Aset%20_output%20to%20%22%22%0A%0Atell%20application%20%22System%20Events%22%0A%09set%20xmlDocument%20to%20make%20new%20XML%20data%20with%20data%20bookmarks%0A%09%2D%2D%20set%20xmlDocument%20to%20contents%20of%20XML%20file%20%22Users%3Attscoff%3ADesktop%3Adeliciousbookmarks%2Exml%22%0A%09%2D%2D%20create%20the%20XML%20object%0A%20%20%20%20set%20%7Bastid%2C%20AppleScript%27s%20text%20item%20delimiters%7D%20to%20%7BAppleScript%27s%20text%20item%20delimiters%2C%20%22%20%22%7D%0A%20%20%20%20%2D%2D%20store%20the%20current%20delimiter%20and%20set%20the%20new%20one%20to%20a%20space%20for%20breaking%20up%20the%20tags%0A%09repeat%20with%20_post%20in%20XML%20elements%20of%20XML%20element%201%20of%20xmlDocument%0A%09%09set%20_url%20to%20value%20of%20XML%20attribute%20%22href%22%20of%20_post%20as%20string%0A%09%09set%20_tags%20to%20text%20items%20of%20%28value%20of%20XML%20attribute%20%22tag%22%20of%20_post%20as%20string%29%0A%09%09set%20end%20of%20_tags%20to%20%22delicious%22%0A%09%09set%20_name%20to%20value%20of%20XML%20attribute%20%22description%22%20of%20_post%20as%20string%0A%09%09set%20_title%20to%20do%20shell%20script%20%22echo%20%5C%22%22%20%26%20_name%20%26%20%22%5C%22%22%20%26%20%22%7Ctr%20%2Dcs%20%2F%5B%5EA%2DZa%2Dz%5D%2F%20%27%20%27%22%0A%09%09%2D%2D%20strips%20some%20bad%20characters%20from%20the%20page%20title%2C%20solves%20some%20errors%0A%09%09set%20_date%20to%20value%20of%20XML%20attribute%20%22time%22%20of%20_post%20as%20string%0A%09%09try%0A%09%09%09tell%20application%20%22Finder%22%0A%09%09%09%09set%20AppleScript%27s%20text%20item%20delimiters%20to%20%22%22%0A%09%09%09%09if%20not%20exists%20alias%20%28%28_folder%20%26%20_title%20as%20string%29%20%26%20%22%2Ewebloc%22%29%20then%0A%09%09%09%09%09set%20webloc%20to%20make%20new%20internet%20location%20file%20at%20_folder%20to%20_url%20with%20properties%20%7Bname%3A_title%7D%0A%09%09%09%09%09%2D%2D%20makes%20a%20%2Ewebloc%20file%20in%20our%20target%20folder%0A%09%09%09%09%09set%20_output%20to%20_output%20%26%20%22Grabbed%20%22%20%26%20_title%0A%09%09%09%09%09set%20AppleScript%27s%20text%20item%20delimiters%20to%20%22%20%22%0A%09%09%09%09%09if%20useTagsApp%20then%0A%09%09%09%09%09%09tell%20application%20%22Tags%22%20to%20apply%20tags%20_tags%20to%20files%20%7BPOSIX%20path%20of%20%28webloc%20as%20string%29%7D%0A%09%09%09%09%09%09%2D%2D%20adds%20OpenMeta%20tags%20to%20our%20newly%20created%20file%0A%09%09%09%09%09%09set%20_output%20to%20_output%20%26%20%22%20and%20tagged%20with%20%22%20%26%20_tags%20as%20string%0A%09%09%09%09%09end%20if%0A%09%09%09%09%09if%20useWebLocThumb%20then%20%0A%09%09%09%09%09%09do%20shell%20script%20%22%2Fusr%2Flocal%2Fbin%2FsetWeblocThumb%20%22%20%26%20quoted%20form%20of%20%28POSIX%20path%20of%20%28webloc%20as%20string%29%29%0A%09%09%09%09%09%09%2D%2D%20use%20setWeblocThumb%20to%20add%20a%20thumbnail%20to%20our%20webloc%20file%0A%09%09%09%09%09%09%2D%2D%20http%3A%2F%2Fhasseg%2Eorg%2FsetWeblocThumb%2F%0A%09%09%09%09%09%09set%20_output%20to%20_output%20%26%20%22%2C%20applied%20thumbnail%22%0A%09%09%09%09%09end%20if%0A%09%09%09%09%09set%20_output%20to%20_output%20%26%20%22%2E%22%20%26%20return%0A%09%09%09%09end%20if%0A%09%09%09end%20tell%0A%09%09on%20error%20myError%0A%09%09%09set%20_output%20to%20_output%20%26%20%22Error%20%22%20%26%20myError%20%26%20return%0A%09%09end%20try%0A%09%09set%20%7B_url%2C_title%2C_tags%2C_name%2C_time%7D%20to%20%7Bnull%2Cnull%2Cnull%2Cnull%2Cnull%7D%0A%09end%20repeat%0A%09set%20AppleScript%27s%20text%20item%20delimiters%20to%20astid%0A%09%2D%2D%20restore%20the%20delimiters%0Aend%20tell%0Ado%20shell%20script%20%22defaults%20write%20com%2Ebrettterpstra%2Egetdelicious%20fromdt%20%22%20%26%20_date%0A%2D%2D%20store%20the%20date%20of%20the%20last%20bookmark%20in%20system%20defaults%0Areturn%20_output">Open this script in your Script Editor</a></p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/delicious-bookmarks-and-openmeta-tags/' rel='bookmark' title='Delicious bookmarks and OpenMeta tags'>Delicious bookmarks and OpenMeta tags</a></li>
<li><a href='http://brettterpstra.com/mirror-your-pinboard-bookmarks-with-openmeta-tags/' rel='bookmark' title='Mirror your Pinboard bookmarks with OpenMeta tags'>Mirror your Pinboard bookmarks with OpenMeta tags</a></li>
<li><a href='http://brettterpstra.com/save-safari-tabs-to-instapaper/' rel='bookmark' title='Save Safari tabs to Instapaper'>Save Safari tabs to Instapaper</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/delicious-spotlight-and-openmeta-tags-revisited/">Delicious, Spotlight and OpenMeta tags, revisited</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/delicious-spotlight-and-openmeta-tags-revisited/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Delicious bookmarks and OpenMeta tags</title>
		<link>http://brettterpstra.com/delicious-bookmarks-and-openmeta-tags/</link>
		<comments>http://brettterpstra.com/delicious-bookmarks-and-openmeta-tags/#comments</comments>
		<pubDate>Tue, 11 May 2010 11:56:50 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[bookmarking]]></category>
		<category><![CDATA[delicious]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[openmeta]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[tagging]]></category>
		<category><![CDATA[utilities]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=421</guid>
		<description><![CDATA[<p>There are quite a few things I love when it comes to my Mac. I love Spotlight. I love OpenMeta tagging. I love Evernote. I love being able to collect information from any source, and find anything I’ve saved, anywhere, no matter what program I used to create it. I especially love programs that allow me to accomplish that. Unfortunately,&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/delicious-bookmarks-and-openmeta-tags/">Delicious bookmarks and OpenMeta tags</a></p>]]></description>
			<content:encoded><![CDATA[<p>There are quite a few things I love when it comes to my Mac. I love <a href="http://www.apple.com/macosx/what-is-macosx/spotlight.html">Spotlight</a>. I love <a href="http://code.google.com/p/openmeta/">OpenMeta</a> tagging. I <a href="http://brettterpstra.com/tag/evernote/">love Evernote</a>. I love being able to collect information from any source, and find anything I’ve saved, anywhere, no matter what program I used to create it. I especially love programs that allow me to accomplish that.</p>

<p>Unfortunately, one of my favorite apps right now, <a href="http://www.delibarapp.com/">Delibar</a>, doesn’t integrate with Spotlight or OpenMeta, despite the fact that it would be relatively easy to do. Delibar is an excellent (and sexy) menubar application for creating and searching <a href="http://delicious.com/">Delicious</a> (and <a href="http://pinboard.in/">Pinboard</a>) bookmarks. A similar app, <a href="http://codesorcery.net/pukka">Pukka</a>, pulls off the Spotlight part, but I still wanted OpenMeta tags that matched my Delicious tags for local searching.</p>

<p>I also use <a href="http://www.gravityapps.com/tags/index.html">Tags.app</a> for most of my tagging. OpenMeta tags allow you to group and classify files with simple tags, and provide a Spotlight-compatible way to search more intelligently. When you tag a website with Tags, it creates a <a href="http://www.downloadatoz.com/file-extensions/webloc-file-extension.html">webloc</a> file in your metadata cache and applies the OpenMeta tags to it. I figured a similar approach would be feasible using AppleScript, and it seems to be working out great. Read on to see the script I’m using, and be sure to let me know if you improve on it!</p>

<p><span id="more-421"></span>
What I’m doing is using curl with the <a href="http://delicious.com/help/api#posts_all">Delicious API</a>, and downloading everything that’s been bookmarked within the last hour. I’m running it with <a href="http://en.wikipedia.org/wiki/Launchd">launchd</a> every hour, so I don’t want to grab more than that every time it runs. It parses out the title, tags and url for the bookmark, saves it to a .webloc file, and tags it using Tags.app’s AppleScript commands. If you’re not running Tags, it could be modified pretty easily to work with the <code>openmeta</code> command line application.</p>

<p>I’m leaving the target folder up to the user, so when you define it in the CONFIG section, make sure it’s pointing to an existing folder. The only other config properties are your Delicious username and password (sent securely). As noted in the comments in the script, you can adjust the time/date it retrieves from in the first line after the CONFIG section.</p>

<p>The script is pretty well commented, so I won’t rewrite the whole thing here. Take a look, and then I’ll show you how I installed it.</p>

<div markdown=0>
<pre><code>
-- CONFIG
property _user : &quot;username&quot; -- delicious username
property _pass : &quot;password&quot; -- delicious password
property targetFolder : &quot;/Users/ttscoff/Library/Caches/Metadata/Delicious&quot; -- POSIX path to existing folder
-- END CONFIG

set _date to do shell script &quot;date -v-1d &#x27;+%Y-%m-%dT%H:%M:%SZ&#x27;&quot;
-- returns a date 1 day ago in the format required by the twitter API.
-- you can adjust the date based on the frequency that you run the script
-- by editing the -v-1d part of the date command (-v-1H for 1 hour)
-- Note that the Delicious dates run on GMT, so you have to account for your time offset
-- For me, this means -v+4H if I want to go back one hour

set bookmarks to do shell script &quot;curl https://&quot; &amp; _user &amp; &quot;:&quot; &amp; _pass &amp; &quot;@api.del.icio.us/v1/posts/all?fromdt=&quot; &amp; _date
-- gets the bookmarks starting with the date specified in _date

set _folder to POSIX file targetFolder as alias
-- turns the POSIX path in CONFIG into an AppleScript alias

tell application &quot;System Events&quot;
    set xmlDocument to make new XML data with data bookmarks
    -- create the XML object
    set {astid, AppleScript&#x27;s text item delimiters} to {AppleScript&#x27;s text item delimiters, &quot; &quot;}
    -- store the current delimiter and set the new one to a space for breaking up the tags
    repeat with _post in XML elements of XML element 1 of xmlDocument
        set _url to value of XML attribute &quot;href&quot; of _post as string
        set _tags to text items of (value of XML attribute &quot;tag&quot; of _post as string)
        set end of _tags to &quot;delicious&quot;
        set _title to value of XML attribute &quot;description&quot; of _post as string
        try -- it fails on some files, the try block lets us keep moving if we hit a problem
            tell application &quot;Finder&quot; to set webloc to make new internet location file to _url at _folder with properties {name:_title}
            -- makes a .webloc file in our target folder
            tell application &quot;Tags&quot; to apply tags _tags to files {POSIX path of (webloc as string)}
            -- adds OpenMeta tags to our newly created file
        end try
    end repeat
    set AppleScript&#x27;s text item delimiters to astid
    -- restore the delimiters
end tell
</code></pre>
</div>

<p><a href="applescript://com.apple.scripteditor?action=new&#038;script=%2D%2D%20CONFIG%0Aproperty%20_user%20%3A%20%22username%22%20%2D%2D%20delicious%20username%0Aproperty%20_pass%20%3A%20%22password%22%20%2D%2D%20delicious%20password%0Aproperty%20targetFolder%20%3A%20%22%2FUsers%2Fttscoff%2FLibrary%2FCaches%2FMetadata%2FDelicious%22%20%2D%2D%20POSIX%20path%20to%20existing%20folder%0A%2D%2D%20END%20CONFIG%0A%0Aset%20_date%20to%20do%20shell%20script%20%22date%20%2Dv%2D1d%20%27%2B%25Y%2D%25m%2D%25dT%25H%3A%25M%3A%25SZ%27%22%0A%2D%2D%20returns%20a%20date%201%20day%20ago%20in%20the%20format%20required%20by%20the%20twitter%20API%2E%0A%2D%2D%20you%20can%20adjust%20the%20date%20based%20on%20the%20frequency%20that%20you%20run%20the%20script%0A%2D%2D%20by%20editing%20the%20%2Dv%2D1d%20part%20of%20the%20date%20command%20%28%2Dv%2D1H%20for%201%20hour%29%0A%0Aset%20bookmarks%20to%20do%20shell%20script%20%22curl%20https%3A%2F%2F%22%20%26%20_user%20%26%20%22%3A%22%20%26%20_pass%20%26%20%22%40api%2Edel%2Eicio%2Eus%2Fv1%2Fposts%2Fall%3Ffromdt%3D%22%20%26%20_date%0A%2D%2D%20gets%20the%20bookmarks%20starting%20with%20the%20date%20specified%20in%20_date%0A%0Aset%20_folder%20to%20POSIX%20file%20targetFolder%20as%20alias%0A%2D%2D%20turns%20the%20POSIX%20path%20in%20CONFIG%20into%20an%20AppleScript%20alias%0A%0Atell%20application%20%22System%20Events%22%0A%09set%20xmlDocument%20to%20make%20new%20XML%20data%20with%20data%20bookmarks%0A%09%2D%2D%20create%20the%20XML%20object%0A%09set%20%7Bastid%2C%20AppleScript%27s%20text%20item%20delimiters%7D%20to%20%7BAppleScript%27s%20text%20item%20delimiters%2C%20%22%20%22%7D%0A%09%2D%2D%20store%20the%20current%20delimiter%20and%20set%20the%20new%20one%20to%20a%20space%20for%20breaking%20up%20the%20tags%0A%09repeat%20with%20_post%20in%20XML%20elements%20of%20XML%20element%201%20of%20xmlDocument%0A%09%09set%20_url%20to%20value%20of%20XML%20attribute%20%22href%22%20of%20_post%20as%20string%0A%09%09set%20_tags%20to%20text%20items%20of%20%28value%20of%20XML%20attribute%20%22tag%22%20of%20_post%20as%20string%29%0A%09%09set%20end%20of%20_tags%20to%20%22delicious%22%0A%09%09set%20_title%20to%20value%20of%20XML%20attribute%20%22description%22%20of%20_post%20as%20string%0A%09%09try%20%2D%2D%20it%20fails%20on%20some%20files%2C%20the%20try%20block%20lets%20us%20keep%20moving%20if%20we%20hit%20a%20problem%0A%09%09%09tell%20application%20%22Finder%22%20to%20set%20webloc%20to%20make%20new%20internet%20location%20file%20to%20_url%20at%20_folder%20with%20properties%20%7Bname%3A_title%7D%0A%09%09%09%2D%2D%20makes%20a%20%2Ewebloc%20file%20in%20our%20target%20folder%0A%09%09%09tell%20application%20%22Tags%22%20to%20apply%20tags%20_tags%20to%20files%20%7BPOSIX%20path%20of%20%28webloc%20as%20string%29%7D%0A%09%09%09%2D%2D%20adds%20OpenMeta%20tags%20to%20our%20newly%20created%20file%0A%09%09end%20try%0A%09end%20repeat%0A%09set%20AppleScript%27s%20text%20item%20delimiters%20to%20astid%0A%09%2D%2D%20restore%20the%20delimiters%0Aend%20tell">Open this script in your Script Editor</a></p>

<h3>Installing</h3>

<p>The first thing I did was make a version of the script that excluded the date parameter (fromdt) in the curl call in order to download my entire history and process it so I was up-to-date. This took a while, but didn’t seem to cause any problems. The Delicious API is pretty quick to throttle you, so download the whole bunch in one API call or you’ll be in trouble.</p>

<p>After editing the config options, I saved the file as an <del datetime="2010-05-11T14:25:06+00:00">Application Bundle</del> <ins datetime="2010-05-11T14:25:06+00:00">(see addendum below)</ins> in my own apps directory (~/Applications). It doesn’t matter where you put it (or what you name it), as long as you know the path to get there. Then I set up a launchd plist to run it every 3600 seconds (hour). I highly recommend <a href="http://sourceforge.net/projects/lingon/">Lingon</a>  for editing all things launchd. It will make sense when you get there.</p>

<h3>Addendum</h3>

<p>In reference to the install procedure above, I’ve actually had more luck saving it as a text file to a scripts folder and running it with osascript through launchd. Here’s my launchd plist, which you can edit and load through the “Expert” section of Lingon’s editor.</p>

<p>Also, as I just added into the code comments above, I didn’t originally account for the fact that Delicious dates are in GMT, and my offset is –5 right now, so I have to use –v+4H to get 1 hour back, not –v-1H.</p>

<div markdown=0>
<pre><code>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
&lt;plist version=&quot;1.0&quot;&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;org.brettterpstra.GetDelicious&lt;/string&gt;
    &lt;key&gt;Nice&lt;/key&gt;
    &lt;integer&gt;8&lt;/integer&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/usr/bin/osascript&lt;/string&gt;
        &lt;string&gt;/Users/ttscoff/scripts/getdelicious&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;RunAtLoad&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;StartInterval&lt;/key&gt;
    &lt;integer&gt;3600&lt;/integer&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</code></pre>
</div>

<p>Areas for improvement:</p>

<ul>
<li>Currently errors out on some bookmarks for unknown reasons</li>
<li>Could have a first-run setting to automatically download and tag ALL bookmarks</li>
<li>Could set the created date of the webloc file based on the date of the bookmark from Delicious</li>
<li>Could provide more feedback or logging</li>
</ul>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/delicious-spotlight-and-openmeta-tags-revisited/' rel='bookmark' title='Delicious, Spotlight and OpenMeta tags, revisited'>Delicious, Spotlight and OpenMeta tags, revisited</a></li>
<li><a href='http://brettterpstra.com/mirror-your-pinboard-bookmarks-with-openmeta-tags/' rel='bookmark' title='Mirror your Pinboard bookmarks with OpenMeta tags'>Mirror your Pinboard bookmarks with OpenMeta tags</a></li>
<li><a href='http://brettterpstra.com/natural-language-dates-for-textexpander/' rel='bookmark' title='Natural language dates for TextExpander'>Natural language dates for TextExpander</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/delicious-bookmarks-and-openmeta-tags/">Delicious bookmarks and OpenMeta tags</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/delicious-bookmarks-and-openmeta-tags/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced
Database Caching 11/49 queries in 0.197 seconds using xcache
Object Caching 1373/1424 objects using xcache
Content Delivery Network via cdn2.brettterpstra.com

Served from: brettterpstra.com @ 2012-02-09 18:03:44 -->
