Commit Graph

67 Commits

Author SHA1 Message Date
Bryan Schumaker
bcacfafa36 find attr filepath correctly
The attribute filepath is easier now that I can walk a fs_tree backwards
and get a path back.
2010-11-11 22:47:53 -05:00
Bryan Schumaker
0af81adbcd 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-11-11 22:46:17 -05:00
Bryan Schumaker
b8eb1817b7 Library indexing
I can now add artist / album / title of each song to an index in the
library.
2010-11-11 08:21:01 -05:00
Bryan Schumaker
6ac2abda27 Library get_attr values
We should walk the tag values bacwards, rather than using the normal
walk_backwards function.
2010-11-10 22:52:50 -05:00
Bryan Schumaker
cd78355b74 Tags in DLValTree
I store the tags in a doubly-linked value tree from now on.
2010-11-10 22:47:01 -05:00
Bryan Schumaker
e7d9ff897d 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-11-10 21:33:15 -05:00
Bryan Schumaker
52da8984c3 Add track fields
Tracks need a playcount and a score in addition to all other fields.
2010-11-10 08:21:03 -05:00
Bryan Schumaker
afd145efd7 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-11-09 23:26:13 -05:00
Bryan Schumaker
0e2898a0f6 Add Track class
This class will be used to store metadata about each song (year, length,
genre ...)
2010-11-09 23:24:49 -05:00
Bryan Schumaker
efa680af19 Library scanning work
I have continued work on library scanning.
2010-11-09 20:08:44 -05:00
Bryan Schumaker
b1ae9fd878 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-11-09 13:58:28 -05:00
Bryan Schumaker
5cf8e8e639 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-11-08 22:47:31 -05:00
Bryan Schumaker
511fb83b0e Remove whitespace 2010-11-08 22:41:43 -05:00
Bryan Schumaker
c364fdf5d1 Remove get_attr
This removes get_attr() as a library function (use get_attrs() instead)
2010-11-08 22:19:23 -05:00
Bryan Schumaker
c5dccdfcdf Use get_attrs
This changes various parts of ocarina / libsaria to use get_attrs()
instead of get_attr().
2010-11-08 22:18:12 -05:00
Bryan Schumaker
7f5d0cd458 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-11-08 22:15:49 -05:00
Bryan Schumaker
a9b5324889 Rename libsaria.music
I decided that libsaria.music should be known as libsaria.audio.  It
makes more sense to me.
2010-11-08 20:58:33 -05:00
Bryan Schumaker
b7559e7864 Added 'art' to library attrs
This attribute will return the path to the cached album art for the
song.
2010-11-07 16:56:02 -05:00
Bryan Schumaker
a40fc0d4ec Playlist filtering
The new playlist module can be filtered again.
2010-11-07 09:40:39 -05:00
Bryan Schumaker
73de67f386 New playlist module
The playlist should be a standalone module rather than inheriting from
the same base class as the library.
2010-11-07 09:15:15 -05:00
Bryan Schumaker
0157d2bcf3 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-11-06 13:53:43 -04:00
Bryan Schumaker
85e85129f8 New library filtering
The new library module can filter songs
2010-11-06 13:49:52 -04:00
Bryan Schumaker
3cece3826f Library play_id()
I have moved over the play_id function to the library module.
2010-11-06 00:52:33 -04:00
Bryan Schumaker
58ad3c7a9d 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-11-05 21:52:10 -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
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
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
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
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
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
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
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
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
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