Anna Schumaker
ecda136015
core/tempq: Move tempq_move() out of the deck namespace
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker
c22b93b2cf
core/tempq: Move tempq_get() out of the deck namespace
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker
6bdc481cb4
core/tempq: Make __tempq_index() private
...
It has no users outside of unit tests.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker
06d62240bb
core/tempq: Move tempq_free() out of the deck namespace
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker
bce2ba33f7
core/tempq: Move tempq_alloc() out of the deck namespace
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker
8c7550d5c3
core/tempq: Move tempq_init() out of the deck namespace
...
I also take this opportunity to drop support for upgrading from file
format 0. I've had several releases since this format was supported, so
this should be safe to do.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker
51379c7e8c
core/history: Add history_prev() function
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker
c125b3893e
core/history: Add history_add() function
...
I decided that having a uniqueue history queue doesn't really get me
anything, so I dropped that portion of the behavior.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker
75c039f22d
core/history: Add history_init() and history_deinit() functions
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker
77d4815eb6
core/history: Move history queue into a new file
...
I think managing this separately from temporary queues will make the
code simpler.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker
8c8ab2a9eb
core/idle: Add idle_cancel() function
...
This function is used to cancel all idle tasks and free the memory
allocated for them. This needs to be called when Ocarina is shutting
down to prevent a possible hang with the gtk idle callback continuing to
process tasks.
Fixes #30 : Closing Ocarina should cancel idle tasks
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-01 08:27:13 -05:00
Anna Schumaker
b3592e40c0
core/playlist: Rename PL_BANNED -> PL_HIDDEN
...
"Banning" a track is a bit harsh. Let's talking about hiding tracks
instead, so that it sounds friendlier.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-29 13:22:31 -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
5844402ee3
core/playlist: Merge __playlist_fill() with playlist_static()
...
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
135e0d95d6
core/playlist: Move dynamic playlists out of the PlaylistQueue class
...
This lets me remove the PlaylistQueue entirely.
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
73992ed912
core/playlist: Clean up how we fill in static playlists
...
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
219f8fa119
core/collection: Update collection on startup
...
This is much more convenient to users, since they don't need to update
the collection manually.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-23 07:55:56 -05:00
Anna Schumaker
94f22c9fc5
core/collection: Statically initialize c_file
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:47:26 -05:00
Anna Schumaker
696933c6b4
core/collection: Rename library_q -> c_queue
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:47:21 -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
49457751c9
core/collection: Clean up path scanning code
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:47:10 -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
ffa12a2c38
core/collection: Move file reading code into collection_init()
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker
79af4513b0
core/collection: Directly save the queue in collection_save()
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -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
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
9701da5392
core/queue: Add a function to resort the queue
...
This can be combined with the Q_ADD_FRONT flag for efficient bulk
insertions.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -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
8fb64015b4
core/queue: Replace vector with struct _queue
...
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
daa09becf7
core/queue: Remove queue destructor
...
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
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
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
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
eac0b92f0d
core/library: Close directory after reading
...
We were opening a directory for scanning, but we never closed when we
were done. If we do this enough then the kernel starts telling us that
there are too many open files.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 10:03:08 -05:00
Anna Schumaker
ad5726b542
core: Add core :: deinit() function
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -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
ad48d24533
core/tags/album: Replace std::string with gchar *
...
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
284e3466f4
core/idle: Replace C++ queue with a glib queue
...
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
91239a392d
core/filter: Clean up header file
...
Adjust commends and remove the filter namespace.
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
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
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
92806c5201
core/tags/track: Clean up constructors
...
I replace the standard and copy constructors with one that tags a track
during construction. This lets me clean up a lot of code, and keep
tagging functions internal to the track class.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
33e20989fa
core/tags/track: Directly inherit from DatabaseEntry
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
ee71786c09
core/tags/track: Move track_last_play() out of the track struct
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
90cdfd4cbd
core/tags/track: Move track_path() out of the track struct
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
c634f5d5e2
core/tags/track: Move track_played() out of the track struct
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
fb4933e418
core/tags/track: Remove track::compare_date()
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
24d5c37a6c
core/tags/track: Remove variable accessor functions
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
9c1cbbf8cb
core/tags/track: Remove tag accessor functions
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
192bdc3ac7
core/tags/track: Replace tags :: track_size() with track_db_get()
...
We want to loop over the track database in several places, so let's make
this easier by just returning the database itself.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
eea0f57cf8
core/tags/track: Move track_commit_db() out of tags namespace
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
d3bdcf2edc
core/tags/track: Move track_db_init() out of the tags namespace
...
And add the functions track_db_deinit() and tags :: db_deinit().
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
d0ec3e2cac
core/tags/track: Move track_remove_all() out of the tags namespace
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
7ffaf91617
core/tags/track: Move track_remove() out of the tags namespace
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
83a945d3da
core/tags/track: Move track_add() out of the tags namespace
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
c8061e2868
core/tags/track: Move track_get() out of the tags namespace
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
765079df94
core/tags/track: Convert Track class into a struct
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
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
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
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
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
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
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
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
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
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
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
Anna Schumaker
08bef63918
core/tags/track: Add a space before title
...
I noticed that tracks beginning with a number were getting combined with
the seconds field, creating an inaccurate seconds count and modifying
the title at the same time.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-14 16:41: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
a88da1dabf
core/file: Refactor file opening code
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-08 15:46:15 -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
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
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
ead1397b31
Remove Doxygen tags
...
I wasn't actually using Doxygen for anything, so it's probably best just
to remove it.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-09-02 14:24:42 -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
c068cbb736
callbacks: Remove on_pq_track_changed()
...
It's been replaced with a function int he QNotifier class.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-03 21:03:05 -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
8cc48aa799
callbacks: Remove on_pq_track_deleted()
...
It's been replaced with a function in the QNotifier class.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-03 12:29:41 -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
89a13ff6f7
callback: Remove on_queue_track_add() callback
...
It no longer has any users.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-03 12:20:07 -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
93c9877d57
playlist: Allow selecting same playlist again
...
This will go unnoticed for Favorites and Banned playlists, but will
allow dynamic playlists to be refreshed without switching to a different
playlist first.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-02-06 14:15:06 -05:00
Anna Schumaker
d0fb9b2155
playlist: Give PlaylistQueues a clear() function
...
This is used to clear the queue before populating it with a different
playlist.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-02-06 14:12:28 -05:00
Anna Schumaker
f7eb34c2af
string: Make _time_detail() static
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-30 10:54:40 -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
7e58a4fef8
filter: Simplify adding words to the filter
...
I can use the lowercase text from string :: lowercase() and take a
single pass over a single string (rather than iterating through a list
of strings).
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-30 10:54:38 -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
ed43fd3689
More utos() cleanups
...
I found a few other places where I can use utos() instead of
stringstreams.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-27 14:03:12 -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
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
694d3f0316
build: Add gstreamer package from gui/Sconscript
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-02 10:31:14 -05:00
Anna Schumaker
f84a1dd891
audio: Shuffle around the code a bit
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-20 16:05:01 -05:00
Anna Schumaker
21f3f7c828
Audio: Remove the _load_track_default() function
...
There are only two callers, and removing it makes the code more
obvious.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-20 15:58:29 -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
acac350879
audio: Remove on_pause_count_changed callback
...
The UI should handle this directly on end-of-stream messages.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-20 15:44:40 -05:00
Anna Schumaker
b633f3fa0c
gst: Update the "now playing" fields through the GST driver
...
This lets me remove the on_track_loaded() callback function by handling
this event directly.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-20 12:05:22 -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
e866ea2574
audio: Make audio functions more consistent
...
Sometimes I would check for cur_track, other times !cur_track.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-20 10:30:22 -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
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
1d2b52cc98
driver: Move the GST driver into the gui
...
This is a straight copy-and-paste of the header file and the code
implementing it. I intent to clean this up with future patches.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-19 14:25:59 -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
326865f6be
driver: Update doxygen documentation
...
This lets me remove the Audio Driver section of the DESIGN document.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-19 13:37:44 -05:00
Anna Schumaker
31a405d3c6
deck: Update doxygen documentation
...
Also remove the deck section of the DESIGN document.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-12 08:25:53 -05:00
Anna Schumaker
0758f08642
Queue: Remove _del_at
...
I merged it with _del(index) since they are for exactly the same thing.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-09 08:50:03 -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
Anna Schumaker
a1b6955a1d
Queue: Clean up queue flags
...
Reformat the doxygen comments and remove the unused Q_FLAG_MASK
constant.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-07 09:58:47 -05:00
Anna Schumaker
30b2ba0fff
Track: Doxygen documentation updates
...
This patch fixes up formatting a little bit and removes the Track
section of the DESIGN document.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker
e7e36caa3a
tagdb: Remove tagdb
...
This shifts the taglib code into library.cpp. I also remove the tagdb
section of the DESIGN document.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker
c7fe5b18d5
tagdb: Rip out most tagdb functions
...
Most of this are a straight replacement with the new versions in
tags/track.cpp.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker
2394e46fb7
Track: Re-enable filtering
...
This has been disabled for some time. I added a test for adding track
indexes to the filter upon creation, but it doesn't properly test adding
to the filter when reading from disk.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker
09bf458d7a
Track: Rename functional test to locale test
...
This code is really testing date and locale handling, so this patch
renames the function to match what it actually does. While I'm at it, I
also introduce some cleanups.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker
4224d89813
Track: Add a function for finding track_db size
...
This returns the actual size of the database, so be careful when using
it! The intent of this function is to allow some kind of iteration when
loading databases.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker
45c83ed2fd
Track: Add a function for removing all tracks from a given library
...
This function will be called when doing library removals.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker
9dfec9934c
Track: Add a function for removing specific tracks from the track_db
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker
d5fc2a4de0
Track: Add a function for saving the track_db
...
The track_db doesn't have autosaving enabled for performance reasons.
This lets us add several tracks to the database between saves, but it
also means we need to provide a commit() function.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker
83cc81c934
Track: Add a function to look up Track tags by index
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker
a30f5ef794
Track: Create an add_track() function
...
We return a new Track tag or NULL if we have already tagged this track.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker
d7ceadafb3
Track: Implement a copy constructor
...
This keeps library size accurate when adding new tracks to the track_db.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:52 -05:00
Anna Schumaker
44aac0dcec
Generic: Create a copy constructor
...
Track tags need a copy constructor to keep library size accurate, so
create one here.
2014-12-04 08:31:52 -05:00