diff options
author | Paul Arthur <paul.arthur@flowerysong.com> | 2012-02-20 23:08:27 -0500 |
---|---|---|
committer | Paul Arthur <paul.arthur@flowerysong.com> | 2012-02-20 23:11:48 -0500 |
commit | e36d29434ed19d4954a609ce71bae75590e8fe08 (patch) | |
tree | 39dd39a71b772c5523b393820d10d86afdad1f79 /lib/class/vainfo.class.php | |
parent | a40824a96baf9a92961cf8e5b7c0ae3f0a4ee263 (diff) | |
download | ampache-e36d29434ed19d4954a609ce71bae75590e8fe08.tar.gz ampache-e36d29434ed19d4954a609ce71bae75590e8fe08.tar.bz2 ampache-e36d29434ed19d4954a609ce71bae75590e8fe08.zip |
vainfo: unset disk if totaldiscs is 1
ID3 should only set disk if it's part of a set, but the same is not true
of other metadata sources.
Also drop no-op attempted cleanup of disk; we've already run intval, so
it won't contain a slash.
Diffstat (limited to 'lib/class/vainfo.class.php')
-rw-r--r-- | lib/class/vainfo.class.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/class/vainfo.class.php b/lib/class/vainfo.class.php index d847424b..cca8f2cb 100644 --- a/lib/class/vainfo.class.php +++ b/lib/class/vainfo.class.php @@ -331,6 +331,10 @@ class vainfo { ? $info['disk'] : intval($tags['disk']); + $info['totaldiscs'] = $info['totaldiscs'] + ? $info['totaldiscs'] + : intval($tags['totaldiscs']); + $info['artist'] = $info['artist'] ? $info['artist'] : trim($tags['artist']); @@ -398,12 +402,10 @@ class vainfo { : Dba::escape($tags['video_codec']); } - // I really think this belongs somewhere else - $slash_point = strpos($info['disk'], '/'); - if ($slash_point !== false) { - $info['disk'] = substr($info['disk'], 0, $slash_point); + if ($info['totaldiscs'] == 1 && $info['disk'] == 1) { + unset $info['disk']; + unset $info['totaldiscs']; } - return $info; @@ -687,7 +689,8 @@ class vainfo { $array['track'] = $this->_clean_tag($data['0']); break; case 'discnumber': - $array['disk'] = $this->_clean_tag($data['0']); + $el = explode('/', $data['0']); + $array['disk'] = $el[0]; break; case 'date': $array['year'] = $this->_clean_tag($data['0']); @@ -754,6 +757,7 @@ class vainfo { case 'pos': $el = explode('/', $data['0']); $array['disk'] = $el[0]; + $array['totaldiscs'] = $el[1]; break; case 'track_number': $array['track'] = $this->_clean_tag($data['0']); |