Skip to content

A self-hosted media server and file management system

Add Codec, Resolution, Bitrate, Lyrics

aminnausin2251e30886a7
diff --git a/app/Jobs/VerifyFiles.php b/app/Jobs/VerifyFiles.php
index 47acd9e8..c6348f3e 100755
--- a/app/Jobs/VerifyFiles.php
+++ b/app/Jobs/VerifyFiles.php
@@ -56,6 +56,8 @@ class VerifyFiles implements ShouldQueue {
protected $embedChain = [];
+ protected $fileMetaData = [];
+
/**
* Create a new job instance.
*/
@@ -133,18 +135,18 @@ class VerifyFiles implements ShouldQueue {
$compositeId = $video->folder->path . '/' . basename($video->path);
$filePath = str_replace('\\', '/', Storage::disk('public')->path('')) . 'media/' . $video->folder->path . '/' . basename($video->path);
// $filePath = str_replace('\\', '/', Storage::path('app/private/')) . 'media/' . $video->folder->path . "/" . basename($video->path);
- $fileMetaData = is_null($video->uuid) ? $this->getFileMetadata($filePath) : []; // Empty unless uuid is missing or duration is missing
+ $this->fileMetaData = is_null($video->uuid) ? $this->getFileMetadata($filePath) : []; // Empty unless uuid is missing or duration is missing
$uuid = $video->uuid ?? ''; // video has ? file has
// if the video in db or file does not have a valid uuid, it will add it in both the db and on the file.
if (! Uuid::isValid($uuid ?? '')) {
- if (! isset($fileMetaData['tags']['uid']) && ! isset($fileMetaData['tags']['uuid'])) {
+ if (! isset($this->fileMetaData['tags']['uid']) && ! isset($this->fileMetaData['tags']['uuid'])) {
$uuid = Str::uuid()->toString();
$this->embedChain[] = new EmbedUidInMetadata($filePath, $uuid, $this->taskId, $video->id);
// $this->embedChain[] = ["path" => $filePath, "uuid" => $uuid];
// EmbedUidInMetadata::dispatch($filePath, $uuid, $this->taskId);
} else {
- $uuid = $fileMetaData['tags']['uuid'] ?? $fileMetaData['tags']['uid']; // Neet to use UUID everywhere instead of mismatching uuid with uid
+ $uuid = $this->fileMetaData['tags']['uuid'] ?? $this->fileMetaData['tags']['uid']; // Neet to use UUID everywhere instead of mismatching uuid with uid
dump("Found UUID {$uuid}");
$video->update(['uuid' => $uuid]); // If embedding, video is updated in the embed job
}
@@ -184,8 +186,8 @@ class VerifyFiles implements ShouldQueue {
$mime_type = isset($changes['mime_type']) ? $changes['mime_type'] : $metadata->mime_type;
- // if description is null and episode is null and the file is of type audio, generate description from audio tags
- $audioMetadata = is_null($metadata->description) && is_null($metadata->episode) && str_starts_with($mime_type, 'audio') ? $this->getAudioDescription($filePath, $fileMetaData ?? null) : [];
+ // if file is of type audio one of the following is true: description and episode is null, codec is null, bitrate is null => generate description from audio tags
+ $audioMetadata = ((is_null($metadata->description) && is_null($metadata->episode)) || is_null($metadata->bitrate) || is_null($metadata->codec)) && str_starts_with($mime_type, 'audio') ? $this->getAudioDescription($filePath, $this->fileMetaData ?? null) : [];
if ((is_null($metadata->poster_url) || filemtime($filePath)) && $mime_type && str_starts_with($mime_type, 'audio')) {
$relativePath = $video->folder->path . '/' . $metadata->id;
@@ -203,14 +205,35 @@ class VerifyFiles implements ShouldQueue {
preg_match('![0-9]+!', $episodeRaw[0] ?? '', $episode);
if (is_null($metadata->duration)) {
- if (! isset($fileMetaData['duration'])) {
- $fileMetaData = $this->getFileMetadata($filePath);
- }
-
- $duration = isset($fileMetaData['duration']) ? floor($fileMetaData['duration']) : null;
+ $this->confirmMetadata($filePath);
+ $duration = isset($this->fileMetaData['tags']['duration']) ? floor($this->fileMetaData['tags']['duration']) : null;
$changes['duration'] = $duration;
}
+ if ((is_null($metadata->resolution_width) || is_null($metadata->resolution_height) || is_null($metadata->frame_rate) || is_null($metadata->codec)) && ! str_starts_with($mime_type, 'audio')) {
+ $this->confirmMetadata($filePath);
+ foreach ($this->fileMetaData['streams'] as $stream) {
+ if (! isset($stream['codec_type']) || $stream['codec_type'] !== 'video' || ! isset($stream['width'])) {
+ continue;
+ }
+
+ $changes['resolution_width'] = floor($stream['width']);
+
+ if (isset($stream['height'])) {
+ $changes['resolution_height'] = floor($stream['height']);
+ }
+ if (isset($stream['codec_name'])) {
+ $changes['codec'] = $stream['codec_name'];
+ }
+ if (isset($stream['avg_frame_rate'])) {
+ [$numerator, $denominator] = explode('/', $stream['avg_frame_rate']);
+ $changes['frame_rate'] = floor($numerator / max($denominator, 1));
+ }
+
+ break;
+ }
+ }
+
if (is_null($metadata->episode)) {
$changes['episode'] = count($episode) == 1 ? (int) $episode[0] : $audioMetadata['episode'] ?? null;
}
@@ -245,6 +268,18 @@ class VerifyFiles implements ShouldQueue {
$changes['description'] = $audioMetadata['description'] ?? $video->description ?? null;
}
+ if (is_null($metadata->lyrics)) {
+ $changes['lyrics'] = $audioMetadata['lyrics'] ?? null;
+ }
+
+ if (is_null($metadata->codec)) {
+ $changes['codec'] = $audioMetadata['codec'] ?? null;
+ }
+
+ if (is_null($metadata->bitrate)) {
+ $changes['bitrate'] = $audioMetadata['bitrate'] ?? null;
+ }
+
is_null($metadata->view_count) ? $changes['view_count'] = Record::where('video_id', $video->id)->count() + ($metadata->id ? Record::where('metadata_id', $metadata->id)->count() : 0) : $stored['view_count'] = $metadata->view_count;
if (count($changes) > 0) {
@@ -277,7 +312,31 @@ class VerifyFiles implements ShouldQueue {
return 'No Changes Found';
}
- Metadata::upsert($transactions, 'id', ['video_id', 'title', 'description', 'duration', 'season', 'episode', 'view_count', 'uuid', 'file_size', 'mime_type', 'poster_url', 'date_scanned', 'date_uploaded']);
+ Metadata::upsert(
+ $transactions,
+ 'id',
+ [
+ 'video_id',
+ 'title',
+ 'description',
+ 'lyrics',
+ 'duration',
+ 'season',
+ 'episode',
+ 'view_count',
+ 'uuid',
+ 'file_size',
+ 'mime_type',
+ 'codec',
+ 'bitrate',
+ 'resolution_width',
+ 'resolution_height',
+ 'frame_rate',
+ 'poster_url',
+ 'date_scanned',
+ 'date_uploaded',
+ ]
+ );
$summary = 'Updated ' . count($transactions) . ' videos from id ' . ($transactions[0]['video_id']) . ' to ' . ($transactions[count($transactions) - 1]['video_id']);
dump($summary);
@@ -335,27 +394,61 @@ class VerifyFiles implements ShouldQueue {
$metadata['format']['tags']['uuid'] = $metadata['format']['tags']['encoder'];
} // ExifTool tag
- return $metadata['format'];
+ // return $metadata['format'];
+ return [
+ 'tags' => $metadata['format']['tags'] ?? [],
+ 'streams' => $metadata['streams'] ?? [],
+ ];
} catch (\Throwable $th) {
dump($th);
Log::error('Unable to get file metadata', ['error' => $th->getMessage()]);
- return ['tags' => []];
+ return ['tags' => [], 'streams' => []];
}
}
- private function getAudioDescription($filePath, $metadata) {
- if (is_null($metadata) || count($metadata) == 0) {
- $metadata = $this->getFileMetadata($filePath);
+ // Call get metadata when needed
+ private function confirmMetadata($filePath) {
+ if (is_null($this->fileMetaData) || count($this->fileMetaData) == 0) {
+ $this->fileMetaData = $this->getFileMetadata($filePath);
}
+ }
+
+ private function getAudioDescription($filePath) {
+ $this->confirmMetadata($filePath);
+
+ $tags = $this->fileMetaData['tags'] ?? [];
+ $streams = $this->fileMetaData['streams'] ?? [];
+
+ $description = implode(' - ', array_filter([
+ $tags['artist'] ?? '',
+ $tags['album'] ?? '',
+ ]));
- $title = $metadata['tags']['title'] ?? null;
- $description = $metadata['tags']['artist'] ?? '';
- $description = ($description ? ($description . ' - ') : '') . ($metadata['tags']['album'] ?? '');
- $season = isset($metadata['tags']['disc']) ? (int) explode($metadata['tags']['disc'], '/')[0] ?? null : null;
- $episode = isset($metadata['tags']['track']) ? (int) explode($metadata['tags']['track'], '/')[0] ?? null : null;
+ // $season = isset($this->fileMetaData['tags']['disc']) ? (int) explode($this->fileMetaData['tags']['disc'], '/')[0] ?? null : null;
+ // $episode = isset($this->fileMetaData['tags']['track']) ? (int) explode($this->fileMetaData['tags']['track'], '/')[0] ?? null : null;
+
+ $results = [
+ 'title' => $tags['title'] ?? null,
+ 'description' => $description ?: null,
+ 'season' => isset($tags['disc']) ? (int) explode('/', $tags['disc'])[0] : null,
+ 'episode' => isset($tags['track']) ? (int) explode('/', $tags['track'])[0] : null,
+ 'lyrics' => $tags['lyrics- '] ?? null,
+ ];
+
+ foreach ($streams as $stream) {
+ if (! $stream['codec_type'] == 'audio') {
+ continue;
+ }
+
+ $results = array_merge($results, array_filter([
+ 'codec' => $stream['codec_name'] ?? null,
+ 'bitrate' => $stream['bit_rate'] ?? null,
+ ]));
+ break;
+ }
- return ['title' => $title, 'description' => $description === '' ? null : $description, 'season' => $season, 'episode' => $episode];
+ return $results;
}
public static function getPathUrl($path) {
diff --git a/app/Models/Metadata.php b/app/Models/Metadata.php
index 0d4c8389..6b88f787 100644
--- a/app/Models/Metadata.php
+++ b/app/Models/Metadata.php
@@ -18,12 +18,18 @@ class Metadata extends Model {
'editor_id',
'title',
'description',
+ 'captions',
'duration',
'episode',
'season',
'view_count',
'file_size',
'mime_type',
+ 'codec',
+ 'bitrate',
+ 'resolution_width',
+ 'resolution_height',
+ 'frame_rate',
'poster_url',
'date_released',
'date_scanned',
diff --git a/database/migrations/2025_01_26_004428_add_resolution_fps_and_bitrate_to_metadata.php b/database/migrations/2025_01_26_004428_add_resolution_fps_and_bitrate_to_metadata.php
new file mode 100644
index 00000000..6f7660f4
--- /dev/null
+++ b/database/migrations/2025_01_26_004428_add_resolution_fps_and_bitrate_to_metadata.php
@@ -0,0 +1,33 @@
+<?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->unsignedInteger('resolution_width')->nullable();
+ $table->unsignedInteger('resolution_height')->nullable();
+ $table->unsignedInteger('frame_rate')->nullable();
+ $table->unsignedBigInteger('bitrate')->nullable();
+ $table->string('codec')->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void {
+ Schema::table('metadata', function (Blueprint $table) {
+ $table->dropColumn('resolution_width');
+ $table->dropColumn('resolution_height');
+ $table->dropColumn('frame_rate');
+ $table->dropColumn('bitrate');
+ $table->dropColumn('codec');
+ });
+ }
+};
diff --git a/database/migrations/2025_01_26_012457_add_lyrics_to_metadata.php b/database/migrations/2025_01_26_012457_add_lyrics_to_metadata.php
new file mode 100644
index 00000000..6b07e972
--- /dev/null
+++ b/database/migrations/2025_01_26_012457_add_lyrics_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->text('lyrics')->nullable(); // Lyrics
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void {
+ Schema::table('metadata', function (Blueprint $table) {
+ $table->dropColumn('lyrics');
+ });
+ }
+};
diff --git a/resources/js/components/cards/VideoCard.vue b/resources/js/components/cards/VideoCard.vue
index bde50d67..120adae7 100755
--- a/resources/js/components/cards/VideoCard.vue
+++ b/resources/js/components/cards/VideoCard.vue
@@ -86,24 +86,45 @@ watch(props, handlePropsUpdate, { immediate: true, deep: true });
metaData?.fields?.description
}}</span> -->
</h3>
- <h4 class="text-ellipsis text-wrap line-clamp-1 text-neutral-500 dark:text-neutral-400 text-sm min-w-fit" title="Duration">
- {{ metaData?.fields?.duration }}
- </h4>
+ <span class="flex gap-1 truncate text-neutral-500 dark:text-neutral-400 text-sm">
+ <h4 class="text-nowrap text-start truncate" :title="`File Size: ${data.file_size ? formatFileSize(data.file_size) : ''}`">
+ {{ data.file_size ? formatFileSize(data.file_size) : '' }}
+ </h4>
+ <h4 v-if="data.metadata?.codec || data.metadata?.resolution_height">|</h4>
+ <h4
+ class="text-nowrap text-start truncate uppercase"
+ :title="`File Size: ${data.file_size ? formatFileSize(data.file_size) : ''}`"
+ v-if="data.metadata?.mime_type?.includes('audio') && data.metadata.codec"
+ >
+ {{ data.metadata.codec }}
+ </h4>
+ <h4
+ class="text-nowrap text-start truncate uppercase"
+ :title="`File Size: ${data.file_size ? formatFileSize(data.file_size) : ''}`"
+ v-else-if="data.metadata?.resolution_height"
+ >
+ {{ data.metadata.resolution_height }}P
+ </h4>
+ </span>
</section>
<section class="flex flex-wrap justify-between gap-x-4 gap-y-2 w-full items-start text-sm sm:w-auto text-neutral-500 dark:text-neutral-400 group">
<span class="flex gap-2 items-center w-full flex-1">
<span class="flex gap-1 truncate">
- <h4 class="text-nowrap text-start truncate" :title="`File Size: ${data.file_size ? formatFileSize(data.file_size) : ''}`">
- {{ data.file_size ? formatFileSize(data.file_size) : '' }}
+ <h4 class="text-nowrap text-start truncate" :title="`View Count: ${metaData?.fields?.views}`">
+ {{ metaData?.fields?.views }}
</h4>
<h4>|</h4>
- <h4 class="text-nowrap text-start truncate" :title="`View Count: ${metaData?.fields?.views}`">
- {{ metaData?.fields?.views }}
+ <h4 class="text-ellipsis text-wrap line-clamp-1 min-w-fit" title="Duration">
+ {{ metaData?.fields?.duration }}
</h4>
</span>
- <span class="hidden sm:flex flex-wrap gap-1 max-h-[22px] px-2 flex-1 overflow-y-auto scrollbar-minimal scrollbar-hover" title="Tags">
+ <span
+ v-if="props.data.video_tags.length"
+ class="hidden sm:flex flex-wrap gap-1 max-h-[22px] px-2 flex-1 overflow-y-auto scrollbar-minimal scrollbar-hover"
+ title="Tags"
+ >
<ChipTag
v-for="(tag, index) in props.data?.video_tags"
v-bind:key="index"
@@ -117,7 +138,7 @@ watch(props, handlePropsUpdate, { immediate: true, deep: true });
{{ toFormattedDate(new Date(props.data?.date_uploaded ?? props.data.date + ' GMT')) }}
</h4>
- <span class="sm:hidden w-full flex flex-wrap gap-1 scrollbar-minimal scrollbar-hover" title="Tags">
+ <span v-if="props.data.video_tags.length" class="sm:hidden w-full flex flex-wrap gap-1 scrollbar-minimal scrollbar-hover" title="Tags">
<ChipTag
v-for="(tag, index) in props.data?.video_tags"
v-bind:key="index"
diff --git a/resources/js/components/pinesUI/ContextMenuItem.vue b/resources/js/components/pinesUI/ContextMenuItem.vue
index 2e4c9c6a..893582c1 100644
--- a/resources/js/components/pinesUI/ContextMenuItem.vue
+++ b/resources/js/components/pinesUI/ContextMenuItem.vue
@@ -9,7 +9,7 @@ const props = withDefaults(defineProps<ContextMenuItem>(), {});
v-if="external && url"
:href="url"
target="_blank"
- :class="`${selected ? (selectedStyle ?? 'font-bold text-violet-500') : ''} cursor-pointer relative w-full flex select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 ${style}`"
+ :class="`${selected ? (selectedStyle ?? 'font-bold text-violet-500') : ''} cursor-pointer relative w-full flex select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 ${style ?? ''}`"
>
<slot name="icon">
<component v-if="icon" :is="icon" class="w-4 h-4 mr-2" />
@@ -34,7 +34,7 @@ const props = withDefaults(defineProps<ContextMenuItem>(), {});
v-else-if="url"
:to="disabled ? '' : url"
:data-disabled="disabled"
- :class="`${selected ? (selectedStyle ?? 'font-bold text-violet-500') : ''} cursor-pointer relative w-full flex select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 ${style}`"
+ :class="`${selected ? (selectedStyle ?? 'font-bold text-violet-500') : ''} cursor-pointer relative w-full flex select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 ${style ?? ''}`"
>
<slot name="icon">
<component v-if="icon" :is="icon" class="w-4 h-4 mr-2" />
@@ -58,7 +58,7 @@ const props = withDefaults(defineProps<ContextMenuItem>(), {});
<button
v-else
:disabled="disabled"
- :class="`${selected ? (selectedStyle ?? 'font-bold text-violet-500') : ''} cursor-pointer relative w-full flex select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 ${style}`"
+ :class="`${selected ? (selectedStyle ?? 'font-bold text-violet-500') : ''} cursor-pointer relative w-full flex select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 ${style ?? ''}`"
:onclick="
() => {
if (action) action();
diff --git a/resources/js/components/pinesUI/Popover.vue b/resources/js/components/pinesUI/Popover.vue
index 3b401b92..49948de2 100644
--- a/resources/js/components/pinesUI/Popover.vue
+++ b/resources/js/components/pinesUI/Popover.vue
@@ -12,6 +12,7 @@ const props = withDefaults(
popoverClass?: string;
buttonComponent?: Component;
buttonAttributes?: { [key: string]: any };
+ verticalOffsetPixels?: number;
}>(),
{
disabled: false,
@@ -75,7 +76,7 @@ const adjustPopoverPosition = () => {
return;
}
- popover.value.$el.style = `left: ${adjustment}px;`;
+ popover.value.$el.style = `left: ${adjustment}px; margin-${popoverPosition.value === 'bottom' ? 'top' : 'bottom'}: ${props.verticalOffsetPixels ?? 32}px;`;
if (popoverArrowRef.value) {
popoverArrowRef.value.style.left = `${popoverRect.width - margin / 2 + popoverArrowRef.value.offsetWidth / 2}px`;
}
@@ -143,7 +144,7 @@ onUnmounted(() => {
>
<UseFocusTrap
v-if="popoverOpen"
- :class="`z-50 absolute w-[300px] max-w-lg p-4 bg-white dark:bg-neutral-800/90 backdrop-blur-sm border border-neutral-200/70 dark:border-neutral-700/10 rounded-md shadow-sm ${popoverClass} -translate-x-1/2 ${popoverAdjustment ? '' : 'left-1/2'} ${popoverPosition === 'bottom' ? 'top-0 mt-8' : 'bottom-0 mb-8'}`"
+ :class="`z-50 absolute w-[300px] max-w-lg p-4 bg-white dark:bg-neutral-800/90 backdrop-blur-sm border border-neutral-200/70 dark:border-neutral-700/10 rounded-md shadow-sm ${popoverClass} -translate-x-1/2 ${popoverAdjustment ? '' : 'left-1/2'} ${popoverPosition === 'bottom' ? 'top-0' : 'bottom-0'}`"
ref="popover"
:options="{ allowOutsideClick: true }"
>
diff --git a/resources/js/components/video/VideoInfoPanel.vue b/resources/js/components/video/VideoInfoPanel.vue
index 6fa0916e..39af5ce9 100755
--- a/resources/js/components/video/VideoInfoPanel.vue
+++ b/resources/js/components/video/VideoInfoPanel.vue
@@ -1,11 +1,12 @@
-<script setup>
-import { handleStorageURL } from '@/service/util';
+<script setup lang="ts">
+import { useTemplateRef, watch } from 'vue';
+import { handleStorageURL, toFormattedDuration } from '@/service/util';
import { useContentStore } from '@/stores/ContentStore';
import { useAuthStore } from '@/stores/AuthStore';
import { storeToRefs } from 'pinia';
-import { watch } from 'vue';
import ButtonClipboard from '@/components/pinesUI/ButtonClipboard.vue';
+import ContextMenuItem from '@/components/pinesUI/ContextMenuItem.vue';
import useMetaData from '@/composables/useMetaData';
import EditFolder from '@/components/forms/EditFolder.vue';
import ButtonIcon from '@/components/inputs/ButtonIcon.vue';
@@ -15,7 +16,9 @@ import EditVideo from '@/components/forms/EditVideo.vue';
import HoverCard from '@/components/cards/HoverCard.vue';
import useModal from '@/composables/useModal';
import ChipTag from '@/components/labels/ChipTag.vue';
+import Popover from '@/components/pinesUI/Popover.vue';
+import ProiconsMoreVertical from '~icons/proicons/more-vertical';
import CircumShare1 from '~icons/circum/share-1';
import CircumEdit from '~icons/circum/edit';
@@ -23,6 +26,8 @@ const { updateVideoData, updateFolderData } = useContentStore();
const { stateVideo, stateFolder } = storeToRefs(useContentStore());
const { userData } = storeToRefs(useAuthStore());
+const popover = useTemplateRef('popover');
+
const defaultDescription = `After defeating the
Demon Lord, Himmel the Hero, priest Heiter, dwarf warrior Eisen, and elf mage
Frieren return to the royal capital. After their procession, they view a meteor
@@ -41,7 +46,7 @@ const defaultDescription = `After defeating the
life-extending magic and tutor Fern in magic in her spare time. She agrees after
seeing Fern is already remarkably skilled despite her youth.`;
-const metaData = useMetaData({ ...stateVideo.value, id: stateVideo.value.id }, stateVideo.value);
+const metaData = useMetaData({ ...stateVideo.value });
const editFolderModal = useModal({ title: 'Edit Folder Details', submitText: 'Submit Details' });
const editVideoModal = useModal({ title: 'Edit Video Details', submitText: 'Submit Details' });
const shareVideoModal = useModal({ title: 'Share Video' });
@@ -50,12 +55,12 @@ const handlePropsUpdate = () => {
metaData.updateData({ ...stateVideo.value, id: stateVideo.value.id });
};
-const handleVideoDetailsUpdate = (res) => {
+const handleVideoDetailsUpdate = (res: any) => {
updateVideoData(res?.data);
editVideoModal.toggleModal(false);
};
-const handleSeriesUpdate = (res) => {
+const handleSeriesUpdate = (res: any) => {
updateFolderData(res?.data);
editFolderModal.toggleModal(false);
};
@@ -64,7 +69,7 @@ watch(() => stateVideo.value, handlePropsUpdate, { immediate: true, deep: true }
</script>
<template>
- <div class="flex flex-col sm:flex-row gap-2 sm:gap-4 p-3 overflow-clip w-full rounded-xl shadow-lg dark:bg-primary-dark-800/70 bg-primary-800 z-20">
+ <div class="flex flex-col sm:flex-row gap-2 sm:gap-4 p-3 w-full rounded-xl shadow-lg dark:bg-primary-dark-800/70 bg-primary-800 z-[11]">
<div id="mp4-header-mobile" class="flex items-center justify-between w-full sm:hidden gap-2 flex-wrap">
<h2 class="text-xl font-medium line-clamp-1 capitalize">
{{ metaData?.fields.title ?? '[Video Name]' }}
@@ -74,7 +79,7 @@ watch(() => stateVideo.value, handlePropsUpdate, { immediate: true, deep: true }
</span>
</div>
- <div id="mp4-description-desktop" class="flex gap-4 sm:flex-1 shrink-0">
+ <div id="mp4-description" class="flex gap-4 sm:flex-1 max-w-full">
<div class="h-32 my-auto object-cover rounded-md shadow-md aspect-2/3 mb-auto relative group">
<img
id="folder-thumbnail"
@@ -113,21 +118,43 @@ watch(() => stateVideo.value, handlePropsUpdate, { immediate: true, deep: true }
</template>
</HoverCard>
- <span class="flex flex-1 gap-2 items-end justify-between text-sm dark:text-slate-400 text-slate-500 max-w-full">
- <p class="text-nowrap text-ellipsis flex-1 h-8 sm:h-[22px] flex items-center justify-start">
- {{ metaData?.fields.views }}
- </p>
+ <span class="flex flex-1 gap-2 items-end justify-between text-sm pe-1 py-1">
+ <span class="flex items-center justify-start gap-1 truncate h-8 sm:h-[22px] dark:text-slate-400 text-slate-500">
+ <p class="text-nowrap text-start truncate">
+ {{ metaData?.fields.views }}
+ </p>
+ <p class="text-nowrap text-start truncate hidden xs:block" v-if="stateVideo?.metadata?.resolution_height">
+ {{ ` | ${stateVideo?.metadata?.resolution_height}p` }}
+ </p>
+ </span>
<section class="flex gap-2 justify-end h-8 sm:hidden">
- <ButtonIcon v-if="userData" aria-label="edit details" title="Edit Video Details" @click="editVideoModal.toggleModal()">
- <template #icon>
- <CircumEdit height="16" width="16" />
+ <Popover popoverClass="!max-w-32 !p-1 !rounded-md !shadow-sm" :vertical-offset-pixels="36" :buttonClass="'!p-1 w-8 h-8 ml-auto'" ref="popover">
+ <template #buttonIcon>
+ <ProiconsMoreVertical class="h-4 w-4" />
</template>
- </ButtonIcon>
- <ButtonIcon aria-label="share" title="Share Video" @click="shareVideoModal.toggleModal()">
- <template #icon>
- <CircumShare1 height="16" width="16" />
+ <template #content>
+ <ContextMenuItem
+ :icon="CircumEdit"
+ :text="'Edit'"
+ :action="
+ () => {
+ popover?.handleClose();
+ editVideoModal.toggleModal();
+ }
+ "
+ />
+ <ContextMenuItem
+ :icon="CircumShare1"
+ :text="'Share'"
+ :action="
+ () => {
+ popover?.handleClose();
+ shareVideoModal.toggleModal();
+ }
+ "
+ />
</template>
- </ButtonIcon>
+ </Popover>
</section>
</span>
</div>
@@ -148,7 +175,7 @@ watch(() => stateVideo.value, handlePropsUpdate, { immediate: true, deep: true }
</ButtonIcon>
</section>
<section class="flex flex-col justify-end text-end text-sm dark:text-slate-400 text-slate-500 max-w-full overflow-clip gap-1">
- <span class="flex gap-1 flex-row flex-wrap max-h-[22px] overflow-hidden justify-end">
+ <span class="flex gap-1 flex-row flex-wrap max-h-[22px] justify-end">
<ChipTag v-for="(tag, index) in stateVideo?.video_tags" v-bind:key="index" :label="tag.name" />
</span>
</section>
diff --git a/resources/js/types/model.ts b/resources/js/types/model.ts
index 8c99cef5..250b04cb 100644
--- a/resources/js/types/model.ts
+++ b/resources/js/types/model.ts
@@ -24,6 +24,7 @@ export interface Metadata {
duration?: number;
view_count?: number;
description?: string;
+ lyrics?: string;
date_released?: string;
tags?: string;
editor_id?: number;
@@ -32,6 +33,11 @@ export interface Metadata {
uuid?: any;
file_size?: number;
mime_type?: string;
+ codec?: string;
+ bitrate?: number;
+ resolution_width?: number;
+ resolution_height?: number;
+ frame_rate?: number;
date_scanned?: string;
date_released_formatted: any;
video?: Video;
diff --git a/resources/js/views/VideoView.vue b/resources/js/views/VideoView.vue
index 3b054831..601b7d34 100755
--- a/resources/js/views/VideoView.vue
+++ b/resources/js/views/VideoView.vue
@@ -75,8 +75,8 @@ const sortingOptions = ref([
disabled: false,
},
{
- title: 'Duration',
- value: 'duration',
+ title: 'Date Uploaded',
+ value: 'date',
disabled: false,
},
{
@@ -85,8 +85,13 @@ const sortingOptions = ref([
disabled: false,
},
{
- title: 'Date Uploaded',
- value: 'date',
+ title: 'Duration',
+ value: 'duration',
+ disabled: false,
+ },
+ {
+ title: 'File Size',
+ value: 'file_size',
disabled: false,
},
{