From b7153e10edff9639f40ec51f38a3f791fe4477eb Mon Sep 17 00:00:00 2001 From: Nick Bartkowiak Date: Tue, 25 Dec 2012 17:43:37 -0600 Subject: [PATCH] Added single and multiple album retrieval to the atist item object. --- Server/Library/Item/Artist.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Server/Library/Item/Artist.php b/Server/Library/Item/Artist.php index 24e9bbd..8e37f66 100644 --- a/Server/Library/Item/Artist.php +++ b/Server/Library/Item/Artist.php @@ -53,4 +53,35 @@ public function setAttributes($attribute) { parent::setAttributes($attribute); } + + /** + * Returns an array of all the albumn objects for the intstantiated artist. + * + * @uses Plex_Server_Library::getItems() + * @uses Plex_Server_Library_ItemAbstract::buildChildrenEndpoint() + * + * @return Plex_Server_Library_Item_Album[] An array of Plex library album + * objects. + */ + public function getAlbums() + { + return $this->getItems( + $this->buildChildrenEndpoint() + ); + } + + /** + * Returns a single album by index, key, or exact title match. + * + * @param integer|string $polymorphicData Either an index, a key, or a title + * for an exact title match that will be used to retrieve a single album. + * + * @uses Plex_Server_Library_ItemAbstract::getPolymorphicItem() + * + * @return Plex_Server_Library_Item_Album A single album. + */ + public function getAlbum($polymorphicData) + { + return $this->getPolymorphicItem($polymorphicData); + } }