diff --git a/src/Simplifiers/SimpleAlbum.php b/src/Simplifiers/SimpleAlbum.php index ec22fbb..876037f 100644 --- a/src/Simplifiers/SimpleAlbum.php +++ b/src/Simplifiers/SimpleAlbum.php @@ -113,10 +113,10 @@ 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"])) { - $this->ddexReleaseAlbum = $release; - } else { + if (strtolower($type->value()) === 'trackrelease') { $this->trackReleasesByReference[$release->getReleaseReference()[0]] = $release; + } else { + $this->ddexReleaseAlbum = $release; } } } diff --git a/tests/Simplifiers/SimplifiersTest.php b/tests/Simplifiers/SimplifiersTest.php index 07bb627..e8b57d4 100644 --- a/tests/Simplifiers/SimplifiersTest.php +++ b/tests/Simplifiers/SimplifiersTest.php @@ -87,7 +87,16 @@ public function testSimpleAlbum() { // Track deal $this->assertContains("PayAsYouGoModel", $track->getDeal()->getCommercialModelTypes()); } - + + public function testSimpleAlbumWithUserDefinedReleaseType() { + $parser = new ErnParserController(); + $ern = $parser->parse("tests/samples/017_user_defined_release_type.xml"); + + $album = new SimpleAlbum($ern); + + $this->assertSame("EP", $album->getDdexRelease()->getReleaseType()[0]->getUserDefinedValue()); + } + public function testResourcePath() { $parser = new ErnParserController(); $ern = $parser->parse("tests/samples/016_utf8_artists.xml"); diff --git a/tests/samples/017_user_defined_release_type.xml b/tests/samples/017_user_defined_release_type.xml new file mode 100644 index 0000000..1ab6792 --- /dev/null +++ b/tests/samples/017_user_defined_release_type.xml @@ -0,0 +1,1319 @@ + + + + R1115 + 202101010101010101001 + + PADPIDA20010101001 + + SenderName + + + + PADPIDA20010101002 + + RecipientName + + + 2021-09-29T06:38:37-04:00 + LiveMessage + + OriginalMessage + + + MusicalWorkSoundRecording + + BAA052029415 + 23479 + + AT10476 + + Sanela kolo + + sr + PT3M08S + 2020-10-26 + + Worldwide + + <TitleText>Sanela kolo</TitleText> + + + + Mirko Kordić + + MainArtist + + + + Mirko Kordić + + MainArtist + + + + N.Autor + + Producer + + + + M.Kordić + + Composer + + + + N.Autor + + Lyricist + + + + Jugodisk + + MusicPublisher + + Mirko Kordić + JD Production + 2020-10-26 + + 2020 + 2020 JD Production + + + Folk + + NotExplicit + + TT10476 + MP3 + false + + 763331950658_01_01.mp3 + resources/ + + d351fb62ac2f10dcb8cbf298b106ca12 + MD5 + + + + + + + MusicalWorkSoundRecording + + BAA052029416 + 23480 + + AT10477 + + Dunavski vrtlog + + sr + PT5M39S + 2020-10-26 + + Worldwide + + <TitleText>Dunavski vrtlog</TitleText> + + + + Slobodan Bozinovic + + MainArtist + + + + Slobodan Bozinovic + + MainArtist + + + + N.Autor + + Producer + + + + Slobodan Bozinovic + + Composer + + + + N.Autor + + Lyricist + + + + Jugodisk + + MusicPublisher + + Slobodan Božinović + JD Production + 2020-10-26 + + 2020 + 2020 JD Production + + + Folk + + NotExplicit + + TT10477 + MP3 + false + + 763331950658_01_02.mp3 + resources/ + + aedb4b31993ba8356200eaa7e323c5b0 + MD5 + + + + + + + MusicalWorkSoundRecording + + BAA052029417 + 23481 + + AT10478 + + Zvečansko kolo + + sr + PT3M36S + 2020-10-26 + + Worldwide + + <TitleText>Zvečansko kolo</TitleText> + + + + Aca Šišić + + MainArtist + + + + Aca Šišić + + MainArtist + + + + M.Lekić + + Producer + + + + Aca Šišić + + Composer + + + + N.Autor + + Lyricist + + + + Jugodisk + + MusicPublisher + + Aca Šišić + JD Production + 2020-10-26 + + 2020 + 2020 JD Production + + + Folk + + NotExplicit + + TT10478 + MP3 + false + + 763331950658_01_03.mp3 + resources/ + + da8f43c6b4649fa73c5d0b7043472a4b + MD5 + + + + + + + MusicalWorkSoundRecording + + BAA052029418 + 23482 + + AT10479 + + Šumadijsko lagano kolo + + sr + PT4M49S + 2020-10-26 + + Worldwide + + <TitleText>Šumadijsko lagano kolo</TitleText> + + + + Tomica Miljić + + MainArtist + + + + Tomica Miljić + + MainArtist + + + + N.Autor + + Producer + + + + Tomica Miljić + + Composer + + + + N.Autor + + Lyricist + + + + Jugodisk + + MusicPublisher + + Tomica Miljić + JD Production + 2020-10-26 + + 2020 + 2020 JD Production + + + Folk + + NotExplicit + + TT10479 + MP3 + false + + 763331950658_01_04.mp3 + resources/ + + b6034096ab4b65eb2b546ca483521841 + MD5 + + + + + + + MusicalWorkSoundRecording + + BAA052029419 + 23483 + + AT10480 + + Župsko kolo + + sr + PT2M32S + 2020-10-26 + + Worldwide + + <TitleText>Župsko kolo</TitleText> + + + + Dragan Aleksandrić + + MainArtist + + + + Dragan Aleksandrić + + MainArtist + + + + N.Autor + + Producer + + + + Dragan Aleksandrić + + Composer + + + + N.Autor + + Lyricist + + + + Jugodisk + + MusicPublisher + + Dragan Aleksandrić + JD Production + 2020-10-26 + + 2020 + 2020 JD Production + + + Folk + + NotExplicit + + TT10480 + MP3 + false + + 763331950658_01_05.mp3 + resources/ + + eae90721c5a6958c486bcbe1869fe461 + MD5 + + + + + + + MusicalWorkSoundRecording + + BAA052029420 + 23484 + + AT10481 + + Najciganskije vašarsko kolo + + sr + PT4M39S + 2020-10-26 + + Worldwide + + <TitleText>Najciganskije vašarsko kolo</TitleText> + + + + Vladeta Kandić + + MainArtist + + + + Vladeta Kandić + + MainArtist + + + + N.Autor + + Producer + + + + Vladeta Kandić + + Composer + + + + N.Autor + + Lyricist + + + + Jugodisk + + MusicPublisher + + Vladeta Kandić + JD Production + 2020-10-26 + + 2020 + 2020 JD Production + + + Folk + + NotExplicit + + TT10481 + MP3 + false + + 763331950658_01_06.mp3 + resources/ + + 9b590f7fb14e950b5b66fa30cef1cb72 + MD5 + + + + + + + MusicalWorkSoundRecording + + BAA052029421 + 23485 + + AT10482 + + Ciganski urnebes + + sr + PT3M35S + 2020-10-26 + + Worldwide + + <TitleText>Ciganski urnebes</TitleText> + + + + Branimir Đokić + + MainArtist + + + + Branimir Đokić + + MainArtist + + + + N.Autor + + Producer + + + + Branimir Đokić + + Composer + + + + N.Autor + + Lyricist + + + + Jugodisk + + MusicPublisher + + Branimir Đokić + JD Production + 2020-10-26 + + 2020 + 2020 JD Production + + + Folk + + NotExplicit + + TT10482 + MP3 + false + + 763331950658_01_07.mp3 + resources/ + + a0d15f7822e7067de1c34c57b2d243a6 + MD5 + + + + + + + MusicalWorkSoundRecording + + BAA052029422 + 23486 + + AT10483 + + Šarplaninska šota + + sr + PT4M54S + 2020-10-26 + + Worldwide + + <TitleText>Šarplaninska šota</TitleText> + + + + Aca Krnjevac + + MainArtist + + + + Aca Krnjevac + + MainArtist + + + + N.Autor + + Producer + + + + Aca Krnjevac + + Composer + + + + N.Autor + + Lyricist + + + + Jugodisk + + MusicPublisher + + Aca Krnjevac + JD Production + 2020-10-26 + + 2020 + 2020 JD Production + + + Folk + + NotExplicit + + TT10483 + MP3 + false + + 763331950658_01_08.mp3 + resources/ + + b04bf4bd780c880c34501765cb6c5ab2 + MD5 + + + + + + + MusicalWorkSoundRecording + + BAA052029423 + 23487 + + AT10484 + + Romska šetnja + + sr + PT4M20S + 2020-10-26 + + Worldwide + + <TitleText>Romska šetnja</TitleText> + + + + Rajko Marinković + + MainArtist + + + + Rajko Marinković + + MainArtist + + + + N.Autor + + Producer + + + + Rajko Marinković + + Composer + + + + N.Autor + + Lyricist + + + + Jugodisk + + MusicPublisher + + Rajko Marinković + JD Production + 2020-10-26 + + 2020 + 2020 JD Production + + + Folk + + NotExplicit + + TT10484 + MP3 + false + + 763331950658_01_09.mp3 + resources/ + + 832b20301f6602b7fd2a19cc2e057fce + MD5 + + + + + + + MusicalWorkSoundRecording + + BAA052029424 + 23488 + + AT10485 + + Dunavski vihor + + sr + PT2M54S + 2020-10-26 + + Worldwide + + <TitleText>Dunavski vihor</TitleText> + + + + Perica Simonovic + + MainArtist + + + + Perica Simonovic + + MainArtist + + + + D.Knežević + + Producer + + + + Perica Simonovic + + Composer + + + + N.Autor + + Lyricist + + + + Jugodisk + + MusicPublisher + + Perica Simonović + JD Production + 2020-10-26 + + 2020 + 2020 JD Production + + + Folk + + NotExplicit + + TT10485 + MP3 + false + + 763331950658_01_10.mp3 + resources/ + + 2b577f42ebf064499c6702194817db68 + MD5 + + + + + + + MusicalWorkSoundRecording + + BAA052029425 + 23489 + + AT10486 + + Biser kolo + + sr + PT4M03S + 2020-10-26 + + Worldwide + + <TitleText>Biser kolo</TitleText> + + + + Novica Negovanović + + MainArtist + + + + Novica Negovanović + + MainArtist + + + + N.Autor + + Producer + + + + Novica Negovanović + + Composer + + + + N.Autor + + Lyricist + + + + Jugodisk + + MusicPublisher + + Novica Negovanović + JD Production + 2020-10-26 + + 2020 + 2020 JD Production + + + Folk + + NotExplicit + + TT10486 + MP3 + false + + 763331950658_01_11.mp3 + resources/ + + 845abbbb6faadd4155ce62a1a208aecf + MD5 + + + + + + + MusicalWorkSoundRecording + + BAA052029426 + 23490 + + AT10487 + + Adranski vez + + sr + PT4M05S + 2020-10-26 + + Worldwide + + <TitleText>Adranski vez</TitleText> + + + + Dragan Zivkovic + + MainArtist + + + + Dragan Zivkovic + + MainArtist + + + + N.Autor + + Producer + + + + N.Negovanović + + Composer + + + + N.Autor + + Lyricist + + + + Jugodisk + + MusicPublisher + + Dragan Živković + JD Production + 2020-10-26 + + 2020 + 2020 JD Production + + + Folk + + NotExplicit + + TT10487 + MP3 + false + + 763331950658_01_12.mp3 + resources/ + + 831b1ed8e1cca5e7f7145eb9214f864f + MD5 + + + + + + + FrontCoverImage + + GGL_UIM_ID:PID1 + + AI1 + + Worldwide + + TI1 + JPEG + 3000 + 3000 + + 763331950658.jpg + resources/ + + e41b96f02bfbf930cfb224445e3a39fb + MD5 + + + + + + + + + + BAA052029415 + + R1 + + Sanela kolo + + + AT10476 + + TrackRelease + + Worldwide + Mirko Kordić + JD Production + + <TitleText>Sanela kolo</TitleText> + + + + Mirko Kordić + + MainArtist + + NotExplicit + + + 1 + SoundRecording + AT10476 + + + + Folk + + 2020-10-26 + + + 2020 + 2020 JD Production + + + 1982 + 1982 JD Production + + + + + BAA052029416 + + R2 + + Dunavski vrtlog + + + AT10477 + + TrackRelease + + Worldwide + Slobodan Božinović + JD Production + + <TitleText>Dunavski vrtlog</TitleText> + + + + Slobodan Bozinovic + + MainArtist + + NotExplicit + + + 2 + SoundRecording + AT10477 + + + + Folk + + 2020-10-26 + + + 2020 + 2020 JD Production + + + 1982 + 1982 JD Production + + + + + 763331950658 + BDN0208 + 2393 + + R0 + + 12 zlatnih kola + + + AI1 + AT10476 + AT10477 + AT10478 + AT10479 + AT10480 + AT10481 + AT10482 + AT10483 + AT10484 + AT10485 + AT10486 + AT10487 + + UserDefined + + Worldwide + Various Artists + JD Production + + <TitleText>12 zlatnih kola</TitleText> + + + + Various Artists + + MainArtist + + NotExplicit + + + 1 + + 1 + SoundRecording + AT10476 + + + 2 + SoundRecording + AT10477 + + + 3 + SoundRecording + AT10478 + + + 4 + SoundRecording + AT10479 + + + 5 + SoundRecording + AT10480 + + + 6 + SoundRecording + AT10481 + + + 7 + SoundRecording + AT10482 + + + 8 + SoundRecording + AT10483 + + + 9 + SoundRecording + AT10484 + + + 10 + SoundRecording + AT10485 + + + 11 + SoundRecording + AT10486 + + + 12 + SoundRecording + AT10487 + + + + Image + AI1 + + + + Folk + + 2020-10-26 + + PT48M14S + + 2020 + 2020 JD Production + + + 1982 + 1982 JD Production + + + + + + R0 + + + PayAsYouGoModel + + PermanentDownload + + Worldwide + + 2020-10-26T00:00:00 + + 2020-10-26 + + + + + SubscriptionModel + + ConditionalDownload + OnDemandStream + + Worldwide + + 2020-10-26T00:00:00 + + 2020-10-26 + + + 2021-09-29 + + + R1 + + + PayAsYouGoModel + + PermanentDownload + + Worldwide + + 2020-10-26T00:00:00 + + + + + + SubscriptionModel + + ConditionalDownload + OnDemandStream + + Worldwide + + 2020-10-26T00:00:00 + + + + 2021-09-29 + + + R2 + + + PayAsYouGoModel + + PermanentDownload + + Worldwide + + 2020-10-26T00:00:00 + + + + + + SubscriptionModel + + ConditionalDownload + OnDemandStream + + Worldwide + + 2020-10-26T00:00:00 + + + + 2021-09-29 + + +