Synchronizing Opera bookmarks with Perl, Org, and git
Who here like me still uses Opera (specifically Opera 12 on Linux)? It's being abandoned, the bugs are piling up, and more websites are not rendering correctly on it. However, the combination of keyboard shortcuts and some specific features like editing+applying source code makes me still stick to it.
The Opera makers provide a service called Opera Link that can synchronizes your browser bookmarks and a few other stuffs between computers and mobile devices. However I prefer not to use it and rely on some good ol' tools instead.
I also happen to be a fan of Org so Org will be the master document.
The steps that I describe here might be too much of a hassle, but I like it and thus share it.
First, you install the CPAN module App::ConvertOperaBookmarksToOrg which includes the utilities adr2org and org2adr.
Then you convert your Opera bookmarks to an Org document with this command:
% adr2org -T ~/.opera/bookmarks.adr > repo/opera-bookmarks.org
opera-bookmarks.org is the actual document that you will be putting into git repository and synchronize between computers. It is convenient to edit via Emacs, and is more easily diff-able by removing volatile bits that change or random written by Opera (like the ID field). The -T option is to exclude the Trash folder, which I don't care for.
In another computer, you convert back to Opera .adr format using:
% org2adr repo/opera-bookmarks.org > ~/.opera/bookmarks.adr
Make sure that Opera is not running when you override its bookmarks file.
I use Opera 12 on Linux. You know it has the ability to export bookmarks as HTML, using the same format Netscape used to use many moons ago. I believe it is mostly round-trippable.
I see, didn't know that. Actually, the .adr format is plain text and very simple and arguably more readable/editable than HTML. The Org document is slightly more diff-able by removing unnecessary parts as well as more convenient to edit using Emacs (or VimOrganizer if you use vim). In fact, I now often add/edit bookmark entries using Emacs, then export to .adr.
Similarly, Firefox can still be made to export/import its bookmarks to a Netscape-format HTML file in a way that's scriptable and mostly round-trippable. That's what I use to synchronize my bookmarks.
Maybe not useful for you, at least not anymore, but FYI, this is a module I wrote, and still maintain, to parse Opera ADR files, part of Bookmarks::Parser:
https://metacpan.org/pod/Bookmarks::Opera
Sorry, correction: I didn't write it originally, but I fixed a lot of bugs and acquired co-maint for it :-)
Thanks for heads up. I should've browsed CPAN first. The .adr format is so (deceptively?) simple, I was tempted to just whip up some lines to parse it. :-)
Note that the module/dist has now since been renamed to App::adr2org (and its counterpart App::org2adr).
Also, I just took a look that Opera already has a *direct* .adr import/export feature, making my module unnecessary. Unless, when you still want to use Org to store the master document (which I do).