Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

JSON-RPC: cleanup #1174

Merged
merged 12 commits into from

2 participants

@Montellese
Owner

These commits are basically cleanup commits which remove hacks that are in the code to be backwards compatible with Eden. There are more and more of these hacks and some stuff (see e.g. #1161) just can't be done without breaking backwards compatibility. So let's make the break and bring all the benefits with it.

b229237 changes the type of some properties provided by xbmc from a concatenated string to an array of strings (e.g. "Rock / Pop" becomes [ "Rock", "Pop" ]).

174c560 properly integrates tagging support into JSON-RPC (not really cleanup).

2fe12ff removes two properties from movies which were never meant to be there.

All those "filter" related commits move the filtering-parameters like "genreid" etc in the FooLibrary.GetFoo() methods into a "filter" parameter. The main reason behind this is that the database logic is not able to apply multiple of those filters (e.g. "genreid" and "actorid") at the same time but nothing prevents a JSON-RPC client from specifying both. With the new "filter" parameter we can restrict JSON-RPC clients to only be able to provide one of those filters per request. Furthermore I have added additional filters like "genre" (in addition to "genreid") and "actor", "studio", "director", "year" etc where possible. So this will allow JSON-RPC clients to provide users with a similar GUI hierarchy as xbmc provides. Furthermore this provides a better solution to #1117 which is currently broken in master.

@jmarshallnz
Owner

Looks good. Possibility to do CVariant -> CVideoDbUrl in the future do you think. It would be nice to have a unified way of handling the filter structure (we currently have at least 3 such things).

@Montellese Montellese was assigned
@Montellese
Owner

What do you mean with CVariant -> CVideoDbUrl? That "genreid" is automatically stored in the CVideoDbUrl? Well in this PR there's no CVideoDbUrl yet because that will be introduced with another PR. We'll probably have to discuss where/how we want to handle injecting those options into CVideoDbUrl. Doing in CVideoDatabase::GetFooNav() has the advantage that the rest of the code doesn't have to know how the filters have to be named.

@Montellese Montellese merged commit 28a085f into xbmc:master
@tru tru referenced this pull request from a commit in plexinc/plex-home-theater-public
@tru tru Don't show the resume dialog if the playback is inited from a client
This fixes the android part of #1174.
f69f8b5
@tru tru referenced this pull request from a commit in plexinc/plex-home-theater-public
@tru tru Refactor PQM a bit to handle resume offsets.
Turns out that sending resume offsets via the playMedia command and
“everything is a play queue” stuff is was a pretty deep rabbit hole.

I had to make the PlayQueue methods take a new option to allow
prompting, this lead to the introduction of the PlexPlayQueueOptions
class instead of just adding more options to the commands.

Fixes #1174
5f82422
@tru tru referenced this pull request from a commit in RasPlex/plex-home-theatre
@tru tru Don't show the resume dialog if the playback is inited from a client
This fixes the android part of #1174.
d96f1f6
@tru tru referenced this pull request from a commit in RasPlex/plex-home-theatre
@tru tru Refactor PQM a bit to handle resume offsets.
Turns out that sending resume offsets via the playMedia command and
“everything is a play queue” stuff is was a pretty deep rabbit hole.

I had to make the PlayQueue methods take a new option to allow
prompting, this lead to the introduction of the PlexPlayQueueOptions
class instead of just adding more options to the commands.

Fixes #1174
3f9b2c5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp
@@ -135,7 +135,7 @@ void CGUIDialogSmartPlaylistRule::OnBrowse()
else if (m_rule.m_field == FieldArtist || m_rule.m_field == FieldAlbumArtist)
{
if (m_type.Equals("songs") || m_type.Equals("mixed") || m_type.Equals("albums"))
- database.GetArtistsNav("musicdb://2/",items,-1,m_rule.m_field == FieldAlbumArtist);
+ database.GetArtistsNav("musicdb://2/", items, m_rule.m_field == FieldAlbumArtist, -1);
if (m_type.Equals("musicvideos") || m_type.Equals("mixed"))
{
CFileItemList items2;
View
2  xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeArtist.cpp
@@ -56,7 +56,7 @@ bool CDirectoryNodeArtist::GetContent(CFileItemList& items) const
CQueryParams params;
CollectQueryParams(params);
- bool bSuccess = musicdatabase.GetArtistsNav(BuildPath(), items, params.GetGenreId(), !g_guiSettings.GetBool("musiclibrary.showcompilationartists"));
+ bool bSuccess = musicdatabase.GetArtistsNav(BuildPath(), items, !g_guiSettings.GetBool("musiclibrary.showcompilationartists"), params.GetGenreId());
musicdatabase.Close();
View
54 xbmc/interfaces/json-rpc/AudioLibrary.cpp
@@ -44,7 +44,20 @@ JSONRPC_STATUS CAudioLibrary::GetArtists(const CStdString &method, ITransportLay
if (!musicdatabase.Open())
return InternalError;
- int genreID = (int)parameterObject["genreid"].asInteger();
+ CMusicDbUrl musicUrl;
+ musicUrl.FromString("musicdb://2/");
+ int genreID = -1, albumID = -1, songID = -1;
+ const CVariant &filter = parameterObject["filter"];
+ if (filter.isMember("genreid"))
+ genreID = (int)filter["genreid"].asInteger();
+ if (filter.isMember("genre"))
+ musicUrl.AddOption("genre", filter["genre"].asString());
+ if (filter.isMember("albumid"))
+ albumID = (int)filter["albumid"].asInteger();
+ if (filter.isMember("album"))
+ musicUrl.AddOption("album", filter["album"].asString());
+ if (filter.isMember("songid"))
+ songID = (int)filter["songid"].asInteger();
// Add "artist" to "properties" array by default
CVariant param = parameterObject;
@@ -57,7 +70,7 @@ JSONRPC_STATUS CAudioLibrary::GetArtists(const CStdString &method, ITransportLay
albumArtistsOnly = parameterObject["albumartistsonly"].asBoolean();
CFileItemList items;
- if (!musicdatabase.GetArtistsNav("musicdb://2/", items, genreID, albumArtistsOnly))
+ if (!musicdatabase.GetArtistsNav(musicUrl.ToString(), items, albumArtistsOnly, genreID, albumID, songID))
return InternalError;
HandleFileItemList("artistid", false, "artists", items, param, result);
@@ -93,8 +106,18 @@ JSONRPC_STATUS CAudioLibrary::GetAlbums(const CStdString &method, ITransportLaye
if (!musicdatabase.Open())
return InternalError;
- int artistID = (int)parameterObject["artistid"].asInteger();
- int genreID = (int)parameterObject["genreid"].asInteger();
+ CMusicDbUrl musicUrl;
+ musicUrl.FromString("musicdb://3/");
+ int artistID = -1, genreID = -1;
+ const CVariant &filter = parameterObject["filter"];
+ if (filter.isMember("artistid"))
+ artistID = (int)filter["artistid"].asInteger();
+ if (filter.isMember("artist"))
+ musicUrl.AddOption("artist", filter["artist"].asString());
+ if (filter.isMember("genreid"))
+ genreID = (int)filter["genreid"].asInteger();
+ if (filter.isMember("genre"))
+ musicUrl.AddOption("genre", filter["genre"].asString());
SortDescription sorting;
ParseLimits(parameterObject, sorting.limitStart, sorting.limitEnd);
@@ -102,7 +125,7 @@ JSONRPC_STATUS CAudioLibrary::GetAlbums(const CStdString &method, ITransportLaye
return InvalidParams;
CFileItemList items;
- if (!musicdatabase.GetAlbumsNav("musicdb://3/", items, genreID, artistID, sorting))
+ if (!musicdatabase.GetAlbumsNav(musicUrl.ToString(), items, genreID, artistID, sorting))
return InternalError;
int size = items.Size();
@@ -142,9 +165,22 @@ JSONRPC_STATUS CAudioLibrary::GetSongs(const CStdString &method, ITransportLayer
if (!musicdatabase.Open())
return InternalError;
- int artistID = (int)parameterObject["artistid"].asInteger();
- int albumID = (int)parameterObject["albumid"].asInteger();
- int genreID = (int)parameterObject["genreid"].asInteger();
+ CMusicDbUrl musicUrl;
+ musicUrl.FromString("musicdb://4/");
+ int genreID = -1, albumID = -1, artistID = -1;
+ const CVariant &filter = parameterObject["filter"];
+ if (filter.isMember("artistid"))
+ artistID = (int)filter["artistid"].asInteger();
+ if (filter.isMember("artist"))
+ musicUrl.AddOption("artist", filter["artist"].asString());
+ if (filter.isMember("genreid"))
+ genreID = (int)filter["genreid"].asInteger();
+ if (filter.isMember("genre"))
+ musicUrl.AddOption("genre", filter["genre"].asString());
+ if (filter.isMember("albumid"))
+ albumID = (int)filter["albumid"].asInteger();
+ if (filter.isMember("album"))
+ musicUrl.AddOption("album", filter["album"].asString());
SortDescription sorting;
ParseLimits(parameterObject, sorting.limitStart, sorting.limitEnd);
@@ -152,7 +188,7 @@ JSONRPC_STATUS CAudioLibrary::GetSongs(const CStdString &method, ITransportLayer
return InvalidParams;
CFileItemList items;
- if (!musicdatabase.GetSongsNav("musicdb://4/", items, genreID, artistID, albumID, sorting))
+ if (!musicdatabase.GetSongsNav(musicUrl.ToString(), items, genreID, artistID, albumID, sorting))
return InternalError;
int size = items.Size();
View
6 xbmc/interfaces/json-rpc/FileItemHandler.cpp
@@ -67,12 +67,11 @@ void CFileItemHandler::FillDetails(ISerializable* info, CFileItemPtr item, const
result["albumlabel"] = item->GetProperty("album_label");
continue;
}
- /* This would break backwards compatibility to JSON-RPC API v4
if (item->HasProperty("album_" + field + "_array"))
{
result[field] = item->GetProperty("album_" + field + "_array");
continue;
- }*/
+ }
if (item->HasProperty("album_" + field))
{
result[field] = item->GetProperty("album_" + field);
@@ -80,12 +79,11 @@ void CFileItemHandler::FillDetails(ISerializable* info, CFileItemPtr item, const
}
}
- /* This would break backwards compatibility to JSON-RPC API v4
if (item->HasProperty("artist_" + field + "_array"))
{
result[field] = item->GetProperty("artist_" + field + "_array");
continue;
- }*/
+ }
if (item->HasProperty("artist_" + field))
{
result[field] = item->GetProperty("artist_" + field);
View
180 xbmc/interfaces/json-rpc/ServiceDescription.h
@@ -32,15 +32,15 @@ namespace JSONRPC
"\"default\": null"
"}",
"\"Optional.String\": {"
- "\"type\": [ \"null\", \"string\" ], "
+ "\"type\": [ \"null\", \"string\" ],"
"\"default\": null"
"}",
"\"Optional.Integer\": {"
- "\"type\": [ \"null\", \"integer\" ], "
+ "\"type\": [ \"null\", \"integer\" ],"
"\"default\": null"
"}",
"\"Optional.Number\": {"
- "\"type\": [ \"null\", \"number\" ], "
+ "\"type\": [ \"null\", \"number\" ],"
"\"default\": null"
"}",
"\"Array.String\": {"
@@ -79,6 +79,8 @@ namespace JSONRPC
"\"System\": { \"type\": \"boolean\", \"required\": true },"
"\"VideoLibrary\": { \"type\": \"boolean\", \"required\": true },"
"\"AudioLibrary\": { \"type\": \"boolean\", \"required\": true },"
+ "\"Application\": { \"type\": \"boolean\", \"required\": true },"
+ "\"Input\": { \"type\": \"boolean\", \"required\": true },"
"\"Other\": { \"type\": \"boolean\", \"required\": true }"
"},"
"\"additionalProperties\": false"
@@ -364,14 +366,14 @@ namespace JSONRPC
"\"Audio.Details.Base\": {"
"\"extends\": \"Media.Details.Base\","
"\"properties\": {"
- "\"genre\": { \"type\": \"string\" }"
+ "\"genre\": { \"$ref\": \"Array.String\" }"
"}"
"}",
"\"Audio.Details.Media\": {"
"\"extends\": \"Audio.Details.Base\","
"\"properties\": {"
"\"title\": { \"type\": \"string\" },"
- "\"artist\": { \"type\": \"string\" },"
+ "\"artist\": { \"$ref\": \"Array.String\" },"
"\"year\": { \"type\": \"integer\" },"
"\"rating\": { \"type\": \"integer\" },"
"\"musicbrainzalbumid\": { \"type\": \"string\" },"
@@ -383,15 +385,15 @@ namespace JSONRPC
"\"properties\": {"
"\"artistid\": { \"$ref\": \"Library.Id\", \"required\": true },"
"\"artist\": { \"type\": \"string\", \"required\": true },"
- "\"instrument\": { \"type\": \"string\" },"
- "\"style\": { \"type\": \"string\" },"
- "\"mood\": { \"type\": \"string\" },"
+ "\"instrument\": { \"$ref\": \"Array.String\" },"
+ "\"style\": { \"$ref\": \"Array.String\" },"
+ "\"mood\": { \"$ref\": \"Array.String\" },"
"\"born\": { \"type\": \"string\" },"
"\"formed\": { \"type\": \"string\" },"
"\"description\": { \"type\": \"string\" },"
"\"died\": { \"type\": \"string\" },"
"\"disbanded\": { \"type\": \"string\" },"
- "\"yearsactive\": { \"type\": \"string\" },"
+ "\"yearsactive\": { \"$ref\": \"Array.String\" },"
"\"musicbrainzartistid\": { \"type\": \"string\" }"
"}"
"}",
@@ -400,12 +402,11 @@ namespace JSONRPC
"\"properties\": {"
"\"albumid\": { \"$ref\": \"Library.Id\", \"required\": true },"
"\"description\": { \"type\": \"string\" },"
- "\"theme\": { \"type\": \"string\" },"
- "\"mood\": { \"type\": \"string\" },"
- "\"style\": { \"type\": \"string\" },"
+ "\"theme\": { \"$ref\": \"Array.String\" },"
+ "\"mood\": { \"$ref\": \"Array.String\" },"
+ "\"style\": { \"$ref\": \"Array.String\" },"
"\"type\": { \"type\": \"string\" },"
- "\"albumlabel\": { \"type\": \"string\" },"
- "\"artistid\": { \"$ref\": \"Library.Id\" }"
+ "\"albumlabel\": { \"type\": \"string\" }"
"}"
"}",
"\"Audio.Details.Song\": {"
@@ -413,7 +414,7 @@ namespace JSONRPC
"\"properties\": {"
"\"songid\": { \"$ref\": \"Library.Id\", \"required\": true },"
"\"file\": { \"type\": \"string\" },"
- "\"albumartist\": { \"type\": \"string\" },"
+ "\"albumartist\": { \"$ref\": \"Array.String\" },"
"\"album\": { \"type\": \"string\" },"
"\"track\": { \"type\": \"integer\" },"
"\"duration\": { \"type\": \"integer\" },"
@@ -422,7 +423,6 @@ namespace JSONRPC
"\"playcount\": { \"type\": \"integer\" },"
"\"musicbrainztrackid\": { \"type\": \"string\" },"
"\"musicbrainzartistid\": { \"type\": \"string\" },"
- "\"artistid\": { \"$ref\": \"Library.Id\" },"
"\"albumid\": { \"$ref\": \"Library.Id\" },"
"\"lastplayed\": { \"type\": \"string\" },"
"\"disc\": { \"type\": \"integer\" }"
@@ -435,9 +435,9 @@ namespace JSONRPC
"\"enum\": [ \"title\", \"genre\", \"year\", \"rating\", \"director\", \"trailer\","
"\"tagline\", \"plot\", \"plotoutline\", \"originaltitle\", \"lastplayed\","
"\"playcount\", \"writer\", \"studio\", \"mpaa\", \"cast\", \"country\","
- "\"imdbnumber\", \"premiered\", \"productioncode\", \"runtime\", \"set\","
- "\"showlink\", \"streamdetails\", \"top250\", \"votes\", \"fanart\","
- "\"thumbnail\", \"file\", \"sorttitle\", \"resume\", \"setid\", \"dateadded\" ]"
+ "\"imdbnumber\", \"runtime\", \"set\", \"showlink\", \"streamdetails\","
+ "\"top250\", \"votes\", \"fanart\", \"thumbnail\", \"file\", \"sorttitle\","
+ "\"resume\", \"setid\", \"dateadded\", \"tag\" ]"
"}"
"}",
"\"Video.Fields.MovieSet\": {"
@@ -566,7 +566,7 @@ namespace JSONRPC
"\"extends\": \"Video.Details.Item\","
"\"properties\": {"
"\"runtime\": { \"type\": \"string\" },"
- "\"director\": { \"type\": \"string\" },"
+ "\"director\": { \"$ref\": \"Array.String\" },"
"\"streamdetails\": { \"$ref\": \"Video.Streams\" },"
"\"resume\": { \"$ref\": \"Video.Resume\" }"
"}"
@@ -575,7 +575,7 @@ namespace JSONRPC
"\"extends\": \"Video.Details.File\","
"\"properties\": {"
"\"movieid\": { \"$ref\": \"Library.Id\", \"required\": true },"
- "\"genre\": { \"type\": \"string\" },"
+ "\"genre\": { \"$ref\": \"Array.String\" },"
"\"year\": { \"type\": \"integer\" },"
"\"rating\": { \"type\": \"number\" },"
"\"trailer\": { \"type\": \"string\" },"
@@ -583,19 +583,18 @@ namespace JSONRPC
"\"plotoutline\": { \"type\": \"string\" },"
"\"originaltitle\": { \"type\": \"string\" },"
"\"sorttitle\": { \"type\": \"string\" },"
- "\"writer\": { \"type\": \"string\" },"
- "\"studio\": { \"type\": \"string\" },"
+ "\"writer\": { \"$ref\": \"Array.String\" },"
+ "\"studio\": { \"$ref\": \"Array.String\" },"
"\"mpaa\": { \"type\": \"string\" },"
"\"cast\": { \"$ref\": \"Video.Cast\" },"
- "\"country\": { \"type\": \"string\" },"
+ "\"country\": { \"$ref\": \"Array.String\" },"
"\"imdbnumber\": { \"type\": \"string\" },"
- "\"premiered\": { \"type\": \"string\" },"
- "\"productioncode\": { \"type\": \"string\" },"
"\"set\": { \"type\": \"string\" },"
- "\"showlink\": { \"type\": \"string\" },"
+ "\"showlink\": { \"$ref\": \"Array.String\" },"
"\"top250\": { \"type\": \"integer\" },"
"\"votes\": { \"type\": \"string\" },"
- "\"setid\": { \"$ref\": \"Library.Id\" }"
+ "\"setid\": { \"$ref\": \"Library.Id\" },"
+ "\"tag\": { \"$ref\": \"Array.String\" }"
"}"
"}",
"\"Video.Details.MovieSet\": {"
@@ -616,12 +615,12 @@ namespace JSONRPC
"\"extends\": \"Video.Details.Item\","
"\"properties\": {"
"\"tvshowid\": { \"$ref\": \"Library.Id\", \"required\": true },"
- "\"genre\": { \"type\": \"string\" },"
+ "\"genre\": { \"$ref\": \"Array.String\" },"
"\"year\": { \"type\": \"integer\" },"
"\"rating\": { \"type\": \"number\" },"
"\"originaltitle\": { \"type\": \"string\" },"
"\"sorttitle\": { \"type\": \"string\" },"
- "\"studio\": { \"type\": \"string\" },"
+ "\"studio\": { \"$ref\": \"Array.String\" },"
"\"mpaa\": { \"type\": \"string\" },"
"\"cast\": { \"$ref\": \"Video.Cast\" },"
"\"episode\": { \"type\": \"integer\" },"
@@ -649,7 +648,7 @@ namespace JSONRPC
"\"episodeid\": { \"$ref\": \"Library.Id\", \"required\": true },"
"\"votes\": { \"type\": \"string\" },"
"\"rating\": { \"type\": \"number\" },"
- "\"writer\": { \"type\": \"string\" },"
+ "\"writer\": { \"$ref\": \"Array.String\" },"
"\"firstaired\": { \"type\": \"string\" },"
"\"productioncode\": { \"type\": \"string\" },"
"\"season\": { \"type\": \"integer\" },"
@@ -664,11 +663,11 @@ namespace JSONRPC
"\"extends\": \"Video.Details.File\","
"\"properties\": {"
"\"musicvideoid\": { \"$ref\": \"Library.Id\", \"required\": true },"
- "\"studio\": { \"type\": \"string\" },"
+ "\"studio\": { \"$ref\": \"Array.String\" },"
"\"year\": { \"type\": \"integer\" },"
"\"album\": { \"type\": \"string\" },"
- "\"artist\": { \"type\": \"string\" },"
- "\"genre\": { \"type\": \"string\" },"
+ "\"artist\": { \"$ref\": \"Array.String\" },"
+ "\"genre\": { \"$ref\": \"Array.String\" },"
"\"track\": { \"type\": \"integer\" }"
"}"
"}",
@@ -723,7 +722,7 @@ namespace JSONRPC
"\"runtime\", \"set\", \"showlink\", \"streamdetails\", \"top250\", \"votes\","
"\"firstaired\", \"season\", \"episode\", \"showtitle\", \"thumbnail\", \"file\","
"\"resume\", \"artistid\", \"albumid\", \"tvshowid\", \"setid\", \"watchedepisodes\","
- "\"disc\" ]"
+ "\"disc\", \"tag\" ]"
"}"
"}",
"\"List.Item.All\": {"
@@ -731,7 +730,7 @@ namespace JSONRPC
"\"properties\": {"
"\"id\": { \"$ref\": \"Library.Id\" },"
"\"type\": { \"type\": \"string\", \"enum\": [ \"unknown\", \"movie\", \"episode\", \"musicvideo\", \"song\", \"picture\" ] },"
- "\"albumartist\": { \"type\": \"string\" },"
+ "\"albumartist\": { \"$ref\": \"Array.String\" },"
"\"album\": { \"type\": \"string\" },"
"\"track\": { \"type\": \"integer\" },"
"\"duration\": { \"type\": \"integer\" },"
@@ -743,8 +742,8 @@ namespace JSONRPC
"\"tagline\": { \"type\": \"string\" },"
"\"plotoutline\": { \"type\": \"string\" },"
"\"originaltitle\": { \"type\": \"string\" },"
- "\"writer\": { \"type\": \"string\" },"
- "\"studio\": { \"type\": \"string\" },"
+ "\"writer\": { \"$ref\": \"Array.String\" },"
+ "\"studio\": { \"$ref\": \"Array.String\" },"
"\"mpaa\": { \"type\": \"string\" },"
"\"cast\": { \"$ref\": \"Video.Cast\" },"
"\"country\": { \"type\": \"string\" },"
@@ -752,19 +751,19 @@ namespace JSONRPC
"\"premiered\": { \"type\": \"string\" },"
"\"productioncode\": { \"type\": \"string\" },"
"\"set\": { \"type\": \"string\" },"
- "\"showlink\": { \"type\": \"string\" },"
+ "\"showlink\": { \"$ref\": \"Array.String\" },"
"\"top250\": { \"type\": \"integer\" },"
"\"votes\": { \"type\": \"string\" },"
"\"firstaired\": { \"type\": \"string\" },"
"\"season\": { \"type\": \"integer\" },"
"\"episode\": { \"type\": \"integer\" },"
"\"showtitle\": { \"type\": \"string\" },"
- "\"artistid\": { \"$ref\": \"Library.Id\" },"
"\"albumid\": { \"$ref\": \"Library.Id\" },"
"\"setid\": { \"$ref\": \"Library.Id\" },"
"\"tvshowid\": { \"$ref\": \"Library.Id\" },"
"\"watchedepisodes\": { \"type\": \"integer\" },"
- "\"disc\": { \"type\": \"integer\" }"
+ "\"disc\": { \"type\": \"integer\" },"
+ "\"tag\": { \"$ref\": \"Array.String\" }"
"}"
"}",
"\"List.Fields.Files\": {"
@@ -943,7 +942,6 @@ namespace JSONRPC
"\"AudioLibrary\": { \"$ref\": \"Optional.Boolean\" },"
"\"VideoLibrary\": { \"$ref\": \"Optional.Boolean\" },"
"\"Application\": { \"$ref\": \"Optional.Boolean\" },"
- "\"Input\": { \"$ref\": \"Optional.Boolean\" },"
"\"Other\": { \"$ref\": \"Optional.Boolean\" }"
"}"
"}"
@@ -1454,10 +1452,18 @@ namespace JSONRPC
"\"permission\": \"ReadData\","
"\"params\": ["
"{ \"name\": \"albumartistsonly\", \"$ref\": \"Optional.Boolean\", \"description\": \"Whether or not to include artists only appearing in compilations. If the parameter is not passed or is passed as null the GUI setting will be used\" },"
- "{ \"name\": \"genreid\", \"$ref\": \"Library.Id\" },"
"{ \"name\": \"properties\", \"$ref\": \"Audio.Fields.Artist\" },"
"{ \"name\": \"limits\", \"$ref\": \"List.Limits\" },"
- "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" }"
+ "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" },"
+ "{ \"name\": \"filter\","
+ "\"type\": ["
+ "{ \"type\": \"object\", \"properties\": { \"genreid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"genre\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"albumid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"album\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"songid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false }"
+ "]"
+ "}"
"],"
"\"returns\": {"
"\"type\": \"object\","
@@ -1490,11 +1496,17 @@ namespace JSONRPC
"\"transport\": \"Response\","
"\"permission\": \"ReadData\","
"\"params\": ["
- "{ \"name\": \"artistid\", \"$ref\": \"Library.Id\" },"
- "{ \"name\": \"genreid\", \"$ref\": \"Library.Id\" },"
"{ \"name\": \"properties\", \"$ref\": \"Audio.Fields.Album\" },"
"{ \"name\": \"limits\", \"$ref\": \"List.Limits\" },"
- "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" }"
+ "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" },"
+ "{ \"name\": \"filter\","
+ "\"type\": ["
+ "{ \"type\": \"object\", \"properties\": { \"genreid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"genre\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"artistid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"artist\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false }"
+ "]"
+ "}"
"],"
"\"returns\": {"
"\"type\": \"object\","
@@ -1527,12 +1539,19 @@ namespace JSONRPC
"\"transport\": \"Response\","
"\"permission\": \"ReadData\","
"\"params\": ["
- "{ \"name\": \"artistid\", \"$ref\": \"Library.Id\" },"
- "{ \"name\": \"albumid\", \"$ref\": \"Library.Id\" },"
- "{ \"name\": \"genreid\", \"$ref\": \"Library.Id\" },"
"{ \"name\": \"properties\", \"$ref\": \"Audio.Fields.Song\" },"
"{ \"name\": \"limits\", \"$ref\": \"List.Limits\" },"
- "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" }"
+ "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" },"
+ "{ \"name\": \"filter\","
+ "\"type\": ["
+ "{ \"type\": \"object\", \"properties\": { \"genreid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"genre\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"artistid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"artist\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"albumid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"album\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false }"
+ "]"
+ "}"
"],"
"\"returns\": {"
"\"type\": \"object\","
@@ -1776,7 +1795,21 @@ namespace JSONRPC
"\"params\": ["
"{ \"name\": \"properties\", \"$ref\": \"Video.Fields.Movie\" },"
"{ \"name\": \"limits\", \"$ref\": \"List.Limits\" },"
- "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" }"
+ "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" },"
+ "{ \"name\": \"filter\","
+ "\"type\": ["
+ "{ \"type\": \"object\", \"properties\": { \"genreid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"genre\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"year\": { \"type\": \"integer\", \"minimum\": 0, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"actor\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"director\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"studio\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"country\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"setid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"set\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"tag\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false }"
+ "]"
+ "}"
"],"
"\"returns\": {"
"\"type\": \"object\","
@@ -1852,7 +1885,16 @@ namespace JSONRPC
"\"params\": ["
"{ \"name\": \"properties\", \"$ref\": \"Video.Fields.TVShow\" },"
"{ \"name\": \"limits\", \"$ref\": \"List.Limits\" },"
- "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" }"
+ "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" },"
+ "{ \"name\": \"filter\","
+ "\"type\": ["
+ "{ \"type\": \"object\", \"properties\": { \"genreid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"genre\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"year\": { \"type\": \"integer\", \"minimum\": 0, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"actor\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"studio\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false }"
+ "]"
+ "}"
"],"
"\"returns\": { \"type\": \"object\","
"\"properties\": {"
@@ -1908,7 +1950,16 @@ namespace JSONRPC
"{ \"name\": \"season\", \"type\": \"integer\", \"minimum\": 0, \"default\": -1 },"
"{ \"name\": \"properties\", \"$ref\": \"Video.Fields.Episode\" },"
"{ \"name\": \"limits\", \"$ref\": \"List.Limits\" },"
- "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" }"
+ "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" },"
+ "{ \"name\": \"filter\","
+ "\"type\": ["
+ "{ \"type\": \"object\", \"properties\": { \"genreid\": { \"$ref\": \"Library.Id\", \"required\": true, \"description\": \"Requires tvshowid to be set\" } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"genre\": { \"type\": \"string\", \"minLength\": 1, \"required\": true, \"description\": \"Requires tvshowid to be set\" } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"year\": { \"type\": \"integer\", \"minimum\": 0, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"actor\": { \"type\": \"string\", \"minLength\": 1, \"required\": true, \"description\": \"Requires tvshowid to be set\" } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"director\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false }"
+ "]"
+ "}"
"],"
"\"returns\": { \"type\": \"object\","
"\"properties\": {"
@@ -1940,11 +1991,19 @@ namespace JSONRPC
"\"transport\": \"Response\","
"\"permission\": \"ReadData\","
"\"params\": ["
- "{ \"name\": \"artistid\", \"$ref\": \"Library.Id\" },"
- "{ \"name\": \"albumid\", \"$ref\": \"Library.Id\" },"
"{ \"name\": \"properties\", \"$ref\": \"Video.Fields.MusicVideo\" },"
"{ \"name\": \"limits\", \"$ref\": \"List.Limits\" },"
- "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" }"
+ "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" },"
+ "{ \"name\": \"filter\","
+ "\"type\": ["
+ "{ \"type\": \"object\", \"properties\": { \"artist\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"genreid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"genre\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"year\": { \"type\": \"integer\", \"minimum\": 0, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"director\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false },"
+ "{ \"type\": \"object\", \"properties\": { \"studio\": { \"type\": \"string\", \"minLength\": 1, \"required\": true } }, \"additionalProperties\": false }"
+ "]"
+ "}"
"],"
"\"returns\": { \"type\": \"object\","
"\"properties\": {"
@@ -2079,7 +2138,8 @@ namespace JSONRPC
"{ \"name\": \"set\", \"$ref\": \"Optional.String\" },"
"{ \"name\": \"showlink\", \"type\": [ \"null\", { \"$ref\": \"Array.String\", \"required\": true } ], \"default\": null },"
"{ \"name\": \"thumbnail\", \"$ref\": \"Optional.String\" },"
- "{ \"name\": \"fanart\", \"$ref\": \"Optional.String\" }"
+ "{ \"name\": \"fanart\", \"$ref\": \"Optional.String\" },"
+ "{ \"name\": \"tag\", \"type\": [ \"null\", { \"$ref\": \"Array.String\", \"required\": true } ], \"default\": null }"
"],"
"\"returns\": \"string\""
"}",
@@ -2533,7 +2593,7 @@ namespace JSONRPC
"\"description\": \"Playback of a media item has been stopped. If there is no ID available extra information will be provided.\","
"\"params\": ["
"{ \"name\": \"sender\", \"type\": \"string\", \"required\": true },"
- "{ \"name\": \"data\", \"type\": \"object\", \"required\": true, "
+ "{ \"name\": \"data\", \"type\": \"object\", \"required\": true,"
"\"properties\": {"
"\"item\": { \"$ref\": \"Player.Notifications.Item\" },"
"\"end\": { \"type\": \"boolean\", \"required\": true, \"description\": \"Whether the player has reached the end of the playable item(s) or not\" }"
@@ -2556,7 +2616,7 @@ namespace JSONRPC
"\"description\": \"The playback position has been changed. If there is no ID available extra information will be provided.\","
"\"params\": ["
"{ \"name\": \"sender\", \"type\": \"string\", \"required\": true },"
- "{ \"name\": \"data\", \"type\": \"object\", \"required\": true, "
+ "{ \"name\": \"data\", \"type\": \"object\", \"required\": true,"
"\"properties\": {"
"\"item\": { \"$ref\": \"Player.Notifications.Item\" },"
"\"player\": { \"$ref\": \"Player.Notifications.Player.Seek\", \"required\": true }"
View
123 xbmc/interfaces/json-rpc/VideoLibrary.cpp
@@ -33,12 +33,45 @@ JSONRPC_STATUS CVideoLibrary::GetMovies(const CStdString &method, ITransportLaye
if (!videodatabase.Open())
return InternalError;
+ SortDescription sorting;
+ ParseLimits(parameterObject, sorting.limitStart, sorting.limitEnd);
+ if (!ParseSorting(parameterObject, sorting.sortBy, sorting.sortOrder, sorting.sortAttributes))
+ return InvalidParams;
+
+ CVideoDbUrl videoUrl;
+ videoUrl.FromString("videodb://1/2/");
+ int genreID = -1, year = -1, setID = 0;
+ const CVariant &filter = parameterObject["filter"];
+ if (filter.isMember("genreid"))
+ genreID = (int)filter["genreid"].asInteger();
+ if (filter.isMember("genre"))
+ videoUrl.AddOption("genre", filter["genre"].asString());
+ if (filter.isMember("year"))
+ year = (int)filter["year"].asInteger();
+ if (filter.isMember("actor"))
+ videoUrl.AddOption("actor", filter["actor"].asString());
+ if (filter.isMember("director"))
+ videoUrl.AddOption("director", filter["director"].asString());
+ if (filter.isMember("studio"))
+ videoUrl.AddOption("studio", filter["studio"].asString());
+ if (filter.isMember("country"))
+ videoUrl.AddOption("country", filter["country"].asString());
+ if (filter.isMember("setid"))
+ setID = (int)filter["setid"].asInteger();
+ if (filter.isMember("set"))
+ videoUrl.AddOption("set", filter["set"].asString());
+ if (filter.isMember("tag"))
+ videoUrl.AddOption("tag", filter["tag"].asString());
+
+ // setID must not be -1 otherwise GetMoviesNav() will return sets
+ if (setID < 0)
+ setID = 0;
+
CFileItemList items;
- JSONRPC_STATUS ret = OK;
- if ((ret = GetVideos(MediaTypeMovie, "videodb://1/2/", parameterObject, items, result, videodatabase)) == OK)
- ret = GetAdditionalMovieDetails(parameterObject, items, result, videodatabase);
+ if (!videodatabase.GetMoviesNav(videoUrl.ToString(), items, genreID, year, -1, -1, -1, -1, setID, -1, sorting))
+ return InvalidParams;
- return ret;
+ return GetAdditionalMovieDetails(parameterObject, items, result, videodatabase);
}
JSONRPC_STATUS CVideoLibrary::GetMovieDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
@@ -110,10 +143,29 @@ JSONRPC_STATUS CVideoLibrary::GetTVShows(const CStdString &method, ITransportLay
if (!videodatabase.Open())
return InternalError;
+ SortDescription sorting;
+ ParseLimits(parameterObject, sorting.limitStart, sorting.limitEnd);
+ if (!ParseSorting(parameterObject, sorting.sortBy, sorting.sortOrder, sorting.sortAttributes))
+ return InvalidParams;
+
+ CVideoDbUrl videoUrl;
+ videoUrl.FromString("videodb://2/2/");
+ int genreID = -1, year = -1;
+ const CVariant &filter = parameterObject["filter"];
+ if (filter.isMember("genreid"))
+ genreID = (int)filter["genreid"].asInteger();
+ if (filter.isMember("genre"))
+ videoUrl.AddOption("genre", filter["genre"].asString());
+ if (filter.isMember("year"))
+ year = (int)filter["year"].asInteger();
+ if (filter.isMember("actor"))
+ videoUrl.AddOption("actor", filter["actor"].asString());
+ if (filter.isMember("studio"))
+ videoUrl.AddOption("studio", filter["studio"].asString());
+
CFileItemList items;
- JSONRPC_STATUS ret = OK;
- if ((ret = GetVideos(MediaTypeTvShow, "videodb://2/2/", parameterObject, items, result, videodatabase)) != OK)
- return ret;
+ if (!videodatabase.GetTvShowsNav(videoUrl.ToString(), items, genreID, year, -1, -1, -1, sorting))
+ return InvalidParams;
bool additionalInfo = false;
for (CVariant::const_iterator_array itr = parameterObject["properties"].begin_array(); itr != parameterObject["properties"].end_array(); itr++)
@@ -134,7 +186,7 @@ JSONRPC_STATUS CVideoLibrary::GetTVShows(const CStdString &method, ITransportLay
size = (int)items.GetProperty("total").asInteger();
HandleFileItemList("tvshowid", true, "tvshows", items, parameterObject, result, size, false);
- return ret;
+ return OK;
}
JSONRPC_STATUS CVideoLibrary::GetTVShowDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
@@ -184,11 +236,30 @@ JSONRPC_STATUS CVideoLibrary::GetEpisodes(const CStdString &method, ITransportLa
int tvshowID = (int)parameterObject["tvshowid"].asInteger();
int season = (int)parameterObject["season"].asInteger();
-
+
CStdString strPath;
strPath.Format("videodb://2/2/%i/%i/", tvshowID, season);
+
+ CVideoDbUrl videoUrl;
+ videoUrl.FromString(strPath);
+ int genreID = -1, year = -1;
+ const CVariant &filter = parameterObject["filter"];
+ if (filter.isMember("genreid"))
+ genreID = (int)filter["genreid"].asInteger();
+ if (filter.isMember("genre"))
+ videoUrl.AddOption("genre", filter["genre"].asString());
+ if (filter.isMember("year"))
+ year = (int)filter["year"].asInteger();
+ if (filter.isMember("actor"))
+ videoUrl.AddOption("actor", filter["actor"].asString());
+ if (filter.isMember("director"))
+ videoUrl.AddOption("director", filter["director"].asString());
+
+ if (tvshowID <= 0 && (genreID > 0 || filter.isMember("actor")))
+ return InvalidParams;
+
CFileItemList items;
- if (!videodatabase.GetEpisodesNav(strPath, items, -1, -1, -1, -1, tvshowID, season, sorting))
+ if (!videodatabase.GetEpisodesNav(videoUrl.ToString(), items, genreID, year, -1, -1, tvshowID, season, sorting))
return InternalError;
return GetAdditionalEpisodeDetails(parameterObject, items, result, videodatabase);
@@ -240,11 +311,25 @@ JSONRPC_STATUS CVideoLibrary::GetMusicVideos(const CStdString &method, ITranspor
if (!ParseSorting(parameterObject, sorting.sortBy, sorting.sortOrder, sorting.sortAttributes))
return InvalidParams;
- int artistID = (int)parameterObject["artistid"].asInteger();
- int albumID = (int)parameterObject["albumid"].asInteger();
+ CVideoDbUrl videoUrl;
+ videoUrl.FromString("videodb://3/2/");
+ int genreID = -1, year = -1;
+ const CVariant &filter = parameterObject["filter"];
+ if (filter.isMember("artist"))
+ videoUrl.AddOption("artist", filter["artist"].asString());
+ if (filter.isMember("genreid"))
+ genreID = (int)filter["genreid"].asInteger();
+ if (filter.isMember("genre"))
+ videoUrl.AddOption("genre", filter["genre"].asString());
+ if (filter.isMember("year"))
+ year = (int)filter["year"].asInteger();
+ if (filter.isMember("director"))
+ videoUrl.AddOption("director", filter["director"].asString());
+ if (filter.isMember("studio"))
+ videoUrl.AddOption("studio", filter["studio"].asString());
CFileItemList items;
- if (!videodatabase.GetMusicVideosNav("videodb://3/2/", items, -1, -1, artistID, -1, -1, albumID, sorting))
+ if (!videodatabase.GetMusicVideosNav(videoUrl.ToString(), items, genreID, year, -1, -1, -1, -1, sorting))
return InternalError;
return GetAdditionalMusicVideoDetails(parameterObject, items, result, videodatabase);
@@ -630,16 +715,6 @@ bool CVideoLibrary::FillFileItemList(const CVariant &parameterObject, CFileItemL
return success;
}
-JSONRPC_STATUS CVideoLibrary::GetVideos(MediaType mediaType, const CStdString &strBaseDir, const CVariant &parameterObject, CFileItemList &items, CVariant &result, CVideoDatabase &videodatabase)
-{
- SortDescription sorting;
- ParseLimits(parameterObject, sorting.limitStart, sorting.limitEnd);
- if (!ParseSorting(parameterObject, sorting.sortBy, sorting.sortOrder, sorting.sortAttributes))
- return InvalidParams;
-
- return videodatabase.GetSortedVideos(mediaType, strBaseDir, sorting, items) ? OK : InternalError;
-}
-
JSONRPC_STATUS CVideoLibrary::GetAdditionalMovieDetails(const CVariant &parameterObject, CFileItemList &items, CVariant &result, CVideoDatabase &videodatabase)
{
if (!videodatabase.Open())
@@ -832,4 +907,6 @@ void CVideoLibrary::UpdateVideoTag(const CVariant &parameterObject, CVideoInfoTa
artwork["thumb"] = parameterObject["thumbnail"].asString();
if (ParameterNotNull(parameterObject, "fanart"))
artwork["fanart"] = parameterObject["fanart"].asString();
+ if (ParameterNotNull(parameterObject, "tag"))
+ CopyStringArray(parameterObject["tag"], details.m_tags);
}
View
1  xbmc/interfaces/json-rpc/VideoLibrary.h
@@ -70,7 +70,6 @@ namespace JSONRPC
static bool FillFileItemList(const CVariant &parameterObject, CFileItemList &list);
private:
- static JSONRPC_STATUS GetVideos(MediaType mediaType, const CStdString &strBaseDir, const CVariant &parameterObject, CFileItemList &items, CVariant &result, CVideoDatabase &videodatabase);
static JSONRPC_STATUS GetAdditionalMovieDetails(const CVariant &parameterObject, CFileItemList &items, CVariant &result, CVideoDatabase &videodatabase);
static JSONRPC_STATUS GetAdditionalEpisodeDetails(const CVariant &parameterObject, CFileItemList &items, CVariant &result, CVideoDatabase &videodatabase);
static JSONRPC_STATUS GetAdditionalMusicVideoDetails(const CVariant &parameterObject, CFileItemList &items, CVariant &result, CVideoDatabase &videodatabase);
View
94 xbmc/interfaces/json-rpc/methods.json
@@ -588,10 +588,18 @@
"permission": "ReadData",
"params": [
{ "name": "albumartistsonly", "$ref": "Optional.Boolean", "description": "Whether or not to include artists only appearing in compilations. If the parameter is not passed or is passed as null the GUI setting will be used" },
- { "name": "genreid", "$ref": "Library.Id" },
{ "name": "properties", "$ref": "Audio.Fields.Artist" },
{ "name": "limits", "$ref": "List.Limits" },
- { "name": "sort", "$ref": "List.Sort" }
+ { "name": "sort", "$ref": "List.Sort" },
+ { "name": "filter",
+ "type": [
+ { "type": "object", "properties": { "genreid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "genre": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "albumid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "album": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "songid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false }
+ ]
+ }
],
"returns": {
"type": "object",
@@ -624,11 +632,17 @@
"transport": "Response",
"permission": "ReadData",
"params": [
- { "name": "artistid", "$ref": "Library.Id" },
- { "name": "genreid", "$ref": "Library.Id" },
{ "name": "properties", "$ref": "Audio.Fields.Album" },
{ "name": "limits", "$ref": "List.Limits" },
- { "name": "sort", "$ref": "List.Sort" }
+ { "name": "sort", "$ref": "List.Sort" },
+ { "name": "filter",
+ "type": [
+ { "type": "object", "properties": { "genreid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "genre": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "artistid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "artist": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false }
+ ]
+ }
],
"returns": {
"type": "object",
@@ -661,12 +675,19 @@
"transport": "Response",
"permission": "ReadData",
"params": [
- { "name": "artistid", "$ref": "Library.Id" },
- { "name": "albumid", "$ref": "Library.Id" },
- { "name": "genreid", "$ref": "Library.Id" },
{ "name": "properties", "$ref": "Audio.Fields.Song" },
{ "name": "limits", "$ref": "List.Limits" },
- { "name": "sort", "$ref": "List.Sort" }
+ { "name": "sort", "$ref": "List.Sort" },
+ { "name": "filter",
+ "type": [
+ { "type": "object", "properties": { "genreid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "genre": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "artistid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "artist": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "albumid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "album": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false }
+ ]
+ }
],
"returns": {
"type": "object",
@@ -910,7 +931,21 @@
"params": [
{ "name": "properties", "$ref": "Video.Fields.Movie" },
{ "name": "limits", "$ref": "List.Limits" },
- { "name": "sort", "$ref": "List.Sort" }
+ { "name": "sort", "$ref": "List.Sort" },
+ { "name": "filter",
+ "type": [
+ { "type": "object", "properties": { "genreid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "genre": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "year": { "type": "integer", "minimum": 0, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "actor": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "director": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "studio": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "country": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "setid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "set": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "tag": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false }
+ ]
+ }
],
"returns": {
"type": "object",
@@ -986,7 +1021,16 @@
"params": [
{ "name": "properties", "$ref": "Video.Fields.TVShow" },
{ "name": "limits", "$ref": "List.Limits" },
- { "name": "sort", "$ref": "List.Sort" }
+ { "name": "sort", "$ref": "List.Sort" },
+ { "name": "filter",
+ "type": [
+ { "type": "object", "properties": { "genreid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "genre": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "year": { "type": "integer", "minimum": 0, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "actor": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "studio": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false }
+ ]
+ }
],
"returns": { "type": "object",
"properties": {
@@ -1042,7 +1086,16 @@
{ "name": "season", "type": "integer", "minimum": 0, "default": -1 },
{ "name": "properties", "$ref": "Video.Fields.Episode" },
{ "name": "limits", "$ref": "List.Limits" },
- { "name": "sort", "$ref": "List.Sort" }
+ { "name": "sort", "$ref": "List.Sort" },
+ { "name": "filter",
+ "type": [
+ { "type": "object", "properties": { "genreid": { "$ref": "Library.Id", "required": true, "description": "Requires tvshowid to be set" } }, "additionalProperties": false },
+ { "type": "object", "properties": { "genre": { "type": "string", "minLength": 1, "required": true, "description": "Requires tvshowid to be set" } }, "additionalProperties": false },
+ { "type": "object", "properties": { "year": { "type": "integer", "minimum": 0, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "actor": { "type": "string", "minLength": 1, "required": true, "description": "Requires tvshowid to be set" } }, "additionalProperties": false },
+ { "type": "object", "properties": { "director": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false }
+ ]
+ }
],
"returns": { "type": "object",
"properties": {
@@ -1074,11 +1127,19 @@
"transport": "Response",
"permission": "ReadData",
"params": [
- { "name": "artistid", "$ref": "Library.Id" },
- { "name": "albumid", "$ref": "Library.Id" },
{ "name": "properties", "$ref": "Video.Fields.MusicVideo" },
{ "name": "limits", "$ref": "List.Limits" },
- { "name": "sort", "$ref": "List.Sort" }
+ { "name": "sort", "$ref": "List.Sort" },
+ { "name": "filter",
+ "type": [
+ { "type": "object", "properties": { "artist": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "genreid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "genre": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "year": { "type": "integer", "minimum": 0, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "director": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false },
+ { "type": "object", "properties": { "studio": { "type": "string", "minLength": 1, "required": true } }, "additionalProperties": false }
+ ]
+ }
],
"returns": { "type": "object",
"properties": {
@@ -1213,7 +1274,8 @@
{ "name": "set", "$ref": "Optional.String" },
{ "name": "showlink", "type": [ "null", { "$ref": "Array.String", "required": true } ], "default": null },
{ "name": "thumbnail", "$ref": "Optional.String" },
- { "name": "fanart", "$ref": "Optional.String" }
+ { "name": "fanart", "$ref": "Optional.String" },
+ { "name": "tag", "type": [ "null", { "$ref": "Array.String", "required": true } ], "default": null }
],
"returns": "string"
},
View
4 xbmc/interfaces/json-rpc/notifications.json
@@ -22,7 +22,7 @@
"description": "Playback of a media item has been stopped. If there is no ID available extra information will be provided.",
"params": [
{ "name": "sender", "type": "string", "required": true },
- { "name": "data", "type": "object", "required": true,
+ { "name": "data", "type": "object", "required": true,
"properties": {
"item": { "$ref": "Player.Notifications.Item" },
"end": { "type": "boolean", "required": true, "description": "Whether the player has reached the end of the playable item(s) or not" }
@@ -45,7 +45,7 @@
"description": "The playback position has been changed. If there is no ID available extra information will be provided.",
"params": [
{ "name": "sender", "type": "string", "required": true },
- { "name": "data", "type": "object", "required": true,
+ { "name": "data", "type": "object", "required": true,
"properties": {
"item": { "$ref": "Player.Notifications.Item" },
"player": { "$ref": "Player.Notifications.Player.Seek", "required": true }
View
81 xbmc/interfaces/json-rpc/types.json
@@ -4,15 +4,15 @@
"default": null
},
"Optional.String": {
- "type": [ "null", "string" ],
+ "type": [ "null", "string" ],
"default": null
},
"Optional.Integer": {
- "type": [ "null", "integer" ],
+ "type": [ "null", "integer" ],
"default": null
},
"Optional.Number": {
- "type": [ "null", "number" ],
+ "type": [ "null", "number" ],
"default": null
},
"Array.String": {
@@ -67,7 +67,7 @@
"type": "integer",
"default": -1,
"minimum": 1
- },
+ },
"Playlist.Id": {
"type": "integer",
"minimum": 0,
@@ -338,14 +338,14 @@
"Audio.Details.Base": {
"extends": "Media.Details.Base",
"properties": {
- "genre": { "type": "string" }
+ "genre": { "$ref": "Array.String" }
}
},
"Audio.Details.Media": {
"extends": "Audio.Details.Base",
"properties": {
"title": { "type": "string" },
- "artist": { "type": "string" },
+ "artist": { "$ref": "Array.String" },
"year": { "type": "integer" },
"rating": { "type": "integer" },
"musicbrainzalbumid": { "type": "string" },
@@ -357,15 +357,15 @@
"properties": {
"artistid": { "$ref": "Library.Id", "required": true },
"artist": { "type": "string", "required": true },
- "instrument": { "type": "string" },
- "style": { "type": "string" },
- "mood": { "type": "string" },
+ "instrument": { "$ref": "Array.String" },
+ "style": { "$ref": "Array.String" },
+ "mood": { "$ref": "Array.String" },
"born": { "type": "string" },
"formed": { "type": "string" },
"description": { "type": "string" },
"died": { "type": "string" },
"disbanded": { "type": "string" },
- "yearsactive": { "type": "string" },
+ "yearsactive": { "$ref": "Array.String" },
"musicbrainzartistid": { "type": "string" }
}
},
@@ -374,12 +374,11 @@
"properties": {
"albumid": { "$ref": "Library.Id", "required": true },
"description": { "type": "string" },
- "theme": { "type": "string" },
- "mood": { "type": "string" },
- "style": { "type": "string" },
+ "theme": { "$ref": "Array.String" },
+ "mood": { "$ref": "Array.String" },
+ "style": { "$ref": "Array.String" },
"type": { "type": "string" },
- "albumlabel": { "type": "string" },
- "artistid": { "$ref": "Library.Id" }
+ "albumlabel": { "type": "string" }
}
},
"Audio.Details.Song": {
@@ -387,7 +386,7 @@
"properties": {
"songid": { "$ref": "Library.Id", "required": true },
"file": { "type": "string" },
- "albumartist": { "type": "string" },
+ "albumartist": { "$ref": "Array.String" },
"album": { "type": "string" },
"track": { "type": "integer" },
"duration": { "type": "integer" },
@@ -396,7 +395,6 @@
"playcount": { "type": "integer" },
"musicbrainztrackid": { "type": "string" },
"musicbrainzartistid": { "type": "string" },
- "artistid": { "$ref": "Library.Id" },
"albumid": { "$ref": "Library.Id" },
"lastplayed": { "type": "string" },
"disc": { "type": "integer" }
@@ -409,9 +407,9 @@
"enum": [ "title", "genre", "year", "rating", "director", "trailer",
"tagline", "plot", "plotoutline", "originaltitle", "lastplayed",
"playcount", "writer", "studio", "mpaa", "cast", "country",
- "imdbnumber", "premiered", "productioncode", "runtime", "set",
- "showlink", "streamdetails", "top250", "votes", "fanart",
- "thumbnail", "file", "sorttitle", "resume", "setid", "dateadded" ]
+ "imdbnumber", "runtime", "set", "showlink", "streamdetails",
+ "top250", "votes", "fanart", "thumbnail", "file", "sorttitle",
+ "resume", "setid", "dateadded", "tag" ]
}
},
"Video.Fields.MovieSet": {
@@ -540,7 +538,7 @@
"extends": "Video.Details.Item",
"properties": {
"runtime": { "type": "string" },
- "director": { "type": "string" },
+ "director": { "$ref": "Array.String" },
"streamdetails": { "$ref": "Video.Streams" },
"resume": { "$ref": "Video.Resume" }
}
@@ -549,7 +547,7 @@
"extends": "Video.Details.File",
"properties": {
"movieid": { "$ref": "Library.Id", "required": true },
- "genre": { "type": "string" },
+ "genre": { "$ref": "Array.String" },
"year": { "type": "integer" },
"rating": { "type": "number" },
"trailer": { "type": "string" },
@@ -557,19 +555,18 @@
"plotoutline": { "type": "string" },
"originaltitle": { "type": "string" },
"sorttitle": { "type": "string" },
- "writer": { "type": "string" },
- "studio": { "type": "string" },
+ "writer": { "$ref": "Array.String" },
+ "studio": { "$ref": "Array.String" },
"mpaa": { "type": "string" },
"cast": { "$ref": "Video.Cast" },
- "country": { "type": "string" },
+ "country": { "$ref": "Array.String" },
"imdbnumber": { "type": "string" },
- "premiered": { "type": "string" },
- "productioncode": { "type": "string" },
"set": { "type": "string" },
- "showlink": { "type": "string" },
+ "showlink": { "$ref": "Array.String" },
"top250": { "type": "integer" },
"votes": { "type": "string" },
- "setid": { "$ref": "Library.Id" }
+ "setid": { "$ref": "Library.Id" },
+ "tag": { "$ref": "Array.String" }
}
},
"Video.Details.MovieSet": {
@@ -590,12 +587,12 @@
"extends": "Video.Details.Item",
"properties": {
"tvshowid": { "$ref": "Library.Id", "required": true },
- "genre": { "type": "string" },
+ "genre": { "$ref": "Array.String" },
"year": { "type": "integer" },
"rating": { "type": "number" },
"originaltitle": { "type": "string" },
"sorttitle": { "type": "string" },
- "studio": { "type": "string" },
+ "studio": { "$ref": "Array.String" },
"mpaa": { "type": "string" },
"cast": { "$ref": "Video.Cast" },
"episode": { "type": "integer" },
@@ -623,7 +620,7 @@
"episodeid": { "$ref": "Library.Id", "required": true },
"votes": { "type": "string" },
"rating": { "type": "number" },
- "writer": { "type": "string" },
+ "writer": { "$ref": "Array.String" },
"firstaired": { "type": "string" },
"productioncode": { "type": "string" },
"season": { "type": "integer" },
@@ -638,11 +635,11 @@
"extends": "Video.Details.File",
"properties": {
"musicvideoid": { "$ref": "Library.Id", "required": true },
- "studio": { "type": "string" },
+ "studio": { "$ref": "Array.String" },
"year": { "type": "integer" },
"album": { "type": "string" },
- "artist": { "type": "string" },
- "genre": { "type": "string" },
+ "artist": { "$ref": "Array.String" },
+ "genre": { "$ref": "Array.String" },
"track": { "type": "integer" }
}
},
@@ -697,7 +694,7 @@
"runtime", "set", "showlink", "streamdetails", "top250", "votes",
"firstaired", "season", "episode", "showtitle", "thumbnail", "file",
"resume", "artistid", "albumid", "tvshowid", "setid", "watchedepisodes",
- "disc" ]
+ "disc", "tag" ]
}
},
"List.Item.All": {
@@ -705,7 +702,7 @@
"properties": {
"id": { "$ref": "Library.Id" },
"type": { "type": "string", "enum": [ "unknown", "movie", "episode", "musicvideo", "song", "picture" ] },
- "albumartist": { "type": "string" },
+ "albumartist": { "$ref": "Array.String" },
"album": { "type": "string" },
"track": { "type": "integer" },
"duration": { "type": "integer" },
@@ -717,8 +714,8 @@
"tagline": { "type": "string" },
"plotoutline": { "type": "string" },
"originaltitle": { "type": "string" },
- "writer": { "type": "string" },
- "studio": { "type": "string" },
+ "writer": { "$ref": "Array.String" },
+ "studio": { "$ref": "Array.String" },
"mpaa": { "type": "string" },
"cast": { "$ref": "Video.Cast" },
"country": { "type": "string" },
@@ -726,19 +723,19 @@
"premiered": { "type": "string" },
"productioncode": { "type": "string" },
"set": { "type": "string" },
- "showlink": { "type": "string" },
+ "showlink": { "$ref": "Array.String" },
"top250": { "type": "integer" },
"votes": { "type": "string" },
"firstaired": { "type": "string" },
"season": { "type": "integer" },
"episode": { "type": "integer" },
"showtitle": { "type": "string" },
- "artistid": { "$ref": "Library.Id" },
"albumid": { "$ref": "Library.Id" },
"setid": { "$ref": "Library.Id" },
"tvshowid": { "$ref": "Library.Id" },
"watchedepisodes": { "type": "integer" },
- "disc": { "type": "integer" }
+ "disc": { "type": "integer" },
+ "tag": { "$ref": "Array.String" }
}
},
"List.Fields.Files": {
View
102 xbmc/music/MusicDatabase.cpp
@@ -2747,7 +2747,7 @@ bool CMusicDatabase::GetAlbumsByYear(const CStdString& strBaseDir, CFileItemList
return GetAlbumsByWhere(musicUrl.ToString(), filter, items);
}
-bool CMusicDatabase::GetArtistsNav(const CStdString& strBaseDir, CFileItemList& items, int idGenre, bool albumArtistsOnly)
+bool CMusicDatabase::GetArtistsNav(const CStdString& strBaseDir, CFileItemList& items, bool albumArtistsOnly /* = false */, int idGenre /* = -1 */, int idAlbum /* = -1 */, int idSong /* = -1 */)
{
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
@@ -2761,6 +2761,10 @@ bool CMusicDatabase::GetArtistsNav(const CStdString& strBaseDir, CFileItemList&
if (idGenre > 0)
musicUrl.AddOption("genreid", idGenre);
+ else if (idAlbum > 0)
+ musicUrl.AddOption("albumid", idAlbum);
+ else if (idSong > 0)
+ musicUrl.AddOption("songid", idSong);
musicUrl.AddOption("albumartistsonly", albumArtistsOnly);
@@ -5032,12 +5036,32 @@ bool CMusicDatabase::GetFilter(const CMusicDbUrl &musicUrl, Filter &filter)
if (type == "artists")
{
- int idGenre = -1;
+ int idGenre = -1, idAlbum = -1, idSong = -1;
bool albumArtistsOnly = false;
option = options.find("genreid");
if (option != options.end())
idGenre = (int)option->second.asInteger();
+ else
+ {
+ option = options.find("genre");
+ if (option != options.end())
+ idGenre = GetGenreByName(option->second.asString());
+ }
+
+ option = options.find("albumid");
+ if (option != options.end())
+ idAlbum = (int)option->second.asInteger();
+ else
+ {
+ option = options.find("album");
+ if (option != options.end())
+ idAlbum = GetAlbumByName(option->second.asString());
+ }
+
+ option = options.find("songid");
+ if (option != options.end())
+ idSong = (int)option->second.asInteger();
option = options.find("albumartistsonly");
if (option != options.end())
@@ -5045,36 +5069,38 @@ bool CMusicDatabase::GetFilter(const CMusicDbUrl &musicUrl, Filter &filter)
CStdString strSQL = "(idArtist IN ";
- if (idGenre <= 0)
+ if (idAlbum > 0)
+ strSQL += PrepareSQL("(SELECT album_artist.idArtist FROM album_artist WHERE album_artist.idAlbum = %i)", idAlbum);
+ else if (idSong > 0)
+ strSQL += PrepareSQL("(SELECT song_artist.idArtist FROM song_artist WHERE song_artist.idSong = %i)", idSong);
+ else if (idGenre > 0)
+ { // same statements as below, but limit to the specified genre
+ // in this case we show the whole lot always - there is no limitation to just album artists
+ if (!albumArtistsOnly) // show all artists in this case (ie those linked to a song)
+ strSQL+=PrepareSQL("(SELECT song_artist.idArtist FROM song_artist" // All artists linked to extra genres
+ " JOIN song_genre ON song_artist.idSong = song_genre.idSong"
+ " WHERE song_genre.idGenre = %i)"
+ " OR idArtist IN ", idGenre);
+ // and add any artists linked to an album (may be different from above due to album artist tag)
+ strSQL += PrepareSQL("(SELECT album_artist.idArtist FROM album_artist" // All album artists linked to extra genres
+ " JOIN album_genre ON album_artist.idAlbum = album_genre.idAlbum"
+ " WHERE album_genre.idGenre = %i)", idGenre);
+ }
+ else
{
if (!albumArtistsOnly) // show all artists in this case (ie those linked to a song)
- strSQL += "(SELECT song_artist.idArtist FROM song_artist) "
- "or idArtist IN ";
+ strSQL += "(SELECT song_artist.idArtist FROM song_artist)"
+ " OR idArtist IN ";
// and always show any artists linked to an album (may be different from above due to album artist tag)
- strSQL += "(SELECT album_artist.idArtist from album_artist"; // All artists linked to an album
+ strSQL += "(SELECT album_artist.idArtist FROM album_artist"; // All artists linked to an album
if (albumArtistsOnly)
strSQL += " WHERE album_artist.boolFeatured = 0"; // then exclude those that have no extra artists
- strSQL += ")"
- ") ";
- }
- else
- { // same statements as above, but limit to the specified genre
- // in this case we show the whole lot always - there is no limitation to just album artists
- if (!albumArtistsOnly) // show all artists in this case (ie those linked to a song)
- strSQL+=PrepareSQL("(SELECT song_artist.idArtist FROM song_artist " // All artists linked to extra genres
- "JOIN song_genre ON song_artist.idSong = song_genre.idSong "
- "WHERE song_genre.idGenre = %i) "
- "or idArtist IN ", idGenre);
- // and add any artists linked to an album (may be different from above due to album artist tag)
- strSQL += PrepareSQL("(SELECT album_artist.idArtist FROM album_artist " // All album artists linked to extra genres
- "JOIN album_genre ON album_artist.idAlbum = album_genre.idAlbum "
- "WHERE album_genre.idGenre = %i)"
- ")", idGenre);
+ strSQL += ")";
}
// remove the null string
- strSQL += " and strArtist != ''";
+ strSQL += ") and strArtist != ''";
// and the various artist entry if applicable
if (!albumArtistsOnly)
@@ -5100,14 +5126,26 @@ bool CMusicDatabase::GetFilter(const CMusicDbUrl &musicUrl, Filter &filter)
if (option != options.end())
filter.AppendWhere(PrepareSQL("idAlbum IN (SELECT song.idAlbum FROM song JOIN song_genre ON song.idSong = song_genre.idSong WHERE song_genre.idGenre = %i)", (int)option->second.asInteger()));
+ option = options.find("genre");
+ if (option != options.end())
+ filter.AppendWhere(PrepareSQL("idAlbum IN (SELECT song.idAlbum FROM song JOIN song_genre ON song.idSong = song_genre.idSong JOIN genre ON genre.idGenre = song_genre.idGenre WHERE genre.strGenre like '%s')", option->second.asString().c_str()));
+
option = options.find("artistid");
if (option != options.end())
filter.AppendWhere(PrepareSQL("idAlbum IN (SELECT song.idAlbum FROM song JOIN song_artist ON song.idSong = song_artist.idSong WHERE song_artist.idArtist = %i)" // All albums linked to this artist via songs
" OR idAlbum IN (SELECT album_artist.idAlbum FROM album_artist WHERE album_artist.idArtist = %i)", // All albums where album artists fit
(int)option->second.asInteger(), (int)option->second.asInteger()));
- // no artist given, so exclude any single albums (aka empty tagged albums)
else
- filter.AppendWhere("albumview.strAlbum <> ''");
+ {
+ option = options.find("artist");
+ if (option != options.end())
+ filter.AppendWhere(PrepareSQL("idAlbum IN (SELECT song.idAlbum FROM song JOIN song_artist ON song.idSong = song_artist.idSong JOIN artist ON artist.idArtist = song_artist.idArtist WHERE artist.strArtist like '%s')" // All albums linked to this artist via songs
+ " OR idAlbum IN (SELECT album_artist.idAlbum FROM album_artist JOIN artist ON artist.idArtist = album_artist.idArtist WHERE artist.strArtist like '%s')", // All albums where album artists fit
+ option->second.asString().c_str(), option->second.asString().c_str()));
+ // no artist given, so exclude any single albums (aka empty tagged albums)
+ else
+ filter.AppendWhere("albumview.strAlbum <> ''");
+ }
}
else if (type == "songs")
{
@@ -5122,16 +5160,30 @@ bool CMusicDatabase::GetFilter(const CMusicDbUrl &musicUrl, Filter &filter)
option = options.find("albumid");
if (option != options.end())
filter.AppendWhere(PrepareSQL("idAlbum = %i", (int)option->second.asInteger()));
+
+ option = options.find("album");
+ if (option != options.end())
+ filter.AppendWhere(PrepareSQL("strAlbum like '%s'", option->second.asString().c_str()));
option = options.find("genreid");
if (option != options.end())
filter.AppendWhere(PrepareSQL("idSong IN (SELECT song_genre.idSong FROM song_genre WHERE song_genre.idGenre = %i)", (int)option->second.asInteger()));
+ option = options.find("genre");
+ if (option != options.end())
+ filter.AppendWhere(PrepareSQL("idSong IN (SELECT song_genre.idSong FROM song_genre JOIN genre ON genre.idGenre = song_genre.idGenre WHERE genre.strGenre like '%s')", option->second.asString().c_str()));
+
option = options.find("artistid");
if (option != options.end())
filter.AppendWhere(PrepareSQL("idSong IN (SELECT song_artist.idSong FROM song_artist WHERE song_artist.idArtist = %i)" // song artists
" OR idSong IN (SELECT song.idSong FROM song JOIN album_artist ON song.idAlbum=album_artist.idAlbum WHERE album_artist.idArtist = %i)", // album artists
(int)option->second.asInteger(), (int)option->second.asInteger()));
+
+ option = options.find("artist");
+ if (option != options.end())
+ filter.AppendWhere(PrepareSQL("idSong IN (SELECT song_artist.idSong FROM song_artist JOIN artist ON artist.idArtist = song_artist.idArtist WHERE artist.strArtist like '%s')" // song artists
+ " OR idSong IN (SELECT song.idSong FROM song JOIN album_artist ON song.idAlbum=album_artist.idAlbum JOIN artist ON artist.idArtist = album_artist.idArtist WHERE artist.strArtist like '%s')", // album artists
+ option->second.asString().c_str(), option->second.asString().c_str()));
}
else
return false;
View
2  xbmc/music/MusicDatabase.h
@@ -152,7 +152,7 @@ class CMusicDatabase : public CDatabase
bool GetPathHash(const CStdString &path, CStdString &hash);
bool GetGenresNav(const CStdString& strBaseDir, CFileItemList& items);
bool GetYearsNav(const CStdString& strBaseDir, CFileItemList& items);
- bool GetArtistsNav(const CStdString& strBaseDir, CFileItemList& items, int idGenre, bool albumArtistsOnly);
+ bool GetArtistsNav(const CStdString& strBaseDir, CFileItemList& items, bool albumArtistsOnly = false, int idGenre = -1, int idAlbum = -1, int idSong = -1);
bool GetAlbumsNav(const CStdString& strBaseDir, CFileItemList& items, int idGenre = -1, int idArtist = -1, const SortDescription &sortDescription = SortDescription());
bool GetAlbumsByYear(const CStdString &strBaseDir, CFileItemList& items, int year);
bool GetSongsNav(const CStdString& strBaseDir, CFileItemList& items, int idGenre, int idArtist,int idAlbum, const SortDescription &sortDescription = SortDescription());
View
2  xbmc/music/infoscanner/MusicInfoScanner.cpp
@@ -289,7 +289,7 @@ void CMusicInfoScanner::FetchArtistInfo(const CStdString& strDirectory,
if (strDirectory.IsEmpty())
{
m_musicDatabase.Open();
- m_musicDatabase.GetArtistsNav("musicdb://2/",items,-1,false);
+ m_musicDatabase.GetArtistsNav("musicdb://2/", items, false, -1);
m_musicDatabase.Close();
}
else
View
9 xbmc/music/tags/MusicInfoTag.cpp
@@ -503,15 +503,12 @@ void CMusicInfoTag::SetSong(const CSong& song)
void CMusicInfoTag::Serialize(CVariant& value)