Commit Graph

655 Commits

Author SHA1 Message Date
Bryan Schumaker 5f1fb2290a ocarina: Remove old playlist code
ocarina/playlist/ was the last subdirectory remaining in the ocarina
code, and I can finally remove it.  Thank you GtkBuilder!  At this
point, there is only one ocarina header file, so I move it to the main
ocarina directory.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-05 09:13:47 -04:00
Bryan Schumaker ba9ecd258b ocarina: Pass key presses directly to the playlist
This lets me remove the "if treeview is focused" special cases that keep
popping up in the window keypress handler.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-04 10:17:57 -04:00
Bryan Schumaker 50b4198001 Add a PLAYLIST_DISABLE notification
Disabled playlists are ignored when picking the next song.  I grey-out
the widgets on the UI when this notification is received.  I keep
filtering enabled this time (the entry was disabled too in Ocarina 5.9)

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-04 09:21:02 -04:00
Bryan Schumaker 3bb8053ea2 Add a close button to temporary playlists
I put it on the tab page this time, instead of in the tab label.  I
don't want wide tab labels, so I should eventually come up with a way of
closing playlists without having to change tabs.  Maybe a right-click
menu?

I also noticed that the libsaria delete_playlist() code didn't work, so
I simplified it a bit.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-03 13:34:06 -04:00
Bryan Schumaker e57b2891e6 ocarina: Clean out some unused playlist code
And comment out things I want to keep as reference so that things
compile.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-03 12:40:02 -04:00
Bryan Schumaker c46671b1fb Create a PLAYLIST_GOTO notification
To move the cursor to the current song.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-03 12:14:54 -04:00
Bryan Schumaker 9fb1d05376 Remove PLAYLIST_FILTER notification
It's easier to refilter automatically after setting the filter text,
rather than going through a bunch of function pointers to change the filter.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-03 11:02:46 -04:00
Bryan Schumaker 992539798b ocarina: Unselect rows when pressing the Escape key
The first time Escape is pressed, rows are unselected.  The second time
Escape is pressed, the toplevel window is selected.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-03 09:07:41 -04:00
Bryan Schumaker 9365881cb4 Reorder playlists
The user can drag-and-drop tabs to change their order in the libsaria
playlist deck.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-02 23:39:08 -04:00
Bryan Schumaker 5bce295251 Add a PLAYLIST_DELETE notification
Triggered when a playlist is garbage collected so the UI can remove the
tab.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-02 13:35:48 -04:00
Bryan Schumaker 26e818cc21 Send a PLAYLIST_RENUMBER notification
I do this when playlists are renumbered, I also move tabs around to
match their new numbers.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-02 13:06:18 -04:00
Bryan Schumaker d27a1fb7ba ocarina: Implement switch-to-page-n keyboard shortcut
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-02 12:20:43 -04:00
Bryan Schumaker 5c09db59a6 Create dynamic playlist tabs
Instead of using a "on_new_playlist()" function, I now use the
notification system to tell the gui that a new playlist has been
created.  For now I just put it on the front of the tab list.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-02 12:09:01 -04:00
Bryan Schumaker 370f6a6832 ocarina: Programmatically create tabs
Dynamic playlists are going to need to run the same code to generate
playlist tabs as the static tabs.  Since I don't know how to use
GtkBuilder fragments, instead I write the code for generating each page.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-02 11:11:20 -04:00
Bryan Schumaker 10cdc5248a ocarina: Move some playlist setup to playlist.cpp
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-01 12:35:56 -04:00
Bryan Schumaker 5a4b9df2b2 ocarina: Split playlist.cpp into two files
One for managing the notebook tabs (tabs.cpp) and one for managing a
specific playlist page (playlist.cpp).

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-01 12:21:11 -04:00
Bryan Schumaker e6c44bf1a9 ocarina: Respond to "Return" as a shortcut
I think it'll be useful to change focus to the current treeview through
a shortcut.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-01 10:37:08 -04:00
Bryan Schumaker 5a9f4f4bca ocarina: Add shortcuts for switching directly to a playlist
Since I don't have dynamic playlists re-implemented yet, I just swtch
between the library, recent, and banned playlists.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-01 10:18:46 -04:00
Bryan Schumaker be67f81782 ocarina: Respond to "slash" keypress
This allows easier access to the filter entry, since clicking it is too
slow.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-01 10:04:52 -04:00
Bryan Schumaker 55431421bf ocarina: Reenable some keyboard shortcuts
I have to track if a filter-text entry has focus to do this properly,
otherwise using a shortcut key while searching a playlist will trigger
that shortcut.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-01 09:48:11 -04:00
Bryan Schumaker ad3cbdebff ocarina: Move playlist tabs setup to playlist.cpp
This was in body/playlist.cpp, but I eventually plan on removing this
file so the code I'm using from there needs to be moved somewhere else.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-30 13:58:46 -04:00
Bryan Schumaker a985ff70a9 Create a PLAYLIST_UPDATE notification
This notification is sent when a track in the playlist is updated, such
as when the play count is incremented.  I also remove the
track_updated() functions from the library renderer and ocarina::Playlist.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-30 10:44:48 -04:00
Bryan Schumaker e8fd94cdeb ocarina: Clear out old ocarina::Playlist code
This class is slowly going away, and these functions have already been
reimplemented using my GtkBuilder interface.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-30 09:29:53 -04:00
Bryan Schumaker 69687ac6c6 libsaria: Remove obsolete renderer functions
Dynamic playlists are disabled right now, so I'm making use of this time
to clear out old code.  This patch removes library renderer functions
that have already been reimplemented.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-30 09:28:07 -04:00
Bryan Schumaker e6d9d2a906 ocarina: Remove more obsolete code
Some of this involved commenting out dead code that I want to use for
reference later.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-30 09:16:08 -04:00
Bryan Schumaker 9801e9335b Create an IDLE_ADD notification
Used for setting up g_idle_add().  Without this, banning songs will save
but unbanning them won't.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-29 10:30:56 -04:00
Bryan Schumaker e9f8c34e5a Create a PLAYLIST_RM notification
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-29 10:30:54 -04:00
Bryan Schumaker 7483aa3c4f ocarina: Set length label when tabs are changed
My old code was doing this by looking for widgets getting mapped or
unmapped.  This was stupid, so now I'm using the GtkNotebook switch-page
signal.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-29 10:29:41 -04:00
Bryan Schumaker b8f2ffdf48 Add a LIBRARY_FILTER notification
I also enable filtering on the new library tab.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-26 10:27:40 -04:00
Bryan Schumaker b2e2404741 ocarina: Play songs when double clicking rows
I copied this function from playlist/treeview.cpp since it seemed to be
working well.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-26 09:31:38 -04:00
Bryan Schumaker 8583ac01d9 Add a PLAYLIST_SIZE notification
Used to notify the UI that the playlist size has changed.  Other options
include: Set the size automatically when responding to PLAYLIST_ADD (and
evenutally "PLAYLIST_RM")

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-25 16:15:47 -04:00
Bryan Schumaker 9b6665030a Create a new Library playlist tab
This tab is appended at the end of the notebook, so it looks as if there
are two Library tabs.  I'm going to use notifications and GtkBuilder on
the new tab to remove the PlaylistRenderer and to hopefully make adding
new features easier.  Right now only inserting tracks into the
LibraryPlist works, and I eventually want to remove the LibraryPlist
liststore in favor of a custom treemodel.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-24 08:35:25 -04:00
Bryan Schumaker fc40dd535c libsaria: Create notifications for autopause
- Send one when the pause type changes
- Send another when the pause count changes

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-22 08:04:21 -04:00
Bryan Schumaker 00111fc87b libsaria: Notifications for play and pause events
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-21 18:19:27 -04:00
Bryan Schumaker 9f7d861b77 libsaria: Remove library::Driver
I initially made this class so that multiple front ends could be used at
once and all receive the same notifications.  I see now that this was a
stupid idea, since I only need to keep one list of the library.  My
notify() function does the same stuff without the need for a driver
list.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-21 17:55:27 -04:00
Bryan Schumaker 3c87b9f852 libsaria: Pass an argument for notifications
Any void * will do, or even NULL!  Try to keep notify.h up-to-date with
what argument is passed and please don't send out the same notification
with multiple argument types.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-21 07:56:45 -04:00
Bryan Schumaker db8be5659c libsaria: Add in a simple notification system
Right now it only notifies that an event happened.  I think I should
eventually pass in an additional argument related to the event that
happened.  This will allow me to send out notifications for preferences
or library paths changing.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-20 08:26:38 -04:00
Bryan Schumaker 5d2631d19a ocarina: Implement the "Add Library" button
To add new paths to the library.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-09 08:29:41 -04:00
Bryan Schumaker 97a7edce41 ocarina: Add an update_all() button
Click to update all library paths.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-08 08:22:33 -04:00
Bryan Schumaker 34dd1a1088 ocarina: Show paths in the library
Clicking them doesn't do anything yet, and the buttons are
non-functional as well.  But paths are displayed as they're configured!

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-07 19:29:18 -04:00
Bryan Schumaker aebcfaab45 ocarina: Re-enable automatic pause
I modified the code slightly from what I used to have.  The biggest
difference is changing the counter will always enable automatic pausing,
so I no longer need the extra click to enable this feature.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-05 09:26:47 -04:00
Bryan Schumaker 761842869e ocarina: Show and hide the idle bar
I check the size of the idle queue during the timeout poll and then
enable the progress bar.  When the queue size reaches zero I hide the
bar again.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-04 13:31:47 -04:00
Bryan Schumaker fdecd7bbdf ocarina: Get the progress bar working again
This was easy, just copy over the old code to status.cpp.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-04 11:57:31 -04:00
Bryan Schumaker 4a764fcc8d ocarina: Remove old controls code
This has already been reimplemented in gtk builder.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-03 08:09:03 -04:00
Bryan Schumaker 54d1ff991d ocarina: Set the length label
The length label is part of the gtk builder description.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-03 08:00:08 -04:00
Bryan Schumaker 5a1b8555db ocarina: Clean out old gtk and button code
Now that I'm using gtk builder I don't need gtk convenience functions.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-03 07:52:08 -04:00
Bryan Schumaker 90355962e4 ocarina: Initialize playlists during startup
I plan on replacing the playlist code eventually, but for now I want to
see how everything looks.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-08-01 08:19:31 -04:00
Bryan Schumaker bb56dc4d2a ocarina: Remove idle_add() from the ocarina namespace
It's only used in ocarina.cpp, and it's already static there.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-07-29 16:09:20 -04:00
Bryan Schumaker ff0f4a2c66 ocarina: Add back Title / Artist / Album labels
Using GtkBuilder now...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-07-29 16:04:22 -04:00
Bryan Schumaker 4585d90a32 ocarina: Remove window.h and lots of gtk shortcuts
The shortcuts were hiding more than they probably should have, and I
didn't have much using them.  The only function in window.h that I'm
going to use is init_window(), so I'll just declare it in ocarina.h.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-07-29 15:11:36 -04:00
Bryan Schumaker 1ddcb9f2fc ocarina: Initialize the window from window.cpp
Eventually this will support all the same features of the old ocarina
window...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-07-29 15:01:20 -04:00
Bryan Schumaker 681aa4b611 libsaria: Remove flags from initdata
I wasn't doing anything with these, so they're just getting in the way
and increasing complexity.  This change also allows me to remove the
"enabled" variable from the idle queue.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-07-29 14:31:35 -04:00
Bryan Schumaker bfb00ec812 libsaria: Remove the remove_tracks() function from playlists
It doesn't make sense to keep it around anymore since I have the
single-track removal function.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-07-01 12:02:11 -04:00
Bryan Schumaker 94cbcd9a5d libsaria: Give playlists a remove_track() function
This makes more sense than pushing a single track into a list and then
iterating over the single item...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-07-01 11:38:50 -04:00
Bryan Schumaker 1ba1c72e3f libsaria: Use a flags variable for initdata
I was using multiple boolean fields, but I think it'll be easier to set
up a single bit-flag field instead.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-07-01 11:24:06 -04:00
Bryan Schumaker aed5a023b3 libsaria: Remove second library path list
I kept around the old list while I was converting everything over to the
new list.  Now that I support all the needed features, I can remove the
old variable.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-07-01 11:24:02 -04:00
Bryan Schumaker 250a8b9bfe libsaria: Rename List::last() -> List::end()
To better match C++ iterators.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-06-30 12:08:04 -04:00
Bryan Schumaker e0074525f3 libsaria: Convert the idle queue to use the new list class
- The erase() function returns the previous item
- Implement a push_front() function
- Implement a pop_front() function

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-06-30 11:59:32 -04:00
Bryan Schumaker e2242359d4 libsaria: Create iterators for lists
Not really C++ iterators, but close enough.  I can get the first and
last values values to use in for loops, I also made a next() function
for list items.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-06-30 11:28:12 -04:00
Bryan Schumaker 065feedee2 libsaria: Save tracks using for_each_item()
It's simpler than custom writing my own for each loop...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-06-16 14:51:47 -04:00
Bryan Schumaker bd8cdee041 libsaria: Implement a find_item() for lists
This function takes a function pointer argument that should return
"true" if the current item is the item we're looking for and "false"
otherwise.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-06-16 14:51:45 -04:00
Bryan Schumaker 8b56659b1c libsaria: Created a list for_each_item()
Useful for accessing each item in the list sequentially without having
to write a lot of loops.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-06-16 14:04:55 -04:00
Bryan Schumaker 311e404af9 libsaria: Give Lists a size()
Return the "count" variable and hope we don't have more than
MAX_UNSIGNED_INT objects in the list...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-06-16 13:37:38 -04:00
Bryan Schumaker bf0e340a53 libsaria: Rename ListNode -> ListItem
I like ListItem better.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-06-14 17:48:44 -04:00
Bryan Schumaker 34c13bc93e libsaria: Add items to a List
I free the memory in the destructor, too!  Be careful, though, the copy
constructor isn't actually a copy constructor.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-06-14 17:18:22 -04:00
Bryan Schumaker da776eeebf libsaria: Initialize list objects
I point the list head towards itself.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-06-14 08:11:16 -04:00
Bryan Schumaker 4aac603b85 libsaria: Begin a custom List class
I'm going to gradually replace the stl list with my own implementation.
This should make everything more efficient and I won't have to deal with
those pesky iterators.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-06-13 21:34:45 -04:00
Bryan Schumaker 14fe5661a5 libsaria: Rename List -> Stack
I want to recycle the "class List" name, so I need to free it up from
the playlist code.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-06-13 21:34:44 -04:00
Bryan Schumaker 7cc5cded9f libsaria: Directly set version in version.h
Rather than building it up as part of a function call

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-06-02 12:16:34 -04:00
Bryan Schumaker 80cf0bb28e ocarina: Use files in the lib directory
I copy images and other files to lib/ocarina/ during the build to make
installing easier.  The lib directory should always be relative to the
bin (executable) path, so I can easily find the lib path based on
executable path (/proc/self/exe).

I can also use this to find bugs in the buld process, such as adding a
file to the images/ directory but forgetting to add it as an install
target.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-06-02 10:41:04 -04:00
Bryan Schumaker fbcc660bd6 build: Create a configuration script
Users set values here to be used by the build system.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-28 11:34:37 -04:00
Bryan Schumaker 5f5f23bf9e Build: Create version.h using an Sconscript file
This lets me pull code out of the generic Sconstruct, so it can't be
bad!  I also removed the test directory since I never made unit tests.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-27 10:23:47 -04:00
Bryan Schumaker 4afce6300c Turn off library paths
I set the "visible" field to "false" and then remove each track from the
library playlist.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-23 07:48:10 -04:00
Bryan Schumaker f5181c50b1 libsaria: Fix deck::prev()
Having tracks add themselves to the recent playlist means that it also
adds itself when going backwards through the playlist, resetting the
cur iterator and causing the same 2 songs to be played.  To get around
this, I gave tracks a new load_unlisted() function to load without
adding themselves to the recently played list.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-19 20:48:25 -04:00
Bryan Schumaker 057bce8809 Show last played date on each playlist tab
I like to know when I last listened to a song.

Signed-off-by: Bryan Schumaker <bjchuma@gmail.com>
2012-05-19 20:09:21 -04:00
Bryan Schumaker ca9f3e6cf9 Show the play count in the playlist renderer
I created a new renderer function for updating tracks when they change.
Using this, I can show the new playcount of tracks as it is incremented.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-19 19:47:11 -04:00
Bryan Schumaker 61769f74fd libsaria: Keep a pointer to each playlist a Track is on
Useful for removing them later without having to check every playlist.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-19 19:01:55 -04:00
Bryan Schumaker 77225d4d9f libsaria: Define MAX_PLAYLISTS in a header file
So applications can use this value too.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-19 18:34:30 -04:00
Bryan Schumaker d74d008223 ocarina: Change disable playlist button image
I do this whenever the playlist disabled flag changes.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-18 12:05:03 -04:00
Bryan Schumaker 973b5d3d31 Save playlist disabled status to file
This allows me to restore it when restarting ocarina.  I also need to
notify the renderer that the playlist status has changed so I can change
the button state.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-18 11:51:52 -04:00
Bryan Schumaker 35d71efe58 Disable temporary playlists
When a playlist is disabled I won't pick songs from it until the user
re-enables it.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-18 11:25:51 -04:00
Bryan Schumaker f6cdcae79c ocarina: Create a make_toggle_button_data() function
Used to pass extra data to the toggle function.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-18 11:24:38 -04:00
Bryan Schumaker ed33881a25 ocarina: Created a shortcut for switching to the banned list
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-17 13:31:02 -04:00
Bryan Schumaker 4718bf77f3 Change playlists when the ban button is pressed
I remove the track from the library playlist and add it to the banned
list.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-17 13:15:36 -04:00
Bryan Schumaker bb7a662f92 Ban songs in the library
Right now, this just toggles the "banned" field in the Track class and
then skips to the next track.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-17 13:00:03 -04:00
Bryan Schumaker e8e8589614 libsaria: Add a new field to the Track class
I plan on using this to track if the user has banned a track or not.
This patch introduces the new field and handles the library version
upgrade.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-17 12:30:11 -04:00
Bryan Schumaker ea7b66ae6d libsaria: Read file from pipe
Scripts should write commands to a temporary file and then write the
path to that file to the application pipe.  I can then write results of
the command to this file before exiting.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-17 11:51:36 -04:00
Bryan Schumaker 8f1de2745e libsaria: Create functions for opening and closing pipes
I'm going to use the pipe with shell scripts for remote-controlling
ocarina (possibly through a web interface).

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-15 11:23:47 -04:00
Bryan Schumaker 463cef95dd libsaria: Create an initdata struct for initializing
Passing individual variables through works for a small number of
variables, but passing a struct makes it easier to add new arguments.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-15 11:06:43 -04:00
Bryan Schumaker d0f6996403 libsaria: Remove the list_recent field from tracks
I think it's easier to check if the track has an associated library
path.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-15 10:49:56 -04:00
Bryan Schumaker 34cd70fa39 libsaria: Track play count
I've had a library field for this for a while, but I haven't been using
it.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-15 10:29:26 -04:00
Bryan Schumaker 36bd2c2b66 Reorder playlists in the playlist deck
This allows me to change playback order without having to delete old
playlists and make new ones.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-14 11:21:10 -04:00
Bryan Schumaker 2dd1e362d1 Created a "delete playlist" button
On the libsaria side, I created a function for finding and deleting a
playlist pointer.  On the ocarina side, I added a button to each
playlist tab to remove the tab.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-13 13:48:22 -04:00
Bryan Schumaker d03e38ffbb ocarina: Add a make_button_data() function
Used for passing extra data through the button clicked callback.  I also
use this patch to remove the extra GdkEvent argument passed to buttons,
since this argument isn't actually part of the callback...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-13 13:36:42 -04:00
Bryan Schumaker 5363cfac82 libsaria: Garbage collect the playlist deck
I do this after choosing the next song and after tracks are removed from
each playlist.  This allows me to remove playlists as they empty.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-13 12:09:39 -04:00
Bryan Schumaker 8309c4a606 libsaria: Remove undefined function
I used in a while ago, but it's been removed (but not from the header file).

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-13 11:35:39 -04:00
Bryan Schumaker 4fe9e667f7 libsaria: Almost always add track to the recent list
Before I was only adding tracks that were picked through the
deck::next() function.  Now I have the track add itself to the recent
list (except when I'm playing an outside track).

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-13 11:26:23 -04:00
Bryan Schumaker c3ba90f900 libsaria: Tell tracks if they should play when loaded
This should set the gst pipeline to the correct state when the song is
loaded, rather than pausing after telling it to play.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-13 11:07:00 -04:00
Bryan Schumaker b04aaf3815 libsaria: Restore last song on startup
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-07 08:08:23 -04:00
Bryan Schumaker a8c6aabff7 libsaria: Return new current index from rm_index()
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-14 11:36:29 -04:00
Bryan Schumaker c2c13b2cbc libsaria: Create a single add_tracks() function
Derived classes need to implement a do_add_tracks() function instead so
I have a single place to notify the renderer and save the playlist.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-14 11:16:15 -04:00
Bryan Schumaker 18e0daeb17 ocarina: Remove more commented out and disabled code
- The old header functions
- The old callback header file
- The old shortcut registering system
- The old main() code

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-13 08:22:44 -04:00
Bryan Schumaker 3b705515c2 ocarina: Remove old songlist code
I've been wanting to do this for a long time.  I don't think I need it
anymore, so it can all be safely removed.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-13 08:19:20 -04:00
Bryan Schumaker 0cdd5eff0d libsaria: Remove diff reject file
Where did this come from?

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-13 08:05:40 -04:00
Bryan Schumaker 3287cde11e ocarina: Find selected indicies
Used for removing tracks from temporary playlists.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-13 08:05:01 -04:00
Bryan Schumaker 99757c47f9 libsaria: Remove tracks by index
Because otherwise removing a track will remove all duplicates, too.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-13 08:03:46 -04:00
Bryan Schumaker 97427af922 Create new playlists in front
The "S" or "Q" shortcut will create a new playlist on the front of the
deck, "s" or "q" creates a shortcut on the back of the deck.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-10 08:04:29 -04:00
Bryan Schumaker 898865293d libsaria: Change deck::push() to deck::push_back()
I'm going to create a push_front() function too, so renaming it makes
sense.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-10 07:57:14 -04:00
Bryan Schumaker b2c17bd54a libsaria: Create a get_playlist() function
I don't want to keep creating functions for doing things to playlists.
Instead, I'd rather just get the playlist directly.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-09 08:00:12 -04:00
Bryan Schumaker 851aa10ae1 libsaria: Create generic function for reading numbered directories
I create directories with numbered files for the library and playlist,
this patch creates generic code for reading them during startup.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:20 -04:00
Bryan Schumaker 261316fb5f libsaria: Clean out header files
Remove things that aren't being used anymore.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:20 -04:00
Bryan Schumaker 0d05e14724 libsaria: Reload playlists on startup
I do this in another idle task, I also had to give the library a
function to find tracks based on (libid, trackid).

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:20 -04:00
Bryan Schumaker 60d2e4fcd8 libsaria: Save temporary playlists
I do this whenever the playlist changes (tracks added, removed or
playlist renumbered).  When playlists are deleted I remove the file.  I
also remove the file when new_number < cur_number.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:20 -04:00
Bryan Schumaker 3caea974fe ocarina: Refilter the playlist
I don't change what can play as a result, but at least I can find songs
again!

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:20 -04:00
Bryan Schumaker 235ac70033 libsaria: Move filter code
From index.cpp to filter.cpp.  I also added in an "is_visible()"
function for testing visibility of tracks.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:20 -04:00
Bryan Schumaker 7820b28534 libsaria: Search the index
And notify the renderer to update

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:20 -04:00
Bryan Schumaker 556aad3344 libsaria: Introduce bare Index class
Right now I just add and remove songs from the index as they are added
and removed from the playlist.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:20 -04:00
Bryan Schumaker 2fb2f97a43 libsaria: Fix compile errors
g++ must have gotten updated...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:20 -04:00
Bryan Schumaker dc57109d9e libsaria: Give access to pause_count
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:19 -04:00
Bryan Schumaker 9d271740aa ocarina: Added automatic pause controls
Right now I just pause after the current song, but I eventually plan on
adding controls to pause after N songs.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:19 -04:00
Bryan Schumaker 2cdfbde9be libsaria: Implement pause after N tracks
I keep a counter that is decremented after every call to next().  When
it reaches zero, pause after loading the next song.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:19 -04:00
Bryan Schumaker 31ab70b37d libsaria: Remove tracks from a specific playlist
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:19 -04:00
Bryan Schumaker 659a2208b8 libsaria: Remove files that no longer exist
I scan a library path, do an lstat() and remove the files that can't be
found.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:19 -04:00
Bryan Schumaker a1819dd5f9 libsaria: Only add new files during a library scan
I simply check if the file is already in the library before tagging it.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:19 -04:00
Bryan Schumaker 537dc3a22d ocarina: Support removing library paths
Use the "Delete" key for now.  I also added in using the plus key to add
new paths.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:19 -04:00
Bryan Schumaker 6e97f04e85 libsaria: Remove library paths
- Delete the library file
- Remove tracks from each playlist
- Notify the renderer that tracks have been removed
- Notify library drivers that the path has been removed
- Remove the path from the list

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:19 -04:00
Bryan Schumaker a33e1e6d8d ocarina: Use the playlist number
- Create new notebook page at number
- Show number to left of label

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:19 -04:00
Bryan Schumaker bc800057e0 libsaria: Expand on numbered playlists
- Renumber when new playlists are either added or removed
- Finding nth playlist is much easier now
- Insert new playlists right before the library

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:19 -04:00
Bryan Schumaker 4e046beb20 libsaria: Introduce playlist numbers
To track where in the deck they are.  Displaying and modifying them
comes next...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:19 -04:00
Bryan Schumaker 5194130db4 libsaria: Rename playlist stack to playlist deck
I'm going to make it less stack-ish because I was getting confused.
Turns out people don't think people have a hard time thinking about song
order starting from the end... :-(

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:19 -04:00
Bryan Schumaker c5fe4546e2 libsaria: Format a duration (in seconds)
I turn it into a string "W days, X hours, Y minutes, Z seconds"

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:19 -04:00
Bryan Schumaker fcc48dbccb ocarina: Show the length of the currently visible playlist
I should eventually format this better...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:19 -04:00
Bryan Schumaker e0ebe4c97f libsaria: Track the length of playlists
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker 026b17a6a5 ocarina: Treeview keypresses
To add songs to already-created playlists.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker c6bf52a516 libsaria: Find nth playlist
Gives access to a specific playlist on the stack.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker 6ae25ccdcb libsaria: Created a toggle_play() function
Switches between playing and paused.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker f67cecef0e ocarina: Add some keyboard shortcuts
0 - 9: Switch to playlist N
L / l: Switch to library
R / r: Switch to recent songs
N / n: Play next song
P / p: Play previous song
Escape: Give main window focus

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker 691f74ee10 libsaria: Return nth renderer
Useful for switching to a specific list in the UI

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker 6214136ee3 ocarina: Tab label improvements
- Respond to the renamed() callback
- Right-align / justify labels

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker 2ae050fe47 libsaria: Automatically rename playlists when added or removed
The one on the top is always numbered "0"

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker 5a272ef62e libsaria: Playlists know their own type
Useful for dynamically renaming them (see next patch).

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker 319d68e8d2 ocarina: Scroll to current song
Only on non-draining playlists when that playlist selects a song.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker acef058afa libsaria: Tell playlist renderers to goto a specific index
I want to use this to scroll the library list when a new song is picked.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker 4116cd3ed2 ocarina: Show recent songs playlist
I also needed to add in a change to focus the library by default.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker 3b3beb4625 libsaria: Track recent songs using a playlist
This way people can see what has played recently and directly select
from a list.  Generic playlist classes are awesome!

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker 5dc215d69a libsaria: Created Queue playlist class
This was much easier using inheritance...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker 3f665712a1 Remove empty playlists when picking next song
Hopefully with fewer problems than 5.7 had...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker 15aabfcff0 Create new playlists on the stack
- Only works for new sets
- Set a callback function when created
- Add a right-click menu to the ocarina treeview
- Remove songs from playlist when picking next song

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker 78787d9cf5 libsaria: Play songs from outside the library
Pass in a file path and play!  I even created a button as a notebook
action widget.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:18 -04:00
Bryan Schumaker 297f81213d ocarina: Provide an open file button
To play random songs from the filesystem.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker cb663075bd ocarina: Remove old button generating code and old footer
I now only have a single instance of the control buttons, so the old
code can be removed now.  The footer has been completely replaced by now.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker 2f26e5b869 libsaria: Remove old callback framework
I'm not using it anymore, so it can be removed.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker db3a9f8b02 libsaria: Clean out header files
I removed a lot of commented out code that won't be needed anymore.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker d6eb7ebb35 libsaria: Remove LibPath class
I'm using a simple struct for this now (see library.h).

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker c5a84807be libsaria: Remove InFile and OutFile classes
I do this all through either appdir or Read / Write tasks

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker 47fadb8113 libsaria: Remove IOTask
I have separate read and write tasks now

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker fad3019d83 libsaria: Reload a saved library
And add tracks to the library playlist.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker d0a1b9fdf8 libsaria: Save library
- Change WriteTask() to take an extra void pointer argument
- Pass library path pointer through WriteTask
- Store tracks to file named after library id.
- Remove newline from tags

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker ab687a49bc libsaria: Create library and track counters
I plan on using (library, track) ids as a way of storing playlists.  I
made both counters unsigned ints, since I'm willing to bet that people
won't have 4,294,967,295 songs or library paths...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker ac3964de01 libsaria: Randomly pick next song from library
I'll eventually allow more playlists to be stacked, but for now picking
from the library is easy.  I may eventually add in a way to pick
sequentially from a set.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker 07c365fcc0 libsaria: Add library playlist to to stack
I do this during library::init()

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker 6bae34e487 libsaria: Added stopping
pause() and seek_to(0).  I also added a button in Ocarina.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker 595806ec0f libsaria: Reenabled seeking
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker 70ef389aab libsaria: Find audio position and duration
Used for update a slider in the UI.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker 4f68e6b26d ocarina: Show and hide the play / pause buttons
Based on the current gstreamer state.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker fe76a8d30a libsaria: Add play(), pause() and get_state() functions
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker e3c44146ff ocarina: Show information on the currently playing track
I update it using the main timeout loop, but only if the current track
pointer has changed.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker f1bbbbcc5c libsaria: Play a track using Track::play_now()
It loads and begins playback.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker 5163447638 libsaria: Remove most audio code
It'll be re-added as I review it all.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker a0d509cdff ocarina: Look for double clicking treeview rows
I now have direct access to the track that was selected, so I created a
dummy function to play it (to be filled in soon).

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker 9464e0d33d ocarina: Watch for insert() operations in the Playlist
And update the GtkListStore when we see these calls.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker 6bb3cd38a4 libsaria: Notify playlist renderers when new tracks are added
For sets, I keep a sorted list and merge-sort the new songs.  I also
created insert_prepare() and insert_done() functions to tell the UI that
we are about to insert (this gives me a chance to call the
freeze_child_notify() and thaw_child_notify() in GTK).

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker 50f2f99074 ocarina: Created treeview and liststore
Track information will be stored in these structures.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker abac8883c3 libsaria: Give playlists a name
Right now this must be set when a new playlist is constructed.  I can
eventually change this to use a default name based on what type of
playlist has been created.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker cdd2fe1af5 Add a playlist renderer
The renderer doesn't actually render anything yet, but it is statically
defined in ocarina/playlist.cpp and it will eventually display the
library.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker b1eb47006d libsaria: Move the renderer into the playlist namespace
This makes more sense to me conceptually than having a class called
PlaylistRenderer.  I also commented out a lot of code, so the renderer
doesn't do anything right now.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker 59789ebc85 ocarina: Begin to set up for playlist code
I'm going to re-implement my old SongList class as a PlaylistRenderer,
so for now I create a new directory and a new header file.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker 6d709e3a18 libsaria: Add sorted songs to the Set playlist
I sort the subset of tracks to be added, and then use insertion sort to
add them to the playlist object.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker cfc50cf745 libsaria: Added Set playlist type
I think inheritance is easier than passing a bunch of flags and then
deciding what to do.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker 29cb7f7a47 libsaria: Create a static playlist for the library
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker dfb5c09260 libsaria: Remove most of the playlist class
I'm going to clean it up too, so I've removed everything for now to
slowly re-add later.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker 01d4819d15 libsaria: Add fields for play count and last played date
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker c38eaccf3a libsaria: Find audio information, too
Length, bitrate and various other fields.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker 97a0bb7260 libsaria: Find song file tags
I don't pull out the audio properties yet, but I do find artist, album,
title and everything else that I can.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker 011db26d92 libsaria: Pass library path to Track()
This will eventually be used to determine if the track is visible based
on library path visibility.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker b0c76f4b11 Notify when library paths have been updated
This gives the UI a chance to set the new path or new size.  I also
updated Ocarina to show the library path size in its liststore row.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker 8f666fe10c libsaria: Add new tracks to library paths during update
Right now the Track added is empty, but I'll fill it in soon enough.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker a944869093 libsaria: Clean out the Track class for re-implementation
This also removed the other `typedef sid_t` left in the header file.
I'll re-add in functions and variables as I need them, and hopefully
keep things working more efficiently.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker d77b06f267 libsaria: Remove sid_t type
I was using the sid_t to lookups for tracks and library paths.  I think
I can simplify things by storing pointers in the UI rather than using
id numbers.  This will give me direct access to whatever it is I want to
manipulate.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker f5462da461 Find files to add to the library
I created a new "list_dir()" function to recursively list directory
contents.  I plan on using this to find songs to add to the library, but
it could also be modified to read playlists and library paths in the
appdir.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker 2c830af7fa Create a progress bar for idle tasks
Whenever a task is queued, I increment a counter.  When it is run, I
increment a different counter.  This allows me to track the idle queue
completion percentage.  I also created a progress bar for Ocarina to
display in the toes of the footer.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:15 -04:00
Bryan Schumaker 03d35fee77 libsaria: Only use the library::Driver for notifications
This allows other tools to be written to modify the library of a
currently running program without having to create a library driver
instance.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:15 -04:00
Bryan Schumaker 032caad800 ocarina: Poll for idle queue tasks
I'm going to need a polling loop for the progress bar.  I might as well
only create one poll() function that is used to do everything...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:15 -04:00
Bryan Schumaker 30e2003a27 libsaria: Find library id from inode number
I want to eventually use this to create a library file for each library
path.  The "visible" field will be used to enable and disable different
paths during run time.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:15 -04:00
Bryan Schumaker 4448ba7ce1 libsaria: Turn the library::Renderer into a library::Driver
This will provide a 2-way notification system, rather than just going
from libsaria to the UI.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:15 -04:00
Bryan Schumaker 111e8f2c3b libsaria: Created a library::Renderer class
The UI should inherit from this class to create a driver used to control
the library.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:15 -04:00
Bryan Schumaker ae9074103a libsaria: Create new LibraryPaths
The UI calls the library::add_path() function to create a new
LibraryPath structure to be managed by the library.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:15 -04:00
Bryan Schumaker 7c8ef5508e libsaria: Comment out most of the library
I want to gradually re-add everything and clean it up as I go along.  To
help with this, I comment out the old code so I can use it as a
reference while writing new code.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:15 -04:00
Bryan Schumaker 8f43bf62e4 ocarina: Created footer tabs
I'm going to use a ribbon-ish interface for the footer and work the
settings pages in with the now playing widgets to make things easier to
find.  Right now, I created everything with placeholders.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:15 -04:00
Bryan Schumaker 3d11ea47ba ocarina: Create default content for the window
I'm not using a notebook as the main widget anymore.  I'm also setting
the content directly, rather than getting the widget from the body code
and setting it in the window code.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:15 -04:00
Bryan Schumaker c0df8f2e2b libsaria: Take idle callback func during libsaria init
This allows me to enable the idle queue if the function pointer is not
NULL.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:15 -04:00
Bryan Schumaker 292d237561 libsaria: Idle queue cleanups
To make the code easier to follow and maintain.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:15 -04:00
Bryan Schumaker 84582ae9d8 libsaria: load preferences from disk during startup
This is one of the first things that happens when initializing libsaria.
This also allows me to remove the remaining commented out code from the
preferences file.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:15 -04:00
Bryan Schumaker 06412afeed libsaria: Save preferences in idle task after they change
I made a WriteTask class to use for saving files.  This allows me to
create a file in the appdir and write out the new preferences if they've
changed.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:14 -04:00
Bryan Schumaker a0da654fc6 ocarina: Resize window to match preference
I initialize the window size preferences to (800, 600) and then resize
the window to match.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:14 -04:00
Bryan Schumaker 3c19e4a3d9 ocarina: set window title and icon
I do this from the window init function using default values, rather
than pass it as a parameter to the init function.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:14 -04:00
Bryan Schumaker 698d449c34 vers_str() needs to be static inline
Otherwise we could possibly have multiple definitions of it.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:14 -04:00
Bryan Schumaker 5817effdde ocarina: Fix up include files and begin new window code
I combined the ocarina.h and gtk.h header files into one single file.  I
also began writing new window managing code under a window namespace for
code separation.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:14 -04:00
Bryan Schumaker 95cc9d272f libsaria: Begin appdir code
I'm going to replace my old path lookup code with something designed
around accessing files in a pre-set directory.  I'm also moving back to
putting files in the home diretory, rather than the XDG_CONFIG directory.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:14 -04:00
Bryan Schumaker 02740d1feb libsaria: Remove initflags and comment out init() functions
Instead, I pass a string with the name of the application being run.
This will be used to have separate applications using libsaria.

This commit also comments out most of the libsaria and ocarina init
functions until I can revise and clean up everything.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:14 -04:00
Bryan Schumaker 933fc308e6 libsaria: Variables in version.h should be static
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:14 -04:00
Bryan Schumaker d764489e89 libsaria: Create init flags
I eventually plan on creating more cpp binaries that link with libsaria
for pipe actions and other things.  It's helpful to only initialize the
parts of libsaria that I intend to use.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:14 -04: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 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 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 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 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 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 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 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
Bryan Schumaker 356f6c0465 libsaria: Add ids to the queue playlist
I could read the queue file, but that doesn't help me add new songs...

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