From 34984dd19509c21112a22d57edd9584db47dac1d Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 26 Oct 2013 20:53:26 +1300 Subject: [PATCH] [textures] expose the texture cache to JSON-RPC with GetTextures/RemoveTexture --- XBMC.xcodeproj/project.pbxproj | 10 ++ project/VS2010Express/XBMC.vcxproj | 2 + project/VS2010Express/XBMC.vcxproj.filters | 6 ++ xbmc/TextureDatabase.cpp | 12 ++- xbmc/TextureDatabase.h | 1 + xbmc/interfaces/json-rpc/JSONRPC.cpp | 5 + .../interfaces/json-rpc/JSONServiceDescription.cpp | 5 + xbmc/interfaces/json-rpc/Makefile | 1 + xbmc/interfaces/json-rpc/ServiceDescription.h | 84 ++++++++++++++++- xbmc/interfaces/json-rpc/TextureOperations.cpp | 103 +++++++++++++++++++++ xbmc/interfaces/json-rpc/TextureOperations.h | 33 +++++++ xbmc/interfaces/json-rpc/methods.json | 28 ++++++ xbmc/interfaces/json-rpc/types.json | 54 +++++++++++ 13 files changed, 341 insertions(+), 3 deletions(-) create mode 100644 xbmc/interfaces/json-rpc/TextureOperations.cpp create mode 100644 xbmc/interfaces/json-rpc/TextureOperations.h diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj index bc3261d..4b19a58 100644 --- a/XBMC.xcodeproj/project.pbxproj +++ b/XBMC.xcodeproj/project.pbxproj @@ -281,6 +281,9 @@ 7C89674613C03B22003631FE /* InfoBool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89674313C03B22003631FE /* InfoBool.cpp */; }; 7C8A14571154CB2600E5FCFA /* TextureCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8A14541154CB2600E5FCFA /* TextureCache.cpp */; }; 7C8A187D115B2A8200E5FCFA /* TextureDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8A187A115B2A8200E5FCFA /* TextureDatabase.cpp */; }; + 7C920CF9181669FF00DA1477 /* TextureOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C920CF7181669FF00DA1477 /* TextureOperations.cpp */; }; + 7C920CFA181669FF00DA1477 /* TextureOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C920CF7181669FF00DA1477 /* TextureOperations.cpp */; }; + 7C920CFB181669FF00DA1477 /* TextureOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C920CF7181669FF00DA1477 /* TextureOperations.cpp */; }; 7C99B6A4133D342100FC2B16 /* CircularCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B6A2133D342100FC2B16 /* CircularCache.cpp */; }; 7C99B7951340723F00FC2B16 /* GUIDialogPlayEject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B7931340723F00FC2B16 /* GUIDialogPlayEject.cpp */; }; 7CAA20511079C8160096DE39 /* BaseRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CAA204F1079C8160096DE39 /* BaseRenderer.cpp */; }; @@ -3743,6 +3746,8 @@ 7C8A14551154CB2600E5FCFA /* TextureCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextureCache.h; sourceTree = ""; }; 7C8A187A115B2A8200E5FCFA /* TextureDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextureDatabase.cpp; sourceTree = ""; }; 7C8A187B115B2A8200E5FCFA /* TextureDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextureDatabase.h; sourceTree = ""; }; + 7C920CF7181669FF00DA1477 /* TextureOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextureOperations.cpp; sourceTree = ""; }; + 7C920CF8181669FF00DA1477 /* TextureOperations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextureOperations.h; sourceTree = ""; }; 7C99B6A2133D342100FC2B16 /* CircularCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CircularCache.cpp; sourceTree = ""; }; 7C99B6A3133D342100FC2B16 /* CircularCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CircularCache.h; sourceTree = ""; }; 7C99B7931340723F00FC2B16 /* GUIDialogPlayEject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogPlayEject.cpp; sourceTree = ""; }; @@ -9030,6 +9035,8 @@ DF00492C162DAEA200A971AD /* PVROperations.h */, F5AE409613415D9E0004BD79 /* SystemOperations.cpp */, F5AE409713415D9E0004BD79 /* SystemOperations.h */, + 7C920CF7181669FF00DA1477 /* TextureOperations.cpp */, + 7C920CF8181669FF00DA1477 /* TextureOperations.h */, F5AE409813415D9E0004BD79 /* VideoLibrary.cpp */, F5AE409913415D9E0004BD79 /* VideoLibrary.h */, F5AE409A13415D9E0004BD79 /* XBMCOperations.cpp */, @@ -10630,6 +10637,7 @@ DFD882E917DD189E001516FE /* StringValidation.cpp in Sources */, F500E35617F3412C004FC217 /* WinEvents.cpp in Sources */, 7C2612711825B6340086E04D /* DatabaseQuery.cpp in Sources */, + 7C920CF9181669FF00DA1477 /* TextureOperations.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -11661,6 +11669,7 @@ DFD882E717DD189E001516FE /* StringValidation.cpp in Sources */, F500E35817F3412C004FC217 /* WinEvents.cpp in Sources */, 7C2612731825B6340086E04D /* DatabaseQuery.cpp in Sources */, + 7C920CFB181669FF00DA1477 /* TextureOperations.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -12694,6 +12703,7 @@ DFD882E817DD189E001516FE /* StringValidation.cpp in Sources */, F500E35717F3412C004FC217 /* WinEvents.cpp in Sources */, 7C2612721825B6340086E04D /* DatabaseQuery.cpp in Sources */, + 7C920CFA181669FF00DA1477 /* TextureOperations.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj index 9ff5c98..7cea765 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj @@ -747,6 +747,7 @@ + @@ -2250,6 +2251,7 @@ + diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters index adbb54e..98a6ca6 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -1219,6 +1219,9 @@ interfaces\json-rpc + + interfaces\json-rpc + music\dialogs @@ -4187,6 +4190,9 @@ interfaces\json-rpc + + interfaces\json-rpc + music\dialogs diff --git a/xbmc/TextureDatabase.cpp b/xbmc/TextureDatabase.cpp index 7a0e469..b47dc31 100644 --- a/xbmc/TextureDatabase.cpp +++ b/xbmc/TextureDatabase.cpp @@ -52,7 +52,7 @@ typedef struct static const translateField fields[] = { { "none", TF_None, CDatabaseQueryRule::TEXT_FIELD }, - { "id", TF_Id, CDatabaseQueryRule::NUMERIC_FIELD }, + { "textureid", TF_Id, CDatabaseQueryRule::NUMERIC_FIELD }, { "url", TF_Url, CDatabaseQueryRule::TEXT_FIELD }, { "cachedurl", TF_CachedUrl, CDatabaseQueryRule::TEXT_FIELD }, { "lasthashcheck", TF_LastHashCheck, CDatabaseQueryRule::TEXT_FIELD }, @@ -100,6 +100,14 @@ CDatabaseQueryRule::FIELD_TYPE CTextureRule::GetFieldType(int field) const return TEXT_FIELD; } +CStdString CTextureRule::FormatParameter(const CStdString &operatorString, const CStdString ¶m, const CDatabase &db, const CStdString &strType) const +{ + CStdString parameter(param); + if (m_field == TF_Url) + parameter = CTextureUtils::UnwrapImageURL(param); + return CDatabaseQueryRule::FormatParameter(operatorString, parameter, db, strType); +} + void CTextureRule::GetAvailableFields(std::vector &fieldList) { // start at 1 to skip TF_None @@ -312,7 +320,7 @@ bool CTextureDatabase::GetTextures(CVariant &items, const Filter &filter) while (!m_pDS->eof()) { CVariant texture; - texture["id"] = m_pDS->fv(0).get_asInt(); + texture["textureid"] = m_pDS->fv(0).get_asInt(); texture["url"] = m_pDS->fv(1).get_asString(); texture["cachedurl"] = m_pDS->fv(2).get_asString(); texture["imagehash"] = m_pDS->fv(3).get_asString(); diff --git a/xbmc/TextureDatabase.h b/xbmc/TextureDatabase.h index 93317d5..75aa45c 100644 --- a/xbmc/TextureDatabase.h +++ b/xbmc/TextureDatabase.h @@ -38,6 +38,7 @@ protected: virtual CStdString TranslateField(int field) const; virtual CStdString GetField(int field, const CStdString& type) const; virtual FIELD_TYPE GetFieldType(int field) const; + virtual CStdString FormatParameter(const CStdString &negate, const CStdString &oper, const CDatabase &db, const CStdString &type) const; }; class CTextureUtils diff --git a/xbmc/interfaces/json-rpc/JSONRPC.cpp b/xbmc/interfaces/json-rpc/JSONRPC.cpp index 6462130..6ac62b3 100644 --- a/xbmc/interfaces/json-rpc/JSONRPC.cpp +++ b/xbmc/interfaces/json-rpc/JSONRPC.cpp @@ -30,6 +30,7 @@ #include "utils/log.h" #include "utils/StringUtils.h" #include "utils/Variant.h" +#include "TextureDatabase.h" using namespace ANNOUNCEMENT; using namespace JSONRPC; @@ -84,6 +85,10 @@ void CJSONRPC::Initialize() CSmartPlaylist::GetAvailableFields("songs", smartplaylistList); CJSONServiceDescription::AddEnum("List.Filter.Fields.Songs", smartplaylistList); + smartplaylistList.clear(); + CTextureRule::GetAvailableFields(smartplaylistList); + CJSONServiceDescription::AddEnum("List.Filter.Fields.Textures", smartplaylistList); + unsigned int size = sizeof(JSONRPC_SERVICE_TYPES) / sizeof(char*); for (unsigned int index = 0; index < size; index++) diff --git a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp index da995ae..2bdc02c 100644 --- a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp +++ b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp @@ -38,6 +38,7 @@ #include "PVROperations.h" #include "ProfilesOperations.h" #include "FavouritesOperations.h" +#include "TextureOperations.h" using namespace std; using namespace JSONRPC; @@ -206,6 +207,10 @@ JsonRpcMethodMap CJSONServiceDescription::m_methodMaps[] = { { "Favourites.GetFavourites", CFavouritesOperations::GetFavourites }, { "Favourites.AddFavourite", CFavouritesOperations::AddFavourite }, +// Textures operations + { "Textures.GetTextures", CTextureOperations::GetTextures }, + { "Textures.RemoveTexture", CTextureOperations::RemoveTexture }, + // XBMC operations { "XBMC.GetInfoLabels", CXBMCOperations::GetInfoLabels }, { "XBMC.GetInfoBooleans", CXBMCOperations::GetInfoBooleans } diff --git a/xbmc/interfaces/json-rpc/Makefile b/xbmc/interfaces/json-rpc/Makefile index 398effb..a44307a 100644 --- a/xbmc/interfaces/json-rpc/Makefile +++ b/xbmc/interfaces/json-rpc/Makefile @@ -13,6 +13,7 @@ SRCS=AddonsOperations.cpp \ ProfilesOperations.cpp \ PVROperations.cpp \ SystemOperations.cpp \ + TextureOperations.cpp \ VideoLibrary.cpp \ XBMCOperations.cpp \ diff --git a/xbmc/interfaces/json-rpc/ServiceDescription.h b/xbmc/interfaces/json-rpc/ServiceDescription.h index d373d2a..be0cd24 100644 --- a/xbmc/interfaces/json-rpc/ServiceDescription.h +++ b/xbmc/interfaces/json-rpc/ServiceDescription.h @@ -22,7 +22,7 @@ namespace JSONRPC { const char* const JSONRPC_SERVICE_ID = "http://xbmc.org/jsonrpc/ServiceDescription.json"; - const char* const JSONRPC_SERVICE_VERSION = "6.8.0"; + const char* const JSONRPC_SERVICE_VERSION = "6.9.0"; const char* const JSONRPC_SERVICE_DESCRIPTION = "JSON-RPC API of XBMC"; const char* const JSONRPC_SERVICE_TYPES[] = { @@ -842,6 +842,33 @@ namespace JSONRPC "\"thumbnail\": { \"type\": \"string\" }" "}" "}", + "\"Textures.Details.Size\": {" + "\"type\": \"object\"," + "\"properties\": {" + "\"size\": { \"type\": \"integer\", \"description\": \"Size of texture (1 == largest)\" }," + "\"width\": { \"type\": \"integer\", \"description\": \"Width of texture\" }," + "\"height\": { \"type\": \"integer\", \"description\": \"Height of texture\" }," + "\"usecount\": { \"type\": \"integer\", \"description\": \"Number of uses\" }," + "\"lastused\": { \"type\": \"string\", \"description\": \"Time of last use\" }" + "}" + "}", + "\"Textures.Fields.Texture\": {" + "\"extends\": \"Item.Fields.Base\"," + "\"items\": { \"type\": \"string\"," + "\"enum\": [ \"url\", \"cachedurl\", \"lasthashcheck\", \"imagehash\", \"sizes\" ]" + "}" + "}", + "\"Textures.Details.Texture\": {" + "\"type\": \"object\"," + "\"properties\": {" + "\"textureid\": { \"$ref\": \"Library.Id\", \"required\": true }," + "\"url\": { \"type\": \"string\", \"description\": \"Original source URL\" }," + "\"cachedurl\": { \"type\": \"string\", \"description\": \"Cached URL on disk\" }," + "\"lasthashcheck\": { \"type\": \"string\", \"description\": \"Last time source was checked for changes\" }," + "\"imagehash\": { \"type\": \"string\", \"description\": \"Hash of image\" }," + "\"sizes\": { \"type\": \"array\", \"items\": { \"$ref\": \"Textures.Details.Size\" } }" + "}" + "}", "\"Profiles.Password\": {" "\"type\": \"object\"," "\"properties\": {" @@ -914,6 +941,12 @@ namespace JSONRPC "\"field\": { \"$ref\": \"List.Filter.Fields.Songs\", \"required\": true }" "}" "}", + "\"List.Filter.Rule.Textures\": {" + "\"extends\": \"List.Filter.Rule\"," + "\"properties\": {" + "\"field\": { \"$ref\": \"List.Filter.Fields.Textures\", \"required\": true }" + "}" + "}", "\"List.Filter.Movies\": {" "\"type\": [" "{ \"type\": \"object\"," @@ -1061,6 +1094,27 @@ namespace JSONRPC "{ \"$ref\": \"List.Filter.Rule.Songs\" }" "]" "}", + "\"List.Filter.Textures\": {" + "\"type\": [" + "{ \"type\": \"object\"," + "\"properties\": {" + "\"and\": { \"type\": \"array\"," + "\"items\": { \"$ref\": \"List.Filter.Textures\" }," + "\"minItems\": 1, \"required\": true" + "}" + "}" + "}," + "{ \"type\": \"object\"," + "\"properties\": {" + "\"or\": { \"type\": \"array\"," + "\"items\": { \"$ref\": \"List.Filter.Textures\" }," + "\"minItems\": 1, \"required\": true" + "}" + "}" + "}," + "{ \"$ref\": \"List.Filter.Rule.Textures\" }" + "]" + "}", "\"List.Item.Base\": {" "\"extends\": [ \"Video.Details.File\", \"Audio.Details.Media\" ]," "\"properties\": {" @@ -3054,6 +3108,34 @@ namespace JSONRPC "\"params\": [ ]," "\"returns\": \"string\"" "}", + "\"Textures.GetTextures\": {" + "\"type\": \"method\"," + "\"description\": \"Retrieve all textures\"," + "\"transport\": \"Response\"," + "\"permission\": \"ReadData\"," + "\"params\": [" + "{ \"name\": \"properties\", \"$ref\": \"Textures.Fields.Texture\" }," + "{ \"name\": \"filter\", \"$ref\": \"List.Filter.Textures\" }" + "]," + "\"returns\": {" + "\"type\": \"object\"," + "\"properties\": {" + "\"textures\": { \"type\": \"array\", \"required\": true," + "\"items\": { \"$ref\": \"Textures.Details.Texture\" }" + "}" + "}" + "}" + "}", + "\"Textures.RemoveTexture\": {" + "\"type\": \"method\"," + "\"description\": \"Remove the specified texture\"," + "\"transport\": \"Response\"," + "\"permission\": \"RemoveData\"," + "\"params\": [" + "{ \"name\": \"textureid\", \"$ref\": \"Library.Id\", \"required\": true, \"description\": \"Texture database identifier\" }" + "]," + "\"returns\": \"string\"" + "}", "\"Profiles.GetProfiles\": {" "\"type\": \"method\"," "\"description\": \"Retrieve all profiles\"," diff --git a/xbmc/interfaces/json-rpc/TextureOperations.cpp b/xbmc/interfaces/json-rpc/TextureOperations.cpp new file mode 100644 index 0000000..ca96272 --- /dev/null +++ b/xbmc/interfaces/json-rpc/TextureOperations.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include "TextureOperations.h" +#include "TextureDatabase.h" +#include "TextureCache.h" + +using namespace JSONRPC; + +JSONRPC_STATUS CTextureOperations::GetTextures(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + CFileItemList listItems; + + CTextureDatabase db; + if (!db.Open()) + return InternalError; + + CDatabase::Filter dbFilter; + const CVariant &filter = parameterObject["filter"]; + if (filter.isObject()) + { + CVariant xspObj(CVariant::VariantTypeObject); + + if (filter.isMember("field")) + { + xspObj["and"] = CVariant(CVariant::VariantTypeArray); + xspObj["and"].push_back(filter); + } + else + xspObj = filter; + + // decipher the rules + CDatabaseQueryRuleCombination rule; + if (!rule.Load(xspObj, &db)) + return InvalidParams; + + dbFilter.AppendWhere(rule.GetWhereClause(db, "")); + } + + // fetch textures from the database + CVariant items = CVariant(CVariant::VariantTypeArray); + if (!db.GetTextures(items, dbFilter)) + return InternalError; + + // return only what was asked for, plus textureid + CVariant prop = parameterObject["properties"]; + prop.push_back("textureid"); + if (!items.empty() && prop.isArray()) + { + std::set fields; + CVariant &item = items[0]; + for (CVariant::const_iterator_map field = item.begin_map(); field != item.end_map(); ++field) + { + if (std::find(prop.begin_array(), prop.end_array(), field->first) == prop.end_array()) + fields.insert(field->first); + } + // erase these fields + for (CVariant::iterator_array item = items.begin_array(); item != items.end_array(); ++item) + { + for (std::set::const_iterator i = fields.begin(); i != fields.end(); ++i) + item->erase(*i); + } + if (fields.find("url") == fields.end()) + { + // wrap cached url to something retrieval from Files.GetFiles() + for (CVariant::iterator_array item = items.begin_array(); item != items.end_array(); ++item) + { + CVariant &cachedUrl = (*item)["url"]; + cachedUrl = CTextureUtils::GetWrappedImageURL(cachedUrl.asString()); + } + } + } + + result["textures"] = items; + return OK; +} + +JSONRPC_STATUS CTextureOperations::RemoveTexture(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + int id = (int)parameterObject["textureid"].asInteger(); + + if (!CTextureCache::Get().ClearCachedImage(id)) + return InvalidParams; + + return ACK; +} diff --git a/xbmc/interfaces/json-rpc/TextureOperations.h b/xbmc/interfaces/json-rpc/TextureOperations.h new file mode 100644 index 0000000..4e84929 --- /dev/null +++ b/xbmc/interfaces/json-rpc/TextureOperations.h @@ -0,0 +1,33 @@ +#pragma once +/* + * Copyright (C) 2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include "utils/StdString.h" +#include "JSONRPC.h" + +namespace JSONRPC +{ + class CTextureOperations + { + public: + static JSONRPC_STATUS GetTextures(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS RemoveTexture(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + }; +} diff --git a/xbmc/interfaces/json-rpc/methods.json b/xbmc/interfaces/json-rpc/methods.json index edacf5e..d7f0e93 100644 --- a/xbmc/interfaces/json-rpc/methods.json +++ b/xbmc/interfaces/json-rpc/methods.json @@ -1725,6 +1725,34 @@ "params": [ ], "returns": "string" }, + "Textures.GetTextures": { + "type": "method", + "description": "Retrieve all textures", + "transport": "Response", + "permission": "ReadData", + "params": [ + { "name": "properties", "$ref": "Textures.Fields.Texture" }, + { "name": "filter", "$ref": "List.Filter.Textures" } + ], + "returns": { + "type": "object", + "properties": { + "textures": { "type": "array", "required": true, + "items": { "$ref": "Textures.Details.Texture" } + } + } + } + }, + "Textures.RemoveTexture": { + "type": "method", + "description": "Remove the specified texture", + "transport": "Response", + "permission": "RemoveData", + "params": [ + { "name": "textureid", "$ref": "Library.Id", "required": true, "description": "Texture database identifier" } + ], + "returns": "string" + }, "Profiles.GetProfiles": { "type": "method", "description": "Retrieve all profiles", diff --git a/xbmc/interfaces/json-rpc/types.json b/xbmc/interfaces/json-rpc/types.json index 72134a6..e7bf533 100644 --- a/xbmc/interfaces/json-rpc/types.json +++ b/xbmc/interfaces/json-rpc/types.json @@ -814,6 +814,33 @@ "thumbnail": { "type": "string" } } }, + "Textures.Details.Size": { + "type": "object", + "properties": { + "size": { "type": "integer", "description": "Size of the texture (1 == largest)" }, + "width": { "type": "integer", "description": "Width of texture" }, + "height": { "type": "integer", "description": "Height of texture" }, + "usecount": { "type": "integer", "description": "Number of uses" }, + "lastused": { "type": "string", "description": "Date of last use" } + } + }, + "Textures.Fields.Texture": { + "extends": "Item.Fields.Base", + "items": { "type": "string", + "enum": [ "url", "cachedurl", "lasthashcheck", "imagehash", "sizes" ] + } + }, + "Textures.Details.Texture": { + "type": "object", + "properties": { + "textureid": { "$ref": "Library.Id", "required": "true" }, + "url": { "type": "string", "description": "Original source URL" }, + "cachedurl": { "type": "string", "description": "Cached URL on disk" }, + "lasthashcheck": { "type": "string", "description": "Last time source was checked for changes" }, + "imagehash": { "type": "string", "description": "Hash of image" }, + "sizes": { "type": "array", "items": { "$ref": "Textures.Details.Size" } } + } + }, "Profiles.Password": { "type": "object", "properties": { @@ -886,6 +913,12 @@ "field": { "$ref": "List.Filter.Fields.Songs", "required": true } } }, + "List.Filter.Rule.Textures": { + "extends": "List.Filter.Rule", + "properties": { + "field": { "$ref": "List.Filter.Fields.Textures", "required": true } + } + }, "List.Filter.Movies": { "type": [ { "type": "object", @@ -1033,6 +1066,27 @@ { "$ref": "List.Filter.Rule.Songs" } ] }, + "List.Filter.Textures": { + "type": [ + { "type": "object", + "properties": { + "and": { "type": "array", + "items": { "$ref": "List.Filter.Textures" }, + "minItems": 1, "required": true + } + } + }, + { "type": "object", + "properties": { + "or": { "type": "array", + "items": { "$ref": "List.Filter.Textures" }, + "minItems": 1, "required": true + } + } + }, + { "$ref": "List.Filter.Rule.Textures" } + ] + }, "List.Item.Base": { "extends": [ "Video.Details.File", "Audio.Details.Media" ], "properties": { -- 2.7.4