diff options
author | Sascha Montellese <sascha.montellese@gmail.com> | 2011-09-01 02:12:22 -0700 |
---|---|---|
committer | Sascha Montellese <sascha.montellese@gmail.com> | 2011-09-01 02:12:22 -0700 |
commit | 491764e6aa4f8a96ab7b8d3e8ef04651fd78949b (patch) | |
tree | ff49e278f4e2d6aa3fe5dba87700039e5ba01e91 | |
parent | 426c2316e51641365ca107b8feffec7dd31cd7f3 (diff) | |
parent | ade996b3d5805284785e325a5203c20108e72829 (diff) |
Merge pull request #389 from Montellese/jsonrpc_parentids
jsonrpc: adds some "parentid" fields (tvshowid, artistid, albumid, setid) to movie/episode/album/song information
-rw-r--r-- | xbmc/interfaces/json-rpc/ServiceDescription.h | 71 | ||||
-rw-r--r-- | xbmc/interfaces/json-rpc/VideoLibrary.cpp | 2 | ||||
-rw-r--r-- | xbmc/interfaces/json-rpc/types.json | 71 | ||||
-rw-r--r-- | xbmc/music/Album.h | 2 | ||||
-rw-r--r-- | xbmc/music/MusicDatabase.cpp | 5 | ||||
-rw-r--r-- | xbmc/music/Song.cpp | 6 | ||||
-rw-r--r-- | xbmc/music/Song.h | 2 | ||||
-rw-r--r-- | xbmc/music/tags/MusicInfoTag.cpp | 21 | ||||
-rw-r--r-- | xbmc/music/tags/MusicInfoTag.h | 4 | ||||
-rw-r--r-- | xbmc/video/VideoDatabase.cpp | 18 | ||||
-rw-r--r-- | xbmc/video/VideoInfoTag.cpp | 60 | ||||
-rw-r--r-- | xbmc/video/VideoInfoTag.h | 4 |
12 files changed, 205 insertions, 61 deletions
diff --git a/xbmc/interfaces/json-rpc/ServiceDescription.h b/xbmc/interfaces/json-rpc/ServiceDescription.h index 9701d81f21..14fbafa395 100644 --- a/xbmc/interfaces/json-rpc/ServiceDescription.h +++ b/xbmc/interfaces/json-rpc/ServiceDescription.h @@ -31,6 +31,14 @@ namespace JSONRPC "\"type\": [ \"null\", \"boolean\" ]," "\"default\": null" "}", + "\"Array.String\": {" + "\"type\": \"array\"," + "\"items\": { \"type\": \"string\" }" + "}", + "\"Array.Integer\": {" + "\"type\": \"array\"," + "\"items\": { \"type\": \"integer\" }" + "}", "\"Global.Time\": {" "\"type\": \"object\"," "\"properties\": {" @@ -120,7 +128,8 @@ namespace JSONRPC "\"enum\": [ \"title\", \"description\", \"artist\", \"genre\"," "\"theme\", \"mood\", \"style\", \"type\", \"label\"," "\"rating\", \"year\", \"musicbrainzalbumid\"," - "\"musicbrainzalbumartistid\", \"fanart\", \"thumbnail\" ]" + "\"musicbrainzalbumartistid\", \"fanart\", \"thumbnail\"," + "\"artistid\" ]" "}" "}", "\"Audio.Fields.Song\": {" @@ -131,7 +140,8 @@ namespace JSONRPC "\"rating\", \"album\", \"track\", \"duration\", \"comment\"," "\"lyrics\", \"musicbrainztrackid\", \"musicbrainzartistid\"," "\"musicbrainzalbumid\", \"musicbrainzalbumartistid\"," - "\"playcount\", \"fanart\", \"thumbnail\", \"file\" ]" + "\"playcount\", \"fanart\", \"thumbnail\", \"file\", \"artistid\"," + "\"albumid\" ]" "}" "}", "\"Audio.Details.Artist\": {" @@ -174,7 +184,8 @@ namespace JSONRPC "\"rating\": { \"type\": \"integer\" }," "\"year\": { \"type\": \"integer\" }," "\"musicbrainzalbumid\": { \"type\": \"string\" }," - "\"musicbrainzalbumartistid\": { \"type\": \"string\" }" + "\"musicbrainzalbumartistid\": { \"type\": \"string\" }," + "\"artistid\": { \"$ref\": \"Library.Id\" }" "}" "}", "\"Audio.Details.Song\": {" @@ -200,7 +211,9 @@ namespace JSONRPC "\"musicbrainztrackid\": { \"type\": \"string\" }," "\"musicbrainzartistid\": { \"type\": \"string\" }," "\"musicbrainzalbumid\": { \"type\": \"string\" }," - "\"musicbrainzalbumartistid\": { \"type\": \"string\" }" + "\"musicbrainzalbumartistid\": { \"type\": \"string\" }," + "\"artistid\": { \"$ref\": \"Library.Id\" }," + "\"albumid\": { \"$ref\": \"Library.Id\" }" "}" "}", "\"Video.Fields.Movie\": {" @@ -212,8 +225,8 @@ namespace JSONRPC "\"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\" ]" + "\"showlink\", \"streamDetails\", \"top250\", \"votes\", \"fanart\"," + "\"thumbnail\", \"file\", \"sorttitle\", \"resume\", \"setid\" ]" "}" "}", "\"Video.Fields.MovieSet\": {" @@ -239,7 +252,7 @@ namespace JSONRPC "\"type\": \"array\"," "\"uniqueItems\": true," "\"items\": { \"type\": \"string\"," - "\"enum\": [ \"season\", \"showtitle\", \"playcount\", \"episode\", \"fanart\", \"thumbnail\" ]" + "\"enum\": [ \"season\", \"showtitle\", \"playcount\", \"episode\", \"fanart\", \"thumbnail\", \"tvshowid\" ]" "}" "}", "\"Video.Fields.Episode\": {" @@ -251,7 +264,7 @@ namespace JSONRPC "\"firstaired\", \"playcount\", \"runtime\", \"director\"," "\"productioncode\", \"season\", \"episode\", \"originaltitle\"," "\"showtitle\", \"cast\", \"streamDetails\", \"lastplayed\", \"fanart\"," - "\"thumbnail\", \"file\", \"resume\" ]" + "\"thumbnail\", \"file\", \"resume\", \"tvshowid\" ]" "}" "}", "\"Video.Fields.MusicVideo\": {" @@ -344,12 +357,13 @@ namespace JSONRPC "\"premiered\": { \"type\": \"string\" }," "\"productioncode\": { \"type\": \"string\" }," "\"runtime\": { \"type\": \"string\" }," - "\"set\": { \"type\": \"string\" }," + "\"set\": { \"$ref\": \"Array.String\" }," "\"showlink\": { \"type\": \"string\" }," "\"streamDetails\": { \"$ref\": \"Video.Streams\" }," "\"top250\": { \"type\": \"integer\" }," "\"votes\": { \"type\": \"string\" }," - "\"resume\": { \"$ref\": \"Video.Resume\" }" + "\"resume\": { \"$ref\": \"Video.Resume\" }," + "\"setid\": { \"$ref\": \"Array.Integer\" }" "}" "}", "\"Video.Details.MovieSet\": {" @@ -413,7 +427,8 @@ namespace JSONRPC "\"thumbnail\": { \"type\": \"string\" }," "\"showtitle\": { \"type\": \"string\" }," "\"playcount\": { \"type\": \"integer\" }," - "\"episode\": { \"type\": \"integer\" }" + "\"episode\": { \"type\": \"integer\" }," + "\"tvshowid\": { \"$ref\": \"Library.Id\" }" "}" "}", "\"Video.Details.Episode\": {" @@ -441,7 +456,8 @@ namespace JSONRPC "\"cast\": { \"$ref\": \"Video.Cast\" }," "\"streamDetails\": { \"$ref\": \"Video.Streams\" }," "\"lastplayed\": { \"type\": \"string\" }," - "\"resume\": { \"$ref\": \"Video.Resume\" }" + "\"resume\": { \"$ref\": \"Video.Resume\" }," + "\"tvshowid\": { \"$ref\": \"Library.Id\" }" "}" "}", "\"Video.Details.MusicVideo\": {" @@ -565,7 +581,8 @@ namespace JSONRPC "\"plotoutline\", \"originaltitle\", \"lastplayed\", \"writer\", \"studio\"," "\"mpaa\", \"cast\", \"country\", \"imdbnumber\", \"premiered\", \"productioncode\"," "\"runtime\", \"set\", \"showlink\", \"streamDetails\", \"top250\", \"votes\"," - "\"firstaired\", \"season\", \"episode\", \"showtitle\", \"thumbnail\", \"file\", \"resume\" ]" + "\"firstaired\", \"season\", \"episode\", \"showtitle\", \"thumbnail\", \"file\"," + "\"resume\", \"artistid\", \"albumid\", \"tvshowid\", \"setid\" ]" "}" "}", "\"List.Fields.Video\": {" @@ -577,8 +594,8 @@ namespace JSONRPC "\"plotoutline\", \"originaltitle\", \"lastplayed\", \"writer\", \"studio\"," "\"mpaa\", \"country\", \"imdbnumber\", \"premiered\", \"productioncode\"," "\"runtime\", \"showlink\", \"streamDetails\", \"top250\", \"votes\"," - "\"firstaired\", \"season\", \"episode\", \"showtitle\"," - "\"thumbnail\", \"file\", \"sorttitle\", \"episodeguide\", \"resume\" ]" + "\"firstaired\", \"season\", \"episode\", \"showtitle\", \"thumbnail\"," + "\"file\", \"sorttitle\", \"episodeguide\", \"resume\", \"tvshowid\", \"setid\" ]" "}" "}", "\"List.Items.All\": {" @@ -623,7 +640,7 @@ namespace JSONRPC "\"premiered\": { \"type\": \"string\" }," "\"productioncode\": { \"type\": \"string\" }," "\"runtime\": { \"type\": \"string\" }," - "\"set\": { \"type\": \"string\" }," + "\"set\": { \"$ref\": \"Array.String\" }," "\"showlink\": { \"type\": \"string\" }," "\"streamDetails\": { \"$ref\": \"Video.Streams\" }," "\"top250\": { \"type\": \"integer\" }," @@ -632,7 +649,11 @@ namespace JSONRPC "\"season\": { \"type\": \"integer\" }," "\"episode\": { \"type\": \"integer\" }," "\"showtitle\": { \"type\": \"string\" }," - "\"resume\": { \"$ref\": \"Video.Resume\" }" + "\"resume\": { \"$ref\": \"Video.Resume\" }," + "\"artistid\": { \"$ref\": \"Library.Id\" }," + "\"albumid\": { \"$ref\": \"Library.Id\" }," + "\"setid\": { \"$ref\": \"Array.Integer\" }," + "\"tvshowid\": { \"$ref\": \"Library.Id\" }" "}" "}" "}", @@ -678,7 +699,9 @@ namespace JSONRPC "\"season\": { \"type\": \"integer\" }," "\"episode\": { \"type\": \"integer\" }," "\"episodeguide\": { \"type\": \"string\" }," - "\"showtitle\": { \"type\": \"string\" }" + "\"showtitle\": { \"type\": \"string\" }," + "\"setid\": { \"type\": \"string\", \"description\": \"Comma-separated list of sets\" }," + "\"tvshowid\": { \"$ref\": \"Library.Id\" }" "}" "}" "}", @@ -707,7 +730,9 @@ namespace JSONRPC "\"musicbrainztrackid\": { \"type\": \"string\" }," "\"musicbrainzartistid\": { \"type\": \"string\" }," "\"musicbrainzalbumid\": { \"type\": \"string\" }," - "\"musicbrainzalbumartistid\": { \"type\": \"string\" }" + "\"musicbrainzalbumartistid\": { \"type\": \"string\" }," + "\"artistid\": { \"$ref\": \"Library.Id\" }," + "\"albumid\": { \"$ref\": \"Library.Id\" }" "}" "}" "}", @@ -764,7 +789,7 @@ namespace JSONRPC "\"premiered\": { \"type\": \"string\" }," "\"productioncode\": { \"type\": \"string\" }," "\"runtime\": { \"type\": \"string\" }," - "\"set\": { \"type\": \"string\" }," + "\"set\": { \"$ref\": \"Array.String\" }," "\"showlink\": { \"type\": \"string\" }," "\"streamDetails\": { \"$ref\": \"Video.Streams\" }," "\"top250\": { \"type\": \"integer\" }," @@ -773,7 +798,11 @@ namespace JSONRPC "\"season\": { \"type\": \"integer\" }," "\"episode\": { \"type\": \"integer\" }," "\"showtitle\": { \"type\": \"string\" }," - "\"resume\": { \"$ref\": \"Video.Resume\" }" + "\"resume\": { \"$ref\": \"Video.Resume\" }," + "\"artistid\": { \"$ref\": \"Library.Id\" }," + "\"albumid\": { \"$ref\": \"Library.Id\" }," + "\"setid\": { \"$ref\": \"Array.Integer\" }," + "\"tvshowid\": { \"$ref\": \"Library.Id\" }" "}" "}" "}" diff --git a/xbmc/interfaces/json-rpc/VideoLibrary.cpp b/xbmc/interfaces/json-rpc/VideoLibrary.cpp index 10d107cd71..9dfe2b4009 100644 --- a/xbmc/interfaces/json-rpc/VideoLibrary.cpp +++ b/xbmc/interfaces/json-rpc/VideoLibrary.cpp @@ -450,7 +450,7 @@ JSON_STATUS CVideoLibrary::GetAdditionalMovieDetails(const CVariant ¶meterOb for (CVariant::const_iterator_array itr = parameterObject["fields"].begin_array(); itr != parameterObject["fields"].end_array(); itr++) { CStdString fieldValue = itr->asString(); - if (fieldValue == "cast" || fieldValue == "set" || fieldValue == "showlink" || fieldValue == "resume") + if (fieldValue == "cast" || fieldValue == "set" || fieldValue == "setid" || fieldValue == "showlink" || fieldValue == "resume") additionalInfo = true; } diff --git a/xbmc/interfaces/json-rpc/types.json b/xbmc/interfaces/json-rpc/types.json index e8bb04badf..ef19977fdf 100644 --- a/xbmc/interfaces/json-rpc/types.json +++ b/xbmc/interfaces/json-rpc/types.json @@ -3,6 +3,14 @@ "type": [ "null", "boolean" ], "default": null }, + "Array.String": { + "type": "array", + "items": { "type": "string" } + }, + "Array.Integer": { + "type": "array", + "items": { "type": "integer" } + }, "Global.Time": { "type": "object", "properties": { @@ -92,7 +100,8 @@ "enum": [ "title", "description", "artist", "genre", "theme", "mood", "style", "type", "label", "rating", "year", "musicbrainzalbumid", - "musicbrainzalbumartistid", "fanart", "thumbnail" ] + "musicbrainzalbumartistid", "fanart", "thumbnail", + "artistid" ] } }, "Audio.Fields.Song": { @@ -103,7 +112,8 @@ "rating", "album", "track", "duration", "comment", "lyrics", "musicbrainztrackid", "musicbrainzartistid", "musicbrainzalbumid", "musicbrainzalbumartistid", - "playcount", "fanart", "thumbnail", "file" ] + "playcount", "fanart", "thumbnail", "file", "artistid", + "albumid" ] } }, "Audio.Details.Artist": { @@ -146,7 +156,8 @@ "rating": { "type": "integer" }, "year": { "type": "integer" }, "musicbrainzalbumid": { "type": "string" }, - "musicbrainzalbumartistid": { "type": "string" } + "musicbrainzalbumartistid": { "type": "string" }, + "artistid": { "$ref": "Library.Id" } } }, "Audio.Details.Song": { @@ -172,7 +183,9 @@ "musicbrainztrackid": { "type": "string" }, "musicbrainzartistid": { "type": "string" }, "musicbrainzalbumid": { "type": "string" }, - "musicbrainzalbumartistid": { "type": "string" } + "musicbrainzalbumartistid": { "type": "string" }, + "artistid": { "$ref": "Library.Id" }, + "albumid": { "$ref": "Library.Id" } } }, "Video.Fields.Movie": { @@ -184,8 +197,8 @@ "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" ] + "showlink", "streamDetails", "top250", "votes", "fanart", + "thumbnail", "file", "sorttitle", "resume", "setid" ] } }, "Video.Fields.MovieSet": { @@ -211,7 +224,7 @@ "type": "array", "uniqueItems": true, "items": { "type": "string", - "enum": [ "season", "showtitle", "playcount", "episode", "fanart", "thumbnail" ] + "enum": [ "season", "showtitle", "playcount", "episode", "fanart", "thumbnail", "tvshowid" ] } }, "Video.Fields.Episode": { @@ -223,7 +236,7 @@ "firstaired", "playcount", "runtime", "director", "productioncode", "season", "episode", "originaltitle", "showtitle", "cast", "streamDetails", "lastplayed", "fanart", - "thumbnail", "file", "resume" ] + "thumbnail", "file", "resume", "tvshowid" ] } }, "Video.Fields.MusicVideo": { @@ -316,12 +329,13 @@ "premiered": { "type": "string" }, "productioncode": { "type": "string" }, "runtime": { "type": "string" }, - "set": { "type": "string" }, + "set": { "$ref": "Array.String" }, "showlink": { "type": "string" }, "streamDetails": { "$ref": "Video.Streams" }, "top250": { "type": "integer" }, "votes": { "type": "string" }, - "resume": { "$ref": "Video.Resume" } + "resume": { "$ref": "Video.Resume" }, + "setid": { "$ref": "Array.Integer" } } }, "Video.Details.MovieSet": { @@ -385,7 +399,8 @@ "thumbnail": { "type": "string" }, "showtitle": { "type": "string" }, "playcount": { "type": "integer" }, - "episode": { "type": "integer" } + "episode": { "type": "integer" }, + "tvshowid": { "$ref": "Library.Id" } } }, "Video.Details.Episode": { @@ -413,7 +428,8 @@ "cast": { "$ref": "Video.Cast" }, "streamDetails": { "$ref": "Video.Streams" }, "lastplayed": { "type": "string" }, - "resume": { "$ref": "Video.Resume" } + "resume": { "$ref": "Video.Resume" }, + "tvshowid": { "$ref": "Library.Id" } } }, "Video.Details.MusicVideo": { @@ -537,7 +553,8 @@ "plotoutline", "originaltitle", "lastplayed", "writer", "studio", "mpaa", "cast", "country", "imdbnumber", "premiered", "productioncode", "runtime", "set", "showlink", "streamDetails", "top250", "votes", - "firstaired", "season", "episode", "showtitle", "thumbnail", "file", "resume" ] + "firstaired", "season", "episode", "showtitle", "thumbnail", "file", + "resume", "artistid", "albumid", "tvshowid", "setid" ] } }, "List.Fields.Video": { @@ -549,8 +566,8 @@ "plotoutline", "originaltitle", "lastplayed", "writer", "studio", "mpaa", "country", "imdbnumber", "premiered", "productioncode", "runtime", "showlink", "streamDetails", "top250", "votes", - "firstaired", "season", "episode", "showtitle", - "thumbnail", "file", "sorttitle", "episodeguide", "resume" ] + "firstaired", "season", "episode", "showtitle", "thumbnail", + "file", "sorttitle", "episodeguide", "resume", "tvshowid", "setid" ] } }, "List.Items.All": { @@ -595,7 +612,7 @@ "premiered": { "type": "string" }, "productioncode": { "type": "string" }, "runtime": { "type": "string" }, - "set": { "type": "string" }, + "set": { "$ref": "Array.String" }, "showlink": { "type": "string" }, "streamDetails": { "$ref": "Video.Streams" }, "top250": { "type": "integer" }, @@ -604,7 +621,11 @@ "season": { "type": "integer" }, "episode": { "type": "integer" }, "showtitle": { "type": "string" }, - "resume": { "$ref": "Video.Resume" } + "resume": { "$ref": "Video.Resume" }, + "artistid": { "$ref": "Library.Id" }, + "albumid": { "$ref": "Library.Id" }, + "setid": { "$ref": "Array.Integer" }, + "tvshowid": { "$ref": "Library.Id" } } } }, @@ -650,7 +671,9 @@ "season": { "type": "integer" }, "episode": { "type": "integer" }, "episodeguide": { "type": "string" }, - "showtitle": { "type": "string" } + "showtitle": { "type": "string" }, + "setid": { "type": "string", "description": "Comma-separated list of sets" }, + "tvshowid": { "$ref": "Library.Id" } } } }, @@ -679,7 +702,9 @@ "musicbrainztrackid": { "type": "string" }, "musicbrainzartistid": { "type": "string" }, "musicbrainzalbumid": { "type": "string" }, - "musicbrainzalbumartistid": { "type": "string" } + "musicbrainzalbumartistid": { "type": "string" }, + "artistid": { "$ref": "Library.Id" }, + "albumid": { "$ref": "Library.Id" } } } }, @@ -736,7 +761,7 @@ "premiered": { "type": "string" }, "productioncode": { "type": "string" }, "runtime": { "type": "string" }, - "set": { "type": "string" }, + "set": { "$ref": "Array.String" }, "showlink": { "type": "string" }, "streamDetails": { "$ref": "Video.Streams" }, "top250": { "type": "integer" }, @@ -745,7 +770,11 @@ "season": { "type": "integer" }, "episode": { "type": "integer" }, "showtitle": { "type": "string" }, - "resume": { "$ref": "Video.Resume" } + "resume": { "$ref": "Video.Resume" }, + "artistid": { "$ref": "Library.Id" }, + "albumid": { "$ref": "Library.Id" }, + "setid": { "$ref": "Array.Integer" }, + "tvshowid": { "$ref": "Library.Id" } } } } diff --git a/xbmc/music/Album.h b/xbmc/music/Album.h index 157fa76e98..b51b3fada3 100644 --- a/xbmc/music/Album.h +++ b/xbmc/music/Album.h @@ -58,6 +58,7 @@ public: m_strDateOfRelease.Empty(); iRating=-1; iYear=-1; + idArtist = -1; songs.clear(); } @@ -78,6 +79,7 @@ public: CStdString m_strDateOfRelease; int iRating; int iYear; + int idArtist; VECSONGS songs; }; diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp index 3fe7cafb4a..dddf7a7e14 100644 --- a/xbmc/music/MusicDatabase.cpp +++ b/xbmc/music/MusicDatabase.cpp @@ -680,11 +680,13 @@ CSong CMusicDatabase::GetSongFromDataset(bool bWithMusicDbPath/*=false*/) // get the full artist string song.strArtist = m_pDS->fv(song_strArtist).get_asString(); song.strArtist += m_pDS->fv(song_strExtraArtists).get_asString(); + song.iArtistId = m_pDS->fv(song_idArtist).get_asInt(); // and the full genre string song.strGenre = m_pDS->fv(song_strGenre).get_asString(); song.strGenre += m_pDS->fv(song_strExtraGenres).get_asString(); // and the rest... song.strAlbum = m_pDS->fv(song_strAlbum).get_asString(); + song.iAlbumId = m_pDS->fv(song_idAlbum).get_asInt(); song.iTrack = m_pDS->fv(song_iTrack).get_asInt() ; song.iDuration = m_pDS->fv(song_iDuration).get_asInt() ; song.iYear = m_pDS->fv(song_iYear).get_asInt() ; @@ -726,12 +728,14 @@ void CMusicDatabase::GetFileItemFromDataset(CFileItem* item, const CStdString& s CStdString strArtist=m_pDS->fv(song_strArtist).get_asString(); strArtist += m_pDS->fv(song_strExtraArtists).get_asString(); item->GetMusicInfoTag()->SetArtist(strArtist); + item->GetMusicInfoTag()->SetArtistId(m_pDS->fv(song_idArtist).get_asInt()); // and the full genre string CStdString strGenre = m_pDS->fv(song_strGenre).get_asString(); strGenre += m_pDS->fv(song_strExtraGenres).get_asString(); item->GetMusicInfoTag()->SetGenre(strGenre); // and the rest... item->GetMusicInfoTag()->SetAlbum(m_pDS->fv(song_strAlbum).get_asString()); + item->GetMusicInfoTag()->SetAlbumId(m_pDS->fv(song_idAlbum).get_asInt()); item->GetMusicInfoTag()->SetTrackAndDiskNumber(m_pDS->fv(song_iTrack).get_asInt()); item->GetMusicInfoTag()->SetDuration(m_pDS->fv(song_iDuration).get_asInt()); item->GetMusicInfoTag()->SetDatabaseId(m_pDS->fv(song_idSong).get_asInt()); @@ -781,6 +785,7 @@ CAlbum CMusicDatabase::GetAlbumFromDataset(dbiplus::Dataset* pDS, bool imageURL album.strAlbum = g_localizeStrings.Get(1050); album.strArtist = pDS->fv(album_strArtist).get_asString(); album.strArtist += pDS->fv(album_strExtraArtists).get_asString(); + album.idArtist = pDS->fv(album_idArtist).get_asInt(); album.strGenre = pDS->fv(album_strGenre).get_asString(); album.strGenre += pDS->fv(album_strExtraGenres).get_asString(); album.iYear = pDS->fv(album_iYear).get_asInt(); diff --git a/xbmc/music/Song.cpp b/xbmc/music/Song.cpp index 6b4e19c7d1..cf48a0419b 100644 --- a/xbmc/music/Song.cpp +++ b/xbmc/music/Song.cpp @@ -53,6 +53,8 @@ CSong::CSong(CMusicInfoTag& tag) iTimesPlayed = 0; iKaraokeNumber = 0; iKaraokeDelay = 0; //! Karaoke song lyrics-music delay in 1/10 seconds. + iArtistId = -1; + iAlbumId = -1; } CSong::CSong() @@ -80,6 +82,8 @@ void CSong::Serialize(CVariant& value) value["rating"] = rating; value["timesplayed"] = iTimesPlayed; value["karaokenumber"] = (int64_t) iKaraokeNumber; + value["artistid"] = iArtistId; + value["albumid"] = iAlbumId; } void CSong::Clear() @@ -109,6 +113,8 @@ void CSong::Clear() iKaraokeNumber = 0; strKaraokeLyrEncoding.Empty(); iKaraokeDelay = 0; + iArtistId = -1; + iAlbumId = -1; } CSongMap::CSongMap() diff --git a/xbmc/music/Song.h b/xbmc/music/Song.h index ba7cb997cc..2506f0bd92 100644 --- a/xbmc/music/Song.h +++ b/xbmc/music/Song.h @@ -92,6 +92,8 @@ public: CStdString lastPlayed; int iStartOffset; int iEndOffset; + int iArtistId; + int iAlbumId; // Karaoke-specific information long iKaraokeNumber; //! Karaoke song number to "select by number". 0 for non-karaoke diff --git a/xbmc/music/tags/MusicInfoTag.cpp b/xbmc/music/tags/MusicInfoTag.cpp index 0c24fc44da..eec4f39b7a 100644 --- a/xbmc/music/tags/MusicInfoTag.cpp +++ b/xbmc/music/tags/MusicInfoTag.cpp @@ -199,11 +199,21 @@ void CMusicInfoTag::SetArtist(const CStdString& strArtist) m_strArtist = Trim(strArtist); } +void CMusicInfoTag::SetArtistId(const int iArtistId) +{ + m_iArtistId = iArtistId; +} + void CMusicInfoTag::SetAlbum(const CStdString& strAlbum) { m_strAlbum = Trim(strAlbum); } +void CMusicInfoTag::SetAlbumId(const int iAlbumId) +{ + m_iAlbumId = iAlbumId; +} + void CMusicInfoTag::SetAlbumArtist(const CStdString& strAlbumArtist) { m_strAlbumArtist = Trim(strAlbumArtist); @@ -352,6 +362,7 @@ void CMusicInfoTag::SetAlbum(const CAlbum& album) SetReleaseDate(stTime); m_iDbId = album.idAlbum; m_bLoaded = true; + m_iArtistId = album.idArtist; } void CMusicInfoTag::SetSong(const CSong& song) @@ -379,6 +390,8 @@ void CMusicInfoTag::SetSong(const CSong& song) m_iDbId = song.idSong; m_bLoaded = true; m_iTimesPlayed = song.iTimesPlayed; + m_iArtistId = song.iArtistId; + m_iAlbumId = song.iAlbumId; } void CMusicInfoTag::Serialize(CVariant& value) @@ -402,6 +415,8 @@ void CMusicInfoTag::Serialize(CVariant& value) value["rating"] = m_rating; value["playcount"] = m_iTimesPlayed; value["lyrics"] = m_strLyrics; + value["artistid"] = m_iArtistId; + value["albumid"] = m_iAlbumId; } void CMusicInfoTag::Archive(CArchive& ar) { @@ -426,6 +441,8 @@ void CMusicInfoTag::Archive(CArchive& ar) ar << m_strComment; ar << m_rating; ar << m_iTimesPlayed; + ar << m_iArtistId; + ar << m_iAlbumId; } else { @@ -448,6 +465,8 @@ void CMusicInfoTag::Archive(CArchive& ar) ar >> m_strComment; ar >> m_rating; ar >> m_iTimesPlayed; + ar >> m_iArtistId; + ar >> m_iAlbumId; } } @@ -473,6 +492,8 @@ void CMusicInfoTag::Clear() m_iDbId = -1; m_iTimesPlayed = 0; memset(&m_dwReleaseDate, 0, sizeof(m_dwReleaseDate) ); + m_iArtistId = -1; + m_iAlbumId = -1; } void CMusicInfoTag::AppendArtist(const CStdString &artist) diff --git a/xbmc/music/tags/MusicInfoTag.h b/xbmc/music/tags/MusicInfoTag.h index ec79ab167b..54eb76b819 100644 --- a/xbmc/music/tags/MusicInfoTag.h +++ b/xbmc/music/tags/MusicInfoTag.h @@ -69,7 +69,9 @@ public: void SetURL(const CStdString& strURL); void SetTitle(const CStdString& strTitle); void SetArtist(const CStdString& strArtist); + void SetArtistId(const int iArtistId); void SetAlbum(const CStdString& strAlbum); + void SetAlbumId(const int iAlbumId); void SetAlbumArtist(const CStdString& strAlbumArtist); void SetGenre(const CStdString& strGenre); void SetYear(int year); @@ -144,6 +146,8 @@ protected: char m_rating; int m_listeners; int m_iTimesPlayed; + int m_iArtistId; + int m_iAlbumId; SYSTEMTIME m_dwReleaseDate; }; } diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index aaa35e689f..3419eb909e 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -1750,13 +1750,11 @@ int CVideoDatabase::SetDetailsForMovie(const CStdString& strFilenameAndPath, con } // add sets... - if (!info.m_strSet.IsEmpty()) + if (info.m_set.size() > 0) { - CStdStringArray sets; - StringUtils::SplitString(info.m_strSet, g_advancedSettings.m_videoItemSeparator, sets); - for (unsigned int i = 0; i < sets.size(); i++) + for (unsigned int i = 0; i < info.m_set.size(); i++) { - CStdString set(sets[i]); + CStdString set(info.m_set[i]); set.Trim(); int idSet = AddSet(set); AddSetToMovie(idMovie, idSet); @@ -2817,14 +2815,13 @@ CVideoInfoTag CVideoDatabase::GetDetailsForMovie(auto_ptr<Dataset> &pDS, bool ne details.m_strPictureURL.Parse(); // create sets string - strSQL = PrepareSQL("SELECT sets.strSet FROM sets,setlinkmovie WHERE setlinkmovie.idMovie=%i AND setlinkmovie.idSet=sets.idSet ORDER BY sets.idSet",idMovie); + strSQL = PrepareSQL("SELECT sets.idSet, sets.strSet FROM sets,setlinkmovie WHERE setlinkmovie.idMovie=%i AND setlinkmovie.idSet=sets.idSet ORDER BY sets.idSet",idMovie); m_pDS2->query(strSQL.c_str()); while (!m_pDS2->eof()) { - CStdString setName = m_pDS2->fv("sets.strSet").get_asString(); - if (!details.m_strSet.IsEmpty()) - details.m_strSet += g_advancedSettings.m_videoItemSeparator; - details.m_strSet += setName; + details.m_set.push_back(m_pDS2->fv("sets.strSet").get_asString()); + details.m_setId.push_back(m_pDS2->fv("sets.idSet").get_asInt()); + m_pDS2->next(); } @@ -2902,6 +2899,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsForEpisode(auto_ptr<Dataset> &pDS, bool details.m_strShowTitle = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_NAME).get_asString(); details.m_strStudio = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_STUDIO).get_asString(); details.m_strPremiered = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_AIRED).get_asString(); + details.m_iIdShow = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_ID).get_asInt(); GetStreamDetails(details); diff --git a/xbmc/video/VideoInfoTag.cpp b/xbmc/video/VideoInfoTag.cpp index dc2018b03d..126231a232 100644 --- a/xbmc/video/VideoInfoTag.cpp +++ b/xbmc/video/VideoInfoTag.cpp @@ -50,7 +50,8 @@ void CVideoInfoTag::Reset() m_strSortTitle = ""; m_strVotes = ""; m_cast.clear(); - m_strSet = ""; + m_set.clear(); + m_setId.clear(); m_strFile = ""; m_strPath = ""; m_strIMDBNumber = ""; @@ -85,6 +86,7 @@ void CVideoInfoTag::Reset() m_parentPathID = -1; m_resumePoint.Reset(); m_resumePoint.type = CBookmark::RESUME; + m_iIdShow = -1; } bool CVideoInfoTag::Save(TiXmlNode *node, const CStdString &tag, bool savePathInfo) @@ -167,8 +169,8 @@ bool CVideoInfoTag::Save(TiXmlNode *node, const CStdString &tag, bool savePathIn g_advancedSettings.m_videoItemSeparator, m_strGenre); XMLUtils::SetAdditiveString(movie, "country", g_advancedSettings.m_videoItemSeparator, m_strCountry); - XMLUtils::SetAdditiveString(movie, "set", - g_advancedSettings.m_videoItemSeparator, m_strSet); + for (unsigned int i = 0; i < m_set.size(); i++) + XMLUtils::SetString(movie, "set", m_set[i]); XMLUtils::SetAdditiveString(movie, "credits", g_advancedSettings.m_videoItemSeparator, m_strWritingCredits); XMLUtils::SetAdditiveString(movie, "director", @@ -285,7 +287,14 @@ void CVideoInfoTag::Archive(CArchive& ar) ar << m_cast[i].thumbUrl.m_xml; } - ar << m_strSet; + ar << (int)m_set.size(); + for (unsigned int i=0;i<m_set.size();++i) + ar << (CStdString)m_set[i]; + + ar << (int)m_setId.size(); + for (unsigned int i=0;i<m_setId.size();++i) + ar << m_setId[i]; + ar << m_strRuntime; ar << m_strFile; ar << m_strPath; @@ -321,6 +330,7 @@ void CVideoInfoTag::Archive(CArchive& ar) ar << m_parentPathID; ar << m_resumePoint.timeInSeconds; ar << m_resumePoint.totalTimeInSeconds; + ar << m_iIdShow; } else { @@ -354,7 +364,25 @@ void CVideoInfoTag::Archive(CArchive& ar) m_cast.push_back(info); } - ar >> m_strSet; + m_set.clear(); + int iSetSize; + ar >> iSetSize; + for (int i=0;i<iSetSize;++i) + { + CStdString strSet; + ar >> strSet; + m_set.push_back(strSet); + } + + m_setId.clear(); + ar >> iSetSize; + for (int i=0;i<iSetSize;++i) + { + int iSetId; + ar >> iSetId; + m_setId.push_back(iSetId); + } + ar >> m_strRuntime; ar >> m_strFile; ar >> m_strPath; @@ -390,6 +418,7 @@ void CVideoInfoTag::Archive(CArchive& ar) ar >> m_parentPathID; ar >> m_resumePoint.timeInSeconds; ar >> m_resumePoint.totalTimeInSeconds; + ar >> m_iIdShow; } } @@ -417,7 +446,12 @@ void CVideoInfoTag::Serialize(CVariant& value) actor["thumbnail"] = thumb; value["cast"].push_back(actor); } - value["set"] = m_strSet; + value["set"] = CVariant(CVariant::VariantTypeArray); + for (unsigned int i = 0; i < m_set.size(); i++) + value["set"].push_back(m_set[i]); + value["setid"] = CVariant(CVariant::VariantTypeArray); + for (unsigned int i = 0; i < m_setId.size(); i++) + value["setid"].push_back(m_setId[i]); value["runtime"] = m_strRuntime; value["file"] = m_strFile; value["path"] = m_strPath; @@ -450,6 +484,7 @@ void CVideoInfoTag::Serialize(CVariant& value) resume["position"] = (float)m_resumePoint.timeInSeconds; resume["total"] = (float)m_resumePoint.totalTimeInSeconds; value["resume"] = resume; + value["tvshowid"] = m_iIdShow; } const CStdString CVideoInfoTag::GetCast(bool bIncludeRole /*= false*/) const @@ -553,7 +588,18 @@ void CVideoInfoTag::ParseNative(const TiXmlElement* movie) } node = node->NextSiblingElement("actor"); } - XMLUtils::GetAdditiveString(movie,"set",g_advancedSettings.m_videoItemSeparator,m_strSet); + + m_set.clear(); + m_setId.clear(); + node = movie->FirstChildElement("set"); + while (node) + { + if (node->FirstChild()) + m_set.push_back(node->FirstChild()->Value()); + + node = node->NextSiblingElement("set"); + } + XMLUtils::GetAdditiveString(movie,"studio",g_advancedSettings.m_videoItemSeparator,m_strStudio); // artists node = movie->FirstChildElement("artist"); diff --git a/xbmc/video/VideoInfoTag.h b/xbmc/video/VideoInfoTag.h index 52926eda6c..81e0a16889 100644 --- a/xbmc/video/VideoInfoTag.h +++ b/xbmc/video/VideoInfoTag.h @@ -68,7 +68,8 @@ public: CStdString m_strArtist; std::vector< SActorInfo > m_cast; typedef std::vector< SActorInfo >::const_iterator iCast; - CStdString m_strSet; + std::vector<std::string> m_set; + std::vector<int> m_setId; CStdString m_strRuntime; CStdString m_strFile; CStdString m_strPath; @@ -99,6 +100,7 @@ public: float m_fRating; float m_fEpBookmark; int m_iBookmarkId; + int m_iIdShow; CFanart m_fanart; CStreamDetails m_streamDetails; CBookmark m_resumePoint; |