Commit Graph

79 Commits

Author SHA1 Message Date
Anna Schumaker c2178bc265 core: Cut back on hardcoded dbe_index uses
The dbe_index of a given database item might change in the future, so we
can't rely on it everywhere.  Let's just use it for saving and loading
files, with the expectation that changes will happen sometime after
startup.

Implements #69: Reduce use of dbe_index in Ocarina code
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-11 10:50:45 -04:00
Anna Schumaker e82beb719f core/tags/track: Reduce the size of the track tag
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2016-09-11 10:50:34 -04:00
Anna Schumaker d16e06111d core/tags/track: Add track_match_token() function
This is used to check if a track has a token that begins with the
requested string.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-29 07:33:00 -04:00
Anna Schumaker 6ad4325f22 core/tags/track: Convert lowercased string into tokens
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-08-29 07:33:00 -04:00
Anna Schumaker 92a53d90b4 core/database: Move database out of containers/ subdirectory
It doesn't make sense to have a subdirectory with a single file.  Let's
move it back to core/

Implements #45: Move database into core/
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-07-29 17:06:01 -04:00
Anna Schumaker 4998b0867b core/tags/track: Find the average play count of tracks
This function returns the average count of tracks that have been played,
and not the average count of all tracks.

Implements #29: Efficiently calculate average play count of tracks
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-14 17:11:06 -04:00
Anna Schumaker 1973d15605 core/tags/track: Count the total number of tracks played
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-14 17:10:52 -04:00
Anna Schumaker a97ec66e7f core/tags/track: Count the number of unplayed tracks
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-06-14 17:10:47 -04:00
Anna Schumaker 799a8d34b5 core/queue: Convert q_sort to a GSList
I needed to bump the track comparison fields by one so I can use signed
values to indicate sort order.  I updated core/library.cpp to add and
subtract one as needed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 4e8a63cc36 core/tags/track: Expand track_compare() to compare by different fields
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker 08c7323dfc core/tags/track: Move comparison fields into track.h
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker c34f0c160d core/containers: Move database into the containers/ directory
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker a5963a553e core/tags/track: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker b5caf6faed core/tags/track: Convert std::string to gchar *
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 9e3e3e514c core/tags/track: Replace constructor with a backwards pointer
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 1b4eb470a7 core/tags/library: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 2755e8a09b core/tags/genre: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 6d9c89392e core/tags/artist: Convert file to C 2016-01-11 09:35:59 -05:00
Anna Schumaker 5309ea5931 core/tags/album: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker bd1de2262d core/tags/track: Wire up the dbe_alloc() database operation
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 877d9ac1d7 core/database: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:19 -05:00
Anna Schumaker 1c22ecfda4 core/database: De-templatize the database
We now have an interface for controlling everything through struct
db_entry, so let's just have the database store a db_entry directly.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker 1bef380ba7 core/database: Introduce the dbe_key() database operation
And store the result in the db_entry struct for use later.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
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 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 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 3eb27debfb core/database: Convert DatabaseEntry class into a struct
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 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 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 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 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 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 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