Fun with image attributes, first baby steps

I got Beta2 installed and wanted to actually use Haiku for something and thought it would be nice to copy over a fairly large set of images from my photo collection and check out some of the ported image applications. I did not have much luck with DigiKam which froze the OS for me after importing a few hundred JPEGS.

Anway, we should use Haiku the way it is intended, right? So why not organize my photo collection directly in tracker by using the extended attributes. Unfortunately Ratings or other image information does not get read and copied to the attributes directly. So I wanted some way to move the metadata to file attributes. There were a few posts / ideas earlier about an index_server that could be the base for this, but seems it not part of Haiku yet.

So I thought about writing a simple script to copy over the image metadata instead. So I added a few more attributes and got it working quite nicely with exiv2 that was already installed. But having to run a shell script from the terminal did not seem nice, so I was looking for a way to add the script as a Tracker add-on. But it seems shells scripts cannot be run directly, so I needed a program to launch my script. Checking the BeOS bible gave me some reference to an old add-on called ShellMe. I could only find old BeOS R3 binaries for this, but decided to write a simpler version myself. So now I wrote my first Haiku app, ShellIt, which only runs one shell script on selected files in Tracker. But this serves my purpose well for now and just wanted to share it with you - all the code and the results are visible in the screenshot. I have not decided regarding the next step, but I need to at least fix the path to the script, not sure where is the best locationā€¦

Screenshot%20from%202020-06-16%2015%3A35%3A15

11 Likes

Next step can be a gui version in yab :wink:

1 Like

Very nice, Jim, and welcome!

I havenā€™t used it yet myself, but you may want to look at ZooKeeper, available in HaikuDepot (of course). Itā€™s supposed to invoke scripts and commands on dropped files or it can be used as Tracker add-on, similar to your approach.

1 Like

Nice, i tought a bit about if it is a good idea to call exiv2 5 times in a row on the same file, but sedding the values from the verbose output would be probably more fragile. Can we see your wallpaper?

1 Like

This is awesome! It will be real fun with a Haiku-native photo browser software!

1 Like

We have a GUI photo browsing and tagging utility application in HaikuArchives called ā€œAlbumā€. How about extending the capabilities of that? https://github.com/HaikuArchives/Album

2 Likes

Excellent idea, and congratulations on your persistence in finding or creating the right tools for the job.

Haikuā€™s file system is much praised, but as yet not very user-friendly. With the right tools it could serve as a catalogue-maker for various applications, not least being things like CD collections.

2 Likes

As an attribute to the ShellIt add-on (or of a symlink to it, maybe)? This would allow to use the add-on easily with different scripts by just copying it around and changing the attribute.

1 Like

32 posts were split to a new topic: A Thumbnail view for Tracker

This should be possible with imagemagick too

1 Like

Thank you all for the incredible enthusiasm and helpful replies so far. I have learnt a lot thanks to you.

humdinger - I can confirm ZooKeeper works fine for running my script as an add-on, so there is actually no need for ā€˜ShellItā€™ anymore.

extrowerk - I agree it could be done more efficiently, I just took the quick / lazy (and perhaps safe) approach for now. I found the wallpaper at https://www.goodfon.com/wallpaper/babochka-list-cvetok-goluboy.html

vidrep - I didnā€™t know Album handled attributes. I like the way you can drag-n-drop any EXIF tag, but have not found a convenient way to handle lots of images quickly. But seems there is a lot of potental there.

PulkoMandy - The top priority would be to implement what you suggest, so each copy could run its own script. This is actually how ZooKeeper works. I have not found a way to get the name / info for the current add-on, but it should be doable. I would also like to add a progressbar as I would run this on many hundred images at a time. I may play around a bit just to learn, even though we have ZooKeeper.

And the discussion around image thumbnails is really interesting, it seems jscipione is using attributes to store the actual image data, which is perfect. It would be fantastic if we could have a thumbnail view that could also display additional attributes below the image, like rating.

I was expecting that at least image metadata like height, width, resolution or color depth was being automatically detected by Tracker. Probably because back in BeOS time I may have used some Tracker replacement or Add-On that made it easier. I find it very useful being able to open a folder of images and know in advance their dimensions. The preview would also be nice, even though I understand the technical constraints being discussed here. An halfway solution would be having a Tracker Add-On allowing on-demand thumbnails generation, but ideally I would prefer an automatic process, with a switch option in Tracker settings.

Width and height are automatically added as attributes to an image if you open it with ShowImage. So if you added these columns to a folder, you will see them there.
Adding Tracker icons using Album is often sufficient if what you want is only to recognize files quicker.
If not sufficient, we have several tools to browse images with previews already. Unfortunately, Album is a bit broken and Butterfly shows only one image at once. There are several Qt apps to do this anyway even if Iā€™d prefer a native solution.

I keep playing around even though I donā€™t really know what Iā€™m doing. :slight_smile:
I downloaded the Haiku source to try to make some adjustments - I really donā€™t like that boolean attributes show as ā€œtrueā€ or ā€œfalseā€, so if rating can use the UTF8 codes for stars, lets do the same for booleans. It is a one line code change in Trackers WidgetAttributeText.cpp, but I havenā€™t figured out how to run my modified version of the Tracker - Iā€™m unable to kill / replace the originalā€¦

So for now Flash attribute is a string, I also adjusted the ratings menu of ShowImage, so the current rating is always visible. To be continuedā€¦

Screenshot%20from%202020-06-20%2010%3A36%3A25

7 Likes

Tracker is automatically relaunched by the launch_daemon if it ā€˜disappearsā€™, normally meaning it has crashed. Thereā€™s the launch_roster command to stop/start system services by their application signature.

To stop Tracker, do launch_roster stop x-vnd.Be-TRAK (you find its signature when invoking the FileType add-on on /system/Tracker).

When testing your built Tracker, you have to make sure the binary finds its freshly built libtracker.so. It does, if you put the libtracker.so into a folder ā€œlibā€ beside the built Tracker binary.

Now you can just launch your built Tracker from Terminal.

2 Likes

Thanks a lot, humdinger - not something I would have figured out on my ownā€¦ :slight_smile:

Itā€™s a good idea. Perhaps, instead of the circle you could consider using a check symbol.. Itā€™s a bit more standard, I think.

3 Likes

I was considering the check symbol, but didnā€™t want an empty space for false. But both options are way better than untranslatable ā€œtrueā€ and ā€œfalseā€ textsā€¦

The heavy white for false and the filled one for true?

Actually, in FileTypes settings for Boolean attributes, there is an option to display as ā€œDefaultā€ or as ā€œCheckboxā€. Right now the setting is not considered in Tracker. Itā€™s probably fine to display the check symbol or nothing if the user selects Checkbox there.

1 Like