Haiku Challenge Day 3

Today I tried testing the database like filesystems with queries and attributes. Of course on my first try I somehow took the complicated way but I somehow got it working. What I tried was tagging and searching my Wallpapers. First of all I opened up the find application that can be found via the haiku main menu in the deskbar. This has a basic set of filetypes and attributes associated to this filetypes. As all my wallpapers don’t have any attributes besides the automatically generated mimetype attribute which is used by the applications (which btw. can be also be used to mask files like I had an video file saved as doc.txt but as the mimetype attribute did not change it opened up the mediaplayer and recognized it as video file).

Find utility

The find utility lets me choose from a dropdown box the various different attributes. But it also offers a forumula option which I used after I choose the attributes to get the complete attribute name how it is saved and can be used in the filesystem.
So the option I was searching for is called Media:Comment . To add now a comment attribute to my files I can start a terminal and execute the command

addattr -t string Media:Comment “My Tag” ~/Wallpaper/*.png

This will add the tag My Tag to the all the *.png files in my Wallpaper directory. If I want to I could also choose files one by one to add different comments to them.

Now to the tricky part. The Media:Comment attribute is not listed in the filesystem index (comparable to a database index) so a search would fail. To tell the filesystem to add it to the index you need to reindex the files by executing:

reindex -v Media:Comment ~/Wallpaper/*.png

This makes those files finally searchable by the find tool. Of course later on I found a graphical attributes editor called jellikit which allows you to easily create new attributes and add them to files.

For the whole reindexing stuff there is a much much more easier way if you already somehow have the files tagged. So for example mostly all of my mp3 files are tagged already. So it is very easy to convert those tags to bfs file attributes. There is even a tool available via installoptionalpackage called armyknife. And this is just an awesome tool. One click on all mp3 tags are written as bfs file attributes.


After that I simply opened up find and created a search for an artists and simply saved this search as a query on my desktop. The cool thing about this query is that it automatically updates the list of files found when I add new music files with the same artist. This even works for plugged in usb thumb drives that contain a bfs partition with reindexed music files.

This is a really really cool feature. But it has the one downside that you need to execute the reindex command after adding a new attribute. At least the standard tools like the ShowImage image viewer should do the reindex on its own when adding new attributes like Rating for example. But overall the find tool is very very powerful and in contrast to KDEs nepomuk which offers a similar feature it has absolutely no performance impact. At least I indexed about 2000 files here already and did not see any performance impact which is pretty cool. Also as contact data (people files) and mails are stored with attributes attached to them I can also create a query with mails from last week or contacts living in a particular region.

So enough querying and indexing for today. The next thing I wanted to do was playing some games. Haiku itself ships with a limit amount of demo applications among them also some games like pairs which is a memory game. But I wanted more so I searched haikuware and was pretty much suprised because there are tons of games available for Haiku. Infact it is the biggest category in haikuware including 469 entries.
Besides some classic games like, BeMines, BeNibblix (A snake like game) and Bing (a pong like game) I also found FreeSpace2 which is a space shooter and simulator. This port needs either the original game files from the full game or the demo but works great if you have them.

Some Games

I also found one of my favorite game Hedgewars. Most of those games are based on SDL gcc4 which can be obtained from haikuware aswell. Also handy sometimes the maxpacklibsgcc4 to get some games running. Sadly I did not get hedgewars working as it needs a gcc4/gcc4hybrid build of haiku which I currently don’t have.(I am running a gcc2hybrid)

Monkey Island in ScummVM

As I love some of the old Indiana Jones and Monkey Island games I downloaded ScummVM available for Haiku and this runs without a problem. All in all there are lots of casual games and some game classics available just like Quake 3 for example. As I am not a hardcore gamer this is more than enough for me to explore and try out.

So all in all the 3rd day I learned to love attributes in haiku and had fun with some games.

3 Kommentare:

Humdinger hat gesagt…

Hi there,

no, I'm not stalking your blog, just commenting on your latest Haiku adventure. :)

Before Haiku goes R1, there'll have to be a discussion which attributes to include in the index by default. MEDIA:rating and MEDIA:comment are good candidates. We don't want too many attributes indexed as that does affect performance at one point...
Once there by default, reindexing of the widely used attributes won't be needed anymore.
Also, once you index e.g. "MEDIA:comment" you don't have to reindex if you add that attribute to some new file or filetype. attributes aren't tied to specific filetypes.

BTW, here a little tip to easily add attributes to some files:
copy a file with a filetype that already has the attribute you need into the folder of the ones you want to edit. Now you can display that attribute under "Attributes" and simply enter the contents into that attribute of any file in that folder.

For example:
' Copy a MP3 into a folder of image files.
* Then show the attributes "Comment" and "Rating" of the MP3 in the "Attributes" menu.
* Now select an image, press ALT+E to rename and use the tab key to jump to those attributes and enter values.


Leszek Lesner hat gesagt…

Very interesting. The copy attributes feature is pretty nice.

scottmc hat gesagt…

Here's a video showing queries in action, this was done by a student during Google Code-In 2012.


Other video demos here: http://haiku-files.org/files/media/