2015-11-11 09:15:25 -05:00
|
|
|
/*
|
2014-11-08 20:53:08 -05:00
|
|
|
* Copyright 2014 (c) Anna Schumaker.
|
2015-11-11 09:15:25 -05:00
|
|
|
*
|
|
|
|
* The album tag is used to store the name and year of albums
|
|
|
|
* added to the tag database.
|
|
|
|
*
|
|
|
|
* When writing an album tag to disk, write out the album_year field
|
|
|
|
* followed by the album_name on the same line:
|
|
|
|
*
|
|
|
|
* ... 1998 Hyrule Symphony
|
|
|
|
* ... 2006 Twilight Princess
|
|
|
|
* ... 2011 Skyward Sword
|
2014-11-08 20:53:08 -05:00
|
|
|
*/
|
|
|
|
#ifndef OCARINA_CORE_TAGS_ALBUM_H
|
|
|
|
#define OCARINA_CORE_TAGS_ALBUM_H
|
|
|
|
|
2016-04-29 11:18:44 -04:00
|
|
|
#include <core/database.h>
|
2016-05-03 07:54:54 -04:00
|
|
|
#include <core/tags/artist.h>
|
2014-11-08 20:53:08 -05:00
|
|
|
|
2015-11-11 07:59:21 -05:00
|
|
|
struct album {
|
2016-05-19 11:01:30 -04:00
|
|
|
unsigned int al_year; /* This album's year. */
|
|
|
|
gchar *al_name; /* This album's name. */
|
|
|
|
gchar **al_tokens; /* This album's tokenized strings. */
|
|
|
|
gchar **al_alts; /* This album's alternate ascii tokens. */
|
2016-05-03 07:54:54 -04:00
|
|
|
struct artist *al_artist;
|
2016-07-26 15:53:47 -04:00
|
|
|
struct genre *al_genre;
|
2015-11-11 07:59:21 -05:00
|
|
|
struct db_entry al_dbe;
|
2014-11-08 20:53:08 -05:00
|
|
|
};
|
|
|
|
|
2015-11-11 07:59:21 -05:00
|
|
|
#define ALBUM(dbe) ((struct album *)DBE_DATA(dbe))
|
2015-11-04 12:23:00 -05:00
|
|
|
|
2014-11-16 14:47:51 -05:00
|
|
|
|
2015-09-24 11:18:48 -04:00
|
|
|
/* Called to initialize the album database. */
|
|
|
|
void album_db_init();
|
2014-11-16 14:47:51 -05:00
|
|
|
|
2015-09-24 11:18:48 -04:00
|
|
|
/* Called to clean up the album database. */
|
|
|
|
void album_db_deinit();
|
2015-09-24 11:09:59 -04:00
|
|
|
|
2015-09-24 11:13:12 -04:00
|
|
|
/* Called to find an album tag by name and year. */
|
2015-11-11 08:11:54 -05:00
|
|
|
struct album *album_find(const gchar *, unsigned int);
|
2015-09-24 11:13:12 -04:00
|
|
|
|
2015-09-24 11:09:59 -04:00
|
|
|
/* Called to get an album tag with a specific index. */
|
|
|
|
struct album *album_get(const unsigned int);
|
|
|
|
|
2015-11-16 09:38:31 -05:00
|
|
|
/* Called to compare two album tags by name. */
|
2015-10-22 09:58:12 -04:00
|
|
|
int album_compare(struct album *, struct album *);
|
|
|
|
|
2015-11-16 09:38:31 -05:00
|
|
|
/* Called to compare two album tags by year. */
|
|
|
|
int album_compare_year(struct album *, struct album *);
|
|
|
|
|
2016-05-19 14:47:58 -04:00
|
|
|
/* Called to check if an artist has a token that matches the given string. */
|
|
|
|
bool album_match_token(struct album *album, const gchar *);
|
|
|
|
|
2016-07-27 08:15:15 -04:00
|
|
|
/* Called to find the database index of the album tag. */
|
|
|
|
static inline unsigned int album_index(struct album *album)
|
|
|
|
{
|
|
|
|
return album->al_dbe.dbe_index;
|
|
|
|
}
|
|
|
|
|
2016-04-30 08:51:34 -04:00
|
|
|
/* Called to check if album artwork has been downloaded. */
|
|
|
|
bool album_artwork_exists(struct album *);
|
|
|
|
|
2016-04-30 12:54:42 -04:00
|
|
|
/*
|
|
|
|
* Called to find the path to an album's artwork.
|
|
|
|
* This function returns a new string that MUST be freed with g_free().
|
|
|
|
*/
|
|
|
|
gchar *album_artwork_path(struct album *);
|
|
|
|
|
2016-07-12 14:36:40 -04:00
|
|
|
/* Called to manually set artwork for a given album. */
|
|
|
|
bool album_artwork_import(struct album *, gchar *);
|
|
|
|
|
2015-11-03 10:39:06 -05:00
|
|
|
#ifdef CONFIG_TESTING
|
|
|
|
const struct db_ops *test_album_ops();
|
|
|
|
#endif /* CONFIG_TESTING */
|
2014-11-08 20:53:08 -05:00
|
|
|
#endif /* OCARINA_CORE_TAGS_ALBUM_H */
|