Skip to content

A self-hosted media server and file management system

i dont know but it seems to work fine

aminnausin18f3398e5356
diff --git a/app/Http/Controllers/Api/V1/PlaybackController.php b/app/Http/Controllers/Api/V1/PlaybackController.php
index 30ddaa88..489332ac 100644
--- a/app/Http/Controllers/Api/V1/PlaybackController.php
+++ b/app/Http/Controllers/Api/V1/PlaybackController.php
@@ -39,29 +39,31 @@ class PlaybackController extends Controller
{
try {
$validated = $request->validated();
- $playback = [];
- $lastId = -1;
+ $playbackUpdates = 0;
+ $metadata = null;
- foreach ($request->entries as $entry) {
- if ($lastId != $entry['metadata_id']) {
+ foreach ($validated['entries'] as $entry) {
+ if (is_Null($metadata) || $metadata->id != $entry['metadata_id']) {
$metadata = Metadata::where('id', $entry['metadata_id'])->first();
if (!$metadata || !$metadata->video()) return $this->error(null, 'Video metadata does not exist', 404);
-
- $lastId = $entry['metadata_id'];
}
$existing = Playback::where('metadata_id', $entry['metadata_id'])->where('progress', $entry['progress'])->first();
if ($existing) {
- $validated['count'] = $existing->count + 1;
- $existing->update($validated);
- return $this->success($existing);
+ $entry['count'] = $existing->count + 1;
+ $existing->update($entry);
+
+ // $playbackIndex = array_search($existing['id'], array_column($playback, 'id'));
+ // $playbackIndex !== false ? $playback[$playbackIndex] = $existing : $playback[] = $existing;
+ } else {
+ $result = Playback::create($entry);
}
- $result = Playback::create($entry);
- array_push($playback, $result);
+ // $playback[] = $result;
+ $playbackUpdates += 1;
}
- return $this->success($playback);
+ return $this->success($playbackUpdates);
} catch (\Throwable $th) {
return $this->error(null, 'Unable to create playback record. Error: ' . $th->getMessage(), 500);
}
diff --git a/app/Http/Controllers/DirectoryController.php b/app/Http/Controllers/DirectoryController.php
index 2be92429..43b3eada 100755
--- a/app/Http/Controllers/DirectoryController.php
+++ b/app/Http/Controllers/DirectoryController.php
@@ -24,121 +24,125 @@ class DirectoryController extends Controller
{
use HttpResponses;
- public function showDirectory(Request $request) {
+ public function showDirectory(Request $request)
+ {
// aim -> return directory and folder id where exists so folder controller is usable
- $privateCategories = array("legacy"=>1);
+ $privateCategories = array("legacy" => 1);
- if(isset($privateCategories[strtolower($request->dir)]) && !$request->user('sanctum')){
+ if (isset($privateCategories[strtolower($request->dir)]) && !$request->user('sanctum')) {
$data['message'] = 'Unauthorized';
return view('error', $data);
}
- $dirRaw = Category::select('id')->firstWhere('name', 'ilike', '%' . $request->dir . '%');
-
- if(isset($dirRaw->id)){
- $data['dir'] = array('id'=>$dirRaw->id,'name'=>$request->dir);
- if(isset($request->folder_name)){
- $data['folder'] = array('id'=>null, 'name'=>$request->folder_name);
- }
- else{
- $folderRaw = Folder::select('id','name')->firstWhere('category_id', $data['dir']['id']);
- $data['folder'] = array('id'=>$folderRaw->id, 'name'=>$folderRaw->name);
+ $dirRaw = Category::select('id')->firstWhere('name', 'ilike', '%' . $request->dir . '%');
+
+ if (isset($dirRaw->id)) {
+ $data['dir'] = array('id' => $dirRaw->id, 'name' => $request->dir);
+ if (isset($request->folder_name)) {
+ $data['folder'] = array('id' => null, 'name' => $request->folder_name);
+ } else {
+ $folderRaw = Folder::select('id', 'name')->firstWhere('category_id', $data['dir']['id']);
+ $data['folder'] = array('id' => $folderRaw->id, 'name' => $folderRaw->name);
}
- }
- else{
- $data['dir'] = array('id'=>null,'name'=>$request->dir);
- $data['folder'] = array('id'=>null, 'name'=>null);
+ } else {
+ $data['dir'] = array('id' => null, 'name' => $request->dir);
+ $data['folder'] = array('id' => null, 'name' => null);
}
// dump($data);
return view('home', $data);
}
- public function showDirectoryAPI(Request $request) {
+ public function showDirectoryAPI(Request $request)
+ {
// All this does is convert url to ids and names
// IDEALLY it should also load data to prevent requiring more api requests
// It does exactly that now it feels fast
try {
- $privateCategories = array("legacy"=>1);
+ $privateCategories = array("legacy" => 1);
$dir = trim(strtolower($request->dir));
$folderName = trim(strtolower($request->folderName));
- if(isset($privateCategories[$dir]) && !$request->user('sanctum')){
+ if (isset($privateCategories[$dir]) && !$request->user('sanctum')) {
$data['message'] = 'Unauthorized';
return $this->error(null, 'Access to this folder is forbidden', 403);
}
- $dirRaw = Category::select('id')->firstWhere('name', 'ilike', '%' . $dir . '%');
- $data = array('dir'=>array('id'=>null,'name'=>$dir,'folders'=>null),'folder'=>array('id'=>null, 'name'=>$folderName ?? null, 'videos'=>null)); // Default null values
+ $dirRaw = Category::select('id')->firstWhere('name', 'ilike', '%' . $dir . '%');
+ $data = array('dir' => array('id' => null, 'name' => $dir, 'folders' => null), 'folder' => array('id' => null, 'name' => $folderName ?? null, 'videos' => null)); // Default null values
- if(!isset($dirRaw->id)){ // Cannot find category so return default nulls
- return $this->error(array('categoryName'=>$dir), 'Cannot find specified category', 200);
+ if (!isset($dirRaw->id)) { // Cannot find category so return default nulls
+ return $this->error(array('categoryName' => $dir), 'Cannot find specified category', 200);
}
$folderList = Folder::where('category_id', $dirRaw->id)->withCount(['videos']); // Folders in category
- $data['dir'] = array('id'=>$dirRaw->id,'name'=>$dir,'folders'=>FolderResource::collection($folderList->get())); // Full category data
+ $data['dir'] = array('id' => $dirRaw->id, 'name' => $dir, 'folders' => FolderResource::collection($folderList->get())); // Full category data
$folderRaw = isset($request->folderName) ? $folderList->firstWhere('name', 'ilike', '%' . $folderName . '%') : $folderList->first(); // Folder in request ? search by name else select first in category
- if(!isset($folderRaw->id)){ // no folder found
- return $this->error(array('categoryName'=>$dir,'folderName'=>$folderName), 'Cannot find folder in specified category', 200);
+ if (!isset($folderRaw->id)) { // no folder found
+ return $this->error(array('categoryName' => $dir, 'folderName' => $folderName), 'Cannot find folder in specified category', 200);
}
- $videoList = VideoResource::collection( Video::where('folder_id', $folderRaw->id)->get());
- $data['folder'] = array('id'=>$folderRaw->id, 'name'=>$folderRaw->name, 'videos'=>$videoList, 'series'=>(isset($folderRaw->series) ? new SeriesResource($folderRaw->series) : null));
+ $videoList = VideoResource::collection(Video::where('folder_id', $folderRaw->id)->get());
+ $data['folder'] = array('id' => $folderRaw->id, 'name' => $folderRaw->name, 'videos' => $videoList, 'series' => (isset($folderRaw->series) ? new SeriesResource($folderRaw->series) : null));
return $this->success($data, '', 200);
-
} catch (\Throwable $th) {
return $this->error(null, 'Unable to parse URL ' . $th->getMessage(), 500);
}
}
- public function getDirectory(Request $request){
+ public function getDirectory(Request $request)
+ {
try {
$default = 'tv';
$dir = isset($request->dir) ? $request->dir : $default;
-
+
$category_id = Category::select('id')->firstWhere('name', $dir)->id;
- $folders = Folder::select('id','name')->where('category_id', $category_id)->get();
+ $folders = Folder::select('id', 'name')->where('category_id', $category_id)->get();
$firstFolder_id = $folders->first()->id;
-
- $videos = Video::select('name','path','date')->where('folder_id', $firstFolder_id)->get();
- dump(json_encode(array("success"=>true, "result"=>array("folders"=>$folders->toArray(),"videos"=>$videos->toArray()), "error"=>""), JSON_UNESCAPED_SLASHES));
+
+ $videos = Video::select('name', 'path', 'date')->where('folder_id', $firstFolder_id)->get();
+ dump(json_encode(array("success" => true, "result" => array("folders" => $folders->toArray(), "videos" => $videos->toArray()), "error" => ""), JSON_UNESCAPED_SLASHES));
//return json_encode(array("success"=>true, "result"=>array("folders"=>$folders->toArray(),"videos"=>$videos->toArray()), "error"=>""), JSON_UNESCAPED_SLASHES);
} catch (\Throwable $th) {
//throw $th;
- return json_encode(array("success"=>false, "result"=>array("folders"=>array(), "videos"=>array()), "error"=>$th->getMessage()), JSON_UNESCAPED_SLASHES);
+ return json_encode(array("success" => false, "result" => array("folders" => array(), "videos" => array()), "error" => $th->getMessage()), JSON_UNESCAPED_SLASHES);
}
}
- public function getDirectoryContents(Request $request){
+ public function getDirectoryContents(Request $request)
+ {
try {
$default = 'tv';
$dir = isset($request->dir) ? $request->dir : $default;
-
+
$category_id = Category::select('id')->firstWhere('name', $dir)->id;
- $folders = Folder::select('id','name')->where('category_id', $category_id)->get();
-
- return(json_encode(array("success"=>true, "result"=>$folders->toArray(), "error"=>""), JSON_UNESCAPED_SLASHES));
+ $folders = Folder::select('id', 'name')->where('category_id', $category_id)->get();
+
+ return (json_encode(array("success" => true, "result" => $folders->toArray(), "error" => ""), JSON_UNESCAPED_SLASHES));
} catch (\Throwable $th) {
- return(json_encode(array("success"=>false, "result"=>array(), "error"=>$th->getMessage()), JSON_UNESCAPED_SLASHES));
+ return (json_encode(array("success" => false, "result" => array(), "error" => $th->getMessage()), JSON_UNESCAPED_SLASHES));
}
}
- public function getFolderContents(VideoCollectionRequest $request){
+ public function getFolderContents(VideoCollectionRequest $request)
+ {
try {
$folder_id = isset($request->folder_id) ? $request->folder_id : throw new ErrorException("No folder id or invalid folder name provided. Cannot generate videos.");
- $videos = Video::select('id','name','path','date')->where('folder_id', $folder_id)->get();
+ $videos = Video::select('id', 'name', 'path', 'date')->where('folder_id', $folder_id)->get();
- return(json_encode(array("success"=>true, "result"=>$videos->toArray(), "error"=>""), JSON_UNESCAPED_SLASHES));
+ return (json_encode(array("success" => true, "result" => $videos->toArray(), "error" => ""), JSON_UNESCAPED_SLASHES));
} catch (\Throwable $th) {
- return(json_encode(array("success"=>false, "result"=>array(), "error"=>$th->getMessage()), JSON_UNESCAPED_SLASHES));
+ return (json_encode(array("success" => false, "result" => array(), "error" => $th->getMessage()), JSON_UNESCAPED_SLASHES));
}
}
- public function indexFiles(Request $request){
+ public function indexFiles(Request $request)
+ {
try {
+ // SyncFiles::dispatchSync();
IndexFiles::dispatchSync();
dump('success');
} catch (\Throwable $th) {
@@ -147,7 +151,8 @@ class DirectoryController extends Controller
}
}
- public function syncFiles(Request $request){
+ public function syncFiles(Request $request)
+ {
try {
SyncFiles::dispatchSync();
dump('success');
@@ -157,16 +162,17 @@ class DirectoryController extends Controller
}
}
- public function verifyFiles(Request $request){
+ public function verifyFiles(Request $request)
+ {
try {
$jobs = [];
$chunks = [];
-
- Video::orderBy('id')->chunk(20, function($videos) use (&$chunks) {
+
+ Video::orderBy('id')->chunk(20, function ($videos) use (&$chunks) {
$chunks[] = $videos;
});
- foreach($chunks as $chunk){
+ foreach ($chunks as $chunk) {
$jobs[] = new VerifyFiles($chunk);
// break;
}
@@ -181,12 +187,12 @@ class DirectoryController extends Controller
try {
$jobs = [];
$chunks = [];
-
- Folder::orderBy('id')->chunk(20, function($folders) use (&$chunks) {
+
+ Folder::orderBy('id')->chunk(20, function ($folders) use (&$chunks) {
$chunks[] = $folders;
});
- foreach($chunks as $chunk){
+ foreach ($chunks as $chunk) {
$jobs[] = new VerifyFolders($chunk);
// break;
}
@@ -199,16 +205,17 @@ class DirectoryController extends Controller
}
}
- public function verifyFolders(Request $request){
+ public function verifyFolders(Request $request)
+ {
try {
$jobs = [];
$chunks = [];
-
- Folder::orderBy('id')->chunk(20, function($folders) use (&$chunks) {
+
+ Folder::orderBy('id')->chunk(20, function ($folders) use (&$chunks) {
$chunks[] = $folders;
});
- foreach($chunks as $chunk){
+ foreach ($chunks as $chunk) {
$jobs[] = new VerifyFolders($chunk);
// break;
}
@@ -221,17 +228,18 @@ class DirectoryController extends Controller
}
}
- public function cleanPaths() {
+ public function cleanPaths()
+ {
$jobs = [];
try {
$chunks = [];
-
- Video::orderBy('id')->chunk(20, function($videos) use (&$chunks) {
+
+ Video::orderBy('id')->chunk(20, function ($videos) use (&$chunks) {
$chunks[] = $videos;
});
- foreach($chunks as $chunk){
+ foreach ($chunks as $chunk) {
$jobs[] = new CleanVideoPaths($chunk);
// break;
}
@@ -242,16 +250,15 @@ class DirectoryController extends Controller
try {
$chunks = [];
-
- Folder::orderBy('id')->chunk(20, function($folders) use (&$chunks) {
+
+ Folder::orderBy('id')->chunk(20, function ($folders) use (&$chunks) {
$chunks[] = $folders;
});
- foreach($chunks as $chunk){
+ foreach ($chunks as $chunk) {
$jobs[] = new CleanFolderPaths($chunk);
// break;
}
-
} catch (\Throwable $th) {
dump('Error cannot clean folder paths');
dump($th);
@@ -262,4 +269,4 @@ class DirectoryController extends Controller
dump('This job has no web output. Check queue listener console for updates.');
}
-}
\ No newline at end of file
+}
diff --git a/app/Http/Resources/VideoResource.php b/app/Http/Resources/VideoResource.php
index b9c1089c..7bb79e21 100755
--- a/app/Http/Resources/VideoResource.php
+++ b/app/Http/Resources/VideoResource.php
@@ -29,9 +29,9 @@ class VideoResource extends JsonResource
'season' => $metadata ? $this->metadata->season : $this->season,
'view_count' => $metadata ? $this->metadata->view_count : $this->view_count,
'tags' => $this->metadata->tags ?? '',
- 'video_tags' => VideoTagResource::collection($this->metadata->videotags),
- 'date_released' => $this->metadata->date_released,
- 'date_updated' => $this->metadata->updated_at,
+ 'video_tags' => $this->metadata ? VideoTagResource::collection($this->metadata->videotags) : [],
+ 'date_released' => $this->metadata ? $this->metadata->date_released : null,
+ 'date_updated' => $this->metadata ? $this->metadata->updated_at : null,
// ],
// 'relationships' => [
'folder_id' => (string)$this->folder->id,
diff --git a/app/Jobs/EmbedUidInMetadata.php b/app/Jobs/EmbedUidInMetadata.php
new file mode 100644
index 00000000..67114c1b
--- /dev/null
+++ b/app/Jobs/EmbedUidInMetadata.php
@@ -0,0 +1,115 @@
+<?php
+
+namespace App\Jobs;
+
+use Illuminate\Bus\Queueable;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
+use Symfony\Component\Process\Process;
+use Symfony\Component\Process\Exception\ProcessFailedException;
+
+class EmbedUidInMetadata implements ShouldQueue
+{
+ use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
+
+ protected $filePath;
+ protected $uid;
+
+ /**
+ * Create a new job instance.
+ *
+ * @return void
+ */
+ public function __construct($filePath, $uid)
+ {
+ $this->filePath = $filePath;
+ $this->uid = $uid;
+ }
+
+ /**
+ * Execute the job.
+ *
+ * @return void
+ */
+ public function handle()
+ {
+ $ext = pathinfo($this->filePath, PATHINFO_EXTENSION);
+
+ dump("Adding uuid to $this->filePath");
+
+ if (!file_exists($this->filePath)) {
+ dump("UUID Fail file does not exist");
+ return;
+ }
+
+ $tempFilePath = $this->filePath . '.tmp';
+
+ $formatMap = ['mp4' => 'mp4', 'mkv' => 'matroska'];
+ $format = $formatMap[$ext] ?? $ext;
+
+ $command = [
+ 'ffmpeg',
+ '-i',
+ $this->filePath,
+ '-c',
+ 'copy',
+ '-movflags',
+ 'use_metadata_tags',
+ '-metadata',
+ "uid=$this->uid",
+ '-f',
+ $format,
+ $tempFilePath
+ ];
+
+ $process = new Process($command);
+ $process->run();
+
+ if (!$process->isSuccessful()) {
+ throw new ProcessFailedException($process);
+ }
+
+ if (file_exists($tempFilePath)) {
+ // Get the original file's timestamps
+ // $originalCreatedTime = filectime($this->filePath);
+ $originalModifiedTime = filemtime($this->filePath);
+ // Replace the original file with the temporary file
+ rename($tempFilePath, $this->filePath);
+ // Restore the original timestamps
+ // touch($this->filePath, $originalModifiedTime, $originalCreatedTime);
+ touch($this->filePath, $originalModifiedTime);
+ } else {
+ throw new \Exception('Failed to create the temporary file with metadata.');
+ }
+ }
+
+ private function getUidFromMetadata($filePath)
+ {
+ $command = [
+ 'ffprobe',
+ '-v',
+ 'quiet',
+ '-print_format',
+ 'json',
+ '-show_format',
+ $filePath,
+ ];
+
+ // Execute the FFmpeg command
+ $process = new Process($command);
+ $process->run();
+
+ // Check if the process was successful
+ if (!$process->isSuccessful()) {
+ throw new ProcessFailedException($process);
+ }
+
+ $output = $process->getOutput(); // Decode JSON output
+ $metadata = json_decode($output, true);
+ dump($metadata);
+
+ return isset($metadata['format']['tags']['uid']) ? $metadata['format']['tags']['uid'] : (isset($metadata['format']['tags']['UID']) ? $metadata['format']['tags']['UID'] : null);
+ }
+}
diff --git a/app/Jobs/IndexFiles.php b/app/Jobs/IndexFiles.php
index b2ad450f..69895450 100755
--- a/app/Jobs/IndexFiles.php
+++ b/app/Jobs/IndexFiles.php
@@ -9,13 +9,16 @@ use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Storage;
-use Illuminate\Support\Facades\File;
+use Illuminate\Support\Str;
use App\Models\Category;
use App\Models\Folder;
use App\Models\Metadata;
use App\Models\Series;
use App\Models\Video;
-use PDO;
+
+use Symfony\Component\Process\Exception\ProcessFailedException;
+use Symfony\Component\Process\Process;
+use Ramsey\Uuid\Uuid;
class IndexFiles implements ShouldQueue, ShouldBeUnique
{
@@ -125,6 +128,7 @@ class IndexFiles implements ShouldQueue, ShouldBeUnique
foreach ($videos as $videoChange) { // for each in stored, remove from new (delete)
$changeID = $videoChange['id'];
+ $changeUUID = $videoChange["uuid"];
$changeName = $videoChange["name"];
$changePath = $videoChange["path"];
$changeFolderID = $videoChange["folder_id"];
@@ -132,7 +136,7 @@ class IndexFiles implements ShouldQueue, ShouldBeUnique
$changeAction = $videoChange["action"];
if ($changeAction === "INSERT") {
- $dbOut .= "INSERT INTO [Videos] VALUES ({$changeID}, {$changeName}, {$changePath}, {$changeFolderID}, {$changeDate} );\n"; // insert
+ $dbOut .= "INSERT INTO [Videos] VALUES ({$changeID}, {$changeUUID}, {$changeName}, {$changePath}, {$changeFolderID}, {$changeDate} );\n"; // insert
$transaction = $videoChange;
unset($transaction["action"]);
@@ -146,8 +150,9 @@ class IndexFiles implements ShouldQueue, ShouldBeUnique
foreach ($metaDataEntries as $metadataChange) { // log metadata additions
$videoID = $metadataChange['video_id'];
$compositeID = $metadataChange["composite_id"];
+ $uuid = $metadataChange['uuid'];
- $dbOut .= "INSERT INTO [metadata] VALUES ({$videoID}, {$compositeID});\n"; // insert
+ $dbOut .= "INSERT INTO [metadata] VALUES ({$videoID}, {$compositeID}, {$uuid});\n"; // insert
array_push($metadataTransactions, $metadataChange);
}
@@ -245,16 +250,16 @@ class IndexFiles implements ShouldQueue, ShouldBeUnique
$seriesChanges = array();
- /*
+ /*
foreach ($stored as $savedFolder){ // O(n) where n = number of already known categories
$currentID = max($currentID, $savedFolder["id"] + 1); // gets max currently used id
$cost ++;
-
+
Double Foreach loop
- o(M*N) where M = number of categories and N = number of files in each category
+ o(M*N) where M = number of categories and N = number of files in each category
really becomes O(n) where n = number of files since N is not constant
-
+
for each folder in each category
key = category/folder
if isset in stored
@@ -263,9 +268,9 @@ class IndexFiles implements ShouldQueue, ShouldBeUnique
add to current -> key, id, basename(folder)
remove from stored
continue
- else
+ else
// new folder not seen before
-
+
add to current -> key, id, basename(folder) ?
add to changes (insert)
id += 1;
@@ -334,9 +339,9 @@ class IndexFiles implements ShouldQueue, ShouldBeUnique
/*
Double Foreach loop
- o(M*N) where M = number of categories and N = number of files in each category
+ o(M*N) where M = number of categories and N = number of files in each category
really becomes O(n) where n = number of files since N is not constant
-
+
for each video in each category
folder = parent directory of video
key = category/folder/video
@@ -346,14 +351,14 @@ class IndexFiles implements ShouldQueue, ShouldBeUnique
add to current -> key, id, basename(folder)
remove from stored
continue
- else
+ else
// new folder not seen before
-
+
add to current -> key, id, basename(folder) ?
add to changes (insert)
id += 1;
-
+
*/
foreach ($scannedFolders as $folder) { // O(n) where n = number of folders * 2 (for scan)
@@ -367,11 +372,27 @@ class IndexFiles implements ShouldQueue, ShouldBeUnique
$files = Storage::files("$path$folder"); // Immediate folders (dont scan sub folders)
$foldersCopy[$folder]['last_scan'] = $folderAccessTime;
+ // $count = 0;
foreach ($files as $file) {
$cost++;
+ $absolutePath = str_replace('\\', '/', Storage::path('')) . $file;
+
$ext = pathinfo($file, PATHINFO_EXTENSION);
if (strtolower($ext) !== 'mp4' && strtolower($ext) !== 'mkv') continue;
+ $uuid = $this->getUidFromMetadata($absolutePath);
+
+ if (!$uuid || !Uuid::isValid($uuid)) {
+ // dump("uuid does not exist for $file as it is $uuid");
+ $uuid = Str::uuid()->toString();
+ // if ($count < 1) {
+ EmbedUidInMetadata::dispatch($absolutePath, $uuid);
+ // $this->embedUidInMetadata($absolutePath, $uuid);
+ // }
+ // $count += 1;
+ // dd('F');
+ }
+
$name = basename($file);
$cleanName = basename($file, ".$ext");
$key = "storage/" . basename($path) . "/$folder/$name";
@@ -380,8 +401,8 @@ class IndexFiles implements ShouldQueue, ShouldBeUnique
$current[$key] = $stored[$key]; // add to current
unset($stored[$key]); // remove from stored
} else {
- $generated = array("id" => $currentID, "name" => $cleanName, "path" => $key, "folder_id" => $folderStructure[$folder]["id"], "date" => date("Y-m-d g:i A", filemtime($rawFile)), "action" => "INSERT");
- $metadata = array("video_id" => $currentID, "composite_id" => "$folder/$name");
+ $generated = array("id" => $currentID, "uuid" => $uuid, "name" => $cleanName, "path" => $key, "folder_id" => $folderStructure[$folder]["id"], "date" => date("Y-m-d g:i A", filemtime($rawFile)), "action" => "INSERT");
+ $metadata = array("video_id" => $currentID, "composite_id" => "$folder/$name", "uuid" => $uuid);
$current[$key] = $currentID; // add to current
array_push($changes, $generated); // add to new (insert)
array_push($metadataChanges, $metadata); // create metadata (insert)
@@ -395,7 +416,7 @@ class IndexFiles implements ShouldQueue, ShouldBeUnique
$current[$video] = $stored[$video]; // see video
continue;
}
- $generated = array("id" => $remainingID, "name" => null, "path" => null, "folder_id" => null, "date" => null, "action" => "DELETE"); // delete by id
+ $generated = array("id" => $remainingID, "uuid" => null, "name" => null, "path" => null, "folder_id" => null, "date" => null, "action" => "DELETE"); // delete by id
array_push($changes, $generated); // add to new (delete)
$cost++;
}
@@ -406,4 +427,80 @@ class IndexFiles implements ShouldQueue, ShouldBeUnique
$data["videoStructure"] = $current;
return array("videoChanges" => $changes, "data" => $data, "cost" => $cost, "updatedFolderStructure" => $foldersCopy, "metadataChanges" => $metadataChanges);
}
+
+ private function getUidFromMetadata($filePath)
+ {
+ $command = [
+ 'ffprobe',
+ '-v',
+ 'quiet',
+ '-print_format',
+ 'json',
+ '-show_format',
+ $filePath,
+ ];
+
+ // Execute the FFmpeg command
+ $process = new Process($command);
+ $process->run();
+
+ // Check if the process was successful
+ if (!$process->isSuccessful()) {
+ throw new ProcessFailedException($process);
+ }
+
+ $output = $process->getOutput(); // Decode JSON output
+ $metadata = json_decode($output, true);
+ // dump($metadata);
+
+ return isset($metadata['format']['tags']['uid']) ? $metadata['format']['tags']['uid'] : (isset($metadata['format']['tags']['UID']) ? $metadata['format']['tags']['UID'] : null);
+ }
+
+ // private function embedUidInMetadata($filePath, $uid)
+ // {
+
+ // $ext = pathinfo($filePath, PATHINFO_EXTENSION);
+ // // Define a temporary file path with the correct extension
+ // $tempFilePath = $filePath . '.tmp';
+
+ // // Map file extensions to FFmpeg formats
+ // $formatMap = ['mp4' => 'mp4', 'mkv' => 'matroska'];
+ // // Determine the correct format to use
+ // $format = isset($formatMap[$ext]) ? $formatMap[$ext] : $ext;
+
+ // $command = [
+ // 'ffmpeg',
+ // '-i',
+ // $filePath,
+ // '-c',
+ // 'copy',
+ // '-movflags',
+ // 'use_metadata_tags',
+ // '-metadata',
+ // "uid=$uid",
+ // '-f',
+ // $format,
+ // $tempFilePath
+ // ];
+ // // Execute the FFmpeg command
+ // $process = new Process($command);
+ // $process->run();
+
+ // // Check if the process was successful
+ // if (!$process->isSuccessful()) {
+ // throw new ProcessFailedException($process);
+ // }
+ // // Replace the original file with the temporary file
+ // if (file_exists($tempFilePath)) {
+ // // Get the original file's timestamps
+ // $originalCreatedTime = filectime($filePath);
+ // $originalModifiedTime = filemtime($filePath);
+ // // Replace the original file with the temporary file
+ // rename($tempFilePath, $filePath);
+ // // Restore the original timestamps
+ // touch($filePath, $originalModifiedTime, $originalCreatedTime);
+ // } else {
+ // throw new Exception('Failed to create the temporary file with metadata.');
+ // }
+ // }
}
diff --git a/app/Jobs/VerifyFiles.php b/app/Jobs/VerifyFiles.php
index 32fe996e..75091d95 100755
--- a/app/Jobs/VerifyFiles.php
+++ b/app/Jobs/VerifyFiles.php
@@ -4,9 +4,9 @@ namespace App\Jobs;
use App\Models\Metadata;
use App\Models\Record;
-use App\Models\Video;
use Illuminate\Bus\Batchable;
use Illuminate\Bus\Queueable;
+use Illuminate\Support\Str;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
@@ -49,8 +49,34 @@ class VerifyFiles implements ShouldQueue
try {
$stored = array();
$changes = array();
+ $compositeId = $video->folder->path . "/" . basename($video->path);
+ $uuid = $video->uuid ?? Str::uuid()->toString();
+ $filePath = str_replace('\\', '/', Storage::path('')) . 'public/media/' . $video->folder->path . "/" . basename($video->path);
+
+ // if the video in db does not have a uuid saved, it will add it in both the db and on the file. This replaces any existing uuid on the file not known to the db.
+ if (is_null($video->uuid)) {
+ EmbedUidInMetadata::dispatch($filePath, $uuid);
+ $video->update(['uuid' => $uuid]);
+ }
+
+ $metadata = Metadata::where('uuid', $uuid)->orWhere('composite_id', $compositeId)->first();
+
+ if (!$metadata) {
+ dump('Create metadata');
+ $metadata = Metadata::create(['uuid' => $uuid, 'composite_id' => $compositeId, 'video_id' => $video->id]);
+ } else {
+ dump($metadata->id);
+ }
+
+ if (is_null($metadata->uuid)) {
+ $changes['uuid'] = $uuid;
+ }
+
+ if (is_null($metadata->composite_id)) {
+ $changes['composite_id'] = $compositeId;
+ }
- $metadata = Metadata::firstOrCreate(['composite_id' => $video->folder->path . "/" . basename($video->path)], ['video_id' => $video->id]);
+ // $metadata = Metadata::firstOrCreate(['composite_id' => $video->folder->path . "/" . basename($video->path)], ['video_id' => $video->id]);
$stored = $metadata->toArray();
preg_match('![sS][0-9]+!', $video->name, $seasonRaw);
@@ -63,7 +89,7 @@ class VerifyFiles implements ShouldQueue
// dump(str_replace('\\', '/', Storage::path('')) . 'public/' . substr($video->path, 8));
$ffprobe = FFMpegFFProbe::create();
$duration = floor($ffprobe
- ->format(str_replace('\\', '/', Storage::path('')) . 'public/' . substr($video->path, 8)) // extracts file information
+ ->format($filePath) // extracts file information
->get('duration'));
$changes['duration'] = $duration;
}
@@ -99,7 +125,7 @@ class VerifyFiles implements ShouldQueue
try {
if (count($transactions) == 0 || $error == true) return;
- Metadata::upsert($transactions, 'id', ['video_id', 'title', 'duration', 'season', 'episode', 'view_count']);
+ Metadata::upsert($transactions, 'id', ['video_id', 'title', 'duration', 'season', 'episode', 'view_count', 'uuid']);
// Video::upsert($transactions, 'id', ['title','duration','season','episode','view_count']);
dump('Updated ' . count($transactions) . ' videos from id ' . ($transactions[0]['video_id']) . ' to ' . ($transactions[count($transactions) - 1]['video_id']));
} catch (\Throwable $th) {
diff --git a/app/Models/Metadata.php b/app/Models/Metadata.php
index 7d4bae50..4ab889d9 100644
--- a/app/Models/Metadata.php
+++ b/app/Models/Metadata.php
@@ -13,6 +13,7 @@ class Metadata extends Model
use HasFactory;
protected $fillable = [
+ 'uuid',
'composite_id',
'video_id',
'editor_id',
diff --git a/app/Models/Video.php b/app/Models/Video.php
index 8d4c60cb..9b45a04d 100755
--- a/app/Models/Video.php
+++ b/app/Models/Video.php
@@ -19,14 +19,17 @@ class Video extends Model
'duration',
'episode',
'season',
- 'view_count'
+ 'view_count',
+ 'uuid',
];
- public function folder(): BelongsTo{
+ public function folder(): BelongsTo
+ {
return $this->belongsTo(Folder::class);
}
- public function metadata(): HasOne{
+ public function metadata(): HasOne
+ {
return $this->hasOne(Metadata::class);
}
}
diff --git a/database/migrations/2024_11_17_175621_add_uuid_to_videos_table.php b/database/migrations/2024_11_17_175621_add_uuid_to_videos_table.php
new file mode 100644
index 00000000..d00fe76e
--- /dev/null
+++ b/database/migrations/2024_11_17_175621_add_uuid_to_videos_table.php
@@ -0,0 +1,28 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ */
+ public function up(): void
+ {
+ Schema::table('videos', function (Blueprint $table) {
+ $table->uuid('uuid')->after('folder_id')->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('videos', function (Blueprint $table) {
+ $table->dropColumn('uuid');
+ });
+ }
+};
diff --git a/database/migrations/2024_11_17_175631_add_uuid_to_metadata_table.php b/database/migrations/2024_11_17_175631_add_uuid_to_metadata_table.php
new file mode 100644
index 00000000..69807525
--- /dev/null
+++ b/database/migrations/2024_11_17_175631_add_uuid_to_metadata_table.php
@@ -0,0 +1,28 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ */
+ public function up(): void
+ {
+ Schema::table('metadata', function (Blueprint $table) {
+ $table->uuid('uuid')->after('composite_id')->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('metadata', function (Blueprint $table) {
+ $table->dropColumn('uuid');
+ });
+ }
+};
diff --git a/package-lock.json b/package-lock.json
index 093d3c19..b1081c18 100755
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,6 +12,7 @@
"@vueuse/components": "^10.11.0",
"@vueuse/core": "^10.11.0",
"@vueuse/integrations": "^11.0.0",
+ "concurrently": "^9.1.0",
"focus-trap": "^7.5.4",
"lodash.clonedeep": "^4.5.0",
"lodash.isequal": "^4.5.0",
@@ -2338,6 +2339,93 @@
"node": ">=6.0"
}
},
+ "node_modules/cliui": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
+ "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
+ "license": "ISC",
+ "dependencies": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.1",
+ "wrap-ansi": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/cliui/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/cliui/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/cliui/node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "license": "MIT"
+ },
+ "node_modules/cliui/node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/cliui/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/cliui/node_modules/wrap-ansi": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -2380,6 +2468,46 @@
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"devOptional": true
},
+ "node_modules/concurrently": {
+ "version": "9.1.0",
+ "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-9.1.0.tgz",
+ "integrity": "sha512-VxkzwMAn4LP7WyMnJNbHN5mKV9L2IbyDjpzemKr99sXNR3GqRNMMHdm7prV1ws9wg7ETj6WUkNOigZVsptwbgg==",
+ "license": "MIT",
+ "dependencies": {
+ "chalk": "^4.1.2",
+ "lodash": "^4.17.21",
+ "rxjs": "^7.8.1",
+ "shell-quote": "^1.8.1",
+ "supports-color": "^8.1.1",
+ "tree-kill": "^1.2.2",
+ "yargs": "^17.7.2"
+ },
+ "bin": {
+ "conc": "dist/bin/concurrently.js",
+ "concurrently": "dist/bin/concurrently.js"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/open-cli-tools/concurrently?sponsor=1"
+ }
+ },
+ "node_modules/concurrently/node_modules/supports-color": {
+ "version": "8.1.1",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
+ "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/supports-color?sponsor=1"
+ }
+ },
"node_modules/confbox": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.7.tgz",
@@ -3075,6 +3203,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "license": "ISC",
+ "engines": {
+ "node": "6.* || 8.* || >= 10.*"
+ }
+ },
"node_modules/get-stream": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
@@ -3481,8 +3618,7 @@
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
- "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
- "dev": true
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"node_modules/lodash.clonedeep": {
"version": "4.5.0",
@@ -4162,6 +4298,15 @@
"integrity": "sha512-8g3/Otx1eJaVD12e31UbJj1YzdtVvzH85HV7t+9MJYk/u3XmkOUJ5Ys9wQrf9PCPK8+xn4ymzqYCiZl6QWKn+A==",
"license": "MIT"
},
+ "node_modules/require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/resolve": {
"version": "1.22.8",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
@@ -4254,6 +4399,15 @@
"queue-microtask": "^1.2.2"
}
},
+ "node_modules/rxjs": {
+ "version": "7.8.1",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz",
+ "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "tslib": "^2.1.0"
+ }
+ },
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
@@ -4332,6 +4486,15 @@
"node": ">=8"
}
},
+ "node_modules/shell-quote": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz",
+ "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/signal-exit": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
@@ -4684,6 +4847,15 @@
"node": ">=8.0"
}
},
+ "node_modules/tree-kill": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz",
+ "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==",
+ "license": "MIT",
+ "bin": {
+ "tree-kill": "cli.js"
+ }
+ },
"node_modules/ts-api-utils": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.0.tgz",
@@ -4702,6 +4874,12 @@
"resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",
"integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA=="
},
+ "node_modules/tslib": {
+ "version": "2.8.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
+ "license": "0BSD"
+ },
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@@ -5253,6 +5431,15 @@
"node": ">=12"
}
},
+ "node_modules/y18n": {
+ "version": "5.0.8",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/yaml": {
"version": "2.3.4",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz",
@@ -5261,6 +5448,74 @@
"node": ">= 14"
}
},
+ "node_modules/yargs": {
+ "version": "17.7.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
+ "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
+ "license": "MIT",
+ "dependencies": {
+ "cliui": "^8.0.1",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.3",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^21.1.1"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/yargs-parser": {
+ "version": "21.1.1",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
+ "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/yargs/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/yargs/node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "license": "MIT"
+ },
+ "node_modules/yargs/node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/yargs/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/yocto-queue": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
diff --git a/package.json b/package.json
index 1cd18dc4..c838ea79 100755
--- a/package.json
+++ b/package.json
@@ -5,7 +5,10 @@
"dev": "vite",
"php:serve": "php artisan serve",
"php:pail": "php artisan pail",
+ "php:queue": "php artisan queue:listen",
+ "php:scheduler": "php artisan schedule:work",
"vite:dev": "concurrently -k -p \"[{name}]\" -c \"blue.bold,green.bold,red.bold\" \"npm:php:serve\" \"npm:php:pail\" \"npm:dev\"",
+ "vite:cron": "concurrently -k -p \"[{name}]\" -c \"blue.bold,green.bold,red.bold\" \"npm:php:queue\" \"npm:php:scheduler\" \"npm:dev\"",
"build": "vite build",
"lint": "eslint",
"lintold": "eslint ./resources/js --ext .js,.vue --ignore-path .gitignore --fix src",
@@ -41,6 +44,7 @@
"@vueuse/components": "^10.11.0",
"@vueuse/core": "^10.11.0",
"@vueuse/integrations": "^11.0.0",
+ "concurrently": "^9.1.0",
"focus-trap": "^7.5.4",
"lodash.clonedeep": "^4.5.0",
"lodash.isequal": "^4.5.0",