core/playlists/system: Add struct sys_playlist
This will contain the playlist and operations for each secific type. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
3d85f0fdc5
commit
d460bcaee8
|
@ -9,14 +9,14 @@ static bool __sys_pl_remove(enum sys_playlist_t, struct track *);
|
|||
|
||||
static struct file sys_file = FILE_INIT("playlist.db", 0, 0);
|
||||
static struct file sys_collection = FILE_INIT("library.q", 0, 0);
|
||||
static struct playlist sys_playlists[SYS_PL_NUM_PLAYLISTS] = {
|
||||
[SYS_PL_FAVORITES] = DEFINE_PLAYLIST(PL_SYSTEM, "Favorites"),
|
||||
[SYS_PL_HIDDEN] = DEFINE_PLAYLIST(PL_SYSTEM, "Hidden"),
|
||||
[SYS_PL_COLLECTION] = DEFINE_PLAYLIST(PL_SYSTEM, "Collection"),
|
||||
[SYS_PL_HISTORY] = DEFINE_PLAYLIST(PL_SYSTEM, "History"),
|
||||
[SYS_PL_UNPLAYED] = DEFINE_PLAYLIST(PL_SYSTEM, "Unplayed"),
|
||||
[SYS_PL_MOST_PLAYED] = DEFINE_PLAYLIST(PL_SYSTEM, "Most Played"),
|
||||
[SYS_PL_LEAST_PLAYED] = DEFINE_PLAYLIST(PL_SYSTEM, "Least Played"),
|
||||
static struct sys_playlist sys_playlists[SYS_PL_NUM_PLAYLISTS] = {
|
||||
[SYS_PL_FAVORITES] = { DEFINE_PLAYLIST(PL_SYSTEM, "Favorites") },
|
||||
[SYS_PL_HIDDEN] = { DEFINE_PLAYLIST(PL_SYSTEM, "Hidden") },
|
||||
[SYS_PL_COLLECTION] = { DEFINE_PLAYLIST(PL_SYSTEM, "Collection") },
|
||||
[SYS_PL_HISTORY] = { DEFINE_PLAYLIST(PL_SYSTEM, "History") },
|
||||
[SYS_PL_UNPLAYED] = { DEFINE_PLAYLIST(PL_SYSTEM, "Unplayed") },
|
||||
[SYS_PL_MOST_PLAYED] = { DEFINE_PLAYLIST(PL_SYSTEM, "Most Played") },
|
||||
[SYS_PL_LEAST_PLAYED] = { DEFINE_PLAYLIST(PL_SYSTEM, "Least Played") },
|
||||
};
|
||||
|
||||
|
||||
|
@ -41,7 +41,13 @@ static enum sys_playlist_t __sys_pl_convert(const gchar *name)
|
|||
|
||||
static inline struct queue *__sys_pl_queue(enum sys_playlist_t plist)
|
||||
{
|
||||
return &sys_playlists[plist].pl_queue;
|
||||
return &sys_playlists[plist].spl_playlist.pl_queue;
|
||||
}
|
||||
|
||||
static struct sys_playlist *__sys_pl_lookup(const gchar *name)
|
||||
{
|
||||
enum sys_playlist_t plist = __sys_pl_convert(name);
|
||||
return (plist < SYS_PL_NUM_PLAYLISTS) ? &sys_playlists[plist] : NULL;
|
||||
}
|
||||
|
||||
static void __sys_pl_save()
|
||||
|
@ -200,10 +206,8 @@ static bool __sys_pl_update(enum sys_playlist_t plist)
|
|||
|
||||
static struct queue *pl_system_get_queue(const gchar *name)
|
||||
{
|
||||
enum sys_playlist_t plist = __sys_pl_convert(name);
|
||||
if (plist == SYS_PL_NUM_PLAYLISTS)
|
||||
return NULL;
|
||||
return __sys_pl_queue(plist);
|
||||
struct sys_playlist *sys_pl = __sys_pl_lookup(name);
|
||||
return sys_pl ? &sys_pl->spl_playlist.pl_queue : NULL;
|
||||
}
|
||||
|
||||
static bool pl_system_new_delete(const gchar *name)
|
||||
|
|
|
@ -17,6 +17,10 @@ enum sys_playlist_t {
|
|||
SYS_PL_NUM_PLAYLISTS, /* Number of system playlists. */
|
||||
};
|
||||
|
||||
struct sys_playlist {
|
||||
struct playlist spl_playlist;
|
||||
};
|
||||
|
||||
|
||||
/* System playlist type. */
|
||||
extern struct playlist_type pl_system;
|
||||
|
|
Loading…
Reference in New Issue