2015-12-17 10:32:01 -05:00
|
|
|
/*
|
2014-06-29 10:36:00 -04:00
|
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
|
|
*/
|
|
|
|
#include <core/core.h>
|
|
|
|
|
2016-08-12 14:00:11 -04:00
|
|
|
static bool core_defragment(void *data)
|
|
|
|
{
|
|
|
|
if (tags_defragment()) {
|
|
|
|
playlist_save();
|
|
|
|
audio_save();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-09-24 10:53:25 -04:00
|
|
|
void core_init(int *argc, char ***argv, struct playlist_callbacks *playlist_cb,
|
|
|
|
struct audio_callbacks *audio_cb, enum idle_sync_t idle_sync)
|
2014-06-29 10:36:00 -04:00
|
|
|
{
|
2016-09-24 10:53:25 -04:00
|
|
|
idle_init(idle_sync);
|
2016-03-29 08:39:00 -04:00
|
|
|
settings_init();
|
2015-11-12 10:24:27 -05:00
|
|
|
tags_init();
|
2016-09-24 10:53:25 -04:00
|
|
|
playlist_init(playlist_cb);
|
|
|
|
audio_init(argc, argv, audio_cb);
|
2016-08-12 14:00:11 -04:00
|
|
|
|
|
|
|
idle_schedule(IDLE_SYNC, core_defragment, NULL);
|
2014-06-29 10:36:00 -04:00
|
|
|
}
|
2015-11-12 10:45:30 -05:00
|
|
|
|
2015-12-17 10:06:40 -05:00
|
|
|
void core_deinit()
|
2015-11-12 10:45:30 -05:00
|
|
|
{
|
2015-12-15 10:46:48 -05:00
|
|
|
audio_deinit();
|
2015-12-11 09:21:10 -05:00
|
|
|
playlist_deinit();
|
2015-11-12 10:45:30 -05:00
|
|
|
tags_deinit();
|
2016-03-29 08:39:00 -04:00
|
|
|
settings_deinit();
|
2016-04-30 10:11:48 -04:00
|
|
|
idle_deinit();
|
2015-11-12 10:45:30 -05:00
|
|
|
}
|