Commit Graph

452 Commits

Author SHA1 Message Date
Bryan Schumaker
fca5fd1bae libsaria: Remove old audio code
I had commented it out while introducing the new stuff.  I should be
able to safely remove it now.
2011-05-01 12:46:16 -04:00
Bryan Schumaker
8574cda529 libsaria: Ported over Ocarina 5.0 audio functions
The new audio code I developed makes more sense and should be easier to
work with.  It makes sense to port it over.
2011-05-01 12:46:16 -04:00
Bryan Schumaker
9f0d8efbb7 libsaria: playlist uses correct prefs.get() function
I forgot to change it over from get_pref()
2011-05-01 12:46:16 -04:00
Bryan Schumaker
3dc0b208cf libsaria: Integrate new preferences and storage code
This patch re-enables most of the libsaria startup procedures.  To allow
this, I had to switch over to the new preferences and object storage
code I recently came up with.
2011-05-01 12:46:16 -04:00
Bryan Schumaker
063869c7ca libsaria: Remove old file management code
I have new code for loading / saving objects, so I can remove the old
stuff.
2011-05-01 12:46:16 -04:00
Bryan Schumaker
5199a26006 libsaria: Remove old preferences code
I don't need it anymore with the new code.
2011-05-01 12:46:16 -04:00
Bryan Schumaker
457bea2ff3 libsaria: New preferences functions
The new preferences code is much easier to work with.  Rather than
inheriting from a complicated tree class, I just set values in a python
dictionary directly.
2011-05-01 12:46:16 -04:00
Bryan Schumaker
af5947b088 libsaria: Save and load python objects
I do this using cPickle.  load_obj() takes a default constructor
function in case the object cannot be created.
2011-05-01 12:46:16 -04:00
Bryan Schumaker
1921e78e55 libsaria: Comment out most code, begin new preferences
I commented out most of the code in libsaria/__init__.py to make it
easier to clean up.  I also began work on libsaria/prefs.py for managing
preferences.

NOTE: For the next several commits, the best way to test changes is by
importing libsaria through the python interpreter.  Trying to run
ocarina will probably fail.
2011-05-01 12:46:16 -04:00
Bryan Schumaker
d2d894a2e4 libsaria: Bump minor version, mark dev as True
This means I am beginning v4.5
2011-05-01 12:46:16 -04:00
Bryan Schumaker
fb24a0cb32 libsaria: Mark __dev__ as False 2011-05-01 12:28:38 -04:00
Bryan Schumaker
7e83108c6a ocarina: Show attrs for song loaded on startup
I was annoyed that this wasn't happening.
2011-05-01 12:28:28 -04:00
Bryan Schumaker
3bc5c05ab1 libsaria: disable plugins
With my recent changes, my old plugins are incompatible.  I'm going to
come up with a new system in a few releases, so I'm going to wait until
then.
2011-05-01 12:28:19 -04:00
Bryan Schumaker
dc8a69bc0d ocarina: Refresh library after loading
To show changes.  I also use the v1.3 decoder function to decode
exported libraries.
2011-05-01 12:27:30 -04:00
Bryan Schumaker
3d1b8773d5 ocarina: Added album art
I put it on the now playing page for now.  Eventually I'll put it in
other places, too.
2011-05-01 12:19:49 -04:00
Bryan Schumaker
bce7651be5 ocarina: Set text on footer labels
This sets (title, album), position and duration values
2011-05-01 12:12:02 -04:00
Bryan Schumaker
a8421b8226 libsaria: Fix removing songs from queue
If I'm going to attempt to remove the song id from the queue whenever a
song song is loaded, I need to check if the song is in the queue before
trying to remove it.
2011-05-01 12:11:24 -04:00
Bryan Schumaker
f5eed60d78 ocarina: Play double clicked songs
Otherwise, what's the point of a gui?
2011-05-01 12:10:28 -04:00
Bryan Schumaker
9a1a0471c5 ocarina: Re-added queue
Once again, using Ocarina-5.0 concepts (such as hiding the tab when the
queue is  empty)
2011-05-01 12:09:47 -04:00
Bryan Schumaker
13a74e47c3 Ocarina: Remove from playlist
I can remove multiple songs from the playlist now.
2011-05-01 12:09:32 -04:00
Bryan Schumaker
bcd42cfea4 Ocarina: Add songs to playlist
Using a right click menu from the library
2011-05-01 12:09:09 -04:00
Bryan Schumaker
33b7f1ba0e Ocarina: Re-added playlist tab
The new tab uses my ocarina 5.0 concepts
2011-05-01 12:08:52 -04:00
Bryan Schumaker
f902c11f9a ocarina: Filter the library again
This time, I use concepts I played with for Ocarina 5.0
2011-05-01 12:07:56 -04:00
Bryan Schumaker
9c6db9ba9b ocarina: New listview code
I can fill in the listview from the library.
2011-05-01 12:07:23 -04:00
Bryan Schumaker
212a846d8c libsaria: Cache removes path if it exists
I wasn't checking if the path exists before removing it, and this caused
an error.  Checking before removing is simple enough, though...
2011-05-01 11:59:29 -04:00
Bryan Schumaker
23cd4da304 Track version in libsaria
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.
2011-05-01 11:40:09 -04:00
Bryan Schumaker
cd914936f3 Bump minor version and mark development as True 2011-05-01 11:39:41 -04:00
Bryan Schumaker
5903d085b2 Current version is 4.3.3 2011-05-01 11:05:55 -04:00
Bryan Schumaker
50cded315e bump bug version 2011-05-01 11:05:55 -04:00
Bryan Schumaker
47f33a3f8f libsaria: Don't save on preference initialization
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...
2011-05-01 11:05:55 -04:00
Bryan Schumaker
802513c726 libsaria: Don't immediately enable preference saving
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.
2011-05-01 11:05:55 -04:00
Bryan Schumaker
e812fbaee0 Don't filter when there are no terms
If there are no terms to filter on, we should return a set of all items.
This will show all songs when a space has been entered into the filter
bar.
2011-05-01 11:05:54 -04:00
Bryan Schumaker
5f10a01bcb Always clear pause_after
Always clearing this ensures that we don't keep pausing after playback
is resumed.
2011-05-01 11:05:54 -04:00
Bryan Schumaker
6201f707cb Mark __dev__ as False
4.3 is almost done!
2010-12-30 11:26:20 -05:00
Bryan Schumaker
6fc6bb60f6 Set play button status correctly when stopped
The stop function needs to return True if it is successful.
2010-12-27 19:09:07 -05:00
Bryan Schumaker
ef5be29197 web: better controls
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.
2010-12-27 19:00:27 -05:00
Bryan Schumaker
0c636bfd56 Clean up universal_open()
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.
2010-12-27 12:06:22 -05:00
Bryan Schumaker
0b8bc2d7fc Fix choosing random song when playlist is filtered
I was setting cur_index based on the index into the visible set, rather
than the index into the entire song list.
2010-12-23 09:53:30 -05:00
Bryan Schumaker
1c4621a79a Set random directly
This makes much more sense than toggling it.  Toggling caused an
inconsistent state during testing.
2010-12-23 09:51:09 -05:00
Bryan Schumaker
270d33d5ec Reset playlist before loading xspf file
Loading an xspf file should replace the current playlist, rather than
add to it.
2010-12-18 16:45:48 -05:00
Bryan Schumaker
aa0f832356 Refresh the playlist after loading
After we load an xspf file, we should refresh the playlist to reflect
changes.
2010-12-18 16:44:18 -05:00
Bryan Schumaker
da99d4b349 Load xspf playlists
This patch adds loading of xspf playlists
2010-12-18 16:39:17 -05:00
Bryan Schumaker
77f065b703 Export playlist to xspf
This patch adds support for saving a playlist as an xspf xml file.  I
only use the <location> tag to keep it simple.
2010-12-18 16:22:06 -05:00
Bryan Schumaker
da1a5413a4 Library source subdirectory filtering
When we add a path to the sources list, we should remove all paths that
are a subdirectory of the new path.
2010-12-18 15:35:51 -05:00
Bryan Schumaker
8d423629be Add fewer library sources
If we are being asked to add a path that is a subdirectory of a current
library source then we shouldn't add it.
2010-12-18 15:28:53 -05:00
Bryan Schumaker
66a3344121 Controls pref initialization
The preferences variable should be initialized earlier to avoid an error
during startup.
2010-12-18 15:06:18 -05:00
Bryan Schumaker
3c2f40c69e Move backup.py -> export.py, import v1.3 library
The move was supposed to be in the previous patch ... oops.

This one also adds in importing a v1.3 library xml file.
2010-12-18 15:03:24 -05:00
Bryan Schumaker
f869b17e2f Rename backup functions
Backup has been renamed to export
Restore has been renamed to import_xml
2010-12-18 14:52:31 -05:00
Bryan Schumaker
c08655c1fa More reformatting and comments 2010-12-18 14:49:35 -05:00
Bryan Schumaker
c49a39ad46 Encode v1.3 library
This patch changes the encode functions to export a v1.3 library
2010-12-18 14:46:31 -05:00
Bryan Schumaker
cafc19fbed Don't set score when importing library
The score system has been replaced with a like / dislike system.  Score
is no longer an attribute that can be set.
2010-12-18 14:36:21 -05:00
Bryan Schumaker
8349efe8c7 Library export formatting changes
This patch rearranges the decode functions to put decoders for a single
version together.  I also removed some extra whitespace and clearly
labeled the decoding sections.
2010-12-18 14:33:17 -05:00
Bryan Schumaker
0eb3a15783 Add functions for controlling "like"
This patch adds a function for getting the "like" status of the current
song.  It also changes the "set_like" function to use an event, rather
than just setting it.
2010-12-18 11:03:25 -05:00
Bryan Schumaker
f55cb44a64 Fix set_attr()
First, set_attr() needs to find the id of the current song.  Second, we
should save after changing attributes.
2010-12-18 11:02:32 -05:00
Bryan Schumaker
076e89783a Add save() to the Source class
This will allow us to save any changes made to the Source()
2010-12-18 11:01:44 -05:00
Bryan Schumaker
401241ac47 Track recent songs for sequential next too
Why was I only adding recent songs to the list when picking a random
song?  It really doesn't make any sense.  This patch tracks recent songs
any time next() is called in the playlist.
2010-12-18 09:36:01 -05:00
Bryan Schumaker
2d0643dd7b Just skip songs the user doesn't like
If the user doesn't like a song, we shouldn't have a 25% chance of
playing the song anyway.  We should just pick a different song.
2010-12-18 09:27:01 -05:00
Bryan Schumaker
0bcb444317 Remove score field
This patch removes the score field from the Track() class
2010-12-17 23:37:06 -05:00
Bryan Schumaker
7c2778614d Added control to set like value
First, this patch adds a function for setting attributes for the current
file.  Second, it adds a function for specifically setting the "like"
attribute.
2010-12-17 23:33:05 -05:00
Bryan Schumaker
d91c099723 Added set_attr to the Source() class
Having access to the set_attr function should allow us to change
attributes for the current track easily.
2010-12-17 23:28:55 -05:00
Bryan Schumaker
0c254aa957 Remove score changing code
I am switching to a like / dislike system, so I don't need to worry
about scores anymore.
2010-12-17 23:18:19 -05:00
Bryan Schumaker
6449b6badb Skip songs based on like, rather than score
I think I can get a better guess for what users like based on what they
tell me, rather than trying to analyze their playback habits.
2010-12-17 23:15:19 -05:00
Bryan Schumaker
da6b0fd3eb Add "like" field to the Track() class
This will allow the users to tell us if they do or don't like a song.
Songs default to None for unrated songs.
2010-12-17 23:06:46 -05:00
Bryan Schumaker
4e5995ec64 Added pause_after control to libsaria
This gives me a chance to remove it as a plugin.  I noticed that
sometimes I would hear a fraction of a second of music before the
pausing started.  This should fix that.
2010-12-17 23:00:45 -05:00
Bryan Schumaker
b5fef6ba3c Check if cur_source is None
We should do this before attempting to return an ID...
2010-12-17 08:31:22 -05:00
Bryan Schumaker
3abc80bdc4 Add seeking to controls
Seeking should be part of controls, rather than existing independently
as part of the audio package.  This patch moves the seeking functions,
and removes the need to pass a specific number of seconds.
2010-12-16 22:08:26 -05:00
Bryan Schumaker
b6c9c12ea9 Remove datetime module import
This was added to test timing changes for my recent pickle improvements.
2010-12-16 11:02:32 -05:00
Bryan Schumaker
84eb73d2a2 Pickling improvements
By using pickle correctly, I can now load in files significantly faster
than the old way.  Library loading times have gone from about 3 seconds
to 0.25 seconds.  I like this.
2010-12-16 09:29:06 -05:00
Bryan Schumaker
677240eabe Added toggle_play()
This function will call play() if audio is currently paused.  It will
call pause() all other times.
2010-12-15 22:26:45 -05:00
Bryan Schumaker
588a2bfb7a Update library in background
This patch adds a function for updating the entire library in the
background.
2010-12-14 20:37:15 -05:00
Bryan Schumaker
646fc59c5c Save playlist after choosing next 2010-12-12 14:47:19 -05:00
Bryan Schumaker
6fc8415838 next() selects from queue
We check the queue for a song first, then go to the playlist.
2010-12-12 14:45:30 -05:00
Bryan Schumaker
4acb972583 Play songs in the queue
Selecting songs in the queue will play the song and remove it from the
queue.
2010-12-12 14:28:19 -05:00
Bryan Schumaker
f47aa206d1 Remove songs from queue
I can now remove songs from the queue.  Additionally, I only add songs
to the queue if they are not already in it.
2010-12-12 14:20:12 -05:00
Bryan Schumaker
c7c81c1b03 Queue reset
I can now reset the queue to an empty state.
2010-12-12 14:13:18 -05:00
Bryan Schumaker
e7bab2fc94 Queue filtering
The queue can now be filtered using the default text entry.
2010-12-12 14:04:36 -05:00
Bryan Schumaker
e997d4df33 Fill queue page
This patch shows what songs are currently in the queue.
2010-12-12 13:57:26 -05:00
Bryan Schumaker
1e3c48bbf1 Add songs to the Queue
I can add songs from both the library and the playlist to the queue
2010-12-12 13:54:38 -05:00
Bryan Schumaker
25dcd0619c Added framework for Queue
This patch adds the queue as a tab on the main window.  I also added the
libsaria queue functions, but right now the don't do anything.
2010-12-12 13:46:49 -05:00
Bryan Schumaker
d01d75cbe5 Find artwork using new get_attrs()
Using the new get_attrs() function makes things easier, and allows us to
find artwork for songs played that aren't in the library.
2010-12-12 08:55:30 -05:00
Bryan Schumaker
4a3e6184ab get_attrs uses list.append()
Appending to the list should be slightly faster than using +=
2010-12-11 21:54:36 -05:00
Bryan Schumaker
6957cc96f6 Clean up playlist
Removed extra spaces and old, commented out code
2010-12-09 08:11:31 -05:00
Bryan Schumaker
a233861cfd Playlist with generic init function
The playlist is now initialized using the generic init function.
2010-12-09 08:10:42 -05:00
Bryan Schumaker
9acd22b402 Library with generic init function
The library is now initialized with the generic init function.
2010-12-09 08:09:37 -05:00
Bryan Schumaker
9785796642 Add generic init function
The generic init function will start a new thread and call the user
given init function with the user given callback function.
2010-12-09 08:07:53 -05:00
Bryan Schumaker
47927bf9d3 File source attrs added
I added length and year attributes
2010-12-08 07:59:20 -05:00
Bryan Schumaker
4749c49e16 Use the file source
When opening a file, we should use the file source instead of directly
loading it.
2010-12-07 20:47:32 -05:00
Bryan Schumaker
5fc2628160 Add file source
The file source is used to play and get attributes for files on disk
that the user wants us to play.
2010-12-07 20:46:42 -05:00
Bryan Schumaker
e2fa7fff78 Don't have named sources
I don't use the named of each source any more.  It can be removed.
2010-12-07 20:45:30 -05:00
Bryan Schumaker
4af08350e2 cur_source no longer a string
It is now a pointer to the current source instance for faster access (no
dictionary lookup needed)
2010-12-07 20:10:33 -05:00
Bryan Schumaker
1089b85e88 Get_attrs current source
The generic get_attrs() function now works correctly.  I had to
introduce a "get_cur_id()" function for each source to get this working.
2010-12-07 08:07:10 -05:00
Bryan Schumaker
9cef85a0e9 Remove play_selected_id
Nothing uses this function so it should be removed
2010-12-05 17:16:04 -05:00
Bryan Schumaker
265e063fe0 Remove lib_get_cur_id()
Nothing using this function, so it should be removed
2010-12-05 17:15:35 -05:00
Bryan Schumaker
f063da5b56 Began work on virtual sources
Virtual sources should make it easier to do things with the current song
without having to know anything about it (such as a song id or file
path).
2010-12-05 17:11:41 -05:00
Bryan Schumaker
a32315e1e5 Remove libsaria.sources.play_id
Nothing uses this function.  Time to remove it
2010-12-05 13:50:24 -05:00
Bryan Schumaker
b6dba32e47 Rename file2id in backup
It is easier to use file_id
2010-12-05 13:42:23 -05:00
Bryan Schumaker
3eeb35d81c Stop using file_to_id
We should now use file_id located in libsaria.path
2010-12-05 13:40:39 -05:00
Bryan Schumaker
fbfc5738c6 Bump version numbers
We are now developing Ocarina 4.3!
2010-12-05 13:40:15 -05:00
Bryan Schumaker
fff834a14c Find file_id for a given path
Finding the id of a file shouldn't be the job of the library.  Instead,
it should exist as part of the path minipulation code.
2010-12-05 13:29:10 -05:00
Bryan Schumaker
9646d256ff Remove plist_refresh() 2010-12-05 13:18:29 -05:00
Bryan Schumaker
3e0b8de257 Rename library.sources
I think that "locations" is a better name than "sources".  Also, it
avoids the confusion of library sources and current track sources.
2010-12-05 13:11:31 -05:00
Bryan Schumaker
7638fea8de Bump versions
Bump the minimum version required for plugins.  Also marked __dev__ =
False in Ocarina and Libsaria
2010-12-05 12:54:32 -05:00
Bryan Schumaker
c3dcb1c44c Comment out unused library attributes
I don't use these right now, but I may in the future.  For now, I will
just comment them out.
2010-12-04 13:39:33 -05:00
Bryan Schumaker
b64055d9b4 Don't load a song on empty playlist
If the playlist's cur_index is < 0, then we should not try to load a
song.
2010-12-04 13:38:40 -05:00
Bryan Schumaker
816bc84dfd Playlist should load id at saved cur_index
After loading the playlist, we should tell gstreamer to load the last
"current song" that the user was listening to.
2010-12-03 23:57:34 -05:00
Bryan Schumaker
e27f043e6e library.load_id()
This function only loads a song id.  It does not play the song.  If you
want to load and play a song, call library.play_id().
2010-12-03 23:56:43 -05:00
Bryan Schumaker
6147bb8e0f Don't check if audio is initialized
The audio module is initialized when libsaria starts up. We don't need
to keep checking it on every file load
2010-12-03 23:39:42 -05:00
Bryan Schumaker
793827b8f2 Check for empty playlist on startup
Before setting libsaria.sources.cur_lib_id, we should check that the
playlist has something to set it to.
2010-12-03 08:36:13 -05:00
Bryan Schumaker
7453a4e5a1 Playlist track cur_index
We should track the current song index between sessions.  This means we
need to set it when selecting a random song.  This also means we need to
save the playlist on each song selection.
2010-12-03 08:36:13 -05:00
Bryan Schumaker
6b92d199e2 Only back up changed files
We only need to back up files with a score != 0 and count != 0
2010-12-03 08:36:13 -05:00
Bryan Schumaker
e5f85fab5c Library importing
I can now import both v1.1 and v1.2 libraries.  I split this into
appropriate functions for each version.
2010-12-03 08:36:13 -05:00
Bryan Schumaker
45b14e5d79 Check library sources before adding
New sources should:
  1) Be a string
  2) Not already be a tracked source
2010-12-03 08:36:13 -05:00
Bryan Schumaker
d251a46a6a Print library scanning errors
If there is an error scanning a file, we should print what the error is
to ease debugging.
2010-12-03 08:36:13 -05:00
Bryan Schumaker
e9fe8321af Backup sources and improvements
I already have a "dumb import" (retag all files based on the filepath)
so there is no point in storing extra attributes when I am only going to
find them again during importing.  Instead, we should only store the
information we need: filepath, score, and playcount.

Additionally, I now store the list of sources in the library backup.
2010-12-03 08:36:13 -05:00
Bryan Schumaker
9ba602318c xml write node with attributes
The xml functions can now create a node with attributes ( <node
attr="something"/> )
2010-12-03 08:35:15 -05:00
Bryan Schumaker
53027b6006 Library list sources
calling library.get_sources() will iterate over the list of sources
contained in the library.  This is mostly used for storing in the backup
xml.
2010-12-03 08:35:15 -05:00
Bryan Schumaker
72f85f9f92 Create a set locked function for album art
We appear to already be locked when we get to the setter function.  I
was getting deadlocked when trying to do anything.  To fix this, I
made it so I can set images without needing the lock.
2010-12-03 08:35:15 -05:00
Bryan Schumaker
e25f35a74a Library set_attr art
I can use the library's set_attr() function to manually set album art
from a local file.
2010-12-03 08:35:14 -05:00
Bryan Schumaker
bb8632cf69 Albumart set from local file
I can pass the file location to the lastfm module to set the artwork
from a local file rather than from a web location.
2010-12-03 08:35:14 -05:00
Bryan Schumaker
0cbf344fa6 Cache delete items
I can now delete things from the cache in addition to adding things.
2010-12-03 08:35:14 -05:00
Bryan Schumaker
8fa2c29fa5 Import old library
I can now import files from an Ocarina 4.1 library exported as xml.
Ocarina 4.2 keeps track of a list of sources, but 4.1 does not.  For
importing to work properly, the library needs to be rescanned before
running the import.  The import will set the playcount and score
attributes for each file.
2010-12-03 08:35:14 -05:00
Bryan Schumaker
13661d47f1 Library set_attr
The library now has a way to set attributes in each track record.
Note: There is currently no way to change artist, album, title or
filepath.
2010-12-03 08:35:14 -05:00
Bryan Schumaker
a0c344dd71 User can pass files to open
If the user passes text as argv to the program, we will call
universal_open with each string in argv.
2010-12-03 08:35:14 -05:00
Bryan Schumaker
a3248b404e URL character escaping
Only escape a subset of the characters when placing a url request.
2010-12-03 08:35:13 -05:00
Bryan Schumaker
36ce963d11 Initialize controls in two parts
This gives us a chance to initialize random early, and then grab the
audio functions later (when they exist)
2010-12-03 08:35:13 -05:00
Bryan Schumaker
1a6146ec1e Progress bar tooltip
The tooltip shows the time corresponding to the mouse location on the
widget.
2010-12-03 08:35:13 -05:00
Bryan Schumaker
82e3698a2b Save recently played songs
In addition to the playlist, I am also saving the list of recently
played songs between sessions.
2010-12-03 08:35:13 -05:00
Bryan Schumaker
558ee3dabe Remove from playlist
I can now remove songs from the playlist.
2010-12-03 08:35:13 -05:00
Bryan Schumaker
2e6adfa15a Playlist deduplication
We shouldn't add the same song to the playlist twice.  The song id set
we are keeping helps with this.
2010-12-03 08:35:13 -05:00
Bryan Schumaker
763b161299 Teased apart old ocarina.collection code
The new code is easier to read, and much less intimidating.  I also
changed the Library() and Playlist() classes into python modules to make
them easier to read.
2010-12-03 08:35:13 -05:00
Bryan Schumaker
a526aa6c8a Fix playlist saving
The playlist was trying to save itself using the old save functions
2010-12-03 08:35:13 -05:00
Bryan Schumaker
4cfc014f90 Library multiple sources list
Tracking multiple sources makes more sense as a list, rather than an
FSTree().
2010-12-03 08:35:13 -05:00
Bryan Schumaker
efe45371db Move set_volume() and toggle_rand() 2010-12-03 08:31:04 -05:00
Bryan Schumaker
cc6772d596 Move stop features to libsaria.controls.py 2010-12-03 08:31:04 -05:00
Bryan Schumaker
fefde40e82 Moved play and pause to libsaria/controls.py
They have been moved from libsaria/audio/__init__.py.
2010-12-03 08:31:04 -05:00
Bryan Schumaker
b5da80d6c2 Add libsaria/controls.py
I will eventually be moving things over to here.  The general rule: if
it has to do with buttons on the gui, then it should probably be
considered a control.
2010-12-03 08:31:03 -05:00
Bryan Schumaker
aa685005c9 init_pref returns value
When I initialize a preference, the actual value of the preference
should be returned to the caller.
2010-12-03 08:31:03 -05:00
Bryan Schumaker
9e82d32489 Move lastfm to path/ 2010-12-03 08:31:03 -05:00
Bryan Schumaker
487e8c39be Move generic saving / loading functions
These belong under path/
2010-12-03 08:31:03 -05:00
Bryan Schumaker
80deb45a3e Move cache into path/
The cache modifies files, so it can be part of path/
2010-12-03 08:31:03 -05:00
Bryan Schumaker
1e7f63aa2d Moved backup.py to path/
This moves the backup functions to a more reasonable place.
2010-12-03 08:31:03 -05:00
Bryan Schumaker
d768e65a4f Web remote controls
I can play, pause, stop, and advance to the next song through the web
interface.
2010-12-03 08:30:15 -05:00
Bryan Schumaker
adbac1c245 url formatting: don't escape the quote
We don't need to do this.  It causes problems with last.fm
2010-12-03 08:30:14 -05:00
Bryan Schumaker
f723d35eea library tag accessor functions
I have created functions to make it easy to get at titles and song ids
from known tags.
2010-12-03 08:30:14 -05:00
Bryan Schumaker
fe2b5970b4 lastfm return None on error
lastfm album art fetching should return None if there is a problem
opening the image url.
2010-12-03 08:30:14 -05:00
Bryan Schumaker
5118829e78 Get artist and album lists from the library
This patch makes it easy to get an artist or album list out of the
library.
2010-12-03 08:30:14 -05:00
Bryan Schumaker
36cf384cf2 Import trees from libsaria.trees 2010-12-03 08:30:14 -05:00
Bryan Schumaker
6d789fe070 Get artwork by (artist, album)
This makes it easier to find artwork using (artist, album) as a key.
This will probably be the best way to use artwork in the web interface.
2010-12-03 08:30:14 -05:00
Bryan Schumaker
dcc5a937ae Added basename() to path
This will be useful for finding the file referred to by a path.
2010-12-03 08:30:13 -05:00
Bryan Schumaker
0719a57270 Moved libsaria.path to a package
This is the beginning of moving file related code into a single package
and out of the main libsaria directory.
2010-12-03 08:30:13 -05:00
Bryan Schumaker
bbcc87e518 Make sure playlist is initialized properly
This stops an error when ocarina is run with an empty library.  Because
the library is empty, the playlist was never being initialized.
2010-12-03 08:30:13 -05:00
Bryan Schumaker
bf8092e621 Removed Table() class
I don't know why this wasn't removed earlier.  It hasn't been used since
Ocarina 4.0
2010-12-03 08:30:13 -05:00
Bryan Schumaker
3798efd007 Removed Map()
I don't need the Map() class anymore
2010-12-03 08:30:13 -05:00
Bryan Schumaker
c80dfcdf27 Finish new prefrences moveover
I have renamed libsaria.prefs2 to libsaria.prefs
2010-12-03 08:30:13 -05:00
Bryan Schumaker
a051d5ac41 Volume through new preferences tree
The volume is now controlled through the preferences tree.
2010-12-03 08:30:13 -05:00
Bryan Schumaker
3f3d111fba Random new preferences
The random feature uses the new preferences tree, rather than the
preferences map.
2010-12-03 08:30:13 -05:00
Bryan Schumaker
7f82a08a3a Ocarina window new preferences tree
The main window will set its size based on the new preferences tree,
instead of the old preferences map.
2010-12-03 08:30:12 -05:00
Bryan Schumaker
de31941af1 Optimize rand_candidate
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()
2010-12-03 08:30:12 -05:00
Bryan Schumaker
0b8223d224 Correctly get the preference tree when initializing 2010-12-03 08:30:12 -05:00
Bryan Schumaker
80d91c3b60 Load preference trees
Preference trees should be able to load from disk if associated with a
file.
2010-12-03 08:30:12 -05:00
Bryan Schumaker
e7fc59a877 Libsaria initialization
I now initialize libsaria during import, rather than as a separate step
afterwards.
2010-12-03 08:30:12 -05:00
Bryan Schumaker
1c5b1b85ba libsaria.collection cleanup
I found more places using libsaria.collection instead of
libsaria.sources
2010-12-03 08:30:12 -05:00
Bryan Schumaker
fcae32cec0 Add prefs2 variable / remove vars
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.
2010-12-03 08:30:12 -05:00
Bryan Schumaker
0716c7a79c Preference trees
Preference trees are used to store various preferences.  Each component
can have its own set of preferences that use overlapping names.
2010-12-03 08:30:12 -05:00
Bryan Schumaker
701306fef6 libsaria sources change
Change files to reflect the rename of libsaria.collection to
libsaria.sources
2010-12-03 08:30:12 -05:00
Bryan Schumaker
caeb77e58c Rename libsaria.collection to libsaria.sources 2010-12-03 08:29:16 -05:00
Bryan Schumaker
53908f3b1e Quit plugins on exit
Plugins should have a chance to clean up after themselves when we are
shutting down.
2010-12-03 08:29:16 -05:00
Bryan Schumaker
eae86f2dae current working directory function
This has been added to libsaria.path as libsaria.path.cwd()
2010-12-03 08:29:16 -05:00
Bryan Schumaker
c4738482b7 Remove old collection code and files 2010-12-03 08:29:16 -05:00
Bryan Schumaker
11e1caefe2 Random song from playlist
I can once again play random songs from the playlist.
2010-12-03 08:29:16 -05:00
Bryan Schumaker
1190fd45cc Playlist next()
The playlist can play the next song in the playlist.
2010-12-03 08:29:16 -05:00
Bryan Schumaker
587844cb4e libsaria.music doesn't exist anymore
It has been renamed libsaria.audio, so the end-of-song function should
be changed to reflect this.
2010-12-03 08:29:16 -05:00
Bryan Schumaker
f8dd01a54c Tree lookup
Lookup will follow a path and return whatever node it is pointing to.
2010-12-03 08:29:16 -05:00
Bryan Schumaker
263cfde85d find attr filepath correctly
The attribute filepath is easier now that I can walk a fs_tree backwards
and get a path back.
2010-12-03 08:29:16 -05:00
Bryan Schumaker
f7a963cab1 Easy file_to_id()
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()...
2010-12-03 08:29:15 -05:00
Bryan Schumaker
18e9c7e135 Library indexing
I can now add artist / album / title of each song to an index in the
library.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
d5d97e502a Library get_attr values
We should walk the tag values bacwards, rather than using the normal
walk_backwards function.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
8aaeffaa7e Tags in DLValTree
I store the tags in a doubly-linked value tree from now on.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
2949535aba Val trees walk values
Val trees can walk through their values in addition to their paths.  A
doubly-linked val tree can also walk values backwards.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
fe449ffea4 Value Trees
Value trees store a value in addition to the path.  They come in normal
and doubly-linked flavors.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
f29c57992a Library FSTrees and unique ids
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).
2010-12-03 08:29:15 -05:00
Bryan Schumaker
5dbbeb7dcb DLFSTrees
Doubly linked filesystem trees are both a doubly linked tree and a
filesystem tree.  They can walk paths backwards.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
ffd38ec9fa Find child id once
Rather than computing the child id for every iteration of walking
backwards, we do it once.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
60aa99ad84 Add track fields
Tracks need a playcount and a score in addition to all other fields.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
5a21e63e3f Add tracks to libray
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).
2010-12-03 08:29:15 -05:00
Bryan Schumaker
b720519043 Add Track class
This class will be used to store metadata about each song (year, length,
genre ...)
2010-12-03 08:29:15 -05:00
Bryan Schumaker
825a8b8346 Add DLTree()
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.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
4a33a2f0fd Remove value from tree displaying
Displaying a tree should not use the old tree.value variable.  This
variable doesn't exist anymore.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
b19e704154 Library scanning work
I have continued work on library scanning.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
5e6cd3c26a FSTree() correct insert
Correctly insert a split path into a FSTree()
2010-12-03 08:29:15 -05:00
Bryan Schumaker
c87a696e21 Tree() length
I made Tree().__len__() to use for finding the number of leafs that
exist on a tree.
2010-12-03 08:29:14 -05:00
Bryan Schumaker
5b4021f3f6 libsaria.path FSTree()
path should use an FSTree() instead of a Tree()
2010-12-03 08:29:14 -05:00
Bryan Schumaker
1f1cbe1b34 FSTrees shouldn't have a value
If a Tree() doesn't have a value, then the FSTree() shouldn't either...
2010-12-03 08:29:14 -05:00
Bryan Schumaker
3598de0b72 Trees don't have values
Trees don't actually need a value.  I can make a subclass later if I
find it's important.
2010-12-03 08:29:14 -05:00
Bryan Schumaker
a66a4a769b Began new library scanning code
The new scanning code will use FSTrees() to find paths.  I hope it will
be easy to make a scanning progress bar with the new system.
2010-12-03 08:29:14 -05:00
Bryan Schumaker
78b445793a libsaria.path() with an FSTree()
I now have a function to walk all files in a filesystem and make an
FSTree().
2010-12-03 08:29:14 -05:00
Bryan Schumaker
d5231e9db1 FSTree()
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.
2010-12-03 08:29:14 -05:00
Bryan Schumaker
e6b968ed13 Load in background
The library and playlist can be loaded in the background to save time!
Also, I changed the library list to use the new populate function.!
2010-12-03 08:29:14 -05:00
Bryan Schumaker
aa79efe6f1 Remove whitespace 2010-12-03 08:29:14 -05:00
Bryan Schumaker
fd812885e8 Remove get_attr
This removes get_attr() as a library function (use get_attrs() instead)
2010-12-03 08:29:14 -05:00