diff options
Diffstat (limited to 'lib/private/Preview/MP3.php')
-rw-r--r-- | lib/private/Preview/MP3.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/private/Preview/MP3.php b/lib/private/Preview/MP3.php index 11a512286ec..f560f100109 100644 --- a/lib/private/Preview/MP3.php +++ b/lib/private/Preview/MP3.php @@ -28,23 +28,26 @@ namespace OC\Preview; use ID3Parser\ID3Parser; -class MP3 extends Provider { +use OCP\Files\File; +use OCP\IImage; + +class MP3 extends ProviderV2 { /** * {@inheritDoc} */ - public function getMimeType() { + public function getMimeType(): string { return '/audio\/mpeg/'; } /** * {@inheritDoc} */ - public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { + public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { $getID3 = new ID3Parser(); - $tmpPath = $fileview->toTmpFile($path); + $tmpPath = $this->getLocalFile($file); $tags = $getID3->analyze($tmpPath); - unlink($tmpPath); + $this->cleanTmpFiles(); $picture = isset($tags['id3v2']['APIC'][0]['data']) ? $tags['id3v2']['APIC'][0]['data'] : null; if(is_null($picture) && isset($tags['id3v2']['PIC'][0]['data'])) { $picture = $tags['id3v2']['PIC'][0]['data']; @@ -61,6 +64,6 @@ class MP3 extends Provider { } } - return false; + return null; } } |