A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
Add new columns to videos
aminnausin59e3023d6d8e
diff --git a/app/Http/Resources/VideoResource.php b/app/Http/Resources/VideoResource.phpindex c7915e28..595d3e9a 100644--- a/app/Http/Resources/VideoResource.php+++ b/app/Http/Resources/VideoResource.php@@ -19,7 +19,13 @@ class VideoResource extends JsonResource'attributes' => ['name' => $this->name,'path' => $this->path,- 'date' => $this->date+ 'date' => $this->date,+ 'date_raw' => $this->date_raw,+ 'title' => $this->title ?? $this->name,+ 'duration' => $this->duration,+ 'episode' => $this->episode,+ 'season' => $this->season,+ 'view_count' => $this->view_count],'relationships' => ['folder_id' => (string)$this->folder->iddiff --git a/database/migrations/2024_07_28_222604_add_meta_data_to_videos_table.php b/database/migrations/2024_07_28_222604_add_meta_data_to_videos_table.phpnew file mode 100644index 00000000..92ecdf34--- /dev/null+++ b/database/migrations/2024_07_28_222604_add_meta_data_to_videos_table.php@@ -0,0 +1,40 @@+<?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->integer('date_raw')->nullable()->after('date');+ $table->string('title')->nullable();+ $table->integer('duration')->nullable();+ $table->integer('episode')->nullable();+ $table->integer('season')->nullable();+ $table->integer('view_count')->nullable();+ });+ }++ /**+ * Reverse the migrations.+ */+ public function down(): void+ {+ Schema::table('videos', function (Blueprint $table) {+ //+ $table->dropColumn('date_raw');+ $table->dropColumn('title');+ $table->dropColumn('duration');+ $table->dropColumn('episode');+ $table->dropColumn('season');+ $table->dropColumn('view_count');+ });+ }+};diff --git a/resources/js/components/cards/VideoCard.vue b/resources/js/components/cards/VideoCard.vueindex cf5c9b4b..998c65df 100644--- a/resources/js/components/cards/VideoCard.vue+++ b/resources/js/components/cards/VideoCard.vue@@ -17,11 +17,11 @@ const handlePlay = () => {class="shadow vid-row w-full rounded-md dark:bg-neutral-800 dark:hover:bg-indigo-900 bg-gray-100 hover:bg-violet-300 odd:bg-violet-100 hover:odd:bg-violet-300 dark:odd:bg-zinc-700 dark:hover:odd:bg-indigo-900 p-3 flex ring-inset flex-wrap flex-col sm:flex-row sm:flex-nowrap":data-id="props.video.id" :data-path="`../${props.video.attributes.path}`" @click="handlePlay"><td class="flex gap-12 w-full">- <p class="vid-row-title w-full xl:min-w-48 sm:max-w-1/2 sm:w-auto flex justify-between items-center gap-12 sm:gap-0"><span class="sm:hidden">Title: </span><span class="line-clamp-1">{{ props.video.attributes.name }}</span></p>- <p class="vid-row-duration truncate hidden sm:block">20m 30s</p>+ <p class="vid-row-title w-full xl:min-w-48 sm:max-w-1/2 sm:w-auto flex justify-between items-center gap-12 sm:gap-0"><span class="sm:hidden">Title: </span><span class="line-clamp-1">{{ props.video.attributes.title ?? props.video.attributes.name }}</span></p>+ <p class="vid-row-duration truncate hidden sm:block">{{ props.video.attributes.duration ?? 'N/A' }}</p></td><td class="flex gap-12 w-full sm:justify-end">- <p class="vid-row-title truncate hidden sm:block">20 Views</p>+ <p class="vid-row-title truncate hidden sm:block">{{ props.video.attributes.view_count ?? 'No Views' }}</p><p class="vid-row-date w-full xl:min-w-36 sm:max-w-1/3 sm:w-auto flex justify-between items-center gap-12 sm:gap-0"><span class="sm:hidden">Date: </span><span class="line-clamp-1">{{ toFormattedDate(new Date(props.video.attributes.date + ' GMT')) }}</span></p></td></tr>diff --git a/resources/js/components/video/VideoPlayer.vue b/resources/js/components/video/VideoPlayer.vueindex 31293f41..7249d838 100644--- a/resources/js/components/video/VideoPlayer.vue+++ b/resources/js/components/video/VideoPlayer.vue@@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia';import { useContentStore } from '../../stores/ContentStore';import { computed, ref, watch } from 'vue';+// Heatmap can be composableconst heatMapData = ref([{ x: 25, y: 60 }, { x: 154, y: 48 }, { x: 266, y: 12 }, { x: 585, y: 18 },{ x: 799, y: 16 }, { x: 1000, y: 100 }]);const heatMap = computed(() => {const start = 'M 0.0,100.0 ';diff --git a/resources/js/use/useMedia.js b/resources/js/use/useMedia.jsdeleted file mode 100644index 7a243bd0..00000000--- a/resources/js/use/useMedia.js+++ /dev/null@@ -1,3 +0,0 @@-export function useMedia() {--}\ No newline at end of filediff --git a/resources/js/use/useRecords.js b/resources/js/use/useRecords.jsdeleted file mode 100644index 86ce55ea..00000000--- a/resources/js/use/useRecords.js+++ /dev/null@@ -1,14 +0,0 @@-import { ref } from 'vue';--/*- ACTIONS for record data ?-- Have get, add, and delete actions- Run and commit to database (store)-*/-export function useRecords() {- const records = ref(null);- const error = ref(null);-- return { records, error};-}\ No newline at end of file