Commit Graph

54 Commits

Author SHA1 Message Date
Bryan Schumaker a730eaa2cc libsaria: Remove other playlist types
They were nice for queue vs set, but I'd rather just reintroduce the
random button.

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

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-12 08:15:31 -04:00
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 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 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 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 4ef59da4dd libsaria: Remove more dead library code
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 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 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 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 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 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 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 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 d6c48ca177 libsaria: Add the library path to the libsaria namespace
I want to move it to a global header file, so it needs to be added to
the libsaria namespace.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-08 08:11:12 -05:00
Bryan Schumaker 180707a6c2 libsaria: Remove redundant code
Nothing needs to call this function anymore.  I also cleaned up the
header file a bit.
2011-12-29 22:08:53 -05:00
Bryan Schumaker dbeb2981d4 libsaria: Move update code to path subdir
This keeps it all together and makes editing the library less confusing.
2011-12-29 21:12:27 -05:00
Bryan Schumaker 995a372a6e libsaria: Library code can access the path_list directly
This makes more sense than using an accessor function.  Nothing outside
the library can use this variable, so there shouldn't be other problems.
2011-12-29 20:37:05 -05:00
Bryan Schumaker fe8a293377 libsaria: Move library's LoadTask() to file.cpp
This is the only place it's used, so it makes sense to define it there.
2011-12-29 20:31:54 -05:00
Bryan Schumaker 9da577daa0 libsaria: Begin moving LibraryPath class to subdirectory
I think it'll be easier to work with if it is self-contained in a
subdirectory.  Otherwise it's too mixed in with the library code to be
maintainable.
2011-12-29 20:27:04 -05:00
Bryan Schumaker 3749b56bfd libsaria: Remove old list file
I've completely replaced it with my new list now.
2011-12-29 15:47:11 -05:00
Bryan Schumaker 0fa608c90f libsaria: Sort the new playlist after reading
Otherwise it won't be useful...
2011-12-28 23:04:41 -05:00
Bryan Schumaker 2effa26b32 libsaria: Began new playlist namespace
It'll exist in parallel to the current list for now.  I'll remove the
old one once the new one has all the same features.
2011-12-28 22:25:55 -05:00
Bryan Schumaker 26a18f331e libsaria: Remove old index code
It has been replaced with my new index.
2011-12-27 22:42:50 -05:00
Bryan Schumaker a74cea2e71 libsaria: Remove old TrackTag() class
It was basically a layer of misdirection that made it harder to use
Tracks.  The Track() class now does everything that the TrackTag() one
did.
2011-12-26 12:14:25 -05:00
Bryan Schumaker 5f20899b14 libsaria: Remove references to ino_t
I want to use sid_t instead.  It's more obvious what it's used for.
2011-12-25 23:29:35 -05:00
Bryan Schumaker a14cedc942 libsaria: Choose songs after filtering
Songs are only picked from the set of visible songs after filtering.
2011-12-11 15:46:35 -05:00
Bryan Schumaker f0decd07d6 libsaria: Load library through an idle task
This allows me to draw the UI first and load the library once that has
finished.  This should make Ocarina feel more responsive.
2011-11-13 13:44:45 -05:00
Bryan Schumaker b36def4c08 libsaria: Change library size when filtered
I return the number of visible songs, so if the user has entered a
filter string then I return the size of the results set.  If we're not
filtered then I return the size of the playlist.
2011-11-13 12:21:00 -05:00
Bryan Schumaker d5df6e134b libsaria: Build the substring index
This is an index of every substring in the (artist, album, title) tags
of the library.  This should be easier to work with than regular
expression based filtering since I don't need to compare every key with
every search term.
2011-11-13 09:48:50 -05:00
Bryan Schumaker 7fc4e22795 libsaria: Call a dummy index function for each TrackTag
This function takes an inode and word list.  Soon it will add each
substring to an index.
2011-11-12 19:31:42 -05:00
Bryan Schumaker ef36c58e96 libsaria: Create an IdleTask for indexing the library
Right now this will only be triggered when the library is loaded from
disk.  Once I get farther I can easily create a function to index a
track as it is added to the library (so I won't need to reindex
everything during this case)
2011-11-12 14:25:32 -05:00
Bryan Schumaker 4f2c75499f libsaria: Clean up LibraryPath class
I moved around some code and removed undefined functions
2011-11-06 13:39:14 -05:00
Bryan Schumaker 5b2e0c7b82 libsaria: Fill a SourceModel from the play_list
Looping over a single list is really easy and straightforward!
2011-11-06 12:44:14 -05:00
Bryan Schumaker 637ea47a60 libsaria: Insert all tracks into one giant list
This puts everything in one place for easy use (I hope)
2011-11-06 12:34:41 -05:00
Bryan Schumaker b55ac22866 libsaria: Introduce a rebuild_list() function
I am going to create a play list in memory based on the state of the
library.  To do this, I first need a way to trigger construction of a
list.
2011-11-06 12:16:54 -05:00
Bryan Schumaker 7507955018 libsaria: Fix bug in updating library
I was readding all tracks to the new linked list, rather than checking
if the track existed first.  This has been fixed.
2011-11-06 12:11:31 -05:00
Bryan Schumaker 297c0637ea libsaria: Rename path list accessor functions
I added these functions into the library namespace so I can remove the
"_library_" part of the function names.
2011-11-06 11:36:12 -05:00
Bryan Schumaker 6d7828b946 libsaria: Store library path as a linked list of track tags
Lookup by id will be slighly slower, but now I will have one list for
each path that can be merged together and sorted to represent the
library.  This sounds like a good tradeoff to me, especially since I can
store an iterator to the current track when deciding what to play next.
This will give me much faster access to song for the current track.
2011-11-06 11:16:46 -05:00
Bryan Schumaker 8609b9a6a7 libsaria: Use a linked list of library paths
I was using a map, but the map required duplicating the library path
everywhere.  Except for removing a path, I don't ever need to look up a
specific path by name, so why bother optimizing this case?  Iterating
over a linked list should be more efficient (and easier to comprehend)
2011-11-06 10:43:35 -05:00
Bryan Schumaker 136f12bc7c libsaria: Created a SourceModel class
The source model class is used to more tightly control how songs are
inserted into the UI.  I provide an insert() function that the library's
for_each() function can take advantage of.  This allows me to directly
insert songs into the UI rather than having to use a static function as
the "middle man"
2011-10-29 15:19:45 -04:00
Bryan Schumaker 39f74eb6b4 libsaria: Various cleanups
- Pass inodes by reference
- Change some namespace code formatting to match later code
2011-10-28 17:02:46 -04:00
Bryan Schumaker a975fcc2cc libsaria: Added a current_track() function
This function will generate a Track object based on the current file
stored by the audio.  I then pass this object to to provided function so
the UI can be updated.
2011-10-28 15:33:17 -04:00
Bryan Schumaker 2a6d05ebee libsaria: Fill out a struct PathInfo
This struct is used by the gui to show how large a library path is
and eventually to remove it from the library.
2011-10-20 13:24:08 -04:00
Bryan Schumaker a508b7ff72 libsaria: Rip out old library
The code was a bit messy and didn't make use of namespaces very well.
By converting to a set of functions (instead of a class) I can use
each function as a function pointer if I want to.  I am also able to
remove libsaria/library.cpp since this was just a set of wrapper
functions to the old static class functions.
2011-10-18 10:02:55 -04:00
Bryan Schumaker 1a7b8a5ae9 libsaria: Load a saved library
No point in saving a library if I can't make use of the save file later.
2011-09-30 08:12:26 -04:00