From: Banana Date: Sun, 11 Jul 2021 14:57:51 +0000 (+0200) Subject: fixed #10. Multiple medias per release X-Git-Tag: 1.2~4 X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=b488ab22e257f3b638c39285a94be980ffc0c420;p=bibliotheca-php.git fixed #10. Multiple medias per release --- 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);