Merge pull request #23766 from owncloud/replace-getid-3

Replace getid3 with ID3Parser
This commit is contained in:
Lukas Reschke 2016-04-06 18:32:18 +02:00
commit 9b930cd01d
2 changed files with 11 additions and 7 deletions

@ -1 +1 @@
Subproject commit 35a8125ac1dc2325da8da5529f50b3881e1b2402 Subproject commit de4313cda759a88745fbc5b5aaaca5e3644b361f

View File

@ -23,6 +23,8 @@
*/ */
namespace OC\Preview; namespace OC\Preview;
use ID3Parser\ID3Parser;
class MP3 extends Provider { class MP3 extends Provider {
/** /**
* {@inheritDoc} * {@inheritDoc}
@ -35,15 +37,17 @@ class MP3 extends Provider {
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
$getID3 = new \getID3(); $getID3 = new ID3Parser();
$tmpPath = $fileview->toTmpFile($path); $tmpPath = $fileview->toTmpFile($path);
$tags = $getID3->analyze($tmpPath); $tags = $getID3->analyze($tmpPath);
\getid3_lib::CopyTagsToComments($tags); unlink($tmpPath);
if(isset($tags['id3v2']['APIC'][0]['data'])) { $picture = isset($tags['id3v2']['APIC'][0]['data']) ? $tags['id3v2']['APIC'][0]['data'] : null;
$picture = @$tags['id3v2']['APIC'][0]['data']; if(is_null($picture) && isset($tags['id3v2']['PIC'][0]['data'])) {
unlink($tmpPath); $picture = $tags['id3v2']['PIC'][0]['data'];
}
if(!is_null($picture)) {
$image = new \OC_Image(); $image = new \OC_Image();
$image->loadFromData($picture); $image->loadFromData($picture);