[Shotwell] Fast (?) question

Lucas Beeler lucas at yorba.org
Mon Apr 15 19:16:11 UTC 2013


Hi Michael,

First, good luck on your master's thesis work! We're really happy that
Shotwell can be used as a shell to help you with your work! You wrote:

> My intention is to extract the info during
> import and store it somewhere where it
> will be available later on during the
> slideshow.

If I were to design this feature, here is what I would do. But, first, let
me make sure that I understand the functionality you want. As I understand
it, what you want is some packet of additional data (let's call it
"computed image data") associated with each photo. This computed image data
will be computed from the pixel values in the photo image, so this
computation can only be done after the pixbuf for a photo becomes
available. Later, this computed image data will be used to generate sound
waveforms that will be played in a slideshow.

So, if the above is what you are thinking of doing, here's how I would go
about it. First, I would not touch BatchImport or any of the import
subsystem. All of that code is complex, brittle, and is soon to be changed.
It involves pools of worker threads that pass off partially imported photo
information to other pools of worker threads. It's really not something you
need to get into to do what you want.

Instead, I would lazy-initialize the computed image data when needed. Once
I had computed it, I would write it to a new column in the database so I
wouldn't have to compute it again (I'm assuming computing it could be a
somewhat lengthy process) for a given photo. Here's how I imagine the user
interface would work. You select a bunch of photos and choose a new menu
option called something like "Play Slideshow with Sounds." When the user
chooses this menu option, check to see if every selected photo already has
sound data computed for it. If one or more photos doesn't have sound data
computed for them, pop up a progress dialog box that says "Please wait.
Computing sound data" and then compute the sound data. When you're done
computing the sound data, write it to the database so it doesn't have to be
computed again, and then start the slideshow with sounds.

Why do I recommend doing it this way? Because if you do it the way I've
described it above, you have effectively added a new feature to Shotwell
that is not dependent on Shotwell itself. Think about it. You've added a
whole new menu option and a new action that's not really tied into any
existing Shotwell subsystem. What this means is that as Shotwell changes,
your sound generation code can remain pretty much the same. When Shotwell
0.15 comes out, you could easily rebase your sound generation code on top
of Shotwell 0.15 since your sound generation code isn't closely coupled to
Shotwell in any way. Note that if you try to wire your code into a
fundamental Shotwell subsystem like batch import, your sound generation
code may break whenever Shotwell changes.

I hope this gives you some direction for how to proceed on your master's
thesis work!

Cheers,
Lucas


On Wed, Apr 10, 2013 at 12:06 AM, Katachanas Michael <kataxan at gmail.com>wrote:

> Hi Lucas,
>
> Many many thanks for your reply.
>
> My intention is to extract the info during import and store it somewhere
> where it will be available later on during the slideshow.
> I have given it a thought and maybe my best bet would be to place the code
> right after successful import (in batchimport? not very pretty). However,
> it fits more inside each "xxxsupport" files (e.g. jfifsupport.vala). Reason
> is that I want the new code be format-independent.
>
> Great job you guys have done there with Shotwell's code by the way.
>
> Thanks again,
> Kind Regards,
> michael
>
>
>
>
> On Wed, Apr 10, 2013 at 2:51 AM, Lucas Beeler <lucas at yorba.org> wrote:
>
>> > I am trying to extract some additional
>> > data from photos. These, later during
>> > slide show, will be sent to another
>> > program to generate sounds.
>>
>> When do you want to extract this information? When photos are initially
>> imported, or later via some kind of explicit command?
>>
>> Lucas
>>
>>
>> On Sun, Apr 7, 2013 at 4:27 AM, Katachanas Michael <kataxan at gmail.com>wrote:
>>
>>> Hi Lucas,
>>>
>>> Sorry for bothering you. I am modifying Shotwell a little bit in the
>>> scope of my MSc essay.
>>>
>>> I am trying to extract some additional data from photos. These, later
>>> during slide show, will be sent to another program to generate sounds.
>>>
>>> Therefore, I need to run some algorithms on each photo's pixbuf and then
>>> store the extracted data in params.row.
>>>
>>> Tried doing this within the sniffers/detection side (e.g.: in
>>> JfifSupport). Problem is that I have only the 'file' information available
>>> there and could not figure out how to use it in order to gain access to the
>>> photo pixbuf (tried some stupid workarounds creating a temp photo object
>>> inside sniffer but ended up with recursive importing loops).
>>>
>>> Adding it in Photo.vala  seems also reasonable but the points which
>>> appear fit (--> have visibility of params.row e.g. in prepare_for_import)
>>> are *static* which causes problem with the methods I need to use.
>>>
>>> I would be really grateful if you could provide me with a hint or a
>>> suggestion as of how I could implement this.
>>>
>>> (Did not want to place this question to the Yorba forum since it is
>>> totally irrelevant to the standard functionality of Shotwell).
>>>
>>> Thanks a lot in advance,
>>> Kind Regards,
>>> Michael
>>>
>>> PS1.: please bare with me if I am talking nonsense when it comes to an
>>> object oriented concept. This is the first time I am seriously working with
>>> an OO language.
>>>
>>> PS2.: My occupation is telecom engineer in 2G, 3G, 4G Networks.
>>>
>>
>>
>



More information about the Shotwell-list mailing list