enums.h 2.98 KB
Newer Older
1 2 3
#ifndef ENUMS_H
#define ENUMS_H

4
#ifdef STATIC_MAUIKIT
camilo higuita's avatar
camilo higuita committed
5
#include "fmh.h"
6 7 8 9
#else
#include <MauiKit/fmh.h>
#endif

10 11 12
#include <QMap>
#include <QVariant>

13 14 15
#include <functional>


16 17 18
namespace PULPO
{

19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
enum class SERVICES : uint8_t
{
    LastFm,
    Spotify,
    iTunes,
    MusicBrainz,
    Genius,
    LyricWikia,
    Wikipedia,
    WikiLyrics,
    Deezer,
    ALL,
    NONE
};

enum class ONTOLOGY : uint8_t
{
    ARTIST,
    ALBUM,
    TRACK
};

enum class INFO : uint8_t
{
    ARTWORK,
    WIKI,
    TAGS,
    METADATA,
    LYRICS,
    ALL,
    NONE
};

/*Generic context names. It's encouraged to use these instead of a unkown string*/
enum class CONTEXT : uint8_t
{
    TRACK_STAT,
    TRACK_NUMBER,
    TRACK_TITLE,
    TRACK_DATE,
    TRACK_TEAM,
    TRACK_AUTHOR,
    TRACK_LANGUAGE,
    TRACK_SIMILAR,

    ALBUM_TEAM,
    ALBUM_STAT,
    ALBUM_TITLE,
    ALBUM_DATE,
    ALBUM_LANGUAGE,
    ALBUM_SIMILAR,
    ALBUM_LABEL,

    ARTIST_STAT,
    ARTIST_TITLE,
    ARTIST_DATE,
    ARTIST_LANGUAGE,
    ARTIST_PLACE,
    ARTIST_SIMILAR,
    ARTIST_TEAM,
    ARTIST_ALIAS,
    ARTIST_GENDER,

    GENRE,
    TAG,
    WIKI,
    IMAGE,
    LYRIC,
    SOURCE

};

static const QMap<CONTEXT,QString> CONTEXT_MAP =
{
    {CONTEXT::ALBUM_STAT, "album_stat"},
    {CONTEXT::ALBUM_TITLE, "album_title"},
    {CONTEXT::ALBUM_DATE, "album_date"},
    {CONTEXT::ALBUM_LANGUAGE, "album_language"},
    {CONTEXT::ALBUM_SIMILAR, "album_similar"},
    {CONTEXT::ALBUM_LABEL, "album_label"},
    {CONTEXT::ALBUM_TEAM, "album_team"},

    {CONTEXT::ARTIST_STAT, "artist_stat"},
    {CONTEXT::ARTIST_TITLE, "artist_title"},
    {CONTEXT::ARTIST_DATE, "artist_date"},
    {CONTEXT::ARTIST_LANGUAGE, "artist_language"},
    {CONTEXT::ARTIST_PLACE, "artist_place"},
    {CONTEXT::ARTIST_SIMILAR, "artist_similar"},
    {CONTEXT::ARTIST_ALIAS, "artist_alias"},
    {CONTEXT::ARTIST_GENDER, "artist_gender"},
    {CONTEXT::ARTIST_TEAM, "artist_team"},

    {CONTEXT::TRACK_STAT, "track_stat"},
    {CONTEXT::TRACK_DATE, "track_date"},
    {CONTEXT::TRACK_TITLE, "track_title"},
    {CONTEXT::TRACK_NUMBER, "track_number"},
    {CONTEXT::TRACK_TEAM, "track_team"},
    {CONTEXT::TRACK_AUTHOR, "track_author"},
    {CONTEXT::TRACK_LANGUAGE, "track_language"},
    {CONTEXT::TRACK_SIMILAR, "track_similar"},

    {CONTEXT::GENRE, "genre"},
    {CONTEXT::TAG, "tag"},
    {CONTEXT::WIKI, "wiki"},
    {CONTEXT::IMAGE, "image"},
    {CONTEXT::LYRIC, "lyric"},
    {CONTEXT::SOURCE, "source"}

};

enum class RECURSIVE : bool
{
    ON = true,
    OFF = false
};

typedef QMap<CONTEXT, QVariant> VALUE;
typedef QMap<INFO, VALUE> INFO_K;
//    typedef QMap<ONTOLOGY, INFO_K> RESPONSE;

typedef QMap<ONTOLOGY, QList<INFO>> SCOPE;

struct RESPONSE
{
    CONTEXT context;
    QVariant value;
};
typedef QList<PULPO::RESPONSE> RESPONSES;

struct REQUEST
{
    FMH::MODEL track;

    PULPO::ONTOLOGY ontology;
    QList<PULPO::INFO> info;
    QList<PULPO::SERVICES> services;

156
    std::function<void(REQUEST request, RESPONSES responses)> callback = nullptr;
157 158
};

159 160 161 162

}

#endif // ENUMS_H