diff --git a/src/Simplifiers/SimpleAlbum.php b/src/Simplifiers/SimpleAlbum.php index ec22fbb..8b6709f 100644 --- a/src/Simplifiers/SimpleAlbum.php +++ b/src/Simplifiers/SimpleAlbum.php @@ -113,7 +113,7 @@ public function __construct($ern) { // Find release of type MainRelease from this ERN foreach ($this->ern->getReleaseList()->getRelease() as $release) { foreach ($release->getReleaseType() as $type) { - if (in_array(strtolower($type->value()), ["album", "classicalalbum"])) { + if (in_array(strtolower($type->value()), ["album", "classicalalbum", "single"])) { $this->ddexReleaseAlbum = $release; } else { $this->trackReleasesByReference[$release->getReleaseReference()[0]] = $release; @@ -523,5 +523,50 @@ public function getCLineText(): ?string { return null; } } + + /** + * Assumption: there is only one ReleaseId + * + * @return string|null + */ + public function getGrid(): ?string { + try { + return $this->ddexReleaseAlbum->getReleaseId()[0]->getGRid(); + } catch (Throwable $ex) { + return null; + } catch (Exception $ex) { + return null; + } + } + + /** + * Assumption: there is only one ReleaseId + * + * @return string|null + */ + public function getIcpn(): ?string { + try { + return $this->ddexReleaseAlbum->getReleaseId()[0]->getICPN(); + } catch (Throwable $ex) { + return null; + } catch (Exception $ex) { + return null; + } + } + + /** + * Assumption: there is only one ReleaseId + * + * @return string|null + */ + public function getCatalogNumber(): ?string { + try { + return $this->ddexReleaseAlbum->getReleaseId()[0]->getCatalogNumber(); + } catch (Throwable $ex) { + return null; + } catch (Exception $ex) { + return null; + } + } } diff --git a/src/Simplifiers/SimpleTrack.php b/src/Simplifiers/SimpleTrack.php index a0805a2..bb3906e 100644 --- a/src/Simplifiers/SimpleTrack.php +++ b/src/Simplifiers/SimpleTrack.php @@ -242,7 +242,7 @@ public function getDurationInSeconds(): ?int { * * @return SimpleArtist[] */ - private function getDisplayArtists() { + public function getDisplayArtists() { $artists = []; foreach ($this->ddexDetails->getDisplayArtist() as $artist) { @@ -263,7 +263,7 @@ private function getDisplayArtists() { * * @return SimpleArtist */ - private function getArtistsFromResourceContributors() { + public function getArtistsFromResourceContributors() { $artists = []; foreach ($this->ddexDetails->getResourceContributor() as $artist) { @@ -284,7 +284,7 @@ private function getArtistsFromResourceContributors() { * * @return SimpleArtist */ - private function getArtistsFromIndirectResourceContributors() { + public function getArtistsFromIndirectResourceContributors() { $artists = []; foreach ($this->ddexDetails->getIndirectResourceContributor() as $artist) { @@ -307,7 +307,7 @@ private function getArtistsFromIndirectResourceContributors() { * * Ignores sequence numbering. Keep the order as written in the XML. * - * @return SimpleArtist + * @return SimpleArtist[] */ public function getArtists() { // Display artists