Commit Graph

793 Commits

Author SHA1 Message Date
Anna Schumaker 5e74385fbb tests/core/containers: Don't pass source to ContainerTest
We can figure it out from the test name.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 8ad45ebef3 tests/core/tags: Don't pass source to TagTest
We can use the test name to find the source file.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 850af16c87 tests/core: Containers and Tags can call CoreTest
CoreTest will do most of the setup for us, so let's not duplicate code.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 5b921e7277 tests/core/tags: Give an order to tag tests
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 8a59485cbc tests/core/containers: Give an order to container tests
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 5d251365fd tests/core: Give an order to core tests
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker bc0437b3fe tests: Clean up how the sanity test is scheduled
I created a new function for checking if a group of tests is running to
help determine if the sanity test needs to run before anything else.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker fef3ef3353 core: Initialize the playlist before the collection
I think it makes more sense to have the collection manage if banned
tracks are displayed or not, rather than doing this from the playlist
layer.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker beda9bfa3f core/collection: Add functions to ban and unban tracks
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 3b5bbf14af core/playlist: playlist_remove() can return a boolean
The collection will be using this soon to tell if a track was
successfully unbanned.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 20825613e9 core/playlist: playlist_add() can return a boolean
There is at least one place in the gui where it needs to know if a track
was actually added to a playlist.  Adding a return value is the best way
to know what happened.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 02c82c182e core/playlist: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker b7a4bb3872 core/playlist: Use playlist_t enum to access playlists
Using strings is pretty tedious, so let's restrict restrict playlist
access to known values.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 88f6fc526c core/playlist: Add a function to remove banned tracks
This replaces the get_tracks() function.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 7a32fdb982 core/playlist: Add dynamic playlist generation unit test
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 4e6028cf6e core/playlist: Move playlist_remove() out of the playlist namespace
I also remove redundant unit tests.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 0e3d6251d3 core/playlist: Move playlist_add() out of the playlist namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 82ed2f2dc0 core/playlist: Move playlist_get_queue() out of the playlist namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 6f0b95608a core/playlist: Move playlist_select() out of the playlist namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 1d3a762936 core/playlist: Move playlist_has() out of the playlist namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 1f5ce9e0d1 core/playlist: Add playlist_deinit() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker b1c5d42387 core/playlist: Move playlist_init() out of the playlist namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 3ecb06bcb6 test: Remove library directory creating functions
Changes to the collections layer mean that I don't need this anymore.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:47:30 -05:00
Anna Schumaker 7065b6312e core/collection: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:47:16 -05:00
Anna Schumaker 8e5cc543c3 core/collection: Fix some memory leaks
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:46:04 -05:00
Anna Schumaker f413d14720 core/collection: Move collection_save() out of the collection namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker 295a4424ed core/collection: Move collection_get_queue() out of the collection
namespace

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker 89ce6d725c core/collection: Add collection_deinit()
To clean up the collection queue.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker 62f0606cd6 core/collection: move collection_set_enabled() out of the collection
namespace

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker 8a1f5403d0 core/collection: Move collection_update() out of the collection namespace
And bring collection_update_all() along with it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker 0cb16f5c64 core/collection: Move collection_remove() out of the collection
namespace

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker 6e39e17060 core/collection: Move collection_add() out of the collection namespace
This patch breaks later tests, since I needed to remove the old ogg
files.  This will be fixed in a few more patches.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker 3204fc0e44 core/collection: Move collection_init() out of the collection namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker d97ae38cc2 core/tests: Generate Ocarina of Time album
I'll need a second album for testing collections, and Ocarina of Time
seems like the obvious choice!

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker e47540a84e core/queue: Add queue_clear()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 10:12:09 -05:00
Anna Schumaker cc164fc4ee core/queue: Add queue_deinit()
To clean up a queue when we're done with it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 10:12:00 -05:00
Anna Schumaker 0b84b6180c core/queue: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05: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 6fa78dbf3a core/queue: Convert q_cur into a queue iterator
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 0a331a44f5 core/queue: Replace on_track_updated() with qop_updated()
This patch also removes the now-unused queue notifier class.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker da0c96ac51 core/queue: Replace on_track_removed() with qop_removed()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker df06b444cf core/queue: Replace on_track_added() with qop_added()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 6aab58629e core/queue: Move read() and write() into TempQueues
These functions are only used by temporary queues, and the collection
queue has its own save function.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker acc78a6667 core/queue: Move queue_remove_all() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker ea00b406e5 core/queue: Move queue_remove() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker d5e34b76d4 core/queue: Add Q_ADD_FRONT flag
This tells the queue to always add tracks at the front.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 8fe85b9782 core/queue: Move queue_add() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 4c4d0ab6ce core/queue: Move queue_sort() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 13723856fc core/queue: Move queue_{set|unset}_flag() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker be5d028fcf core/deck: Wire up the qop_save() function
So temporary queues can save when flags change or when sorted.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 9451a41ff1 core/collection: Wire up the qop_save() operation
This will be triggered both when queue flags are changed and when the
queue is sorted.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker ce55ef2421 core/queue: Add queue operations vector
And a function to help with saving queues.  This patch also adds the
Q_SAVE_FLAGS and Q_SAVE_SORT queue flags to control if the queue should
be saved when flags are changed or when the queue is sorted.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker b3a8fa293b core/queue: Move queue_has_flag() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 3e5bef5f3c core/queue: Move queue_updated() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker ff0c2a09a8 core/queue: Move queue_at() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker c259177dde core/queue: Move queue_size() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 331e56716a core/queue: Move queue_next() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 6bd625f65b core/queue: Move queue_selected() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker d6ae61d915 core/queue: Remove queue :: set_notifier()
Let's just set the q_notify variable directly, rather than going through
a function.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker a721a95604 core/queue: Remove queue :: length()
Let's just access the q_length variable directly.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 281947aded core/queue: Convert from class to struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 626eb48933 core/queue: Rewrite unit test
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 8fe65e68b4 tests: Check for ffmpeg and vorbiscomment before generating music
We can't run most of our tests without the generated tracks.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-25 10:29:59 -05:00
Anna Schumaker b586461104 core/containers/queue: Add _q_clear() function
This is used to clean up the items on a queue, and should be called to
prevent memory leaks.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-25 08:08:28 -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 9a16a18b9f core/tags/album: Add an album_compare_year() function
With special handling for albums with the same year but different names.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker f44710f7ae core/containers/queue: Add _q_add_sorted() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker b36869ff93 core/containers/queue: Add _q_sort() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker b7e4a1de23 core/containers/queue: Add _q_remove_it() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker e87e37414d core/containers/queue: Add _q_for_each() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker f26b50bdf8 core/containers/queue: Add _q_iter_set() and _q_iter_val()
This patch implements basic queue iterator functions for accessing
specific positions on the queue.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker 1fefbb6b4a core/containers/queue: Add _q_add_head() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker 6a653bd35e core/containers/queue: Add _q_add_tail() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker bf332b36a5 core/containers/queue: Add _q_size() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker 79627bb287 core/containers/queue: Add basic queue struct
This struct is a wrapper around the GQueue container, similar to how we
do sets.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker 58a983efd1 core/containers: Move index into the containers/ directory
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 f02853e9c7 core/containers: Move set into the containers/ directory
This patch also creates 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 800aeda633 core/tags: Move tags_deinit() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker eb349c60e9 core/tags: Move tags_init() out of the tags namespace
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 62fd782710 core/tags/library: Replace std::string with gchar *
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 5cc4efb6ac core/tags/library: Replace constructor with a backwards pointer
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 6c3d708576 core/tags/genre: Replace std::string with gchar *
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker e98e74213e core/tags/genre: Replace constructor with a backwards pointer
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 c07d1e9024 core/tags/artist: Replace std:string with gchar *
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker d404579297 core/tags/artist: Replace constructor with a backwards pointer
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
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 7c3bba11b5 core/tags/album: Replace constructor with a backwards pointer
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker ab837b1a18 core/idle: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 8474ff1907 core/idle: Move idle_schedule() out of the idle namespace
And rewrite it to use void pointers instead of inheritance.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 8e25c4d89e core/idle: Move idle_run_task() out of the idle queue
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker f17a19fe57 core/idle: Move idle_progress() out of the idle namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker cfd8ca8d43 core/filter: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker f2664aa8f2 core/filter: Move filter_search() out of the filter namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 90afcd6065 core/filter: Move filter_add() out of the filter namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker b98b1a5855 core/filter: Rewrite unit test
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 746c55ac56 core/database: Change db_insert() to insert-by-key
This means that databases completely manage when memory is allocated.

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 55a688cdcc core/index: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:19 -05:00
Anna Schumaker 507ac4602d core/index: Replace index_entry constructor with backwards pointer
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:19 -05:00
Anna Schumaker b28b0c8464 core/database: Add C-style initializer macro
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:19 -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 8dfe818a7a core/database: Replace constructors with a backwards pointer
This lets me use the struct db_entry without needing an inheritance
system.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:19 -05:00
Anna Schumaker 4a4529b158 core/database: Replace std::map with a glib hash table
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:19 -05:00
Anna Schumaker 9dd9d7d8f7 core/database: Replace std::vector with a glib array
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 c77ca65630 core/database: Introduce the dbe_setup() database operation
Track tags need to add themselves to the filter index and update the
library track count once added to the database.

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 049156a523 core/database: Introduce the dbe_alloc() database operation
For allocating new database items from a given key.  Tracks do not need
this function since we have special handling for creation and insertion.

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 847e4c1925 core/database: Remove db_entry::index() function
Let's just access the dbe_index variable directly.

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 1c0235c8c7 core/tags/generic: Remove Generic tag
Nothing uses it anymore, so it can be safely removed :)

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker cfd501c5d6 core/tags/track: Rewrite unit test
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:47:22 -05:00
Anna Schumaker 18311afcfe core/tests: Write a script to generate empty albums
gen_tracks.sh will read a specially configured file and create a
directory containing empty tracks to use for testing.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:46:35 -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 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 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 446f1228cf core/tags/library: Add library_file() function
To help with finding the full path of files that are located in the
library's directory.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 24504c7de8 core/tags/library: Remove library size() and {inc|dec}_size() functions
We can just access this variable directly instead.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker ac2b4ad52c core/tags/library: Remove library enabled() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 47ab4c4b17 core/tags/library: Move library_set_enabled() out of the library struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker f41235e5b2 core/tags/library: Replace tags :: library_size() with library_db_get()
It's easier to just pass off the library database rather than forcing
higher layers to iterate over the entire thing (including possible
invalid entries).

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 768f86e802 core/tags/library: Move library_db_init() out of the tags namespace
And add the function library_db_deinit().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker d7cff5faf4 core/tags/library: Move library_remove() out of tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker a288922b65 core/tags/library: Move library_find() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker e1093f7eab core/tags/library: Move library_get() out of the tags namespace
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 dbd4475815 core/tags/library: Rewrite unit test
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker cc3becd566 core/tags/genre: Directly inherit from DatabaseEntry
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 8aa05ecedc core/tags/genre: Move genre_db_init() out of the tags namespace
And add the function genre_db_deinit().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 9522da88d0 core/tags/genre: Move genre_find() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker c611eb306d core/tags/genre: Move genre_get() out of the tags namespace
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 4cba24e72a core/tags/genre: Rewrite unit test
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker fe3d7867d1 core/tags/artist: Directly inherit from DatabaseEntry
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 405ff0cf88 core/tags/artist: Move artist_db_init() out of the tags namespace
And add the function artist_db_deinit().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 52886c926e core/tags/artist: Move artist_find() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 81518dce47 core/tags/artist: Move artist_get() out of the tags namespace
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 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 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 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
Anna Schumaker b1ef40679b core/string: Add a test for several sec2str_long() fields
I also remove the swap() function I was using to reallocate strings out
of a static buffer.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-14 08:31:35 -04:00
Anna Schumaker 08394c3168 core/file: Add a C-style initializer macro
I eventually intend to remove the file_init() function, once everything
has been converted to C.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-12 08:30:01 -04:00
Anna Schumaker cf6364f5d1 core/file.c: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-12 08:23:06 -04:00
Anna Schumaker 7529ccd4cc core/file: Switch file_readl() to return a gchar *
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-12 08:23:06 -04:00
Anna Schumaker 471c773bd5 core/file: Switch file_path() to return a gchar *
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-12 08:23:06 -04:00
Anna Schumaker d306c809b6 core/file: Switch file_init() to take a gchar *
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-12 08:23:06 -04:00
Anna Schumaker d783c6b479 core/file: Remove NOT_OPEN open mode
I can use the file->f_file pointer for the same thing.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-12 08:23:06 -04:00
Anna Schumaker dbd27d1297 core/file: Use a C-style file stream for reading from files
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>
2015-10-12 08:23:05 -04:00
Anna Schumaker f24da08d85 core/file: Use a C-style file stream for writing to files
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>
2015-10-12 08:22:36 -04:00
Anna Schumaker 3b220d3f3a core/file: Move file_readl() out of the file struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-09 09:14:34 -04:00
Anna Schumaker 074339040b core/file: Remove the file struct constructor
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>
2015-10-09 09:14:34 -04:00
Anna Schumaker 09c7164aee core/file: Move the close() function out of the file struct
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>
2015-10-09 09:14:34 -04:00
Anna Schumaker c88b796a7a core/file: Move the open() function out of the file struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-09 09:14:08 -04:00
Anna Schumaker 7e9eb9e7d2 core/file: Move exists() out of the file struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-08 15:46:09 -04:00
Anna Schumaker aa21ede894 core/file: Move get_filepath() function out of the file struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-08 15:45:57 -04:00
Anna Schumaker ce94680d4d core/file: Move get_version() function out of the file struct
This is now a simple function for accessing the current version of the
file.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-08 15:45:51 -04: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
Anna Schumaker 068afd6276 core/random: Convert to C
And convert the unit test while we're at it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 10:05:58 -04:00
Anna Schumaker cea50ae37f core/random: Rename random() -> random_range()
This prevents a conflict with C's stdlib.h.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 10:05:52 -04:00
Anna Schumaker 023bae737c core/string: Add a function for comparing strings
And switch over the GenericTag to using it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 09:59:41 -04:00
Anna Schumaker 60678d1ddb core/string: Convert file to C
And convert the unit test while we're at it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 09:56:19 -04:00
Anna Schumaker 1a3735251d core/string: Move string_lowercase() out of "string" namespace
And refactor to use glib string functions while we're at it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 09:54:16 -04:00
Anna Schumaker 83fe822dc7 core/string: Move sec2str_detailed() out of "string" namespace
I also take the opportunity to rename the function to
string_sec2str_long().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 09:46:30 -04:00
Anna Schumaker 18b83f5c26 core/string: Refactor sec2str_detailed()
I only need one function to perform the entire conversion using
g_strdup_printf().  This helps to simplify the code before switching
over to C.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 09:41:17 -04:00
Anna Schumaker a314ee03ca core/string: Move sec2str() out of "string" namespace
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>
2015-10-07 09:33:50 -04:00
Anna Schumaker 82d1da491b core/string: Remove string :: utos()
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>
2015-10-07 09:31:28 -04:00
Anna Schumaker 65fb3888b6 tests/core: Update audio test to the new framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:29 -04:00
Anna Schumaker 077c6bf0c8 tests/core: Update deck test to new framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:29 -04:00
Anna Schumaker 1cb7eff37d tests/core: Update playlist test to the new framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:29 -04:00
Anna Schumaker b81b1eeda7 tests/core: Update library test to the new framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:29 -04:00
Anna Schumaker ff26171d6f tests/core: Update queue test to the new framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:29 -04:00
Anna Schumaker cfca7fccb0 tests/core: Update random test to the new framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:29 -04:00
Anna Schumaker 9882727c81 tests/core: Update tags/track test to the new framework 2015-10-07 08:26:29 -04:00
Anna Schumaker cefadba363 tests/core: Update tags/library test to new framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:29 -04:00
Anna Schumaker a74c52e5cb tests/core: Update tags/genre test to new framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:28 -04:00
Anna Schumaker 0c294d2481 tests/core: Update tags/album unit test to the new framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:28 -04:00
Anna Schumaker e6f26d036c tests/core: Update tags/artist test to the new framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:28 -04:00
Anna Schumaker a6d206a003 tests/core: Update tags/generic test to the new framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:28 -04:00
Anna Schumaker 0dd91e25c7 tests/core: Update idle queue test to the new framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:28 -04:00
Anna Schumaker 583bb5d84b tests/core: Update filter test to new framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:28 -04:00
Anna Schumaker a9219d4f22 tests/core: Update index unit test to the new framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:28 -04:00
Anna Schumaker 7318363287 tests/core: Update database test to the new framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:28 -04:00
Anna Schumaker da8131aa6d tests/core: Update file test to new testing framework
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:26:27 -04:00
Anna Schumaker 2276a44a07 tests/core: Update string test to the new framework
I converted the test to the new framework, and I introduced a new
"test.h" file in the source directory to help with mixing C and C++
code.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:19:49 -04:00
Anna Schumaker 55a7673983 tests/core: Update version test to the new framework
The version test is fairly simple, since it only tests the values set in
a single header file.  The remaining tests will be more challenging,
since I'll have to modify core code and the test at the same time.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:19:45 -04:00