diff --git a/Web/Models/Entities/Audio.php b/Web/Models/Entities/Audio.php index 3b998f32..de7114b4 100644 --- a/Web/Models/Entities/Audio.php +++ b/Web/Models/Entities/Audio.php @@ -167,6 +167,11 @@ class Audio extends Media return !is_null($this->getRecord()->lyrics) ? htmlspecialchars($this->getRecord()->lyrics, ENT_DISALLOWED | ENT_XHTML) : NULL; } + function getLRC(): ?string + { + return !is_null($this->getRecord()->lrc) ? htmlspecialchars($this->getRecord()->lrc, ENT_DISALLOWED | ENT_XHTML) : NULL; + } + function getLength(): int { return $this->getRecord()->length; diff --git a/Web/Presenters/AudioPresenter.php b/Web/Presenters/AudioPresenter.php index ae38d1d0..d06c9c0a 100644 --- a/Web/Presenters/AudioPresenter.php +++ b/Web/Presenters/AudioPresenter.php @@ -802,4 +802,15 @@ final class AudioPresenter extends OpenVKPresenter $this->returnJson($resultArr); } + + function renderLRC(int $id) { + $audio = (new Audios)->get($id); + header("Content-Type: application/octet-stream"); + + if ($audio->isAvailable()) { + exit($audio->getLRC()); + } else { + exit(""); + } + } } diff --git a/Web/Presenters/templates/Audio/bigplayer.xml b/Web/Presenters/templates/Audio/bigplayer.xml index 6ae6326d..c400839d 100644 --- a/Web/Presenters/templates/Audio/bigplayer.xml +++ b/Web/Presenters/templates/Audio/bigplayer.xml @@ -48,9 +48,11 @@
+
+
diff --git a/Web/Presenters/templates/Audio/player.xml b/Web/Presenters/templates/Audio/player.xml index 24fe4723..031b3f0c 100644 --- a/Web/Presenters/templates/Audio/player.xml +++ b/Web/Presenters/templates/Audio/player.xml @@ -2,7 +2,7 @@ {php $isWithdrawn = $audio->isWithdrawn()} {php $isAvailable = $audio->isAvailable()} {php $editable = isset($thisUser) && $audio->canBeModifiedBy($thisUser)} -
+
getLRC()) }data-lrc="/audio{$audio->getId()}/lrc"{/if}>