Commit Graph

2996 Commits

Author SHA1 Message Date
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 5c56d53f9f core/tags/artist: Rewrite unit test
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 928c215494 core/tags/album: Clean up constructors
Remove an unused constructor and share code between everything left.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker e5b0047812 core/tags/album: Directly inherit from DatabaseEntry
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker a7746cf901 core/tags/album: Remove album::year() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker abe12bac64 core/tags/album: Move album_db_init() out of the tags namespace
And add the function album_db_deinit().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 0fa2d8acc2 core/tags/album: Move album_find() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 1f5668bd72 core/tags/album: Move album_get() out of the tags namespace
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 75d4bd2af3 core/tags/album: Rewrite unit test
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 45207ebd2e core/index: Replace index_entry iterators with struct set_iter
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker a8bb7ffccd core/index: Remove index_entry :: size()
It was only used by the testing code, so there is really no reason to
keep it around.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 58f704cdd2 core/index: Remove Index class
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 025f13ffeb core/index: Move index_has() out of the index_entry struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 7dcfc2ba78 core/index: Move index_init() out of the Index class
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker a580e5cdb5 core/index: Move index_remove() out of the Index class
And fold IndexEntry :: remove() into index_remove().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 46363b1406 core/index: Move index_insert() out of the Index class
And fold IndexEntry :: insert() into index_insert().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker a91326551f core/index: Convert IndexEntry class to a struct
In addition, I added the prefix "ie_" to all member names.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 1244531f0d core/index: Rewrite unit test
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 2c5b14c7f3 core/database: Replace database constructor and destructor
Use db_init() and db_deinit() instead.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 3ff992cf52 core/database: Replace database iterators with db_for_each()
This function is similar to Linux's list_for_each_safe(), and lets you
iterate over a database even if the current item is removed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker ffd38bd28b core/database: Move db_find() out of the database struct
I also take the chance to modify this function slightly.  Now, if a
matching item could not be found a new item will be allocated.

I added the new function db_get() if callers just want to get an item
without allocating.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker f2f23cb225 core/database: Move db_at() out of the database struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 929279259d core/database: Move db_remove() out of the database struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 9c358539fe core/database: Move db_insert() out of the database struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 68c953f186 core/database: Move db_{save|autosave}() out of the database struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 8486fc6111 core/database: Move db_load() out of the database struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 3a74cb0aa5 core/database: Move db_actual_size() out of the database struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 1dcbc0c505 core/database: Remove database::size() function
We can just use the db_size variable directly.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 8a4e9fc2bc core/database: Convert class to a struct
In addition, we lowercase variable names and add a db_ prefix to all
struct members.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 385515edbc core/database: Rewrite unit test
I want a more thorough set of tests before I begin modifying the
database class.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 0b8dd94213 Ocarina v6.4.1
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:36:47 -05:00
Anna Schumaker db9be296cb core/file: Add better error reporting
Printing out the filename of the file that broke is generally helpful.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-04 10:11:33 -05:00
Anna Schumaker 5b5b7ebea6 core/playlist: Don't calculate an average if count is zero
This fixes a divide-by-zero segfault.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-02 15:25:59 -05:00
Anna Schumaker 1cd22a9454 core/set: Add functions for reading and writing sets
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker 82a74dd5ec core/set: Add a function for clearing sets
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker 09c87e14aa core/set: Add function for copying values between sets
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker 73f61e13d7 core/set: Add function for finding set intersections
Finding an inline intersection is really easy using iterators, so I
wrote this function to modify one of the set rather than returning a new
one.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker 4d065508cd core/set: Add new struct to act as a set
The glib library doesn't have a dedicated "set" container, so I need to
create a wrapper around a hash table to accomplish the same results.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker 9e0c4404fc core/date: Add date_set() to directly set a date structure
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker 422f6a389f core/tags/track: Clean up date handling unit test
Most of this isn't needed anymore now that date handling is being tested
elsewhere.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker ea35d81c22 core/date: Add date_string() to convert a date to a string
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker 0a2abb2b31 core/string: Add string_tm2str() function to get a date stringg
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker f5d744a75c core/date: Add date_{read|write} functions for date IO
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker af1939a6e7 core/date: Add date_compare() for comparing two dates
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -05:00
Anna Schumaker cef39bc0fc core/date: Add date_today() function for finding today's date
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:54 -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 7865557fd5 core/string: Realloc strings before returning
g_strchomp() modifies the string in place, but doesn't free up unused
memory at the end of the original string.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-10 10:55:38 -05:00
Anna Schumaker 461cbdb9c3 core/string: Use g_utf8_collate() for string comparisons
This function compares strings using "linguistically correct rules for
the current locale".

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-02 14:13:00 -05:00
Anna Schumaker 6b25987785 core/string: Add unicode handling to string_lowercase()
This helps improve filtering, since I drop all modifications to
characters (such as accents over an 'e').

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-11-02 14:13:00 -05:00