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>
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>
And replace it with the function file_init(). Let's take this chance to
rework parts of the unit test as well.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This change also lets me remove the destructor, since code is expected
to call file_close() when IO is complete.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
And I replace it with a simple call to g_strdup_printf() that does the
exact same thing. Note that callers are now required to free the
returned string with g_free().
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
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>
A long int is shorter on ARM than x86, which could cause position and
duration values to get truncated. Additionally, quering gstreamer with
a long int causes a compile error on ARM. Let's just do the right thing
and make this value an int64_t.
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
This class will be used to push queue changes directly to the GUI.
Currently changes get mapped through the old callbacks system, which can
lead to several inefficiencies because the GUI has to look up each queue
structure in a list.
This patch implements a basic QNotifier class and provides a function
for setting a Queue's notifier.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I can use the lowercase text from string :: lowercase() and take a
single pass over a single string (rather than iterating through a list
of strings).
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This function converts unsigned ints into strings. This allows me to
replace several almost identical functions with one function call.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This means I no longer need to pass argc and argv parameters to core/,
so I can eventually work towards removing the Driver :: init() function.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This was used to get around layering issues with the gstreamer driver.
Now that the gstreamer implementation is in the gui code we can have it
call audio::next() directly.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
It's not used anywhere else except during this one test, so move it out
of the global include files.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This is a straight copy-and-paste of the header file and the code
implementing it. I intent to clean this up with future patches.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
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>
This shifts the taglib code into library.cpp. I also remove the tagdb
section of the DESIGN document.
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 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>
The new constructor covers these cases without needing to do taglib
stuff inside the Track class.
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>
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 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>
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>
I created a new directory for tag related code. This keeps the core/
directory cleaner and prevents file name collisions between the library
layer and the library tag.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I don't want anybody outside of the IndexEntry class to modify the
values in this container. This patch makes it private and provides
iterator access instead.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This variable should only be set by the Database when a DatabaseItem is
first created. This means I should hide _index from the rest of the
world to prevent accidental modifications. I also add an accessor
function for other code that needs to read _index.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I transfer everything from my DESIGN file into doxygen, and then remove
the section from DESIGN.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I add more detailed documentation matching what was in my DESIGN file.
In addition, I also prefix private File members with an underscore like
I do in other Ocarina classes.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I added a little more detail about how this function works. This lets
me remove this section from the DESIGN file.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I want to have all of Ocarina documented in the code, rather than in a
difficult-to-maintain DESIGN file. Let's get going on that!
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Initialize everything from the core/ layer, that way lib/ doesn't need
to know the correct order.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
Without this check we could end up creating a Track for a .ini file or
some other non-audio file.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I now mimic the effects of the "changed" callback with inheritance.
This makes for a cleaner implementation.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
I plan to introduce a new lib/ that sits between the gui and the backend
files (similar to how glibc sits between the kernel and userspace).
This gets the rename out of the way before I change my mind again.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>