Commit Graph

452 Commits

Author SHA1 Message Date
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
Bryan Schumaker
02704b4d7e Use get_attrs
This changes various parts of ocarina / libsaria to use get_attrs()
instead of get_attr().
2010-12-03 08:29:14 -05:00
Bryan Schumaker
31bf833a50 Library get_attrs()
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.
2010-12-03 08:29:14 -05:00
Bryan Schumaker
2dc7f58206 Rename libsaria.music
I decided that libsaria.music should be known as libsaria.audio.  It
makes more sense to me.
2010-12-03 08:29:14 -05:00
Bryan Schumaker
71a9a0a23f Added 'art' to library attrs
This attribute will return the path to the cached album art for the
song.
2010-12-03 08:29:13 -05:00
Bryan Schumaker
45c6097299 get_artwork_id()
If I already have the song id, there is no reason I should have to look
up the filepath to set the artwork.
2010-12-03 08:29:13 -05:00
Bryan Schumaker
15c4a273bf Playlist filtering
The new playlist module can be filtered again.
2010-12-03 08:29:13 -05:00
Bryan Schumaker
1de5243753 New playlist module
The playlist should be a standalone module rather than inheriting from
the same base class as the library.
2010-12-03 08:29:13 -05:00
Bryan Schumaker
8ca67cd4c7 Libsaria trees
libsaria.path.make_tree(path) will return a tree rooted at path
2010-12-03 08:29:13 -05:00
Bryan Schumaker
f561e6b3e2 Remove library functions from collections.lens
I have removed some functions from the old library class since they have
been re-implemented in the library module.
2010-12-03 08:29:13 -05:00
Bryan Schumaker
643da7c12a New library filtering
The new library module can filter songs
2010-12-03 08:29:13 -05:00
Bryan Schumaker
ca331f6b64 Library play_id()
I have moved over the play_id function to the library module.
2010-12-03 08:29:13 -05:00
Bryan Schumaker
8356c58493 Library class -> library module
I think that the library will be cleaner if I turn it into a module
instead of keeping it a class.
2010-12-03 08:29:13 -05:00
Bryan Schumaker
85040621ed Bump the minor version number
This reflects that I am working on Ocarina 4.2 / Libsaria 1.2 now.
2010-12-03 08:28:05 -05:00
Bryan Schumaker
1703fff378 Modified backup code
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.
2010-11-19 23:05:57 -05:00
Bryan Schumaker
65ccdb1780 Library backup
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)
2010-11-19 22:51:56 -05:00
Bryan Schumaker
8b2a0b9433 Added xml creation functions
These functions are designed to help create an xml document.
2010-11-19 22:51:42 -05:00
Bryan Schumaker
5833b1908c universal_open() needs escape character replacement
%20 and $22 should be replaced with " " and "\"" before using the path
to create a library.
2010-11-09 14:08:16 -05:00
Bryan Schumaker
bda392bc88 Correctly set __dev__ for libsaria and ocarina. 2010-11-06 13:36:03 -04:00
Bryan Schumaker
049e27c559 Ocarina 4.1 2010-11-05 18:38:44 -04:00
Bryan Schumaker
4a1ff91b57 Plugins check version
We should check plugin versions when loading them.  If the API changes
in a future version, then old plugins shouldn't work.
2010-11-05 08:15:32 -04:00
Bryan Schumaker
99c510dd20 Development plugin path
When libsaria.__dev__ is True, we should use a different path for
plugins.
2010-11-05 08:13:21 -04:00
Bryan Schumaker
16da9fda2b web.py escape character full replacement
Replace all special symbols, not just ' ' and '&'.
2010-11-04 10:14:31 -04:00
Bryan Schumaker
2b7b38da4f Merge branch 'master' of file:///home/bjschuma/public_html/git/ocarina
Conflicts:
	ocarina/image.py
2010-11-03 23:07:18 -04:00
Bryan Schumaker
3ed0b10aab Only change play button when playing
If no song is playing and the play button is clicked we shouldn't switch
to the pause button.  This could confuse users.
2010-11-03 22:04:51 -04:00
Bryan Schumaker
4c916f2fd3 Reset playlist and library functions
These functions should be called to reset the library and playlist,
which is better than deleting the old files and making a new one.
2010-11-03 08:11:15 -04:00
Bryan Schumaker
7308ed8225 Web request error handling
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.
2010-11-02 21:08:37 -04:00
Bryan Schumaker
a97e82ef1c Up last played limit from 15 to 30 2010-11-02 19:20:11 -04:00
Bryan Schumaker
47f091b7ad collections should be saved as something.dl_tree, not somethingdl_tree 2010-11-01 11:56:07 -04:00
Bryan Schumaker
5a6b321ffe Rework collection saving to work with -dev appending 2010-11-01 08:24:53 -04:00
Bryan Schumaker
b408e4b727 Development and stable pickle files
When libsaria.__dev__ == True, we save data to a file with -dev appended
before the extention.
2010-11-01 08:22:38 -04:00
Bryan Schumaker
025a118290 Fix get_rand_candidate crash
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.
2010-10-31 17:21:12 -04:00
Bryan Schumaker
aa9f517959 Walk filtered IDs
We already have a function for walking all song ids.  Collections should
be able to walk the filtered IDs too.
2010-10-31 17:20:20 -04:00
Bryan Schumaker
49328c5200 choose_next() already starts the NEXT event... 2010-10-31 17:19:46 -04:00
Bryan Schumaker
76eaa3eb16 NEXT event
Rather than call choose_next() directly, we should wrap this in a NEXT
event so that things can respond to it.
2010-10-30 13:52:38 -04:00
Bryan Schumaker
3087eb9954 init_var()
I made an init_var function that matches the init_pref function, only
for runtime variables.
2010-10-30 13:40:06 -04:00
Bryan Schumaker
1136e3f4af Cache path correction
If we look for a cache item that includes the directory seperator
character, then we should replace it with a different character.
2010-10-30 12:54:45 -04:00
Bryan Schumaker
c5a606193a Cache dir setup
The cache should use path.saria_dir() to determine the correct path,
rather than setting it directly.
2010-10-30 12:47:41 -04:00
Bryan Schumaker
356244e3be Gstreamer locking
Locking for gstreamer operations may help prevent a double free error I
was getting.
2010-10-30 12:09:28 -04:00
Bryan Schumaker
b000bbf808 Basic playlist deduplication
Before adding songs to the playlist, check if the playlist already
contains the song id.
2010-10-28 08:30:46 -04:00
Bryan Schumaker
4f899c4834 Delete empty cache files
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.
2010-10-27 09:09:18 -04:00
Bryan Schumaker
3a81afdc92 last.fm for album art
Whenever a new song is loaded, we check the cache for album art.  If we
don't have art yet, then we place a request to the last.fm to find an
image.
2010-10-26 22:44:09 -04:00
Bryan Schumaker
657d016017 libsaria/web.py
This file contains a url class designed to make it easy to build up a
url and then place a python urllib2 request.
2010-10-26 22:40:00 -04:00
Bryan Schumaker
e3327093ad libsaria/xm.py
xm.py contains helpful xml parsing functions that we can use for
decoding last.fm requests.
2010-10-26 22:39:04 -04:00
Bryan Schumaker
3b92b00d87 Cache should check for success of func()
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.
2010-10-26 22:33:28 -04:00
Bryan Schumaker
b204743e1b Print iterations
For now, print the number of iterations it takes to choose a song at
random.
2010-10-26 22:30:01 -04:00
Bryan Schumaker
5cf837aee2 Library update
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.
2010-10-25 21:58:18 -04:00
Bryan Schumaker
c35f210369 Playlist random improvements
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.
2010-10-25 20:33:22 -04:00
Bryan Schumaker
43eab40b01 Uninvite functions on error
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.
2010-10-25 09:48:24 -04:00
Bryan Schumaker
b69e790186 Cache attempt to close file
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..
2010-10-25 09:08:14 -04:00
Bryan Schumaker
5c842def01 Generic cache
I have created a generic cache to hold information outside of the
library.  This could include album art or an artist bio.
2010-10-24 17:26:53 -04:00
Bryan Schumaker
4f371987a0 Version strings
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.
2010-10-24 17:22:24 -04:00
Bryan Schumaker
3671b01e84 universal_open bug
After installing a plugin, universal_open() should return rather than
continue on.
2010-10-24 17:12:01 -04:00
Bryan Schumaker
b7efda1d80 Added version variables
libsaria is now known as libsaria version 1.1.
ocarina  is now known as ocarina  version 4.1.
Both are still under development (__dev__ == True)
2010-10-23 20:17:25 -04:00
Bryan Schumaker
9603e4cef0 Forward / Rewind buttons
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.
2010-10-23 15:53:52 -04:00
Bryan Schumaker
f982fab96a More attribute labels
Year, count, length, and length2 labels have been created.  The length2
label adds a "/" before displaying the length of the current song.
2010-10-23 15:35:16 -04:00
Bryan Schumaker
50f7e1203d Score system
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.
2010-10-21 17:11:33 -04:00
Bryan Schumaker
5835f55eb2 Track play count
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%
2010-10-21 12:43:59 -04:00
Bryan Schumaker
6d7b08f921 Random
- Made a random check button to toggle the random preference
- Playlists pick a random song from what is visible
2010-10-21 08:47:10 -04:00
Bryan Schumaker
f1fc5caf07 Bugfixes
data.py: Return after deciding to scan a new library

playlist: refresh during the PREPLISTREFRESH event, not the
POSTPLISTREFRESH event
2010-10-21 07:55:21 -04:00
Bryan Schumaker
bb86a70ae4 Playlist next
The playlist will play the next visible song when the current song ends.
If we have reached the end of the list, we loop back around to the
beginning.
2010-10-20 22:18:41 -04:00
Bryan Schumaker
dc1b6dd4a6 Playlists
I can add songs to a playlist and populate the playlist afterwards (and
on startup).
2010-10-20 21:53:47 -04:00
Bryan Schumaker
02fe6dc8ba Right click menus
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!)
2010-10-20 21:11:12 -04:00
Bryan Schumaker
48d0af571c Collection filtering
I moved filtering from the Library lens to the collection base class
2010-10-20 20:21:11 -04:00
Bryan Schumaker
8f370aa3bd Change all volume buttons
All existing volume buttons must be changed when the volume changes, not
just the one receiving the value-changed signal.
2010-10-20 20:08:21 -04:00
Bryan Schumaker
7b8d2288cd Player volume
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.
2010-10-20 20:04:23 -04:00
Bryan Schumaker
9caa247d04 Collection.find_id(): Check if the result is false. If it is, return
None.  Otherwise, return result[0]
2010-10-20 07:59:08 -04:00
Bryan Schumaker
b45117e761 Don't return list[0] when having the library look up an id 2010-10-19 22:30:57 -04:00
Bryan Schumaker
d56f3b2d0a Multiple changes
- Remove google from the web radio plugin
- Change ocarina.py to use python2
- Seek in song using slider
2010-10-18 21:04:39 -04:00
Bryan Schumaker
ff8d599008 removed print statements 2010-10-18 10:59:00 -04:00
Bryan Schumaker
6a2ec62015 Call pause() at end of each stream 2010-10-18 10:49:48 -04:00
Bryan Schumaker
b85f1ac5c4 Formatting changes to the event error message 2010-10-18 10:12:05 -04:00
Bryan Schumaker
98ded4f032 Progress bar slider movement
The progress bar slider updates every half second as a song plays.
2010-10-16 14:21:25 -04:00
Bryan Schumaker
1da55341d4 Fixed loading of random songs
I fixed loading of songs not in the library by correctly implementing
the path walk function in the DLTree class
2010-10-15 23:12:33 -04:00
Bryan Schumaker
45e2b0325f Filtering improvements
When a list is filtered, if the Nth song is selected we should play song
N in the filtered list and not the original list.
2010-10-14 08:16:13 -04:00
Bryan Schumaker
eb7932fad2 Added the beginnings of a progress bar 2010-10-11 20:48:43 -04:00
Bryan Schumaker
6934974d75 Time strings
During scanning I convert the length into a time string ( "h:mm:ss" ).
This is drawn in the gui when a collection list is populated.
2010-10-11 18:22:05 -04:00
Bryan Schumaker
6c6477b677 Index filtering
I have implemented simple filtering over the library.  This will return
a set of visible songs based on the search pattern.
2010-10-10 23:06:54 -04:00
Bryan Schumaker
168025fb60 Collection Indexing
I can now add songs to a collection's index.  The index only works for
unicode string right now (all others must be converted)
2010-10-10 13:45:52 -04:00
Bryan Schumaker
2c27185679 Use new collection structure to populate the library list. 2010-10-08 13:09:42 -04:00
Bryan Schumaker
adcb73dac9 Have a working doubly-linked tree based library.
I have a bit more to do before I support everything the old library did.
Mostly getattr work.
2010-10-06 23:31:36 -04:00
Bryan Schumaker
ab29b2cb2b More work with collections based on doubly linked trees 2010-10-03 19:00:06 -04:00
Bryan Schumaker
31b470e597 Track tags in another double linked tree. Create a record for each
track linking to each tree.  Create a library filter for creating a
library.
2010-10-01 21:33:19 -04:00
Bryan Schumaker
8221411ca2 Double linked trees
I have begun working on doubly-linked trees for use in collections.
2010-10-01 12:32:24 -04:00
Bryan Schumaker
6609e48d5c Play / Pause / Close tabs
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.
2010-09-13 19:32:13 -04:00
Bryan Schumaker
4a5085d973 File chooser window
I have created my own file chooser window that can select both files and
directories.  Currently, the "OK" button must be clicked to select
anything.
2010-09-12 19:11:37 -04:00
Bryan Schumaker
2f562bcc81 Buttons
Added a button class, and attached play/pause buttons to the bottom of
the window.
2010-08-30 17:57:08 -04:00
Bryan Schumaker
4d41cbfc30 Playlist borders
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.
2010-08-25 08:18:57 -04:00
Bryan Schumaker
c5a7508573 Began bottom pane
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.
2010-08-22 12:40:39 -04:00
Bryan Schumaker
8594c3b330 Collection get_attr() and list hover popup
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.
2010-08-20 19:37:55 -04:00
Bryan Schumaker
304855c10d Use gtk.ListStore.insert
The append function of a ListStore is extremely slow.  Now I use  the
ListStore insert function, and manually track the size of the list
myself.
2010-08-20 08:27:12 -04:00
Bryan Schumaker
15cc5d22f0 Backend and frontend changes
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.
2010-08-19 23:02:30 -04:00
Bryan Schumaker
66a8c5169e Web Radio Plugin
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.
2010-08-15 13:39:31 -04:00
Bryan Schumaker
853dde3ea7 Plugins Install
I can now install plugins through drag and drop / universal open.  For
now, installing plugins involves copying the file to ~/.saria/plugins/.
2010-08-15 01:05:37 -04:00
Bryan Schumaker
7ce3da1a2a Ocarina GUI
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.
2010-08-13 23:58:19 -04:00
Bryan Schumaker
d8cadb83e9 Collection Tree
I have implemented a tree to store store information about each track.
I now support tracks that have the same artist, album, and title.
2010-08-12 22:11:13 -04:00
Bryan Schumaker
71b3289f62 Improved collection indexing
I can now create an index over an entire collection faster.  The
bottleneck is still disk accesses, but I still think this was a good
challenge.
2010-08-12 08:27:21 -04:00
Bryan Schumaker
52b1236b29 Collection work
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.
2010-08-08 14:30:15 -04:00
Bryan Schumaker
25a0d0be9f Added audio functions
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.
2010-08-07 19:39:46 -04:00
Bryan Schumaker
28d23faa5a Created libsaria.startup()
This function should be called to initialize the preferences and
variables dictionary when libsaria is started.  This function triggers
the POSTSTARTUP event.
2010-08-07 14:36:37 -04:00
Bryan Schumaker
57ec240798 Added event system
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
2010-08-07 14:23:50 -04:00