Waiting for features upstream

Tuesday, 23 September 2014

I (grudgingly) use the Calibre e-book management software to handle my collection of books, and copy them over to my kindle-toy.

One thing that has always bothered me was the fact that when books are imported their ratings are too. If I receive a small sample of ebooks from a friend their ratings are added to my collections.

I've always regarded ratings as things personal to me, rather than attributes of a book itself; as my tastes might not match yours, and vice-versa.

On that basis the last time I was importing a small number of books and getting annoyed at having to manually reset all the imported ratings I decided to do something about it. I started hacking and put together a simple Calibre plugin to automatically zero ratings when books are imported to the collection (i.e. set the rating to be zero).

Sadly this work wasn't painless, despite the small size, as an unfortunate bug in Calibre meant my plugin method wasn't called. Happily Kovid Goyal helped me work through the problem, and he committed a fix that will be in the next Calibre release. For the moment I'm using today's git-snapshot and it works well.

Similarly I've recently started using extended file attributes to store metadata on my desktop system. Unfortunately the GNU findutils package doesn't allow you to do the obvious thing:

$ find ~/foo -xattr user.comment
/home/skx/foo/bar/t.txt
/home/skx/foo/bar/xc.txt
/home/skx/foo/bar/x.txt

There are several xattr patches floating around, but I had to bundle my own in debian/patches to get support for finding files that have particular attribute names.

Maybe one day extended attributes will be taken seriously. (rsync, cp, etc will preserve them. I'm hazy on the compatibility with tar, but most things seem to be working.)

| 4 comments.

 

Comments On This Entry

[gravitar] Anonymous

Submitted at 21:34:23 on 23 september 2014

Your blog seems to be showing the comments from the previous article on the current one.

Regarding find with xattrs: while it won't be as fast, you can use -exec to do what you want.

[author] Steve Kemp

Submitted at 21:49:54 on 23 september 2014

Yeah the blog-comment problem was embarassing - if an entry had zero comments then comments from the previous post would be copied over.

The perils of caching templates ..

Yes, using `-exec` would work, but as you say it is slower and feels like a hack.

[gravitar] Teddy

Submitted at 23:29:44 on 23 september 2014

As far as I have seen, normal "tar" does not support ACLs or xattrs (nor does "cpio"). Supposedly the "bsdtar" program supports them (and, I assume, "bsdcpio"), but I have not tried those.

[gravitar] mirabilos

Submitted at 09:04:47 on 25 september 2014

Extended attributes are so un-UNIX. They are orthogonal to everything the Unix principles believe in. You should reconsider using them – they may match your usecase, but maybe you could use something more KISS, more plaintext, more unix-y, to avoid this Windows/Macism.

 

Comments are closed on posts which are more than ten days old.

Recent Posts

Recent Tags