Commit Graph

226 Commits

Author SHA1 Message Date
Anna Schumaker f51852f62e core/database: Introduce the dbe_write() database operation
For writing database entries to disk.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker 2da33f1c75 core/database: Introduce the dbe_read() database operation
This function allocates and returns a new database entry using
information read from a file.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker c77ca65630 core/database: Introduce the dbe_setup() database operation
Track tags need to add themselves to the filter index and update the
library track count once added to the database.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker c8021639ba core/database: Introduce the dbe_free() database operation
The Track tag needs to do some cleanup when removed from a database, so
we need to use this op when removing items.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker 049156a523 core/database: Introduce the dbe_alloc() database operation
For allocating new database items from a given key.  Tracks do not need
this function since we have special handling for creation and insertion.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker ab1572ed34 core/database: Add operations vector
I intend to replace C++ inheritance with this struct of function
pointers.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker 847e4c1925 core/database: Remove db_entry::index() function
Let's just access the dbe_index variable directly.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker 1c0235c8c7 core/tags/generic: Remove Generic tag
Nothing uses it anymore, so it can be safely removed :)

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker 92806c5201 core/tags/track: Clean up constructors
I replace the standard and copy constructors with one that tags a track
during construction.  This lets me clean up a lot of code, and keep
tagging functions internal to the track class.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 33e20989fa core/tags/track: Directly inherit from DatabaseEntry
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker ee71786c09 core/tags/track: Move track_last_play() out of the track struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 90cdfd4cbd core/tags/track: Move track_path() out of the track struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker c634f5d5e2 core/tags/track: Move track_played() out of the track struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker fb4933e418 core/tags/track: Remove track::compare_date()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 24d5c37a6c core/tags/track: Remove variable accessor functions
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 9c1cbbf8cb core/tags/track: Remove tag accessor functions
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 192bdc3ac7 core/tags/track: Replace tags :: track_size() with track_db_get()
We want to loop over the track database in several places, so let's make
this easier by just returning the database itself.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker eea0f57cf8 core/tags/track: Move track_commit_db() out of tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker d3bdcf2edc core/tags/track: Move track_db_init() out of the tags namespace
And add the functions track_db_deinit() and tags :: db_deinit().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker d0ec3e2cac core/tags/track: Move track_remove_all() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 7ffaf91617 core/tags/track: Move track_remove() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 83a945d3da core/tags/track: Move track_add() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker c8061e2868 core/tags/track: Move track_get() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 765079df94 core/tags/track: Convert Track class into a struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 446f1228cf core/tags/library: Add library_file() function
To help with finding the full path of files that are located in the
library's directory.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 24504c7de8 core/tags/library: Remove library size() and {inc|dec}_size() functions
We can just access this variable directly instead.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker ac2b4ad52c core/tags/library: Remove library enabled() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 47ab4c4b17 core/tags/library: Move library_set_enabled() out of the library struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker f41235e5b2 core/tags/library: Replace tags :: library_size() with library_db_get()
It's easier to just pass off the library database rather than forcing
higher layers to iterate over the entire thing (including possible
invalid entries).

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 768f86e802 core/tags/library: Move library_db_init() out of the tags namespace
And add the function library_db_deinit().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker d7cff5faf4 core/tags/library: Move library_remove() out of tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker a288922b65 core/tags/library: Move library_find() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker e1093f7eab core/tags/library: Move library_get() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker ffa5e65ba7 core/tags/library: Convert Library class to a struct
I also have to replace the "library" namespace with the "collection"
namespace to avoid naming collisions.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker cc3becd566 core/tags/genre: Directly inherit from DatabaseEntry
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 8aa05ecedc core/tags/genre: Move genre_db_init() out of the tags namespace
And add the function genre_db_deinit().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 9522da88d0 core/tags/genre: Move genre_find() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker c611eb306d core/tags/genre: Move genre_get() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 5e59166dab core/tags/genre: Convert Genre class to a struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker fe3d7867d1 core/tags/artist: Directly inherit from DatabaseEntry
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 405ff0cf88 core/tags/artist: Move artist_db_init() out of the tags namespace
And add the function artist_db_deinit().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 52886c926e core/tags/artist: Move artist_find() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 81518dce47 core/tags/artist: Move artist_get() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 2c5c0aa7e0 core/tags/artist: Convert Artist class to a struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 928c215494 core/tags/album: Clean up constructors
Remove an unused constructor and share code between everything left.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker e5b0047812 core/tags/album: Directly inherit from DatabaseEntry
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker a7746cf901 core/tags/album: Remove album::year() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker abe12bac64 core/tags/album: Move album_db_init() out of the tags namespace
And add the function album_db_deinit().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 0fa2d8acc2 core/tags/album: Move album_find() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 1f5668bd72 core/tags/album: Move album_get() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker e6bdf65606 core/tags/album: Convert Album class to a struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 2c5b14c7f3 core/database: Replace database constructor and destructor
Use db_init() and db_deinit() instead.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 3ff992cf52 core/database: Replace database iterators with db_for_each()
This function is similar to Linux's list_for_each_safe(), and lets you
iterate over a database even if the current item is removed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker ffd38bd28b core/database: Move db_find() out of the database struct
I also take the chance to modify this function slightly.  Now, if a
matching item could not be found a new item will be allocated.

I added the new function db_get() if callers just want to get an item
without allocating.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker f2f23cb225 core/database: Move db_at() out of the database struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 929279259d core/database: Move db_remove() out of the database struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 9c358539fe core/database: Move db_insert() out of the database struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 68c953f186 core/database: Move db_{save|autosave}() out of the database struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 8486fc6111 core/database: Move db_load() out of the database struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 3a74cb0aa5 core/database: Move db_actual_size() out of the database struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 8a4e9fc2bc core/database: Convert class to a struct
In addition, we lowercase variable names and add a db_ prefix to all
struct members.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 9e0c4404fc core/date: Add date_set() to directly set a date structure
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker ea35d81c22 core/date: Add date_string() to convert a date to a string
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker f5d744a75c core/date: Add date_{read|write} functions for date IO
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker af1939a6e7 core/date: Add date_compare() for comparing two dates
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker cef39bc0fc core/date: Add date_today() function for finding today's date
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker d230396cb2 core/date: Add new file for date structure code
Moving this out of the track class should help to simplify the code.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker 08bef63918 core/tags/track: Add a space before title
I noticed that tracks beginning with a number were getting combined with
the seconds field, creating an inaccurate seconds count and modifying
the title at the same time.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-14 16:41:01 -04:00
Anna Schumaker 7529ccd4cc core/file: Switch file_readl() to return a gchar *
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-12 08:23:06 -04:00
Anna Schumaker dbd27d1297 core/file: Use a C-style file stream for reading from files
I also introduced a file_readf() function to make it easier to read a
formatted string from the file.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-12 08:23:05 -04:00
Anna Schumaker f24da08d85 core/file: Use a C-style file stream for writing to files
I also introduced a file_writef() function to make it easier to write a
formatted string to the file.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-12 08:22:36 -04:00
Anna Schumaker 3b220d3f3a core/file: Move file_readl() out of the file struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-09 09:14:34 -04:00
Anna Schumaker 1dcc56c87e core/file: Convert class to a struct
In addition, we lowercase variable names and add an f_ prefix to all
struct mebers.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 10:39:51 -04:00
Anna Schumaker 023bae737c core/string: Add a function for comparing strings
And switch over the GenericTag to using it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 09:59:41 -04:00
Anna Schumaker 60678d1ddb core/string: Convert file to C
And convert the unit test while we're at it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 09:56:19 -04:00
Anna Schumaker 1a3735251d core/string: Move string_lowercase() out of "string" namespace
And refactor to use glib string functions while we're at it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 09:54:16 -04:00
Anna Schumaker 82d1da491b core/string: Remove string :: utos()
I replace it with calls to g_strdup_printf().  This has the additional
benefit that I can do uint conversions at the same time as other
formatting options, so this seems like a win.  The only downside is that
I have to manually free the memory that glib allocates, but that's easy
enough.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 09:31:28 -04:00
Anna Schumaker ead1397b31 Remove Doxygen tags
I wasn't actually using Doxygen for anything, so it's probably best just
to remove it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-09-02 14:24:42 -04:00
Anna Schumaker 6c4dc5b1db filter: Remove lowercase() function
And switch everything over to using the new implementation.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-30 09:35:55 -05:00
Anna Schumaker ed43fd3689 More utos() cleanups
I found a few other places where I can use utos() instead of
stringstreams.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-27 14:03:12 -05:00
Anna Schumaker 12260a3de9 string: Add a function for converting seconds to string
This is used to get a string representation of the number of seconds
passed in.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-27 09:23:14 -05:00
Anna Schumaker 30b2ba0fff Track: Doxygen documentation updates
This patch fixes up formatting a little bit and removes the Track
section of the DESIGN document.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker c7fe5b18d5 tagdb: Rip out most tagdb functions
Most of this are a straight replacement with the new versions in
tags/track.cpp.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker 2394e46fb7 Track: Re-enable filtering
This has been disabled for some time.  I added a test for adding track
indexes to the filter upon creation, but it doesn't properly test adding
to the filter when reading from disk.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker 09bf458d7a Track: Rename functional test to locale test
This code is really testing date and locale handling, so this patch
renames the function to match what it actually does.  While I'm at it, I
also introduce some cleanups.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker 4224d89813 Track: Add a function for finding track_db size
This returns the actual size of the database, so be careful when using
it!  The intent of this function is to allow some kind of iteration when
loading databases.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker 45c83ed2fd Track: Add a function for removing all tracks from a given library
This function will be called when doing library removals.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker 9dfec9934c Track: Add a function for removing specific tracks from the track_db
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker d5fc2a4de0 Track: Add a function for saving the track_db
The track_db doesn't have autosaving enabled for performance reasons.
This lets us add several tracks to the database between saves, but it
also means we need to provide a commit() function.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker 83cc81c934 Track: Add a function to look up Track tags by index
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker a30f5ef794 Track: Create an add_track() function
We return a new Track tag or NULL if we have already tagged this track.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker d7ceadafb3 Track: Implement a copy constructor
This keeps library size accurate when adding new tracks to the track_db.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker 44aac0dcec Generic: Create a copy constructor
Track tags need a copy constructor to keep library size accurate, so
create one here.
2014-12-04 08:31:52 -05:00
Anna Schumaker 4edbd69fa7 Track: Change constructor to take relative paths
I'm going to need to split this value earlier to do a unique lookup when
inserting, so the constructor can take the relative path to make things
easier.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker 2578cdadfe Track: Move read and write code into tags/track.cpp
Sadly, this patch disables filtering for tracks.  This will be reenabled
sometime soon!

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker b5a529795d Track: Add a function for comparing two dates
I don't want to expose the date structure outside of the track class, so
I'll provide a comparison function instead.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker de1b5fcef3 Track: Remove old constructor and tag() function
The new constructor covers these cases without needing to do taglib
stuff inside the Track class.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker a2b3ca1292 Track: Make last played date private
This patch creates a new structure to track the last played date, which
can be expanded into a class at some future point.  Additionally, I use
strftime() to calculate the current date based on the user's current
locale settings.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 6daa26f0d6 Track: Make filepath private
I don't want anybody outside of this class changing the value, so it
shouldn't be public.  I also change the primary key to use library index
instead of the full filepath while I'm at it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker cdd20da5c0 Track: Convert length_str into a function
I don't think this value needs to be stored anywhere in the Track class
since it's fairly easy to calculate.  Let's convert it into a function
for now and reevaluate later!

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 2540a6aa7a Track: Use GenericTag's _name and _lowercase fields
This lets me remove the duplicate title and title_lowercase fields from
the Track tag.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 1fdee864a2 Track: Hide length from the public
I provide an accessor function to keep this value from ever getting
changed outside of the Track class.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker eb23127f6d Track: Hide the play count from the public
I provide an accessor function to keep this value from getting changed
outside of this class.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 468a4e79d5 Track: Hide the track number from the public
I provide an accessor function to keep this value from ever getting
changed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 91f6f54b4e Track: Add a test for the Track destructor
We want to make sure that the _library size is decremented whenever a
track is removed or destroyed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 2dfa9bf168 Track: Hide the genre tag from the public
And set it using the new constructor.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker c6029f13f2 Track: Hide the album tag from the public
And set it using the new constructor.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 0a6ace3c14 Track: Hide the artist tag from the public
Also set it using our new constructor.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 6149c928d2 Track: Begin a new Track constructor
I want to provide the Library, Artist, Album, and Genre tags to the
Track on construction to (hopefully) eliminate the Track::tag()
function.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 37613573e4 Track: Hide the library field from the public
And provide an accessor function.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 7e52c9b364 Track: Move the default constructor to a new cpp file
I also use this opportunity to create a new default constructor test for
the Track tag.  This patch also disables the tags test since the tagdb
will be going away soon.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker cbcd9c594d GenericTag: Add a function for comparing tag names
I was only ever comparing the lowercase version of the name, so this
should be done in a single place (the GenericTag) to make maintenance
easier.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker f433ced9cb Library: Add functions for looking up or creating Library tags
This patch moves the library_db into tags/library.cpp, where it can be
effectively managed by the Library tag.  For this to work, I need to add
some extra functions to the tags namespace to:

	- Create new Library tags,
	- Find tags by index,
	- Remove the Library at a specific index, and
	- Find the actual size of the library_db.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 8545837672 Genre: Add functions for looking up or creating Genre tags
The genre_db should really be controlled from within the Genre tag,
so this patch adds functions to find or create Genre tags to the tags
namespace.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 7d3e9a3d28 Album: Add functions for looking up or creating Album tags
The album_db should really be controlled from within the Album tag, so
this patch adds functions to find or create Album tags to the tags
namespace.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker bac54857fd Artist: Add functions for looking up or creating Artist tags
The artist_db should really be controlled from within the Artist tag, so
this patch creates a new tags namespace containing functions that will
find or create tags as they are requested.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker d88f008728 Library: Update documentation for the Library tag
I also take the chance to remove the corresponding section of the DESIGN
file.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker ce8b3ada03 Library: Rename count -> _size
Also make it private and provide accessor functions.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 754d45efd0 Library: Make _enabled private
I added in accessor functions to get and set this value.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 01e514736e Library Tag: Make root_path private
And just change the name of the variable to "_path".

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 4d6cb81f77 Library: Move the Library tag into a new file
No code or documentation changes yet, just split things out for now.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 1e6bcf7451 Genre: Move Genre tag into a new file
- This tag now inherits from GenericTag.
- Add a Genre-specific unit test.
- Remove the genre tag section of the DESIGN file.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker 2d9d87afc9 Album: Move Album tag into a new file
Also make it inherit from the GenericTag base class.  Also also, add a
unit test specific to Album tags.  Finally, I remove the corresponding
section of the DESIGN file since it is no longer needed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:49 -05:00
Anna Schumaker a9fc53964c Artist: The ArtistTag should inherit from GenericTag
The GenericTag class provides most of the implementation, so use it!

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-03 13:03:11 -05:00
Anna Schumaker fb4f523206 GenericTag: Create a generic tag that other tag classes can use
This implements the basics so I don't need to keep reimplementing
everything.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-03 13:03:10 -05:00
Anna Schumaker b3d904c128 Artist: Move artist tag code into a new directory
core/tags.cpp was WAY too big, so I moved this code into a new file in
its own directory.  I also created a new unit test just for testing the
Artist tag.

This patch disables the "tags" test since it conflicts with the
tests/core/tags/ directory.  This is okay because the tagdb is gradually
being phased out!

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-03 13:02:49 -05:00