From b488ab22e257f3b638c39285a94be980ffc0c420 Mon Sep 17 00:00:00 2001 From: Banana Date: Sun, 11 Jul 2021 16:57:51 +0200 Subject: [PATCH] fixed #10. Multiple medias per release --- webclient/lib/musicbrainz.class.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/webclient/lib/musicbrainz.class.php b/webclient/lib/musicbrainz.class.php index c7184ef..e492567 100644 --- a/webclient/lib/musicbrainz.class.php +++ b/webclient/lib/musicbrainz.class.php @@ -195,14 +195,17 @@ class Musicbrainz { $ret['tracks'] = ''; $ret['image'] = ''; $ret['runtime'] = 0; - foreach($data['media'][0]['tracks'] as $track) { - $ret['runtime'] += $track['length']; - $l = $track['length'] / 1000; - $l = date("i:s",$l); - $ret['tracks'] .= $track['number'].' - '.$track['title'].' - '.$l."\n"; + + foreach($data['media'] as $media) { + foreach($media['tracks'] as $track) { + $ret['runtime'] += $track['length']; + $l = $track['length'] / 1000; + $l = date("i:s",$l); + $ret['tracks'] .= $track['number'].' - '.$track['title'].' - '.$l."\n"; + } } - $ret['runtime'] = $ret['runtime'] / 1000; - $ret['runtime'] = date("i",$ret['runtime']); + + $ret['runtime'] = round($ret['runtime'] / 1000 / 60); // image $do = $this->_curlCall($this->_IMAGE_ENDPOINT.$releaseId); -- 2.39.5