I move the code into a new cpp file, so it is no longer a header-only
library. I also take the chance to add a for-each function for testing
iterators.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
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>
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>
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>
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>
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>
I want to test basic reading and writing before running the functional
test, since the functional test will eventually trigger database
commits.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This makes the code a little bit cleaner, since we don't need to keep
doing lookups for each test run.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This tests all the basic things that the tag does: storing values and
reading / writing from file.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
- 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>
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>