You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.3 KiB

<?php
4 weeks ago
use App\Dataclasses\DatabaseFolkTuneDetails;
use App\Dataclasses\TuneVariant;
use App\Wrappers\DatabaseInteractions;
use App\Wrappers\SQLQueryBuilderWrapper;
require_once __DIR__ . "/../../../vendor/autoload.php";
$tuneDir = __DIR__ . '/../../../LocalStorage/Tunes';
$targetTuneVariantID = $_GET['tune-variant-id'];
4 weeks ago
$db = new DatabaseInteractions();
4 weeks ago
$tuneDetails = $db->RunOneSelect(
queryBuilder: SQLQueryBuilderWrapper::SELECT_ONE(
table: 'Tunes',
id: $targetTuneVariantID
4 weeks ago
)
->cols([
'T.ID AS TuneID',
4 weeks ago
"CONCAT('[', GROUP_CONCAT(
CONCAT(
'{\"TimeSignature\":', JSON_QUOTE(T_TP.TimeSignature), ',',
'\"KeySignature\":', JSON_QUOTE(T_TP.KeySignature), ',',
4 weeks ago
'\"PartLetter\":', JSON_QUOTE(T_TP.PartLetter), ',',
'\"ABCNotation\":', JSON_QUOTE(T_TP.ABCNotation), '}'
4 weeks ago
)
), ']') AS Parts"
])
->join(
join: 'INNER',
spec: 'TuneParts AS T_TP',
cond: 'T.ID = T_TP.TuneID'
4 weeks ago
)
->groupBy(spec: [
'T.ID',
])
);
4 weeks ago
$tuneDetails = new DatabaseFolkTuneDetails($tuneDetails);
4 weeks ago
header(header: "Content-type: text/text");
4 weeks ago
echo $tuneDetails->Build();
die();