Skip to content
This repository
Browse code

json-rpc: add "albumartistid" property for songs

  • Loading branch information...
commit a8c055c723ce565adf7c7802dd1d6115684d24a4 1 parent 7a51202
Sascha Montellese authored November 27, 2012
13  xbmc/interfaces/json-rpc/AudioLibrary.cpp
@@ -703,6 +703,7 @@ JSONRPC_STATUS CAudioLibrary::GetAdditionalSongDetails(const CVariant &parameter
703 703
   std::set<std::string> checkProperties;
704 704
   checkProperties.insert("genreid");
705 705
   checkProperties.insert("artistid");
  706
+  checkProperties.insert("albumartistid");
706 707
   std::set<std::string> additionalProperties;
707 708
   if (!CheckForAdditionalProperties(parameterObject["properties"], checkProperties, additionalProperties))
708 709
     return OK;
@@ -734,6 +735,18 @@ JSONRPC_STATUS CAudioLibrary::GetAdditionalSongDetails(const CVariant &parameter
734 735
         item->SetProperty("artistid", artistidObj);
735 736
       }
736 737
     }
  738
+    if (additionalProperties.find("albumartistid") != additionalProperties.end() && item->GetMusicInfoTag()->GetAlbumId() > 0)
  739
+    {
  740
+      std::vector<int> albumartistids;
  741
+      if (musicdatabase.GetArtistsByAlbum(item->GetMusicInfoTag()->GetAlbumId(), true, albumartistids))
  742
+      {
  743
+        CVariant albumartistidObj(CVariant::VariantTypeArray);
  744
+        for (std::vector<int>::const_iterator albumartistid = albumartistids.begin(); albumartistid != albumartistids.end(); albumartistid++)
  745
+          albumartistidObj.push_back(*albumartistid);
  746
+
  747
+        item->SetProperty("albumartistid", albumartistidObj);
  748
+      }
  749
+    }
737 750
   }
738 751
 
739 752
   return OK;
16  xbmc/interfaces/json-rpc/ServiceDescription.h
@@ -430,13 +430,14 @@ namespace JSONRPC
430 430
     "\"Audio.Fields.Song\": {"
431 431
       "\"extends\": \"Item.Fields.Base\","
432 432
       "\"items\": { \"type\": \"string\","
433  
-        "\"description\": \"Requesting the genreid and/or artistid field will result in increased response times\","
  433
+        "\"description\": \"Requesting the genreid, artistid and/or albumartistid field will result in increased response times\","
434 434
         "\"enum\": [ \"title\", \"artist\", \"albumartist\", \"genre\", \"year\","
435 435
                   "\"rating\", \"album\", \"track\", \"duration\", \"comment\","
436 436
                   "\"lyrics\", \"musicbrainztrackid\", \"musicbrainzartistid\","
437 437
                   "\"musicbrainzalbumid\", \"musicbrainzalbumartistid\","
438 438
                   "\"playcount\", \"fanart\", \"thumbnail\", \"file\", \"albumid\","
439  
-                  "\"lastplayed\", \"disc\", \"genreid\", \"artistid\", \"displayartist\" ]"
  439
+                  "\"lastplayed\", \"disc\", \"genreid\", \"artistid\", \"displayartist\","
  440
+                  "\"albumartistid\" ]"
440 441
       "}"
441 442
     "}",
442 443
     "\"Audio.Details.Base\": {"
@@ -505,7 +506,8 @@ namespace JSONRPC
505 506
         "\"musicbrainzartistid\": { \"type\": \"string\" },"
506 507
         "\"albumid\": { \"$ref\": \"Library.Id\" },"
507 508
         "\"lastplayed\": { \"type\": \"string\" },"
508  
-        "\"disc\": { \"type\": \"integer\" }"
  509
+        "\"disc\": { \"type\": \"integer\" },"
  510
+        "\"albumartistid\": { \"$ref\": \"Array.Integer\" }"
509 511
       "}"
510 512
     "}",
511 513
     "\"Video.Fields.Movie\": {"
@@ -1048,7 +1050,8 @@ namespace JSONRPC
1048 1050
         "\"tvshowid\": { \"$ref\": \"Library.Id\" },"
1049 1051
         "\"watchedepisodes\": { \"type\": \"integer\" },"
1050 1052
         "\"disc\": { \"type\": \"integer\" },"
1051  
-        "\"tag\": { \"$ref\": \"Array.String\" }"
  1053
+        "\"tag\": { \"$ref\": \"Array.String\" },"
  1054
+        "\"albumartistid\": { \"$ref\": \"Array.Integer\" }"
1052 1055
       "}"
1053 1056
     "}",
1054 1057
     "\"List.Fields.All\": {"
@@ -1064,7 +1067,8 @@ namespace JSONRPC
1064 1067
                   "\"firstaired\", \"season\", \"episode\", \"showtitle\", \"thumbnail\", \"file\","
1065 1068
                   "\"resume\", \"artistid\", \"albumid\", \"tvshowid\", \"setid\", \"watchedepisodes\","
1066 1069
                   "\"disc\", \"tag\", \"art\", \"channel\", \"channeltype\", \"hidden\", \"locked\","
1067  
-                  "\"channelnumber\", \"starttime\", \"endtime\", \"genreid\", \"displayartist\" ]"
  1070
+                  "\"channelnumber\", \"starttime\", \"endtime\", \"genreid\", \"displayartist\","
  1071
+                  "\"albumartistid\" ]"
1068 1072
       "}"
1069 1073
     "}",
1070 1074
     "\"List.Item.All\": {"
@@ -1092,7 +1096,7 @@ namespace JSONRPC
1092 1096
                   "\"firstaired\", \"season\", \"episode\", \"showtitle\", \"thumbnail\", \"file\","
1093 1097
                   "\"resume\", \"artistid\", \"albumid\", \"tvshowid\", \"setid\", \"watchedepisodes\","
1094 1098
                   "\"disc\", \"tag\", \"art\", \"size\", \"lastmodified\", \"mimetype\", \"genreid\","
1095  
-                  "\"displayartist\" ]"
  1099
+                  "\"displayartist\", \"albumartistid\" ]"
1096 1100
       "}"
1097 1101
     "}",
1098 1102
     "\"List.Item.File\": {"
16  xbmc/interfaces/json-rpc/types.json
@@ -403,13 +403,14 @@
403 403
   "Audio.Fields.Song": {
404 404
     "extends": "Item.Fields.Base",
405 405
     "items": { "type": "string",
406  
-      "description": "Requesting the genreid and/or artistid field will result in increased response times",
  406
+      "description": "Requesting the genreid, artistid and/or albumartistid field will result in increased response times",
407 407
       "enum": [ "title", "artist", "albumartist", "genre", "year",
408 408
                 "rating", "album", "track", "duration", "comment",
409 409
                 "lyrics", "musicbrainztrackid", "musicbrainzartistid",
410 410
                 "musicbrainzalbumid", "musicbrainzalbumartistid",
411 411
                 "playcount", "fanart", "thumbnail", "file", "albumid",
412  
-                "lastplayed", "disc", "genreid", "artistid", "displayartist" ]
  412
+                "lastplayed", "disc", "genreid", "artistid", "displayartist",
  413
+                "albumartistid" ]
413 414
     }
414 415
   },
415 416
   "Audio.Details.Base": {
@@ -478,7 +479,8 @@
478 479
       "musicbrainzartistid": { "type": "string" },
479 480
       "albumid": { "$ref": "Library.Id" },
480 481
       "lastplayed": { "type": "string" },
481  
-      "disc": { "type": "integer" }
  482
+      "disc": { "type": "integer" },
  483
+      "albumartistid": { "$ref": "Array.Integer" }
482 484
     }
483 485
   },
484 486
   "Video.Fields.Movie": {
@@ -1021,7 +1023,8 @@
1021 1023
       "tvshowid": { "$ref": "Library.Id" },
1022 1024
       "watchedepisodes": { "type": "integer" },
1023 1025
       "disc": { "type": "integer" },
1024  
-      "tag": { "$ref": "Array.String" }
  1026
+      "tag": { "$ref": "Array.String" },
  1027
+      "albumartistid": { "$ref": "Array.Integer" }
1025 1028
     }
1026 1029
   },
1027 1030
   "List.Fields.All": {
@@ -1037,7 +1040,8 @@
1037 1040
                 "firstaired", "season", "episode", "showtitle", "thumbnail", "file",
1038 1041
                 "resume", "artistid", "albumid", "tvshowid", "setid", "watchedepisodes",
1039 1042
                 "disc", "tag", "art", "channel", "channeltype", "hidden", "locked",
1040  
-                "channelnumber", "starttime", "endtime", "genreid", "displayartist" ]
  1043
+                "channelnumber", "starttime", "endtime", "genreid", "displayartist",
  1044
+                "albumartistid" ]
1041 1045
     }
1042 1046
   },
1043 1047
   "List.Item.All": {
@@ -1065,7 +1069,7 @@
1065 1069
                 "firstaired", "season", "episode", "showtitle", "thumbnail", "file",
1066 1070
                 "resume", "artistid", "albumid", "tvshowid", "setid", "watchedepisodes",
1067 1071
                 "disc", "tag", "art", "size", "lastmodified", "mimetype", "genreid",
1068  
-                "displayartist" ]
  1072
+                "displayartist", "albumartistid" ]
1069 1073
     }
1070 1074
   },
1071 1075
   "List.Item.File": {

0 notes on commit a8c055c

Please sign in to comment.
Something went wrong with that request. Please try again.