Commit Graph

305 Commits

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