mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-24 22:25:56 -05:00
make containers query honor metatags, add mt-daapd specific playlist tags for type and smart playlist spec
This commit is contained in:
parent
158a76ae16
commit
533c273a0b
@ -171,7 +171,8 @@ DAAP_ITEMS taglist[] = {
|
||||
{ 0x01, "aeSP", "com.apple.itunes.smart-playlist" },
|
||||
/* iTunes 4.5+ */
|
||||
{ 0x01, "msas", "dmap.authenticationschemes" },
|
||||
{ 0x05, "ascd", "daap.songcodectype" }, /* there is a songcodec subtype, too */
|
||||
{ 0x05, "ascd", "daap.songcodectype" },
|
||||
{ 0x05, "ascs", "daap.songcodecsubtype" },
|
||||
{ 0x09, "agrp", "daap.songgrouping" },
|
||||
{ 0x05, "aeSV", "com.apple.itunes.music-sharing-version" },
|
||||
{ 0x05, "aePI", "com.apple.itunes.itms-playlistid" },
|
||||
@ -179,54 +180,68 @@ DAAP_ITEMS taglist[] = {
|
||||
{ 0x05, "aeGI", "com.apple.iTunes.itms-genreid" },
|
||||
{ 0x05, "aeAI", "com.apple.iTunes.itms-artistid" },
|
||||
{ 0x05, "aeSI", "com.apple.iTunes.itms-songid" },
|
||||
{ 0x05, "aeSF", "com.apple.iTunes.itms-storefrontid" },
|
||||
|
||||
/* mt-daapd specific */
|
||||
{ 0x09, "MSPS", "org.mt-daapd.smart-playlist-spec" },
|
||||
{ 0x01, "MPTY", "org.mt-daapd.playlist-type" },
|
||||
|
||||
{ 0x00, NULL, NULL }
|
||||
};
|
||||
|
||||
/** map the string names specified in the meta= tag to bit numbers */
|
||||
static METAMAP db_metamap[] = {
|
||||
{ "dmap.itemid", metaItemId },
|
||||
{ "dmap.itemname", metaItemName },
|
||||
{ "dmap.itemkind", metaItemKind },
|
||||
{ "dmap.persistentid", metaPersistentId },
|
||||
{ "dmap.containeritemid", metaContainerItemId },
|
||||
{ "dmap.parentcontainerid", metaParentContainerId },
|
||||
{ "dmap.itemid", metaItemId },
|
||||
{ "dmap.itemname", metaItemName },
|
||||
{ "dmap.itemkind", metaItemKind },
|
||||
{ "dmap.persistentid", metaPersistentId },
|
||||
{ "dmap.containeritemid", metaContainerItemId },
|
||||
{ "dmap.parentcontainerid", metaParentContainerId },
|
||||
/* end generics */
|
||||
{ "daap.songalbum", metaSongAlbum },
|
||||
{ "daap.songartist", metaSongArtist },
|
||||
{ "daap.songbitrate", metaSongBitRate },
|
||||
{ "daap.songbeatsperminute",metaSongBPM },
|
||||
{ "daap.songcomment", metaSongComment },
|
||||
{ "daap.songcompilation", metaSongCompilation },
|
||||
{ "daap.songcomposer", metaSongComposer },
|
||||
{ "daap.songdatakind", metaSongDataKind },
|
||||
{ "daap.songdataurl", metaSongDataURL },
|
||||
{ "daap.songdateadded", metaSongDateAdded },
|
||||
{ "daap.songdatemodified", metaSongDateModified },
|
||||
{ "daap.songdescription", metaSongDescription },
|
||||
{ "daap.songdisabled", metaSongDisabled },
|
||||
{ "daap.songdisccount", metaSongDiscCount },
|
||||
{ "daap.songdiscnumber", metaSongDiscNumber },
|
||||
{ "daap.songeqpreset", metaSongEqPreset },
|
||||
{ "daap.songformat", metaSongFormat },
|
||||
{ "daap.songgenre", metaSongGenre },
|
||||
{ "daap.songgrouping", metaSongGrouping },
|
||||
{ "daap.songrelativevolume",metaSongRelativeVolume },
|
||||
{ "daap.songsamplerate", metaSongSampleRate },
|
||||
{ "daap.songsize", metaSongSize },
|
||||
{ "daap.songstarttime", metaSongStartTime },
|
||||
{ "daap.songstoptime", metaSongStopTime },
|
||||
{ "daap.songtime", metaSongTime },
|
||||
{ "daap.songtrackcount", metaSongTrackCount },
|
||||
{ "daap.songtracknumber", metaSongTrackNumber },
|
||||
{ "daap.songuserrating", metaSongUserRating },
|
||||
{ "daap.songyear", metaSongYear },
|
||||
{ "daap.songalbum", metaSongAlbum },
|
||||
{ "daap.songartist", metaSongArtist },
|
||||
{ "daap.songbitrate", metaSongBitRate },
|
||||
{ "daap.songbeatsperminute", metaSongBPM },
|
||||
{ "daap.songcomment", metaSongComment },
|
||||
{ "daap.songcompilation", metaSongCompilation },
|
||||
{ "daap.songcomposer", metaSongComposer },
|
||||
{ "daap.songdatakind", metaSongDataKind },
|
||||
{ "daap.songdataurl", metaSongDataURL },
|
||||
{ "daap.songdateadded", metaSongDateAdded },
|
||||
{ "daap.songdatemodified", metaSongDateModified },
|
||||
{ "daap.songdescription", metaSongDescription },
|
||||
{ "daap.songdisabled", metaSongDisabled },
|
||||
{ "daap.songdisccount", metaSongDiscCount },
|
||||
{ "daap.songdiscnumber", metaSongDiscNumber },
|
||||
{ "daap.songeqpreset", metaSongEqPreset },
|
||||
{ "daap.songformat", metaSongFormat },
|
||||
{ "daap.songgenre", metaSongGenre },
|
||||
{ "daap.songgrouping", metaSongGrouping },
|
||||
{ "daap.songrelativevolume", metaSongRelativeVolume },
|
||||
{ "daap.songsamplerate", metaSongSampleRate },
|
||||
{ "daap.songsize", metaSongSize },
|
||||
{ "daap.songstarttime", metaSongStartTime },
|
||||
{ "daap.songstoptime", metaSongStopTime },
|
||||
{ "daap.songtime", metaSongTime },
|
||||
{ "daap.songtrackcount", metaSongTrackCount },
|
||||
{ "daap.songtracknumber", metaSongTrackNumber },
|
||||
{ "daap.songuserrating", metaSongUserRating },
|
||||
{ "daap.songyear", metaSongYear },
|
||||
/* iTunes 4.5+ (forgot exactly when) */
|
||||
{ "daap.songcodectype", metaSongCodecType },
|
||||
{ "daap.songcodecsubtype", metaSongCodecSubType },
|
||||
{ "com.apple.itunes.norm-volume", metaItunesNormVolume },
|
||||
{ "com.apple.itunes.itms-songid", metaItmsSongId },
|
||||
{ "com.apple.itunes.itms-artistid", metaItmsArtistId },
|
||||
{ "com.apple.itunes.itms-playlistid", metaItmsPlaylistId },
|
||||
{ "com.apple.itunes.itms-composerid", metaItmsComposerId },
|
||||
{ "com.apple.itunes.itms-genreid", metaItmsGenreId },
|
||||
{ "com.apple.itunes.itms-storefrontid",metaItmsStorefrontId },
|
||||
{ "com.apple.itunes.smart-playlist", metaItunesSmartPlaylist },
|
||||
/* mt-daapd specific */
|
||||
{ "org.mt-daapd.smart-playlist-spec", metaMTDSmartPlaylistSpec },
|
||||
{ 0, 0 }
|
||||
{ "org.mt-daapd.smart-playlist-spec", metaMPlaylistSpec },
|
||||
{ "org.mt-daapd.playlist-type", metaMPlaylistType },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
|
@ -66,8 +66,21 @@ typedef enum {
|
||||
metaSongUserRating,
|
||||
metaSongYear,
|
||||
|
||||
/* iTunes 4.5 + */
|
||||
metaSongCodecType,
|
||||
metaSongCodecSubType,
|
||||
metaItunesNormVolume,
|
||||
metaItmsSongId,
|
||||
metaItmsArtistId,
|
||||
metaItmsPlaylistId,
|
||||
metaItmsComposerId,
|
||||
metaItmsGenreId,
|
||||
metaItmsStorefrontId,
|
||||
metaItunesSmartPlaylist,
|
||||
|
||||
/* mt-daapd specific */
|
||||
metaMTDSmartPlaylistSpec
|
||||
metaMPlaylistSpec,
|
||||
metaMPlaylistType
|
||||
} MetaFieldName_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -806,12 +806,17 @@ int db_sqlite_get_size(DBQUERYINFO *pinfo, char **valarray) {
|
||||
return valarray[0] ? (8 + strlen(valarray[0])) : 0;
|
||||
case queryTypePlaylists:
|
||||
size = 8; /* mlit */
|
||||
size += 12; /* miid */
|
||||
size += 12; /* mimc */
|
||||
size += 9; /* aeSP */
|
||||
size += (8 + strlen(valarray[1])); /* minm */
|
||||
if((valarray[2]) && atoi(valarray[2])) /* MSPS */
|
||||
size += (8 + strlen(valarray[4]));
|
||||
size += 12; /* mimc - you get it whether you want it or not */
|
||||
if(db_wantsmeta(pinfo->meta, metaItemId))
|
||||
size += 12; /* miid */
|
||||
if(db_wantsmeta(pinfo->meta, metaItunesSmartPlaylist))
|
||||
size += 9; /* aeSP */
|
||||
if(db_wantsmeta(pinfo->meta, metaItemName))
|
||||
size += (8 + strlen(valarray[1])); /* minm */
|
||||
if(valarray[2] && atoi(valarray[2]) && db_wantsmeta(pinfo->meta, metaMPlaylistSpec))
|
||||
size += (8 + strlen(valarray[4])); /* MSPS */
|
||||
if(db_wantsmeta(pinfo->meta, metaMPlaylistType))
|
||||
size += 9; /* MPTY */
|
||||
return size;
|
||||
break;
|
||||
case queryTypeItems:
|
||||
@ -961,12 +966,17 @@ int db_sqlite_build_dmap(DBQUERYINFO *pinfo, char **valarray, char *presult, int
|
||||
case queryTypePlaylists:
|
||||
/* do I want to include the mlit? */
|
||||
current += db_dmap_add_container(current,"mlit",len - 8);
|
||||
current += db_dmap_add_int(current,"miid",atoi(valarray[0]));
|
||||
if(db_wantsmeta(pinfo->meta,metaItemId))
|
||||
current += db_dmap_add_int(current,"miid",atoi(valarray[0]));
|
||||
current += db_dmap_add_int(current,"mimc",atoi(valarray[3]));
|
||||
current += db_dmap_add_char(current,"aeSP",atoi(valarray[2]));
|
||||
current += db_dmap_add_string(current,"minm",valarray[1]);
|
||||
if((valarray[2]) && atoi(valarray[2]))
|
||||
if(db_wantsmeta(pinfo->meta,metaItunesSmartPlaylist))
|
||||
current += db_dmap_add_char(current,"aeSP",atoi(valarray[2]));
|
||||
if(db_wantsmeta(pinfo->meta,metaItemName))
|
||||
current += db_dmap_add_string(current,"minm",valarray[1]);
|
||||
if((valarray[2]) && atoi(valarray[2]) && db_wantsmeta(pinfo->meta, metaMPlaylistSpec))
|
||||
current += db_dmap_add_string(current,"MSPS",valarray[4]);
|
||||
if(db_wantsmeta(pinfo->meta, metaMPlaylistType))
|
||||
current += db_dmap_add_char(current,"MPTY",atoi(valarray[2]));
|
||||
break;
|
||||
case queryTypeItems:
|
||||
case queryTypePlaylistItems: /* essentially the same query */
|
||||
|
@ -883,7 +883,10 @@ void dispatch_playlists(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
|
||||
if(ws_getvar(pwsc,"meta")) {
|
||||
pqi->meta = db_encode_meta(ws_getvar(pwsc,"meta"));
|
||||
} else {
|
||||
pqi->meta = (MetaField_t) -1ll;
|
||||
pqi->meta = ((1ll << metaItemId) |
|
||||
(1ll << metaItemName) |
|
||||
(1ll << metaPersistentId) |
|
||||
(1ll << metaItunesSmartPlaylist));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user