feat: added connection to rabbitmq in file management. Created App\Lib\RabbitMQSender from /legacy/application/model/RabbitMQ.php
This commit is contained in:
parent
887c74f97a
commit
5682eec1cc
7 changed files with 200 additions and 140 deletions
|
@ -3,14 +3,29 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Helpers\LengthFormatter;
|
||||
use App\Jobs\FileJob;
|
||||
use App\Lib\RabbitMQSender;
|
||||
use App\Models\File;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class FileController extends Controller
|
||||
{
|
||||
protected static $propertyDefinitions = array(
|
||||
'content_type' => 'shortstr',
|
||||
'content_encoding' => 'shortstr',
|
||||
'application_headers' => 'table_object',
|
||||
'delivery_mode' => 'octet',
|
||||
'priority' => 'octet',
|
||||
'correlation_id' => 'shortstr',
|
||||
'reply_to' => 'shortstr',
|
||||
'expiration' => 'shortstr',
|
||||
'message_id' => 'shortstr',
|
||||
'timestamp' => 'timestamp',
|
||||
'type' => 'shortstr',
|
||||
'user_id' => 'shortstr',
|
||||
'app_id' => 'shortstr',
|
||||
'cluster_id' => 'shortstr',
|
||||
);
|
||||
public function index() {
|
||||
//ToDo
|
||||
}
|
||||
|
@ -47,22 +62,19 @@ class FileController extends Controller
|
|||
'hidden' => true,
|
||||
'is_scheduled' => false,
|
||||
'is_playlist' => false,
|
||||
'filesize' => 0
|
||||
'filesize' => 0,
|
||||
'track_type_id' => $request->track_type_id ? $request->track_type_id : null,
|
||||
]);
|
||||
|
||||
$tmpFile = $file->move(Storage::disk('libretime-tmp')->path(''), $dbFile->id.'-'.$originalName);
|
||||
|
||||
//Create array to dispatch to Analyzer
|
||||
$payload = [
|
||||
'id' => $dbFile->id,
|
||||
'tmp_file_path' => $tmpFile->getPathname(),
|
||||
'import_directory' => Storage::disk('libretime-upload')->path('').'/'.'1', //$user->id,
|
||||
'original_filename' => $originalName,
|
||||
'options' => new \stdClass()
|
||||
];
|
||||
|
||||
//Queue::connection('rabbitmq')->pushRaw(json_encode($payload), 'airtime-upload');
|
||||
//Queue::dispatch(new FileJob($payload));
|
||||
RabbitMQSender::SendMessageToAnalyzer(
|
||||
$tmpFile->getPathname(),
|
||||
Storage::disk('libretime-upload')->path('').'/'.'1', //$user->id,
|
||||
$originalName,
|
||||
$dbFile->id,
|
||||
$dbFile->track_type_id
|
||||
);
|
||||
}
|
||||
|
||||
public function show($id) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue