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
Anna Schumaker
63769c9c0b
Convert unit test framework to C
...
I commented out most of the file and directory modification code while I
was at it. I'll re-add these as I convert more files to C.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 08:19:37 -04:00
Anna Schumaker
34a15d58c4
Remove test_env
...
I want to make the scons files simpler, so I have decided to drop down
to only one test environment. This patch disables
tests/core/Sconscript, but I'll add this back in as I make other changes
throughout the codebase.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-09-11 09:11:38 -04:00
Anna Schumaker
ec4d3b945e
audio: Fix seeking on ARM
...
The on_seek() function needs to take an int64_t to avoid truncating on
ARM.
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2015-04-14 09:05:09 -04:00
Anna Schumaker
657ce8f0f4
audio: Ensure position and duration results are 64 bits
...
A long int is shorter on ARM than x86, which could cause position and
duration values to get truncated. Additionally, quering gstreamer with
a long int causes a compile error on ARM. Let's just do the right thing
and make this value an int64_t.
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2015-04-14 09:05:05 -04:00
Anna Schumaker
eabb5ef856
queue: Remove Q_NOTIFY_REMOVE flag
...
It no longer has any meaning.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-09 09:27:46 -04:00
Anna Schumaker
9180545bc2
queue: Remove on_remove() notification
...
I no longer need it to pass queue-removed messages to the gui.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-09 09:26:36 -04:00
Anna Schumaker
c80468a739
callback: Remove all references to callbacks
...
Callbacks have no remaining users and can safely be removed :)
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-04 10:21:31 -04:00
Anna Schumaker
116d1cd28f
deck: Make sure that Q_NOTIFY_REMOVE is set
...
TempQueues need this to tell the GUI when they have been removed.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-04 10:20:53 -04:00
Anna Schumaker
e8b68b84eb
queue: Add an on_remove() notification to the QNotifier class
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-04 10:20:49 -04:00
Anna Schumaker
b95bbe6ad4
queue: Create an on_track_updated() callback
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-03 20:55:07 -04:00
Anna Schumaker
9eef2ad35d
queue: Create an on_track_removed() notification
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-03 12:24:37 -04:00
Anna Schumaker
91fc9436a5
queue: Give notifiers an "on_track_added()" function
...
So they can tell GUIs that something has been added.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-03 12:19:08 -04:00
Anna Schumaker
c5598293d6
queue: Create a notifier class
...
This class will be used to push queue changes directly to the GUI.
Currently changes get mapped through the old callbacks system, which can
lead to several inefficiencies because the GUI has to look up each queue
structure in a list.
This patch implements a basic QNotifier class and provides a function
for setting a Queue's notifier.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-03 12:16:40 -04:00
Anna Schumaker
75d39cbd85
playlist: Add a "least played tracks" playlist
...
This playlist will look for any track with a below average playcount.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-02-06 15:33:42 -05:00
Anna Schumaker
0997ffff99
playlist: Add a "most played tracks" playlist
...
This playlist will look for any track with an above average play count.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-02-06 15:10:38 -05:00
Anna Schumaker
64291ff02c
playlist: Add an "unplayed tracks" dynamic playlist
...
Unplayed tracks is a dynamic playlist generated whenever we are asked to
select the "Unplayed" playlist. Note that dynamic playlists aren't
hooked up to the other playlist functions (has, add, del, or
get_tracks). This is to avoid adding them to the index and potentially
writing out to disk.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-02-06 14:33:57 -05:00
Anna Schumaker
3f423fb3ae
filter: Use string :: lowercase() for searching
...
This is a much simpler way of doing things.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-30 10:54:39 -05:00
Anna Schumaker
6c4dc5b1db
filter: Remove lowercase() function
...
And switch everything over to using the new implementation.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-30 09:35:55 -05:00
Anna Schumaker
7733e24c07
string: Add a lowercase() function
...
This function strips out special characters and returns the lowercase
version of the string.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-30 09:32:50 -05:00
Anna Schumaker
cc6f4c9293
string: Add a function for creating a detailed time string
...
I use this to display the total running time of queues in the gui.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-29 08:27:25 -05:00
Anna Schumaker
12260a3de9
string: Add a function for converting seconds to string
...
This is used to get a string representation of the number of seconds
passed in.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-27 09:23:14 -05:00
Anna Schumaker
6c6437c2bd
string: Create a utos() function
...
This function converts unsigned ints into strings. This allows me to
replace several almost identical functions with one function call.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-27 08:37:27 -05:00
Anna Schumaker
77fc2fff5c
version: Add a "+" to version string
...
I use this to show that there have been any changes since the last
release.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-26 08:43:14 -05:00
Anna Schumaker
e6d9a58be2
gui: Remove CONFIG_TEST macros
...
I haven't had gui unit tests in months, so these can be removed for now.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-21 08:43:55 -05:00
Anna Schumaker
74a557739d
lib: Remove rest of lib/
...
This is all contained in the gui code now.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-21 08:39:02 -05:00
Anna Schumaker
98ff0b79cd
colmgr: Merge lib/ and gui/ code back together
...
The code is still messy now, but I'll be cleaning it up soon!
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-17 13:19:41 -05:00
Anna Schumaker
27c7dc91d8
queue: Fix up sorting
...
If years are equal then sort by album name.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-13 10:08:53 -05:00
Anna Schumaker
6cfd0d5c51
tests: Rework much of the testing library
...
I move the code into a new cpp file, so it is no longer a header-only
library. I also take the chance to add a for-each function for testing
iterators.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-13 09:35:26 -05:00
Anna Schumaker
8d3010a31e
queue: minor cleanup
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-13 09:35:26 -05:00
Anna Schumaker
1dfe475ade
idle: Clean up unit test
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-13 09:35:26 -05:00
Anna Schumaker
afd47ce667
index: Clean up unit test
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-13 09:35:26 -05:00
Anna Schumaker
4b0c6121c3
database: Clean up the unit test
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-13 09:35:26 -05:00
Anna Schumaker
0abc562033
build: Remove unused global environment variables
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-02 10:43:44 -05:00
Anna Schumaker
a371e832dd
build: Remove valgrind support
...
I never actually used this. Testing with valgrind should happen
manually if needed.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-02 10:32:16 -05:00
Anna Schumaker
3750293ca0
tags: Fix expected years
...
Year is no longer 2014.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-02 10:26:52 -05:00
Anna Schumaker
92d264d4ac
audio: Move Driver into audio.h
...
I also rename from Driver -> AudioDriver.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-20 15:48:07 -05:00
Anna Schumaker
6a117c762e
driver: play() and pause() shouldn't return a boolean
...
This value is never used in the audio layer so let's stop returning it
from the driver.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-20 14:32:31 -05:00
Anna Schumaker
d7113cb124
driver: Pass Tracks to the load() function
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-20 12:01:38 -05:00
Anna Schumaker
a4ad0aa79b
driver: Fold eos() into the driver
...
With this patch I no longer need a Driver :: init() function to handle
picking the next track.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-20 11:04:14 -05:00
Anna Schumaker
fd2a251c14
audio: Initialize GST from the gui layer
...
This means I no longer need to pass argc and argv parameters to core/,
so I can eventually work towards removing the Driver :: init() function.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-20 10:16:44 -05:00
Anna Schumaker
e7a8ad54bd
Audio: Remove the driver on_error() callback function
...
This was used to get around layering issues with the gstreamer driver.
Now that the gstreamer implementation is in the gui code we can have it
call audio::next() directly.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-19 17:26:39 -05:00
Anna Schumaker
5b32bb16b4
Audio: Make the TestDriver class completely internal to the audio test
...
It's not used anywhere else except during this one test, so move it out
of the global include files.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-19 17:21:32 -05:00
Anna Schumaker
b9d4c6749d
audio: Move the get_driver() function into the audio namespace
...
It's already in the audio.cpp file, so just reshuffle things a little
bit.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-19 14:54:12 -05:00
Anna Schumaker
f20898b79c
driver: Merge code with audio.cpp
...
The driver is intended to be a small class, so put it in the audio code
now and we'll clean it up in future patches.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-19 14:37:56 -05:00
Anna Schumaker
c12dbae73a
driver: Track current driver with a pointer
...
This will let me implement drivers outside of this file allowing for
easier customization.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-19 14:20:30 -05:00
Anna Schumaker
39eb22f05c
Queue: Update doxygen documentation
...
I also remove the related section of the DESIGN document.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-09 08:40:14 -05:00