Commit Graph

274 Commits

Author SHA1 Message Date
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