Skip to content

A self-hosted media server and file management system

upload date wip

aminnausine19857284d17
diff --git a/app/Jobs/IndexFiles.php b/app/Jobs/IndexFiles.php
index 051bc377..91f196d3 100755
--- a/app/Jobs/IndexFiles.php
+++ b/app/Jobs/IndexFiles.php
@@ -214,8 +214,9 @@ class IndexFiles implements ShouldBeUnique, ShouldQueue {
$file_size = $metadataChange['file_size'];
$duration = $metadataChange['duration'];
$date_scanned = $metadataChange['date_scanned'];
+ $date_uploaded = $metadataChange['date_uploaded'];
- $dbOut .= "UPSERT INTO [metadata] VALUES ({$videoID}, {$compositeID}, {$uuid}, {$file_size}, {$duration}, {$date_scanned});\n\n"; // upsert
+ $dbOut .= "UPSERT INTO [metadata] VALUES ({$videoID}, {$compositeID}, {$uuid}, {$file_size}, {$duration}, {$date_scanned}, {$date_uploaded});\n\n"; // upsert
array_push($metadataTransactions, $metadataChange);
}
@@ -496,8 +497,12 @@ class IndexFiles implements ShouldBeUnique, ShouldQueue {
}
// 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')];
+
+ $mtime = filemtime($rawFile);
+ $ctime = filectime($rawFile);
+
+ $generated = ['id' => $currentID, 'uuid' => $embeddingUuid ? null : $uuid, 'name' => $cleanName, 'path' => $key, 'folder_id' => $folderStructure[$folder]['id'], 'date' => date('Y-m-d h:i A', $mtime < $ctime ? $mtime : $ctime), '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'), 'date_uploaded' => date('Y-m-d h:i A', $mtime < $ctime ? $mtime : $ctime)];
$current[$key] = $currentID; // add to current
array_push($changes, $generated); // add to new (insert)
array_push($metadataChanges, $metadata); // create metadata (insert)
diff --git a/database/migrations/2025_01_23_202554_add_date_uploaded_to_metadata.php b/database/migrations/2025_01_23_202554_add_date_uploaded_to_metadata.php
new file mode 100644
index 00000000..2e679433
--- /dev/null
+++ b/database/migrations/2025_01_23_202554_add_date_uploaded_to_metadata.php
@@ -0,0 +1,25 @@
+<?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->timestamp('date_uploaded')->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void {
+ Schema::table('metadata', function (Blueprint $table) {
+ $table->dropColumn('date_uploaded');
+ });
+ }
+};
diff --git a/resources/js/components/cards/CategoryFolderCard.vue b/resources/js/components/cards/CategoryFolderCard.vue
index 176d6160..7694bebc 100644
--- a/resources/js/components/cards/CategoryFolderCard.vue
+++ b/resources/js/components/cards/CategoryFolderCard.vue
@@ -20,7 +20,7 @@ const popover = useTemplateRef('popover');
<template>
<div class="flex flex-col rounded-xl shadow-lg dark:bg-primary-dark-800/70 bg-white dark:hover:bg-primary-dark-600 hover:bg-primary-800 ring-1 ring-gray-900/5 w-full group">
- <RouterLink :to="`/${data?.name}`" class="w-full h-40">
+ <RouterLink :to="`/${data?.path}`" class="w-full h-40">
<img
class="w-full h-full object-cover rounded-t-md shadow-sm mb-auto ring-1 ring-gray-900/5"
:src="