This function is similar to the add_to_playlist() function I recently
added. The idea is to have the queue add things to itself, rather than
having the playlist and library implement this function independently.
It was silly to have the library control adding songs to the playlist.
The playlist should provide an easy function that takes the selected
songs and adds them.
Trying to save the window each time wasn't working well. I found that
clicking the preferences button a second time would display an empty
window, rather than what was saved. The user probably won't notice the
time it takes to create the window again.
Tracking two different versions for Ocarina and libsaria was too much
work. From now on, Ocarina and libsaria will have the same version.
Ocarina's version string will be set based on libsaria.
This used to cause the album art to change to the Ocarina icon. When
the user cancels setting album art, None is returned from the selector
function. We should check for this before trying to set the image and
return early if path is None.
When a preference is initially created, it should be set to a default
value. If it is set to a default value, then we don't need to save it
immediately. Let's wait until it changes before actually doing a
save...
We shouldn't need to save preferences during startup because at this
point only the initial values have been set. If nothing is changed,
then nothing needs to be saved and we can save some time. This should
also prevent any problems caused by crashing during a save.
I split out the web controls to a new file, and can set the status of
the play button correctly when the page is loaded. Finally, the
set_play_button() function is called on a timer so changes on the
application will be reflected on the web page eventually.
The set_attr_once() function is the same as set_attr(), only it will
only set the value once. Attributes like "version" should use this,
since the ocarina version shouldn't change often.
I was using the attribute as the object id in the html page. By
splitting the two, I can have the same attribute set in multiple places
on a single page independently.
The ocarina package can track the startup time better than the launcher
script. Tracking it in the package will also make startup time
available to other callers.
The cleaned up version chooses what function to call based on file
extention. I use map.get() to pick a function, and use the open_music()
function as the default.