From e90aba05390e01be569b9fdcb72b1fd75722c72e Mon Sep 17 00:00:00 2001 From: Daniel Neto Date: Mon, 9 Sep 2024 14:09:55 -0300 Subject: [PATCH] Update --- plugin/AI/receiveAsync.json.php | 46 +++++++++++++++++++-------------- plugin/AI/tabs/usage.php | 2 +- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/plugin/AI/receiveAsync.json.php b/plugin/AI/receiveAsync.json.php index 14a35e47aa17..c5ef844e5442 100644 --- a/plugin/AI/receiveAsync.json.php +++ b/plugin/AI/receiveAsync.json.php @@ -92,14 +92,15 @@ _error_log('AI: ' . basename(__FILE__) . ' line=' . __LINE__); if (!empty($_REQUEST['response'])) { $jsonDecoded = Ai_transcribe_responses::saveVTT( - $_REQUEST['response']['vtt'], - $_REQUEST['response']['language'], - $_REQUEST['response']['duration'], - $_REQUEST['response']['text'], - $_REQUEST['response']['total_price'], - $_REQUEST['response']['size_in_bytes'], - $_REQUEST['response']['mp3'], - $jsonDecoded); + $_REQUEST['response']['vtt'], + $_REQUEST['response']['language'], + $_REQUEST['response']['duration'], + $_REQUEST['response']['text'], + $_REQUEST['response']['total_price'], + $_REQUEST['response']['size_in_bytes'], + $_REQUEST['response']['mp3'], + $jsonDecoded + ); } break; case AI::$typeShorts: @@ -138,20 +139,27 @@ } } - $jsonDecoded->addAudioTrack = HLSAudioManager::addAudioTrack($token->videos_id, $mp3URL, $language); + $jsonDecoded->addAudioTrack = HLSAudioManager::addAudioTrack($token->videos_id, $mp3URL, $language); $jsonDecoded->error = empty($jsonDecoded->addAudioTrack); $vtt = file_get_contents($vttURL); $jsonDecoded = Ai_transcribe_responses::saveVTT( - $vtt , - $language, - 0, - $vtt, - 0, - strlen($vtt), - $mp3URL, - $jsonDecoded); - - _error_log('End line=' . __LINE__.' '.json_encode($jsonDecoded->addAudioTrack)); + $vtt, + $language, + 0, + $vtt, + 0, + strlen($vtt), + $mp3URL, + $jsonDecoded + ); + + $o = new Ai_responses_json(0); + $o->setResponse($jsonDecoded); + $o->setAi_type(AI::$typeDubbing); + $o->setAi_responses_id($token->ai_responses_id); + $jsonDecoded->Ai_transcribe_responses = $o->save(); + + _error_log('End line=' . __LINE__ . ' ' . json_encode($jsonDecoded->addAudioTrack)); //$jsonDecoded->lines[] = __LINE__; } break; diff --git a/plugin/AI/tabs/usage.php b/plugin/AI/tabs/usage.php index dc82f8d37968..9c9985a014b3 100644 --- a/plugin/AI/tabs/usage.php +++ b/plugin/AI/tabs/usage.php @@ -13,7 +13,7 @@ // Convert file size to human-readable format $formattedSize = humanFileSize($fileSize); - echo ""; + echo ""; echo "

File: " . basename($path) . "

"; echo "

Duration: $duration

"; echo "

File Size: $formattedSize

";