From 158a76ae16bc6792a73247b4bed3749e5b6f311d Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Sat, 2 Apr 2005 04:33:04 +0000 Subject: [PATCH] Add smart playlist clause to playlist query --- src/db-generic.c | 8 +++++++- src/db-generic.h | 5 ++++- src/dbs-sqlite.c | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/db-generic.c b/src/db-generic.c index c6809e59..46438a70 100644 --- a/src/db-generic.c +++ b/src/db-generic.c @@ -171,7 +171,7 @@ DAAP_ITEMS taglist[] = { { 0x01, "aeSP", "com.apple.itunes.smart-playlist" }, /* iTunes 4.5+ */ { 0x01, "msas", "dmap.authenticationschemes" }, - { 0x05, "ascd", "daap.songcodectype" }, + { 0x05, "ascd", "daap.songcodectype" }, /* there is a songcodec subtype, too */ { 0x09, "agrp", "daap.songgrouping" }, { 0x05, "aeSV", "com.apple.itunes.music-sharing-version" }, { 0x05, "aePI", "com.apple.itunes.itms-playlistid" }, @@ -179,6 +179,10 @@ DAAP_ITEMS taglist[] = { { 0x05, "aeGI", "com.apple.iTunes.itms-genreid" }, { 0x05, "aeAI", "com.apple.iTunes.itms-artistid" }, { 0x05, "aeSI", "com.apple.iTunes.itms-songid" }, + + /* mt-daapd specific */ + { 0x09, "MSPS", "org.mt-daapd.smart-playlist-spec" }, + { 0x00, NULL, NULL } }; @@ -220,6 +224,8 @@ static METAMAP db_metamap[] = { { "daap.songtracknumber", metaSongTrackNumber }, { "daap.songuserrating", metaSongUserRating }, { "daap.songyear", metaSongYear }, + /* mt-daapd specific */ + { "org.mt-daapd.smart-playlist-spec", metaMTDSmartPlaylistSpec }, { 0, 0 } }; diff --git a/src/db-generic.h b/src/db-generic.h index 7522cf69..6ce79ff5 100644 --- a/src/db-generic.h +++ b/src/db-generic.h @@ -64,7 +64,10 @@ typedef enum { metaSongTrackCount, metaSongTrackNumber, metaSongUserRating, - metaSongYear + metaSongYear, + + /* mt-daapd specific */ + metaMTDSmartPlaylistSpec } MetaFieldName_t; typedef enum { diff --git a/src/dbs-sqlite.c b/src/dbs-sqlite.c index b97de5c6..50f8a105 100644 --- a/src/dbs-sqlite.c +++ b/src/dbs-sqlite.c @@ -810,6 +810,8 @@ int db_sqlite_get_size(DBQUERYINFO *pinfo, char **valarray) { size += 12; /* mimc */ size += 9; /* aeSP */ size += (8 + strlen(valarray[1])); /* minm */ + if((valarray[2]) && atoi(valarray[2])) /* MSPS */ + size += (8 + strlen(valarray[4])); return size; break; case queryTypeItems: @@ -963,6 +965,8 @@ int db_sqlite_build_dmap(DBQUERYINFO *pinfo, char **valarray, char *presult, int 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])) + current += db_dmap_add_string(current,"MSPS",valarray[4]); break; case queryTypeItems: case queryTypePlaylistItems: /* essentially the same query */