The set of searchable songs shouldn't change while selecting songs. We
can determine which list of songs to look at up front and always use
that as an argument to rand_candidate()
The prefs2 structure is where I will store my new tree-based
preferences. I'll use this for now until everything gets moved over. I
also remove the vars variable since nothing uses it.
file_to_id() can stat the filepath to find the inode number (aka the
song id). This is much easier than doing a bunch of lookups. What I
really want to do eventually is get rid of file_to_id()...
I now make a filesystem tree to store the library. In addition, I am
using inode number to track songs. This should make it easier to detect
moved files (inode number matches but path doesn't).
I now attempt to add every file in the filesystem to the library as a
Track(). Errors are logged and bad extentions are saved (so we know not
to scan them in the future).
This patch adds a double-linked tree class for use in storing the
library. This class can walk backwards from a leaf node when
walk_backwards is called.
FSTree() is a tree representing paths in a filesystem. It has functions
for inserting paths and returning the paths it is storing. A path is a
UNIX path: "/home/bjschuma" is the path to my home directory.
get_attrs() will return a list of requested attributes for a given song
id. For now, I have changed get_attr() into a wrapper around get_attrs
that returns the first entry in the result list.
The backup code needed to be modified so that it works with Ocarina 4.1.
This involved writing a function to walk library ids, and using the
lib_get_attr function from the collection.
I can now backup the library to an xml file. This will be useful for
library updates in the future. The plan is to eventually backport this
feature to Ocarina 4.1 (To make the 4.1 -> 4.2 transition easier)
Added a try / except block around placing a urllib2.urlopen().
Additionally, when there is an error I print it and return None. This
will tell the cache to remove the opened file.
For some reason the loop in get_rand_candidate was exiting earlier than
I thought. For now, I am returning the last ID looked at to fix the
problem. I expect there is a better solution, but this seems to work
until I can clean up the collection system.
When a cache filler function returns without success, we need to delete
the empty file we create so that it doesn't trigger a false positive the
next time we access it.
We return after checking if the fetcher function succeeds. To do this
properly, we should store the value we get so that the cached file can
be closed before returning.
I no longer reset the library before scanning. This allows me to do a
basic form of updating. Unfortunately, I have to manually select the
same directory to update it. Eventually I should find a way of
automating library updates.
I now keep track of the last 15 songs played. If a song with the same
(artist, title) as one of the songs in the list attempts to play, we
skip it.
Songs with a negative score have a (20 * score) + 100 per cent chance of
playing. When score is -5, the song should never play.
I used to try to find a song 5 times before giving up and playing the
song with the current id. I have upped the threshold to 15.
If a function responding to an event has an unhandled exception, we
print a message telling what went wrong and that the function has been
uninvited. However, I never actually uninvite the function from the
event. I have now added in a call to uninvite() before printing the
message.
Attempt to close the file passed to the get callback function. Closing
is the right thing to do, but it is possible that the user will close it
before returning..
Libsaria and Ocarina have a __vers__ variable. This contains a string
with the official version (eg. "Ocarina 4.1-dev" or "Libsaria 1.1").
"-dev" means that there have been changes since the last official
version.
I have created forward and rewind buttons to draw on the info bar. In
addition, I have created seek_sec() to seek the song by X seconds.
Right now, the seek buttons add +/- 5 seconds to the current position.
The score system will help determine what users do and don't like. When
the user chooses a song or listens to > 75% of a song, we increment the
score. If the user selects a different song in the first 1/3 of
playback then we decrement the score.
Songs with a score >= 0 will always be played. Songs with a score < 0
have a 50% chance of playing.
The play count is incremented under two conditions. 1) The track
finishes playing. 2) The user skips to the next track, but the current
track has played more than 75%
I have started a system to create a right click menu on the fly and show
it. Currently, it only works for the library. This will be used to
populate the playlist and probably many other things (like plugins!)
I can now change the volume using a button in the gui. Additionally,
the volume is stored between sessions, and the correct value is loaded
when libsaria is initialized.
I am using tabs in the info pane to act as buttons when the pane is
expanded. Eventually I want to move this over to an action widget, but
pygtk doesn't support action widgets for notebooks yet. Hopefully this
will be fixed by the next release.
Both top and bottom playlist borders are present, but both only have a
placeholder label for now. Double clicking on a row in the list will
play a song now.
I only need to create one bottom pane instance now. When the tabs are
changed, the object will be removed from the old tab and added to the
new one. This will preserve the state of the pane between tabs.
Collections now have a get_attr function. This function takes a song id
and a string with the requested attribute. The value of the attribute
is returned. This is used for generating a hover popup with the
playcount.
Libsaria events now support starting specific callback functions in a
background thread. This replaces starting a specific event in the
background.
I have a library tab that is added to the main window through use of the
ocarina.add_tab function.
I have new tests for walking the tree and running multiple threads with
locks.
The web radio plugin can load pandora and grooveshark. This happens
when a web radio tab is selected. After the web document is loaded,
playing music will be paused.
I have begun creating the Ocarina 4.1 gui. So far, I can create and
resize a window. After a resize, the new size is saved and used again
when Ocarina is next started. I am also investigating drag and drop for
use with plugin loading.
I've begun work on a generic collection class for the library, playlist,
and queue. Tagpy functions have been merged into the
libsaria.collections.__init__.py file to make things easier.
I have reworked the gstreamer functions from Ocarina 4.0 and combined
everything into one file. I have also created an audio test that plays
a song from my library.
This function should be called to initialize the preferences and
variables dictionary when libsaria is started. This function triggers
the POSTSTARTUP event.
I combined various parts of the Ocarina 4.0 event system into one file.
The new event file has threading abilities built in, so I no longer need
an external file for that
I revised the Ocarina 4.0 map class so it will hopefully have better
performance. I also began working on a new testing system so testing
specific changes should be easier than with Ocarina 4.0