Commit Graph

1490 Commits

Author SHA1 Message Date
Bryan Schumaker
af2d4833fa Begin Ocarina 5.8 2012-04-07 10:01:14 -04:00
Bryan Schumaker
db00eb0908 libsaria: Include missing header file
This was needed for unlink()

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:00:05 -04:00
Bryan Schumaker
696da607ba Ocarina 5.7-rc 2012-03-06 08:12:51 -05:00
Bryan Schumaker
37bcb47de2 libsaria: Check the top of the stack through a function
The UI shortcuts may remove songs from the queue with no way of
notifying the stack layer.  The UI should call the stack_top_pop()
function to check if the top playlist is empty and ready for removal.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-03-05 08:23:00 -05:00
Bryan Schumaker
ed3254813c libsaria: Playlist tells renderer where to insert tracks
Now renderers don't need to track this on their own, and renderers will
update as tracks are added.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-03-05 07:47:55 -05:00
Bryan Schumaker
3c423e986a libsaria: Load playlists on startup
I removed this in a previous patch by accident, but I fixed it now.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-03-04 10:29:39 -05:00
Bryan Schumaker
981b64a635 libsaira: Pass a flag if renderers should be deleted
Not all renderers are created dynamically, so I made a way of telling
the playlist system if renderers should be deleted.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-03-04 10:13:44 -05:00
Bryan Schumaker
dd5e73a2ba libsaria: Delete playlists and renderers when popped
This allows dynamic memory to be freed when we are done using it.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-03-04 10:02:03 -05:00
Bryan Schumaker
83897633ce Dynamically allocate queue playlists
I only allow one queue instance right now, but this allows me to remove
the queue directory since it is no longer needed.  I also removed the
QUEUE_REFRESH callback since all this is handled through the libsaria
playlist code.  All that's left is reloading saved playlists on startup.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-03-03 14:19:33 -05:00
Bryan Schumaker
d7725d9068 ocarina: Allocate SongLists when they are needed
Right now it's just for a single queue, but I should be able to expand
this once I enable more stacking in the backend.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-03-02 08:09:35 -05:00
Bryan Schumaker
c23c4a2740 ocarina: Add tabs from Songlist init()
If Songlists manage this, then I can have them remove their pages
through on_playlist_empty().

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-28 08:16:25 -05:00
Bryan Schumaker
ef62f5d2b0 libsaria: Alert the PlaylistRenderer when the playlist becomes empty
This allows for bookkeeping and other cleanup (schedule playlist
removal, remove from UI, and so on).

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-28 08:16:23 -05:00
Bryan Schumaker
d41c64c798 ocarina: Remove the Page class
This patch does two things.  First, I remove the Page class and let each
notebook page manage itself.  Second, I created functions to add the
header and footer to a GtkWidget and then prepend the page in the
notebook (so it adds pages as if it was a stack).

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-27 11:31:33 -05:00
Bryan Schumaker
b7e1c2c631 libsaria: Create a Playlist stack
My goal is to eventually pick songs from whatever is on top of the
playlist stack.  Right now, only the library is added and no songs are
picked.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-25 17:21:19 -05:00
Bryan Schumaker
8d50e63df2 libsaria: Remove refresh() after picking next queued song
Unfortunately, this doesn't hide the queue when empty anymore.  I
probably won't see this behavior again until I create the stack.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-25 14:04:31 -05:00
Bryan Schumaker
e03dfb33b8 libsaria: Remove indices from the queue
This replaces the "remove id" ability and replaces it with a "remove
index" ability.  Removing an index will remove the correct song in the
case that the same song has been added multiple times.  I also modified
the UI to remove rows at a specific index.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-25 13:50:56 -05:00
Bryan Schumaker
6637a82573 ocarina: Remove the SongListFuncs struct
I can get everything I need using playlists and renderers, so I can
safely remove this bit of code (I never really liked it anyway...).  I
have to keep around the queue::size() function for a little bit longer,
since choosing the next song still uses it.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-25 10:52:35 -05:00
Bryan Schumaker
f7d7589882 libsaria: Remove library and queue iterator functions
I don't need these now that I have playlist renderers, so I might as
well rip out the code while I'm thinking about it.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-25 10:11:26 -05:00
Bryan Schumaker
4ebfd8a33b libsaria: Use a tighter loop to fill in the playlist
Rather than exposing iterator functions, I now have a function to walk
the playlist and call the renderer insert() function for each track.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-25 10:04:19 -05:00
Bryan Schumaker
055f349cd1 libsaria: Playlist knows about the renderer
I plan on using this to fill in each playlist instead of using my
current iterator system.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-25 09:50:35 -05:00
Bryan Schumaker
f795af5d6c libsaria: Created a playlist renderer
This class will be given a Playlist and will be in charge of calling
Playlist functions.  I eventually plan on expanding this to allow the
playlist to call renderer functions instead of using my current callback
system.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-25 09:45:27 -05:00
Bryan Schumaker
d8b6f5b0a0 libsaria: Queue size uses apparent_size()
I don't have filtering enabled right now, but I may change my mind in
the future.  Might as well prepare now...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-24 09:44:37 -05:00
Bryan Schumaker
4ee79d8385 libsaria: Always load the library first
Other playlists need this, so it makes sense to queue this up first.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-24 09:36:14 -05:00
Bryan Schumaker
3472aec5bf libsaria: Save idl_task to filename
This was hardcoded to "queue.q"

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-24 09:35:44 -05:00
Bryan Schumaker
98573bf3a9 libsaria: Create a function for reloading a playlist
I don't think I'll need this once I implement dynamic, stackable
playlists, but for now I need a way of scheduling the idle task.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-24 09:34:18 -05:00
Bryan Schumaker
f3abd0cbc6 libsaria: Fix sequential_next()
the while(true) created a state where the loop never ended.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-24 09:26:25 -05:00
Bryan Schumaker
aaeb4d8fba libsaria: Replace SaveTask and LoadTask
I put in a generic IOTask function.  I'm sure this could eventually be
expanded to open and pass the appropriate stream to functions using this
task.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-23 09:57:52 -05:00
Bryan Schumaker
a9abe28d84 libsaria: Don't choose a random song if none are visible
This lead to a floating point exception and crashed Ocarina.  Oops...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-23 09:31:10 -05:00
Bryan Schumaker
b5339f8688 libsaria: Remove the library/list subdirectory
I moved all the functions into a single file and bumped that file up one
directory.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-23 09:26:02 -05:00
Bryan Schumaker
8a52471c95 libsaria: Remove the old library track list
I've completely replaced it with a Playlist now.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-23 09:17:54 -05:00
Bryan Schumaker
b46a4e38ac libsaria: Check random preference in some cases
If both PL_RANDOM and PL_SEQUENTIAL are enabled, then I want to check
the random preference to determine what to do.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-23 09:15:04 -05:00
Bryan Schumaker
d902de95cc libsaria: Pick a random song from the playlist
I do this if PL_RANDOM is set before checking PL_SEQUENTIAL.  I still
need to respond to the case that both flags are set...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-22 10:10:17 -05:00
Bryan Schumaker
d075773682 libsaria: Give playlists an apparent_size() function
This will return the number of visible songs, instead of the number of
songs in the playlist.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-22 10:03:40 -05:00
Bryan Schumaker
9980f53f63 libsaria: Iterate past invisible songs when choosing next
If the PL_FILTER flag is enabled, then we skip songs that aren't
currenly visible.
2012-02-21 10:05:45 -05:00
Bryan Schumaker
c8ad4371d6 libsaria: Added playlist flags and improved next()
The improved next() function will increment the current iterator to the
next visible song.  If no songs are visible, then it moves to the next
song on the list.  The PL_DRAIN flags is then checked, and if draining
is enabled then the current track is removed from the list before
returning.

This patch also switches over the library sequential next function to
use the lib_playlist version.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-21 09:47:23 -05:00
Bryan Schumaker
8b9457a8d0 libsaria: Remove library::find_filepath()
I can do this easier with library::lookup() since this avoids having to
loop on the entire track_list.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-20 10:02:56 -05:00
Bryan Schumaker
cc224376fa libsaria: Replace library::get_info()
get_info() performed a loop over all library paths and over each track
in each path to find the requested sid_t.  I now keep a map sid_t ->
Track * to make finding the track easier and faster.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-20 09:44:57 -05:00
Bryan Schumaker
8069144e87 libsaria: Get library size from the library playlist
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-20 09:22:47 -05:00
Bryan Schumaker
8af182fac9 libsaria: Change playlists to a list of Track pointers
This allows more direct access to each item in the list.  It also speeds
up sorting, since I don't need to keep looking up the same tracks over
and over again in the library.

Siged-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:58:23 -05:00
Bryan Schumaker
7b6ecfdd99 libsaria: Sort the Playlist
I do this whenever the sort() function is called.  I eventually want a
more automatic way of doing this, so I expect the function won't exist
for long.
2012-02-19 17:47:29 -05:00
Bryan Schumaker
f352952924 libsaria: Add and remove individual tracks to a playlist
I can easily get the sid_t out of the Track pointer, so I might as well
allow this for now...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:37:04 -05:00
Bryan Schumaker
e52e6ae3b0 libsaria: Don't require filename when creating a Playlist
A Playlist created without a filename will sever be loaded or saved.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:28:13 -05:00
Bryan Schumaker
7a272e35f5 libsaria: Create load and save functions in the Playlist
These create and schedule idle tasks that perform the actual loading or
saving.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:17:26 -05:00
Bryan Schumaker
2813481dff libsaria: Remove old queue code
With Playlists this code is no longer needed.  I'll remove more of this
code once I've updated the UI.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:17:26 -05:00
Bryan Schumaker
57c8fcf030 libsaria: Save a playlist whenever it changes
With this change, my old queue code no longer saves itself.  Instead, it
only sends out QUEUE_REFRESH notifications.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:17:25 -05:00
Bryan Schumaker
00274a836f libsaria: SaveTasks take an extra argument
I want to pass a Playlist through to save a changing playlist.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:17:25 -05:00
Bryan Schumaker
83e3fa4b24 libsaria: Pick next song from the Playlist
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:17:25 -05:00
Bryan Schumaker
95aa5802cd libsaria: Remove ids from a playlist
Note that this follows the broken implementation used by the queue.  It
will remove all ids with the given values rather than the ones at a
specifix index.  This will be fixed later when I update the UI to make
it Playlist-aware.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:17:25 -05:00
Bryan Schumaker
7aca058254 libsaria: Give Playlists a size() function
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:17:25 -05:00
Bryan Schumaker
6866200e42 libsaria: Implement playlist iterators
I replace the old queue iterator functions with calls to the queue
playlist object that way I don't need to modify the UI.  This creates a
common iterator that can be used by all playlists.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:17:25 -05:00