summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2023-11-08 22:02:10 +0100
committerRaindropsSys <raindrops@equestria.dev>2023-11-08 22:02:10 +0100
commit492cb3104fabe1b54f360d2a0ea57de60674f404 (patch)
treef17178b8af7912113e3081a103bac267aa180c8e /api
parentb83a38434156038bc02db74cb93fa8460d0f2f32 (diff)
downloadmist-492cb3104fabe1b54f360d2a0ea57de60674f404.tar.gz
mist-492cb3104fabe1b54f360d2a0ea57de60674f404.tar.bz2
mist-492cb3104fabe1b54f360d2a0ea57de60674f404.zip
Updated 7 files, added android/app/release/app-release.apk.zip and renamed android/app/release/app-release.apka (automated)
Diffstat (limited to 'api')
-rw-r--r--api/lyrics.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/api/lyrics.php b/api/lyrics.php
index d72a17c..74503dc 100644
--- a/api/lyrics.php
+++ b/api/lyrics.php
@@ -2,6 +2,7 @@
header("X-Frame-Options: SAMEORIGIN");
header("Content-Type: application/json");
+//header("Content-Type: text/plain");
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $songs;
$token = json_decode(file_exists("/opt/spotify/token.json") ? file_get_contents("/opt/spotify/token.json") : file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/app.json"), true);
@@ -34,6 +35,22 @@ if (isset($data) && str_ends_with($data["syncType"], "_SYNCED")) {
], JSON_PRETTY_PRINT));
}
+$probe = [];
+exec("ffprobe -v quiet -print_format json -show_format $_SERVER[DOCUMENT_ROOT]/assets/content/$_GET[id].flac", $probe);
+$metadata = json_decode(implode("\n", $probe), true);
+
+if (isset($metadata["format"]["tags"]["UNSYNCEDLYRICS"])) {
+ die(json_encode([
+ "synced" => false,
+ "payload" => trim($metadata["format"]["tags"]["UNSYNCEDLYRICS"])
+ ], JSON_PRETTY_PRINT));
+} elseif (isset($metadata["format"]["tags"]["unsyncedlyrics"])) {
+ die(json_encode([
+ "synced" => false,
+ "payload" => trim($metadata["format"]["tags"]["unsyncedlyrics"])
+ ], JSON_PRETTY_PRINT));
+}
+
$genius = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["genius"];
$id = array_values(array_filter(json_decode(file_get_contents("https://api.genius.com/search?q=" . rawurlencode($song["title"] . " " . $song["artist"]), false, stream_context_create([