A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
increase timeout, dont check for uuid when indexing if file is not new, and prevent ending the task on batch end if the task is still processing
aminnausin1753d1bd56c0
diff --git a/app/Http/Controllers/DirectoryController.php b/app/Http/Controllers/DirectoryController.phpindex 10b4779f..4e0627c7 100755--- a/app/Http/Controllers/DirectoryController.php+++ b/app/Http/Controllers/DirectoryController.php@@ -377,6 +377,11 @@ class DirectoryController extends Controller {TaskStatus::INCOMPLETE :TaskStatus::COMPLETED));++ if ($task->status == TaskStatus::PROCESSING) {+ return;+ }+$ended_at = now();try {diff --git a/app/Jobs/EmbedUidInMetadata.php b/app/Jobs/EmbedUidInMetadata.phpindex 32ac61a9..d0ec52fd 100644--- a/app/Jobs/EmbedUidInMetadata.php+++ b/app/Jobs/EmbedUidInMetadata.php@@ -36,7 +36,7 @@ class EmbedUidInMetadata implements ShouldQueue {protected $taskService;- public $timeout = 1200;+ public $timeout = 3600;/*** Create a new job instance.@@ -161,6 +161,7 @@ class EmbedUidInMetadata implements ShouldQueue {];$process = new Process($command);+ $process->setTimeout(3600);$process->run();if (! $process->isSuccessful()) {diff --git a/app/Jobs/IndexFiles.php b/app/Jobs/IndexFiles.phpindex 02e64da6..32686a10 100755--- a/app/Jobs/IndexFiles.php+++ b/app/Jobs/IndexFiles.php@@ -454,27 +454,29 @@ class IndexFiles implements ShouldBeUnique, ShouldQueue {continue;}- $fileMetaData = VerifyFiles::getFileMetadata($absolutePath);- $uuid = isset($fileMetaData['tags']['uuid']) ? $fileMetaData['tags']['uuid'] : (isset($fileMetaData['tags']['uid']) ? $fileMetaData['tags']['uid'] : null);- $embeddingUuid = false;- if (! $uuid || ! Uuid::isValid($uuid)) {- $uuid = Str::uuid()->toString();- $this->embedChain[] = new EmbedUidInMetadata($absolutePath, $uuid, $this->taskId, $currentID);- $embeddingUuid = true;- // $this->embedChain[] = ["path" => $absolutePath, "uid" => $uuid];- // EmbedUidInMetadata::dispatch($absolutePath, $uuid, $this->taskId);- }-$name = basename($file);$cleanName = basename($file, ".$ext");$key = 'storage/' . basename($path) . "/$folder/$name";$rawFile = "$rawPath$file";+if (isset($stored[$key])) {$current[$key] = $stored[$key]; // add to currentunset($stored[$key]); // remove from stored} else {$mime_type = File::mimeType($absolutePath) ?? null;+ // Only check uuid on new videos, old video uuid will be checked in verify files with chunking+ $fileMetaData = VerifyFiles::getFileMetadata($absolutePath);+ $uuid = isset($fileMetaData['tags']['uuid']) ? $fileMetaData['tags']['uuid'] : (isset($fileMetaData['tags']['uid']) ? $fileMetaData['tags']['uid'] : null);+ $embeddingUuid = false;+ if (! $uuid || ! Uuid::isValid($uuid)) {+ $uuid = Str::uuid()->toString();+ $this->embedChain[] = new EmbedUidInMetadata($absolutePath, $uuid, $this->taskId, $currentID);+ $embeddingUuid = true;+ // $this->embedChain[] = ["path" => $absolutePath, "uid" => $uuid];+ // EmbedUidInMetadata::dispatch($absolutePath, $uuid, $this->taskId);+ }+// Dont add uuid to video if embedding job is to be scheduled. This prevents not knowing if the uuid was applied to the video in case a job fails.$generated = ['id' => $currentID, 'uuid' => $embeddingUuid ? null : $uuid, 'name' => $cleanName, 'path' => $key, 'folder_id' => $folderStructure[$folder]['id'], 'date' => date('Y-m-d h:i A', filemtime($rawFile)), 'action' => 'INSERT'];$metadata = ['video_id' => $currentID, 'composite_id' => "$folder/$name", 'uuid' => $uuid, 'file_size' => filesize($rawFile), 'duration' => isset($fileMetaData['duration']) ? (int) $fileMetaData['duration'] : null, 'mime_type' => $mime_type ?? null, 'date_scanned' => date('Y-m-d h:i:s A')];diff --git a/config/queue.php b/config/queue.phpindex eb0b505b..384b02cf 100755--- a/config/queue.php+++ b/config/queue.php@@ -41,6 +41,7 @@ return ['queue' => env('DB_QUEUE', 'default'),'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),'after_commit' => false,+ 'timeout' => 3600,],'database_high' => [diff --git a/package.json b/package.jsonindex 87f8718a..b08d9ac9 100755--- a/package.json+++ b/package.json@@ -5,7 +5,7 @@"dev": "vite","php:serve": "php artisan serve","php:pail": "php artisan pail",- "php:queue": "php artisan queue:listen",+ "php:queue": "php artisan queue:listen --timeout=3600","php:queue-high": "php artisan queue:listen --queue=high","php:pulse": "php artisan pulse:check","php:scheduler": "php artisan schedule:work",diff --git a/resources/js/components/cards/CategoryCard.vue b/resources/js/components/cards/CategoryCard.vueindex aff597f7..e1dd2913 100644--- a/resources/js/components/cards/CategoryCard.vue+++ b/resources/js/components/cards/CategoryCard.vue@@ -93,7 +93,7 @@ watch(<h3 class="capitalize group-hover:text-purple-600">{{ data?.name }}</h3>- <span class="flex flex-wrap gap-2 [&>*]:h-6 text-sm">+ <span class="flex gap-2 [&>*]:h-6 text-sm"><!-- <ButtonText class="hidden 2xl:flex" :title="'Scan for Folder Changes'" @click="handleStartScan"><template #text> Scan </template><template #icon> <ProiconsArrowSync class="h-4 w-4" /></template>diff --git a/resources/js/components/cards/TaskCard.vue b/resources/js/components/cards/TaskCard.vueindex 016e028b..d07d3a88 100644--- a/resources/js/components/cards/TaskCard.vue+++ b/resources/js/components/cards/TaskCard.vue@@ -136,7 +136,7 @@ watch(:class="`grid xs:grid-cols-2 col-span-3 md:col-span-2 gap-x-4`":title="`Sub Tasks: ${data.sub_tasks_total}\n\nPending: ${data.sub_tasks_pending}\n\nCompleted: ${data.sub_tasks_complete}\n\nFailed: ${data.sub_tasks_failed}`">- <h4 class="text-xs text-neutral-500 dark:text-neutral-400 truncate line-clamp-1 capitalize w-20">Sub Tasks: {{ data.sub_tasks_total }}</h4>+ <h4 class="text-xs text-neutral-500 dark:text-neutral-400 truncate line-clamp-1 capitalize w-24">Sub Tasks: {{ data.sub_tasks_total }}</h4><h4 class="text-xs text-neutral-500 dark:text-neutral-400 truncate line-clamp-1 capitalize" v-if="data.sub_tasks_failed">Failed: {{ data.sub_tasks_failed }}</h4>