Commit Graph

36 Commits

Author SHA1 Message Date
Anna Schumaker 1b34a9a8a0 index: Update the index design
I updated the design and rewrote the unit tests.  This creates something
more consistent with how I ended up using the index.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:05 -04:00
Anna Schumaker fc8dc9d55e database: Design and test updates
I add:
- Autosaving option
- Real iterators
- Better accessor functions

The new design and unit test also allows me to remove the 300,000+ line
"database.good" file that the old tests were based on.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:05 -04:00
Anna Schumaker 959cac0fe1 Database: Update design for database entries
I changed primary_key() into a function since it is only called once,
and there is no point in using more mmemory than I need to.  I also
created a basic unit test for everything that database entries are
supposed to do.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:05 -04:00
Anna Schumaker 21c80ea1f9 lib: Import ban status from Ocarina 5.x
Now that I have a banned playlist working I can remember the ban status
easier.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:02 -04:00
Anna Schumaker 3894c4ac97 playlist: Create a playqueue to store the current playlist
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:02 -04:00
Anna Schumaker 72accfd26d library: Add tracks to the filter for searching
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:02 -04:00
Anna Schumaker 03b44b9e16 Update play count
When a track finishes, I tell the library to update playcount.  Then,
the library triggers a callback to the playqueue deck telling it to
update.

This patch also finds and prints the track that causes a gstreamer
error.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker e9416e6ace library: Properly set the track primary_key from file
First this was missing, then I set it to the short path, now it's
correct.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker 7a78e649a0 library: Separate error messages with line breaks
This condition is only hit when trying to tag files that aren't
recognized as audio files.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker 63df51a847 library: Set primary key in the Library class
To prevent duplicates from being added to the library.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker e256c24b20 playqueue: Sort playqueues if PQ_SORTED is enabled
I don't have user-configurable sorting (yet), but for now I'm sorting by
Artist -> Year -> Track #.

I also fix a bug where the library wasn't lowercasing artist, album,
genere, and track fields when reading from file.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker b490322f55 library: Don't send notifications if the library is disabled
In other words, don't add tracks to the collection playqueue if they are
disabled.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker 0e2cc50e7b library: Fix some bugs
- Check for path existing in the library already before adding again.
- Iterate over track database using <= for comparison, and not just <

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:59 -04:00
Anna Schumaker e0770030d5 library: Load all databases
For some reason I was only loading the library_db, and ignoring the
others.  I fix this, and send out callbacks for each track loaded.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker f51ba3e3ec library: Create a function for enabling and disabling paths
I also update the deck tests, since this is where changes will show up.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker 25ee2e945c library: Add callbacks for adding and removing tracks
Useful for keeping a library playqueue up to date.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker c2e7772ebe callbacks: Add initial callbacks
This patch adds library callbacks for adding a new path and for updating
tracks in a path.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker eff294a7c7 library: Added an update_all() function
To update all paths in a library.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker 360ebed1fa errors: Rename error codes
Gstreamer includes <errno.h>, which already defines several of these
symbols.  I rename them to avoid namespace collisions.  Perhaps a better
solution would be to use the errno.h definitions directly?

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker 98e8324a61 library: Only enable some functions if CONFIG_TEST is enabled
I was using CONFIG_DEBUG for these, but they really should be under
CONFIG_TEST for use by the testing code ONLY.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker 5dd5ec6db0 library: Add a lookup_path() function
This returns a pointer to the library :: Library structure requested.
The gui will use this to display information about each path.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker fa51433b94 library: Track the size of each path
I track the size of each library path for display purposes.  I also had
to add in a check for if a new track already exists in the db before
tagging it so updating a library should be much faster now.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker a2665d4e41 library: Implement importing old libraries
This adds backwards-compatibility for Ocarina 5.11 libraries.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker 371b988dac library: Various updates
- Combine Artist and Genre struct
- Add in exceptions, rather than boolean returns
- Update the library through idle tasks

I have not implemented importing Ocarina 5.11 libraries yet.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker 8d8e9262d6 library: Initial backend updates
I do not make any of the library spec changes yet, instead I update the
backend code so it compiles and still works with the changes I have made
so far.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker b759b9743d library: Implement library path validation
I scan the track database and remove files that no longer exist.  I
don't yet add in new tracks found in the directories.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker e0f28cb366 library: Strip whitespace from genre and tracks
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker a50d8f6e0a database: Allow templated keys to the database index
This allows me to have a std::pair<> as a key if needed.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker eaafaeb7d4 library: Updates for new database design
I need a templated primary key system to group together albums with
years.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker 4fc09978dc library: Lookup a song by id
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>
2014-04-06 19:56:55 -04:00
Anna Schumaker e314248f10 library: Find tags for each track
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>
2014-04-06 19:56:55 -04:00
Anna Schumaker 846810fa2f library: Clean up database entry creation
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>
2014-04-06 19:56:55 -04:00
Anna Schumaker 3f943aa1d6 library: Find album and genre tags
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:55 -04:00
Anna Schumaker 10fd3292fd library: Scan a directory
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>
2014-04-06 19:56:55 -04:00
Anna Schumaker 81429b0229 library: Add support for saving and restoring the library
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>
2014-04-06 19:56:55 -04:00
Anna Schumaker 9ddbaf0b97 library: Implement basic path management
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>
2014-04-06 19:56:55 -04:00