This patch updates the design so indexes are built upon databases using
a special IndexEntry. I also updated the tests/index/ test to match
the new system, but I have not updated filter or group tests yet.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I require entries to have a "primary key" that is stored in a map to
make it easy to find database rows by key.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I made a few modifications to the database, and introduced an
"IndexEntry" database type to do the exact same thing :)
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
Add more to the Library, Playlist and Audio design to match how I expect
the GUI to use the backend.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
If the id is valid, I fill out a song structure and return true.
If the id is invalid, I return false.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This is each song's track number, play count, and anything else specific
to a single file. After updating, save all the changed databases.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
Passing the TagLib :: Tag pointer is much easier and cuts down on extra
arguments to each constructor.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I don't build up a complete set of databases yet, but I do create the
Artist name database to use later.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
Eventually these functions may have to become idle tasks, but for now I
write to disk whenever the library_db is changed and then read from disk
by calling the init() function.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I can add and remove root-level directories from the library database.
I do not save the database when modified, and I don't yet run an update
on all the files.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
- Check if we are finding the "last" iterator in an empty database
- Better print() descriptions
- Print test return codes that aren't 0 to help find segfaults
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
It doesn't make sense to need to set this value outside of the database
code like I had been doing. So when a new row is inserted mark it as
valid right away.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This function is used in debug mode to print the current status of the
index. I also created a print_keys() function to only list the keys.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
Other tests may need to print out a database. To make this easier I've
added a print() function to the base database class. This function will
only exist when CONFIG.TEST == True, so don't use it outside of testing!
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
Rather than doing everything in tedious if blocks written in any order,
I instead resolve dependencies using a much simpler loop. At the moment
each module only depends on a single other module, so this will have to
be extended if I ever need multiple-dependency resolution.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
Rather than setting up all variables twice, just call reset() to
initialize everything. *BONUS* Reset can be used to initialize the
value of CONFIG.TEST!
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I was using my own cpp file to remove old test data to start with a
clean slate. I've decided it's easier to just remove the files before
running tests if they exist.
I also use this patch to update the test design and add an idea for the
future.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
For some reason I turned the file test into three separate files. All
other tests were in a single source file, so I updated file tests to
match.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
"basic" doesn't really fit the description for what I'm testing here. I
was expecting to do a series of unrelated tests, but all I'm really
doing it testing the print function.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
The library will need databases that have unique values (such as the
artist or album tables). This patch adds support for that in my
existing database code.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I assign tags to the 1, 10, 60, and 600 second long ogg files as they
are copied to the new library directory. This is much faster than
generating sound files on the fly, but it makes this commit 2.5MB in
size...
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
The idle queue is used to schedule tasks ... later. This code was
mostly adoted from a reference TDD experiment by Josh Larson
(themutatedshrimp@gmail.com). Thanks Josh!
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I only handle the "All Music", "Library" and "Banned" groups at the
moment but I'll eventually add in more features (in future versions).
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I still have some back-end work to do first, but I should start thinking
out what users will see.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I have everything except for save() and load() written. My unittest is
fairly comprehensive and tests everything implemented so far, so with
any luck putting in save() and load() features will go quickly.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
- Save recent database changes
- Move the idle queue after the database
- Put file class definition notation
- Update the todo list
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
I had planned on using the stream operator for my database class but
this created some crazy compiler error that I was having difficulty
figuring out. I decided to take the easy route for now and instead
create read() and write() functions that do exactly the same thing.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
Items will be marked "invalid" rather than directly removed from the
database. This make it easier, since I won't need to reassign IDs to
every database item after the removed one.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
A database may have invalid rows. If this is the case, then the next()
function needs to return the id of the next valid row. I'm aware that
this could get horribly inefficient on large DBs with many invalid rows.
I don't expect people to delete large chunks of music all at once, but a
defragment tool is on my "todo" list for a future Ocarina version.
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>