I only have one application so there is no point in having a way to
create multiple application directories.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
I was keeping a vector of objects, and then pass pointers to these
objects around everywhere. HOWEVER, when vectors are resized they
allocate new memory and copy things over invalidating iterators and
pointers to the original objects. This can cause memory corruption
issues when I try to use a pointer to an object that no longer exists.
The simple solution? Allocate tracks dynamically and then store the
pointer in the library path.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
I want to remove the various idle task types that have built up and
replace everything with a single idle type. I also want the idle layer
to be the only place new tasks are allocated.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
Now that I'm using vectors for everything I don't need to maintain my
own class. Nothing uses it now, so it can be safely removed.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
For each library path, I replace the linked list with a vector allowing
me to easily index into the list to find tracks.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
The vector should be simpler than a linked list for tracking playlists.
I also changed reading playlists to use a function in the playlist class
rather than a function outside of the playlist.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
I'm going to gradually move this out of the playlist/ directory since it
doesn't really belong there. I also plan on cleaning up / rewriting
much of the code as I go along.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
I plan on removing this class in favor STL classes. I probably
shouldn't have even tried to implement this myself...
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
Most of this was commented out and hasn't been used in almost a year.
The new gstreamer code doesn't have the property probe feature anymore,
so I can't reimplement my old alsa code. I'll drop it for now and
figure it out later (after cleaning up this other code).
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
I used to use my own inverted index implementation, which makes sense if
I'm searching all songs for a specific match. Instead, GTK was visiting
each track and asking "does this song match?" and this requires a
different implementation. So rather than make an index, instead I have
each track generate substrings for its tags and then I compare filter
text against the substring set.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
I also replace a few PLAYLIST_* notifications with a generic
PLAYLIST_CHANGED notification for when small changes occur. I think
that using set_flag() and check_flag() will make code cleaner and easier
to maintain.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
My "insert while sorted" code was getting complicated, and didn't send
all the notifications to the UI (only the first ~1200 songs were
displayed). This patch both simplifies the code and produces the right
answer without a noticable performance penalty.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
I can make this simplier by simply passing the index into the vector,
rather than needing to calculate the iterator and pass the index.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
There is no reason to track this on my own, iterating over all tracks
and calculating it on the fly is easier and basically unnoticable.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
I don't need to iterate through a linked list to find the track anymore.
Instead, I can access tracks directly using an index.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
I know what playlists are library, recent and banned. All others are
just named "Playlist" so there is no need to set up a name variable.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
Vectors are more straightforward than linked lists and they should allow
me to clean up the code a lot. For now I just put in the straight
conversion, I'll clean things up in future patches.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
I didn't realize this was still around. It should be removed since I
switched to a notification system instead of using the renderer.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This finishes the job I started in the last commit. Once again, I use
an enum of string properties to determine the right field to return.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
Rathen than using a bunch of get_PROPERTY_NAME() functions, I think it's
cleaner to use dictionary-like indexing to access properties. This
patch converts most track access functions, but I haven't gotten around
to strings yet.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
Rather than hardcode this as a flag, if I set this through the
preferences code users can change the value.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
Flags let me manually set properties after the playlist has been
created, rather than needing to decide upfront with no way of converting
to something else.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
I plan on removing the extra playlist classes to simplify code a bit, so
this function needs to be implemented for everything.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
I created simpler functions using the push_front() / push_back() names
that stl uses. If we're a set-type playlist, then call the
insert_sorted function instead. I also remove unnecessary bulk-inserts
of a single track. Packing and unpacking a list each time seems stupid.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
- Read a command from the pipe, rather than reading a file with a
command in it.
- Use a single ocarina script for all commands, rather than several two
line scripts.
- Change ocarina.bin to point to ocarina instead of ocarina-player for
convenience.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
The build system hadn't been touched in a while, so it needed some
cleaning up. I moved ocarina-specific files into the ocarina/ directory
and use the ocarina/Sconscript to set up build commands.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This was old code that had been replaced by fs.cpp months ago. I must
have forgotten about removing the rest of it...
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
Ocarina no longer has a header file subdirectory so there is no reason
to have a libsaria subdirectory anymore. Putting header files directly
in the include/ directory is a bit simpler.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
I was trying to add an empty list, rather than track items. This caused
the library count to increase (on the library path tab), but the library
playlist was never given track pointers so you had to restart ocarina to
see songs.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
I have notifications to handle everything the renderer used to do, and
I've removed it from the UI side.
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
- 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>
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>
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>
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>
- 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>