Commit Graph

519 Commits

Author SHA1 Message Date
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
Bryan Schumaker
2fa54e76ac libsaria: Create a parallel queue as a Playlist
My goal is to slowly phase in use of a Playlist class.  This patch
begins this effort by creating the Playlist class and changing the queue
code to load queue.q as a playlist in addition to the queue's hardcoded
list.

Signed-off-by: Bryan Schumake <bjschuma@gmail.com>
2012-02-19 17:17:25 -05:00
Bryan Schumaker
c452af1ce7 libsaria: LoadTasks take an extra argument
I want to pass a playlist argument through during playlist construction,
so I changed the LoadTask to handle it.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:17:25 -05:00
Bryan Schumaker
7a355d1434 libsaria: Remove the SourceModel class
Nothing has used it in a few months, so it can safely be removed.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:17:25 -05:00
Bryan Schumaker
bec76743da libsaria: Call gst_quit()
This gives gstreamer a chance to free anything it's created.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-11 12:57:22 -05:00
Bryan Schumaker
280baa7572 libsaria: Allow different UIs to use a different pipe
The UI now passes in a string to use as the filename.  In addition, I
store the filename and remove it when the application is closed.  If the
pipe already exists, then I return the path without creating a new one.

Pipes will only be removed by the application that creates them.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-08 08:11:13 -05:00
Bryan Schumaker
0aa8b950a9 ocarina: Scroll to saved song
I save the song before refreshing the library so I can scroll back to
it.  This way the user isn't interrupted too much...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-08 08:11:13 -05:00
Bryan Schumaker
362a0697c9 ocarina: Scroll to a songid instead of a Track
I want to store the currently selected row and go back there after a
refresh or a filter.  This allows me to find the current songid and
scroll back to it later.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-08 08:11:13 -05:00
Bryan Schumaker
8623779210 libsaria: Reduce library refreshes during update
The library only needs to refresh if new tracks were found, so don't do
anything if nothing new has been added.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-08 08:11:13 -05:00
Bryan Schumaker
551ae682b5 ocarina: Provide a UI for using ALSA
You can either turn it on or off, and then you can select an output
device from a dropdown list.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
2012-02-08 08:11:13 -05:00
Bryan Schumaker
01288e1a86 Libsaria: Make alsa controls its own thing
I created a new preference for "Using ALSA" that people can set if they
want to use extra alsa features.  This should allow the UI to provide a
dropdown list of outputs that users can select.  Once a UI is in place,
users can play music either on their computer speakers or pipe it out to
their blu ray players (or other device).

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
2012-02-08 08:11:13 -05:00
Bryan Schumaker
56f0e801f5 ocarina: Give each page its own footer
After listening to a long queue, I noticed that there were problems
re-realizing widgets after moving the footer to a different page (the
header might have the same problem?).  I decided to fix this issue by
creating a new footer instance for each notebook page.

If I do the same thing for the page header then I can get rid of the
"move this widget from page X to page Y" logic AND allow pages to use
their own custom header AND allow for separate library and queue
filters.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-08 08:11:13 -05:00
Bryan Schumaker
41467524db ocarina: Listen for text written to a named pipe
If the text is "play", "pause", or "next" then I call the appropriate
libsaria function.  I eventually plan on adding more commands so bash
can act as a generic remote control, but for now this is a good start!

To use:  `echo play > ~/.config/saria[-debug]/saria.pipe` after creating
the fifo (see scripts/makepipe).

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-08 08:11:13 -05:00
Bryan Schumaker
82b9974448 libsaria: Get the path to the pipe file
This will either return the full path to the file or an empty string if
no pipe has been created.
2012-02-08 08:11:13 -05:00
Bryan Schumaker
808927da45 libsaria: Export size of a library path to the UI
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-08 08:11:13 -05:00
Bryan Schumaker
1daa12ee81 libsaria: Create a library path iterator
This makes it easier to loop over all the library paths without needing
to know anything about implementation.  I modified the update functions
to use the new way, so it should be ready for use by the UI.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-08 08:11:13 -05:00
Bryan Schumaker
12b193cc80 libsaria: Move LibraryPath to a global header
I am going to expose this class to the UI so it can directly access
information (size, path, ...).

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-08 08:11:12 -05:00
Bryan Schumaker
3d511a1f19 libsaria: Remove old callback framework
I moved ocarina over to the new system, so the old one can go away now
since it isn't thread safe and nothing uses it anymore.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-08 08:11:12 -05:00
Bryan Schumaker
7150e8bdee libsaria: Prepare for a single callback handler function
Rather than keeping a map of function pointers, I want the UI to
register a single function that takes a callback_t as an argument.  From
there, the UI can decide the best way to handle callback lookups (such
as grabbing a lock before changing anything).  At the very least, a
switch statement or array lookup should be faster than searching a map.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-08 08:11:12 -05:00
Bryan Schumaker
fe7bf9e445 libsaria: Check if a song exists before loading it
This could lead to a segmentation fault if we don't do it...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-07 22:25:13 -05:00
Bryan Schumaker
51e5887971 libsaria: Rename the index rand() function
I found it was calling itself over and over again, rather than calling
the stdlib rand().  This wasn't the desired behavior...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-07 08:47:24 -05:00
Bryan Schumaker
3fa1331303 libsaria: Remove ids from the queue
In case the user changes their mind...
2011-12-30 23:27:15 -05:00
Bryan Schumaker
d655739b77 libsaria: Save queue to disk
This will restore the queue the next time ocarina is started up.
2011-12-30 20:26:36 -05:00
Bryan Schumaker
8a0922c4a1 libsaria: Generic LoadFile() task
This was specific to the library namespace, but I think it makes more
sense to exist as a global class definition that can be reused by
others.
2011-12-30 20:22:47 -05:00
Bryan Schumaker
11e82cccf1 libsaria: Save queue to disk
I save when IDs are added and when a next track is chosen.
2011-12-30 20:02:24 -05:00
Bryan Schumaker
4dac0fe096 libsaria: New current_track() function
Instead of taking a callback function,  I instead find a pointer to the
current track and return this to the caller.
2011-12-30 19:47:13 -05:00
Bryan Schumaker
0ef8e44207 libsaria: Remove unused variable from Track() 2011-12-30 19:46:54 -05:00
Bryan Schumaker
a44ecbb795 libsaria: Remove old readdir() function
It's not used anymore...
2011-12-30 19:15:03 -05:00
Bryan Schumaker
ab0e459298 libsaria: Change track cleanup process
Tracks only need to be unlisted from the library list when they are
manually removed by the user.  Trying to do this during shutdown lead do
a segfault because the library's file_list had already been removed when
I tried to access it.
2011-12-30 16:42:04 -05:00
Bryan Schumaker
2a9900c1e5 libsaria: Tracks remove themselves from the list
This is mostly for when a library path is removed from the list.  Tracks
all remove themselves when destroyed, and then the library can be
refreshed.
2011-12-30 16:05:35 -05:00
Bryan Schumaker
26979eb6a9 libsaria: Track()s add themselves to the index and library
When one is created, it adds itself to the library and index.  Up next:
removing themselves when they are destroyed.
2011-12-30 15:57:14 -05:00
Bryan Schumaker
6b7c3f3d50 libsaria: Use dynamic memory for library tracks
This allows me to create only one Track() instance for each song in the
library.  Before this, a Track() was being created and then copied when
adding new songs to the library.  I thought this was wasteful, so now
each song is only created once.
2011-12-30 15:50:21 -05:00
Bryan Schumaker
02f8dbc6b8 ocarina: Fill queue using iterator functions
I don't need the old for_each method anymore, either.  I remove it using
this patch.
2011-12-29 16:24:54 -05:00
Bryan Schumaker
fe8c1cd580 libsaria: Create iterator functions for the queue 2011-12-29 16:24:33 -05:00
Bryan Schumaker
fb0084c275 libsaria: Remove old play_id() function
Nothing uses it anymore
2011-12-29 15:35:06 -05:00
Bryan Schumaker
8049a7a9fd libsaria: Select songid using libsaria controls.cpp
I do this in the upper level namespace, rather than doing it in the
library, to make use of the play_filepath() function that I already have
written.
2011-12-29 15:32:15 -05:00
Bryan Schumaker
7b78f18e52 libsaria: Remove next() from the queue
I don't need it anymore.
2011-12-29 15:10:00 -05:00