Commit Graph

25 Commits

Author SHA1 Message Date
Anna Schumaker b8b215be35 deck: Save and restore the playlist deck
The read and write functions will be called by a higher up layer, so I
need to open the file manually in the test.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker 0c01751946 playlist: Implement next()
Random and sequential next, for both locked and unlocked playlists.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker 168f08392d playlist: Implement read() and write()
The file will be passed in by the deck layer, since it stores multiple
files.  I just fake up a file in test_2() that is used for storing the
playlist.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker 3a478ddba7 playlist: Implement playlist modification functions
I can now add and remove tracks, in addition to asking for the playlist
size.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker 2d13b74c12 playlist: Create the initial playlist class
Right now it just knows the value of its flags variable.  More to come
soon!

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Bryan Schumaker 101648dc0a Remove old include files
I'm going to replace them with new files for Ocarina 6.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2014-04-06 19:56:51 -04:00
Bryan Schumaker 8f7a610d6d libsaria: Remove DataState optimization
It made sense at the time, but I'm not convinced the added complexity is
actually worth it.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2014-04-06 19:56:50 -04:00
Bryan Schumaker 3a486082af libsaria: Move recent playlist to the new deck file
I also created a new playlist flag for unique playlists so I don't need
to handle this elsewhere.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-11-18 11:45:10 -05:00
Bryan Schumaker b091df8ec4 libsaria: Load playlists to a new playlist_deck vector
The vector should be simpler than a linked list for tracking playlists.
I also changed reading playlists to use a function in the playlist class
rather than a function outside of the playlist.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-11-18 11:15:18 -05:00
Bryan Schumaker 33c80788b8 libsaria: Rewrite playlist filtering
I used to use my own inverted index implementation, which makes sense if
I'm searching all songs for a specific match.  Instead, GTK was visiting
each track and asking "does this song match?" and this requires a
different implementation.  So rather than make an index, instead I have
each track generate substrings for its tags and then I compare filter
text against the substring set.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-11-04 09:17:22 -05:00
Bryan Schumaker f65416ed2c libsaria: Clean up playlist header file
There was an undefined function and an unused protected section.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-11-03 23:14:36 -04:00
Bryan Schumaker e1930b0c88 libsaria: Create functions for checking and setting flags
I also replace a few PLAYLIST_* notifications with a generic
PLAYLIST_CHANGED notification for when small changes occur.  I think
that using set_flag() and check_flag() will make code cleaner and easier
to maintain.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-11-03 22:58:26 -04:00
Bryan Schumaker e116025754 libsaria: Fix playlist bulk insert
My "insert while sorted" code was getting complicated, and didn't send
all the notifications to the UI (only the first ~1200 songs were
displayed).  This patch both simplifies the code and produces the right
answer without a noticable performance penalty.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-11-03 21:43:52 -04:00
Bryan Schumaker d345d3211f libsaria: Remove the old remove_track_it() function
I can make this simplier by simply passing the index into the vector,
rather than needing to calculate the iterator and pass the index.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-11-03 17:03:16 -04:00
Bryan Schumaker 52c09ddb12 libsaria: Don't track playlist length
There is no reason to track this on my own, iterating over all tracks
and calculating it on the fly is easier and basically unnoticable.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-11-03 15:59:54 -04:00
Bryan Schumaker d9e343895c libsaria: Clean up picking the next song from a playlist
I don't need to iterate through a linked list to find the track anymore.
Instead, I can access tracks directly using an index.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-11-03 15:36:09 -04:00
Bryan Schumaker cf8ded7d5d libsaria: Remove name field from playlists
I know what playlists are library, recent and banned.  All others are
just named "Playlist" so there is no need to set up a name variable.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-11-03 15:34:13 -04:00
Bryan Schumaker b98373c0fa libsaria: Convert Playlist class to use a vector
Vectors are more straightforward than linked lists and they should allow
me to clean up the code a lot.  For now I just put in the straight
conversion, I'll clean things up in future patches.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-11-02 23:00:20 -04:00
Bryan Schumaker c67222ab95 libsaria: Remove remaining PlaylistRenderer code
I didn't realize this was still around.  It should be removed since I
switched to a notification system instead of using the renderer.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-11-02 21:43:32 -04:00
Bryan Schumaker 9933b31353 libsaria: Sort the playlist when setting PL_SORT
Otherwise the flag seems to have no effect until new songs are added.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-17 08:16:59 -04:00
Bryan Schumaker bf5b8a3bdd libsaria: Remove PlaylistType in favor of flags
Flags let me manually set properties after the playlist has been
created, rather than needing to decide upfront with no way of converting
to something else.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-14 20:25:09 -04:00
Bryan Schumaker a730eaa2cc libsaria: Remove other playlist types
They were nice for queue vs set, but I'd rather just reintroduce the
random button.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-14 16:55:02 -04:00
Bryan Schumaker 64b5b78a42 libsaria: Move the next() function into the Playlist class
I plan on removing the extra playlist classes to simplify code a bit, so
this function needs to be implemented for everything.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-14 16:38:33 -04:00
Bryan Schumaker 0600556ca4 libsaria: Replace add_track() and friends
I created simpler functions using the push_front() / push_back() names
that stl uses.  If we're a set-type playlist, then call the
insert_sorted function instead.  I also remove unnecessary bulk-inserts
of a single track.  Packing and unpacking a list each time seems stupid.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-14 16:22:50 -04:00
Bryan Schumaker 258875bdb8 libsaria: Move header files out of include/libsaria/
Ocarina no longer has a header file subdirectory so there is no reason
to have a libsaria subdirectory anymore.  Putting header files directly
in the include/ directory is a bit simpler.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-12 08:15:31 -04:00