diff options
-rw-r--r-- | xbmc/interfaces/json-rpc/AudioLibrary.cpp | 14 | ||||
-rw-r--r-- | xbmc/interfaces/json-rpc/ServiceDescription.h | 44 | ||||
-rw-r--r-- | xbmc/interfaces/json-rpc/VideoLibrary.cpp | 14 | ||||
-rw-r--r-- | xbmc/interfaces/json-rpc/methods.json | 11 | ||||
-rw-r--r-- | xbmc/interfaces/json-rpc/types.json | 33 |
5 files changed, 47 insertions, 69 deletions
diff --git a/xbmc/interfaces/json-rpc/AudioLibrary.cpp b/xbmc/interfaces/json-rpc/AudioLibrary.cpp index 3e45740098..1a3cff4d43 100644 --- a/xbmc/interfaces/json-rpc/AudioLibrary.cpp +++ b/xbmc/interfaces/json-rpc/AudioLibrary.cpp @@ -178,15 +178,15 @@ JSON_STATUS CAudioLibrary::GetGenres(const CStdString &method, ITransportLayer * if (!musicdatabase.Open()) return InternalError; - // Add "genre" to "fields" array by default - CVariant param = parameterObject; - if (!param.isMember("fields")) - param["fields"] = CVariant(CVariant::VariantTypeArray); - param["fields"].append("genre"); - CFileItemList items; if (musicdatabase.GetGenresNav("", items)) - HandleFileItemList("genreid", false, "genres", items, param, result); + { + /* need to set strTitle in each item*/ + for (unsigned int i = 0; i < (unsigned int)items.Size(); i++) + items[i]->GetMusicInfoTag()->SetTitle(items[i]->GetLabel()); + + HandleFileItemList("genreid", false, "genres", items, parameterObject, result); + } musicdatabase.Close(); return OK; diff --git a/xbmc/interfaces/json-rpc/ServiceDescription.h b/xbmc/interfaces/json-rpc/ServiceDescription.h index 49a066065a..0704b2d896 100644 --- a/xbmc/interfaces/json-rpc/ServiceDescription.h +++ b/xbmc/interfaces/json-rpc/ServiceDescription.h @@ -85,15 +85,18 @@ namespace JSONRPC "\"default\": -1," "\"minimum\": 1" "}", - "\"Library.Genres\": {" + "\"Library.Fields.Genre\": {" "\"type\": \"array\"," - "\"items\": { \"type\": \"object\"," - "\"properties\": {" - "\"genreid\": { \"$ref\": \"Library.Id\", \"required\": true }," - "\"genre\": { \"type\": \"string\", \"required\": true }," - "\"label\": { \"type\": \"string\", \"required\": true }," - "\"thumbnail\": { \"type\": \"string\" }" - "}" + "\"uniqueItems\": true," + "\"items\": { \"type\": \"string\", \"enum\": [ \"title\", \"thumbnail\" ] }" + "}", + "\"Library.Details.Genres\": {" + "\"type\": \"object\"," + "\"properties\": {" + "\"genreid\": { \"$ref\": \"Library.Id\", \"required\": true }," + "\"label\": { \"type\": \"string\", \"required\": true }," + "\"title\": { \"type\": \"string\" }," + "\"thumbnail\": { \"type\": \"string\" }" "}" "}", "\"Audio.Fields.Artist\": {" @@ -127,11 +130,6 @@ namespace JSONRPC "\"playcount\", \"fanart\", \"thumbnail\", \"file\" ]" "}" "}", - "\"Audio.Fields.Genre\": {" - "\"type\": \"array\"," - "\"uniqueItems\": true," - "\"items\": { \"type\": \"string\", \"enum\": [ \"thumbnail\" ] }" - "}", "\"Audio.Details.Artist\": {" "\"type\": \"object\"," "\"properties\": {" @@ -454,15 +452,6 @@ namespace JSONRPC "\"lastplayed\": { \"type\": \"string\" }" "}" "}", - "\"Video.Details.Genre\": {" - "\"type\": \"object\"," - "\"properties\": {" - "\"genreid\": { \"$ref\": \"Library.Id\", \"required\": true }," - "\"genre\": { \"type\": \"string\", \"required\": true }," - "\"label\": { \"type\": \"string\", \"required\": true }," - "\"thumbnail\": { \"type\": \"string\" }" - "}" - "}", "\"Playlist.Id\": {" "\"type\": \"object\"," "\"properties\": {" @@ -1683,7 +1672,7 @@ namespace JSONRPC "\"transport\": \"Response\"," "\"permission\": \"ReadData\"," "\"params\": [" - "{ \"name\": \"fields\", \"$ref\": \"Audio.Fields.Genre\" }," + "{ \"name\": \"fields\", \"$ref\": \"Library.Fields.Genre\" }," "{ \"name\": \"limits\", \"$ref\": \"List.Limits\" }," "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" }" "]," @@ -1691,7 +1680,9 @@ namespace JSONRPC "\"type\": \"object\"," "\"properties\": {" "\"limits\": { \"$ref\": \"List.LimitsReturned\", \"required\": true }," - "\"genres\": { \"$ref\": \"Library.Genres\", \"required\": true }" + "\"genres\": { \"type\": \"array\", \"required\": true," + "\"items\": { \"$ref\": \"Library.Details.Genre\" }" + "}" "}" "}" "}", @@ -1969,6 +1960,7 @@ namespace JSONRPC "\"permission\": \"ReadData\"," "\"params\": [" "{ \"name\": \"type\", \"type\": \"string\", \"required\": true, \"enum\": [ \"movie\", \"tvshow\", \"musicvideo\"] }," + "{ \"name\": \"fields\", \"$ref\": \"Library.Fields.Genre\" }," "{ \"name\": \"limits\", \"$ref\": \"List.Limits\" }," "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" }" "]," @@ -1976,8 +1968,8 @@ namespace JSONRPC "\"type\": \"object\"," "\"properties\": {" "\"limits\": { \"$ref\": \"List.LimitsReturned\", \"required\": true }," - "\"genres\": { \"type\": \"array\"," - "\"items\": { \"$ref\": \"Video.Details.Genre\" }" + "\"genres\": { \"type\": \"array\", \"required\": true," + "\"items\": { \"$ref\": \"Library.Details.Genre\" }" "}" "}" "}" diff --git a/xbmc/interfaces/json-rpc/VideoLibrary.cpp b/xbmc/interfaces/json-rpc/VideoLibrary.cpp index 509ec4e68a..c83389ed2d 100644 --- a/xbmc/interfaces/json-rpc/VideoLibrary.cpp +++ b/xbmc/interfaces/json-rpc/VideoLibrary.cpp @@ -351,13 +351,7 @@ JSON_STATUS CVideoLibrary::GetRecentlyAddedMusicVideos(const CStdString &method, JSON_STATUS CVideoLibrary::GetGenres(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CVariant param = parameterObject; - if (!param.isMember("fields")) - param["fields"] = CVariant(CVariant::VariantTypeArray); - param["fields"].append("genre"); - param["fields"].append("thumbnail"); - - CStdString media = parameterObject["type"].asString(); + CStdString media = parameterObject["type"].asString(); media = media.ToLower(); int idContent; @@ -376,11 +370,11 @@ JSON_STATUS CVideoLibrary::GetGenres(const CStdString &method, ITransportLayer * CFileItemList items; if (videodatabase.GetGenresNav("", items, idContent)) { - /* need to set strGenre in each item*/ + /* need to set strTitle in each item*/ for (unsigned int i = 0; i < (unsigned int)items.Size(); i++) - items[i]->GetVideoInfoTag()->m_strGenre = items[i]->GetLabel(); + items[i]->GetVideoInfoTag()->m_strTitle = items[i]->GetLabel(); - HandleFileItemList("genreid", false, "genres", items, param, result); + HandleFileItemList("genreid", false, "genres", items, parameterObject, result); } videodatabase.Close(); diff --git a/xbmc/interfaces/json-rpc/methods.json b/xbmc/interfaces/json-rpc/methods.json index 2e14d29898..18cc18ab45 100644 --- a/xbmc/interfaces/json-rpc/methods.json +++ b/xbmc/interfaces/json-rpc/methods.json @@ -920,7 +920,7 @@ "transport": "Response", "permission": "ReadData", "params": [ - { "name": "fields", "$ref": "Audio.Fields.Genre" }, + { "name": "fields", "$ref": "Library.Fields.Genre" }, { "name": "limits", "$ref": "List.Limits" }, { "name": "sort", "$ref": "List.Sort" } ], @@ -928,7 +928,9 @@ "type": "object", "properties": { "limits": { "$ref": "List.LimitsReturned", "required": true }, - "genres": { "$ref": "Library.Genres", "required": true } + "genres": { "type": "array", "required": true, + "items": { "$ref": "Library.Details.Genre" } + } } } }, @@ -1206,6 +1208,7 @@ "permission": "ReadData", "params": [ { "name": "type", "type": "string", "required": true, "enum": [ "movie", "tvshow", "musicvideo"] }, + { "name": "fields", "$ref": "Library.Fields.Genre" }, { "name": "limits", "$ref": "List.Limits" }, { "name": "sort", "$ref": "List.Sort" } ], @@ -1213,8 +1216,8 @@ "type": "object", "properties": { "limits": { "$ref": "List.LimitsReturned", "required": true }, - "genres": { "type": "array", - "items": { "$ref": "Video.Details.Genre" } + "genres": { "type": "array", "required": true, + "items": { "$ref": "Library.Details.Genre" } } } } diff --git a/xbmc/interfaces/json-rpc/types.json b/xbmc/interfaces/json-rpc/types.json index bfd93c3b12..019f1343a9 100644 --- a/xbmc/interfaces/json-rpc/types.json +++ b/xbmc/interfaces/json-rpc/types.json @@ -57,15 +57,18 @@ "default": -1, "minimum": 1 }, - "Library.Genres": { + "Library.Fields.Genre": { "type": "array", - "items": { "type": "object", - "properties": { - "genreid": { "$ref": "Library.Id", "required": true }, - "genre": { "type": "string", "required": true }, - "label": { "type": "string", "required": true }, - "thumbnail": { "type": "string" } - } + "uniqueItems": true, + "items": { "type": "string", "enum": [ "title", "thumbnail" ] } + }, + "Library.Details.Genres": { + "type": "object", + "properties": { + "genreid": { "$ref": "Library.Id", "required": true }, + "label": { "type": "string", "required": true }, + "title": { "type": "string" }, + "thumbnail": { "type": "string" } } }, "Audio.Fields.Artist": { @@ -99,11 +102,6 @@ "playcount", "fanart", "thumbnail", "file" ] } }, - "Audio.Fields.Genre": { - "type": "array", - "uniqueItems": true, - "items": { "type": "string", "enum": [ "thumbnail" ] } - }, "Audio.Details.Artist": { "type": "object", "properties": { @@ -426,15 +424,6 @@ "lastplayed": { "type": "string" } } }, - "Video.Details.Genre": { - "type": "object", - "properties": { - "genreid": { "$ref": "Library.Id", "required": true }, - "genre": { "type": "string", "required": true }, - "label": { "type": "string", "required": true }, - "thumbnail": { "type": "string" } - } - }, "Playlist.Id": { "type": "object", "properties": { |