ffplayout/pages/player.vue

814 lines
27 KiB
Vue
Raw Normal View History

2020-04-07 17:56:46 +02:00
<template>
2024-04-08 17:07:03 +02:00
<div class="h-full">
2023-01-11 10:54:25 +01:00
<Control />
2024-04-08 17:07:03 +02:00
<div class="flex justify-end p-1">
<div>
<input type="date" class="input input-sm input-bordered w-full max-w-xs" v-model="listDate" />
2023-01-11 10:54:25 +01:00
</div>
</div>
2024-04-08 17:07:03 +02:00
<div class="p-1 min-h-[500px] h-[calc(100vh-800px)] xl:h-[calc(100vh-480px)]">
<splitpanes class="border border-my-gray rounded">
<pane class="h-full" min-size="0" max-size="80" size="20">
<div
v-if="mediaStore.isLoading"
class="w-full h-full absolute z-10 flex justify-center bg-base-100/70"
2023-01-11 10:54:25 +01:00
>
2024-04-08 17:07:03 +02:00
<span class="loading loading-spinner loading-lg" />
</div>
<div class="bg-base-100 border-b border-my-gray">
<div v-if="mediaStore.folderTree.parent && mediaStore.crumbs">
<nav class="breadcrumbs px-3">
<ul>
<li v-for="(crumb, index) in mediaStore.crumbs" :key="index">
<button
v-if="mediaStore.crumbs.length > 1 && mediaStore.crumbs.length - 1 > index"
@click="mediaStore.getTree(crumb.path)"
>
<i class="bi-folder-fill me-1" />
{{ crumb.text }}
</button>
<span v-else><i class="bi-folder-fill me-1" />{{ crumb.text }}</span>
</li>
</ul>
</nav>
2023-01-11 10:54:25 +01:00
</div>
2024-04-08 17:07:03 +02:00
</div>
<ul class="h-[calc(100%-40px)] overflow-auto m-1">
<li class="flex px-1" v-for="folder in mediaStore.folderTree.folders" :key="folder.uid">
<button
class="truncate"
@click="mediaStore.getTree(`/${mediaStore.folderTree.source}/${folder.name}`)"
2023-01-11 10:54:25 +01:00
>
2024-04-08 17:07:03 +02:00
<i class="bi-folder-fill" />
{{ folder.name }}
</button>
</li>
<Sortable :list="mediaStore.folderTree.files" :options="browserSortOptions" item-key="name">
<template #item="{ element, index }">
<li
:id="`file_${index}`"
class="draggable px-1 grid grid-cols-[auto_110px]"
:key="element.name"
>
<div class="truncate cursor-grab">
<i v-if="mediaType(element.name) === 'audio'" class="bi-music-note-beamed" />
<i v-else-if="mediaType(element.name) === 'video'" class="bi-film" />
<i
v-else-if="mediaType(element.name) === 'image'"
2024-04-08 17:07:03 +02:00
class="bi-file-earmark-image"
/>
2024-04-08 17:07:03 +02:00
<i v-else class="bi-file-binary" />
2023-01-11 10:54:25 +01:00
{{ element.name }}
</div>
2024-04-08 17:07:03 +02:00
<div>
<button
class="w-7"
@click=";(showPreviewModal = true), setPreviewData(element.name)"
>
2023-01-11 10:54:25 +01:00
<i class="bi-play-fill" />
2024-04-08 17:07:03 +02:00
</button>
<div class="inline-block w-[82px]">{{ toMin(element.duration) }}</div>
</div>
2024-04-08 17:07:03 +02:00
</li>
</template>
</Sortable>
2023-01-11 10:54:25 +01:00
</ul>
2024-04-08 17:07:03 +02:00
</pane>
<pane>
<div class="w-full h-full">
<div
class="grid grid-cols-[70px_auto_50px_70px_70px_70px_30px_60px_80px] bg-base-100 py-2 px-3 border-b border-my-gray"
2023-01-11 10:54:25 +01:00
>
2024-04-08 17:07:03 +02:00
<div>Start</div>
<div>File</div>
<div class="text-center">Play</div>
<div class="">Duration</div>
<div class="hidden md:flex">In</div>
<div class="hidden md:flex">Out</div>
<div class="hidden md:flex justify-center">Ad</div>
<div class="text-center">Edit</div>
<div class="hidden md:flex justify-center">Delete</div>
</div>
<div
v-if="playlistIsLoading"
class="w-full h-full absolute z-10 flex justify-center bg-base-100/70"
>
<span class="loading loading-spinner loading-lg" />
</div>
2024-04-08 17:15:24 +02:00
<div id="scroll-container" class="h-full overflow-auto">
2024-04-08 17:07:03 +02:00
<Sortable
:list="playlistStore.playlist"
item-key="uid"
class=""
:style="`height: ${
playlistStore.playlist ? playlistStore.playlist.length * 38 + 76 : 300
}px`"
tag="ul"
:options="playlistSortOptions"
@add="cloneClip"
@end="moveItemInArray"
>
<template #item="{ element, index }">
<li
:id="`clip_${index}`"
class="draggable bg-base-300 even:bg-base-100 grid grid-cols-[70px_auto_50px_70px_70px_70px_30px_60px_80px] h-[38px] px-3 py-[8px]"
:class="
index === playlistStore.currentClipIndex && listDate === todayDate
? 'active-playlist-clip'
: ''
"
:key="element.uid"
>
<div>{{ secondsToTime(element.begin) }}</div>
<div class="grabbing truncate cursor-grab">{{ filename(element.source) }}</div>
<div class="text-center">
<button @click=";(showPreviewModal = true), setPreviewData(element.source)">
2023-01-11 10:54:25 +01:00
<i class="bi-play-fill" />
2024-04-08 17:07:03 +02:00
</button>
2023-01-11 10:54:25 +01:00
</div>
2024-04-08 17:07:03 +02:00
<div>{{ secToHMS(element.duration) }}</div>
<div class="hidden md:flex">{{ secToHMS(element.in) }}</div>
<div class="hidden md:flex">{{ secToHMS(element.out) }}</div>
<div class="hidden md:flex justify-center pt-[3px]">
2023-01-11 10:54:25 +01:00
<input
2024-04-08 17:07:03 +02:00
class="checkbox checkbox-xs rounded"
2023-01-11 10:54:25 +01:00
type="checkbox"
:checked="
element.category && element.category === 'advertisement'
? true
: false
"
@change="setCategory($event, element)"
/>
</div>
2024-04-08 17:07:03 +02:00
<div class="text-center">
<button @click=";(showSourceModal = true), editPlaylistItem(index)">
2023-01-11 10:54:25 +01:00
<i class="bi-pencil-square" />
2024-04-08 17:07:03 +02:00
</button>
2023-01-11 10:54:25 +01:00
</div>
2024-04-08 17:07:03 +02:00
<div class="text-center hidden md:flex justify-center">
<button @click="deletePlaylistItem(index)">
2023-01-11 10:54:25 +01:00
<i class="bi-x-circle-fill" />
2024-04-08 17:07:03 +02:00
</button>
2023-01-11 10:54:25 +01:00
</div>
2024-04-08 17:07:03 +02:00
</li>
</template>
</Sortable>
</div>
2023-01-11 10:54:25 +01:00
</div>
2024-04-08 17:07:03 +02:00
</pane>
</splitpanes>
</div>
2023-01-11 10:54:25 +01:00
2024-04-08 17:07:03 +02:00
<div class="join flex justify-end m-3">
2024-04-08 21:33:28 +02:00
<button class="btn btn-sm btn-primary join-item" title="Copy Playlist" @click="showCopyModal = true">
2023-01-11 10:54:25 +01:00
<i class="bi-files" />
2024-04-08 17:07:03 +02:00
</button>
<button
2023-01-11 10:54:25 +01:00
v-if="!configStore.configPlayout.playlist.loop"
2024-04-08 17:07:03 +02:00
class="btn btn-sm btn-primary join-item"
2023-01-11 10:54:25 +01:00
title="Loop Clips in Playlist"
@click="loopClips()"
>
<i class="bi-view-stacked" />
2024-04-08 17:07:03 +02:00
</button>
<button
class="btn btn-sm btn-primary join-item"
2023-01-11 10:54:25 +01:00
title="Add (remote) Source to Playlist"
2024-04-08 17:07:03 +02:00
@click="showSourceModal = true"
2023-01-11 10:54:25 +01:00
>
<i class="bi-file-earmark-plus" />
2024-04-08 17:07:03 +02:00
</button>
<button
class="btn btn-sm btn-primary join-item"
2023-01-11 10:54:25 +01:00
title="Import text/m3u file"
2024-04-08 21:33:28 +02:00
@click="showImportModal = true"
2023-01-11 10:54:25 +01:00
>
<i class="bi-file-text" />
2024-04-08 17:07:03 +02:00
</button>
<button
class="btn btn-sm btn-primary join-item"
2024-04-08 21:33:28 +02:00
@click="mediaStore.getTree('', true), (showPlaylistGenerator = true)"
>
2023-01-11 10:54:25 +01:00
<i class="bi-sort-down-alt" />
2024-04-08 17:07:03 +02:00
</button>
<button class="btn btn-sm btn-primary join-item" title="Reset Playlist" @click="getPlaylist()">
2023-01-11 10:54:25 +01:00
<i class="bi-arrow-counterclockwise" />
2024-04-08 17:07:03 +02:00
</button>
<button
class="btn btn-sm btn-primary join-item"
2024-04-08 21:33:28 +02:00
title="Save Playlist"
@click=";(targetDate = listDate), savePlaylist(true)"
2024-04-08 17:07:03 +02:00
>
2024-04-08 21:33:28 +02:00
<i class="bi-download" />
</button>
<button class="btn btn-sm btn-primary join-item" title="Delete Playlist" @click="showDeleteModal = true">
2023-01-11 10:54:25 +01:00
<i class="bi-trash" />
2024-04-08 17:07:03 +02:00
</button>
</div>
<Modal :show="showPreviewModal" :title="`Preview: ${previewName}`" :modal-action="closePlayer">
<div class="w-[1024px] max-w-full aspect-video">
<VideoPlayer v-if="isVideo && previewOpt" reference="previewPlayer" :options="previewOpt" />
<img v-else :src="previewUrl" class="img-fluid" :alt="previewName" />
2023-01-11 10:54:25 +01:00
</div>
2024-04-08 17:07:03 +02:00
</Modal>
2023-01-11 10:54:25 +01:00
2024-04-08 17:07:03 +02:00
<Modal :show="showSourceModal" title="Add/Edit Source" :modal-action="processSource">
<div>
<label class="form-control w-full mt-3">
<div class="label">
<span class="label-text">In</span>
2023-01-11 10:54:25 +01:00
</div>
2024-04-08 17:07:03 +02:00
<input type="number" class="input input-sm input-bordered w-full" v-model.number="newSource.in" />
</label>
<label class="form-control w-full mt-3">
<div class="label">
<span class="label-text">Out</span>
2023-01-11 10:54:25 +01:00
</div>
2024-04-08 17:07:03 +02:00
<input type="number" class="input input-sm input-bordered w-full" v-model.number="newSource.out" />
</label>
2023-01-11 10:54:25 +01:00
2024-04-08 17:07:03 +02:00
<label class="form-control w-full mt-3">
<div class="label">
<span class="label-text">Duration</span>
2023-01-11 10:54:25 +01:00
</div>
2024-04-08 17:07:03 +02:00
<input
type="number"
class="input input-sm input-bordered w-full"
v-model.number="newSource.duration"
/>
</label>
<label class="form-control w-full mt-3">
<div class="label">
<span class="label-text">Source</span>
</div>
<input type="text" class="input input-sm input-bordered w-full" v-model="newSource.source" />
</label>
<label class="form-control w-full mt-3">
<div class="label">
<span class="label-text">Audio</span>
</div>
<input type="text" class="input input-sm input-bordered w-full" v-model="newSource.audio" />
</label>
<label class="form-control w-full mt-3">
<div class="label">
<span class="label-text">Custom Filter</span>
</div>
<input type="text" class="input input-sm input-bordered w-full" v-model="newSource.custom_filter" />
</label>
<div class="form-control">
<label class="cursor-pointer label">
<span class="label-text">Advertisement</span>
<input type="checkbox" class="checkbox checkbox-sm" @click="isAd" />
</label>
2023-01-11 10:54:25 +01:00
</div>
</div>
2024-04-08 17:07:03 +02:00
</Modal>
2023-01-11 10:54:25 +01:00
2024-04-08 21:33:28 +02:00
<Modal :show="showImportModal" title="Import Playlist" :modal-action="importPlaylist">
<input
ref="fileImport"
type="file"
class="file-input file-input-sm file-input-bordered w-full"
v-on:change="onFileChange"
multiple
/>
</Modal>
2023-01-11 10:54:25 +01:00
2024-04-08 21:33:28 +02:00
<Modal :show="showCopyModal" :title="`Copy Program ${listDate}`" :modal-action="savePlaylist">
<input type="date" class="input input-sm input-bordered w-full" v-model="targetDate" />
</Modal>
2023-01-11 10:54:25 +01:00
2024-04-08 21:33:28 +02:00
<Modal :show="showDeleteModal" title="Delete Program" :modal-action="deletePlaylist">
<span>
Delete program from <strong>{{ listDate }}</strong>
</span>
</Modal>
2024-04-08 21:42:12 +02:00
<PlaylistGenerator v-if="showPlaylistGenerator" :close="closeGenerator" />
2020-04-07 17:56:46 +02:00
</div>
</template>
2023-01-11 10:54:25 +01:00
<script setup lang="ts">
2023-03-22 16:01:58 +01:00
import { storeToRefs } from 'pinia'
2023-01-11 10:54:25 +01:00
const { $_, $dayjs } = useNuxtApp()
const { secToHMS, filename, secondsToTime, toMin, mediaType } = stringFormatter()
2023-01-11 10:54:25 +01:00
const { processPlaylist, genUID } = playlistOperations()
const contentType = { 'content-type': 'application/json;charset=UTF-8' }
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
const mediaStore = useMedia()
const playlistStore = usePlaylist()
useHead({
title: 'Player | ffplayout',
2023-01-11 10:54:25 +01:00
})
2023-03-22 16:01:58 +01:00
const { configID } = storeToRefs(useConfig())
2024-04-08 21:33:28 +02:00
const { listDate } = storeToRefs(usePlaylist())
2023-03-22 16:01:58 +01:00
2023-01-11 10:54:25 +01:00
const fileImport = ref()
const playlistIsLoading = ref(false)
const todayDate = ref($dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD'))
2023-01-11 10:54:25 +01:00
const targetDate = ref($dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD'))
const editId = ref(-1)
const textFile = ref()
2024-04-08 17:07:03 +02:00
const showPreviewModal = ref(false)
const showSourceModal = ref(false)
2024-04-08 21:33:28 +02:00
const showImportModal = ref(false)
const showCopyModal = ref(false)
const showDeleteModal = ref(false)
const showPlaylistGenerator = ref(false)
2024-04-08 17:07:03 +02:00
2023-01-11 10:54:25 +01:00
const previewName = ref('')
const previewUrl = ref('')
const previewOpt = ref()
const isVideo = ref(false)
2024-04-08 21:33:28 +02:00
const browserSortOptions = {
2023-01-11 10:54:25 +01:00
group: { name: 'playlist', pull: 'clone', put: false },
sort: false,
}
const playlistSortOptions = {
2023-01-11 10:54:25 +01:00
group: 'playlist',
animation: 100,
handle: '.grabbing',
}
2024-04-08 21:33:28 +02:00
2023-01-11 10:54:25 +01:00
const newSource = ref({
begin: 0,
in: 0,
out: 0,
duration: 0,
category: '',
custom_filter: '',
source: '',
audio: '',
uid: '',
2023-01-11 10:54:25 +01:00
} as PlaylistItem)
2024-04-08 17:15:24 +02:00
onMounted(async () => {
2023-01-11 10:54:25 +01:00
if (!mediaStore.folderTree.parent) {
2024-04-08 17:15:24 +02:00
await mediaStore.getTree('')
}
2023-01-11 10:54:25 +01:00
getPlaylist()
})
2020-04-07 17:56:46 +02:00
2024-04-08 17:15:24 +02:00
watch([listDate, configID], async () => {
2024-04-08 17:07:03 +02:00
mediaStore.getTree('')
2024-04-08 17:15:24 +02:00
await getPlaylist()
2023-01-11 10:54:25 +01:00
})
2021-03-23 10:43:41 +01:00
function scrollTo(index: number) {
const child = document.getElementById(`clip_${index}`)
2023-06-28 11:01:17 +02:00
const parent = document.getElementById('scroll-container')
2023-06-28 11:01:17 +02:00
if (child && parent) {
const topPos = child.offsetTop
parent.scrollTop = topPos - 50
}
}
2023-01-11 10:54:25 +01:00
async function getPlaylist() {
playlistIsLoading.value = true
await playlistStore.getPlaylist(listDate.value)
playlistIsLoading.value = false
if (listDate.value === todayDate.value) {
scrollTo(playlistStore.currentClipIndex)
} else {
scrollTo(0)
}
2023-01-11 10:54:25 +01:00
}
2021-03-23 10:43:41 +01:00
2024-04-08 21:42:12 +02:00
function closeGenerator() {
showPlaylistGenerator.value = false
}
2023-01-11 10:54:25 +01:00
function closePlayer() {
2024-04-08 17:07:03 +02:00
showPreviewModal.value = false
2023-01-11 10:54:25 +01:00
isVideo.value = false
}
2023-01-11 10:54:25 +01:00
function setCategory(event: any, item: PlaylistItem) {
if (event.target.checked) {
item.category = 'advertisement'
} else {
item.category = ''
}
}
function onFileChange(evt: any) {
const files = evt.target.files || evt.dataTransfer.files
2023-01-11 10:54:25 +01:00
if (!files.length) {
return
}
2023-01-11 10:54:25 +01:00
textFile.value = files
}
2023-01-11 10:54:25 +01:00
function cloneClip(event: any) {
const o = event.oldIndex
const n = event.newIndex
2021-10-31 15:49:21 +01:00
2023-01-11 10:54:25 +01:00
event.item.remove()
2021-10-31 15:49:21 +01:00
2023-01-11 10:54:25 +01:00
const storagePath = configStore.configPlayout.storage.path
const sourcePath = `${storagePath}/${mediaStore.folderTree.source}/${mediaStore.folderTree.files[o].name}`.replace(
/\/[/]+/g,
'/'
)
2023-01-11 10:54:25 +01:00
playlistStore.playlist.splice(n, 0, {
uid: genUID(),
begin: 0,
source: sourcePath,
in: 0,
out: mediaStore.folderTree.files[o].duration,
duration: mediaStore.folderTree.files[o].duration,
2023-01-11 10:54:25 +01:00
})
2023-01-11 10:54:25 +01:00
playlistStore.playlist = processPlaylist(
configStore.startInSec,
configStore.playlistLength,
playlistStore.playlist,
false
)
}
2021-03-23 10:43:41 +01:00
2023-01-11 10:54:25 +01:00
function moveItemInArray(event: any) {
playlistStore.playlist.splice(event.newIndex, 0, playlistStore.playlist.splice(event.oldIndex, 1)[0])
2021-10-31 15:49:21 +01:00
2023-01-11 10:54:25 +01:00
playlistStore.playlist = processPlaylist(
configStore.startInSec,
configStore.playlistLength,
playlistStore.playlist,
false
)
}
2021-10-31 15:49:21 +01:00
2023-01-11 10:54:25 +01:00
function setPreviewData(path: string) {
let fullPath = path
2023-08-06 23:27:10 +02:00
const storagePath = configStore.configPlayout.storage.path
const lastIndex = storagePath.lastIndexOf('/')
2023-01-11 10:54:25 +01:00
if (!path.includes('/')) {
const parent = mediaStore.folderTree.parent ? mediaStore.folderTree.parent : ''
fullPath = `/${parent}/${mediaStore.folderTree.source}/${path}`.replace(/\/[/]+/g, '/')
2023-08-06 23:27:10 +02:00
} else if (lastIndex !== -1) {
let pathPrefix = storagePath.substring(0, lastIndex)
fullPath = path.replace(pathPrefix, '')
2023-01-11 10:54:25 +01:00
}
2022-07-06 16:22:27 +02:00
2023-01-11 10:54:25 +01:00
previewName.value = fullPath.split('/').slice(-1)[0]
if (path.match(/^http/)) {
previewUrl.value = path
} else {
2024-02-09 11:21:52 +01:00
previewUrl.value = encodeURIComponent(
`/file/${configStore.configGui[configStore.configID].id}${fullPath}`
).replace(/%2F/g, '/')
}
2022-07-06 16:22:27 +02:00
2023-01-11 10:54:25 +01:00
const ext = previewName.value.split('.').slice(-1)[0].toLowerCase()
const fileType =
mediaType(previewName.value) === 'audio'
? `audio/${ext}`
: mediaType(previewName.value) === 'live'
? 'application/x-mpegURL'
: `video/${ext}`
2023-01-11 10:54:25 +01:00
if (configStore.configPlayout.storage.extensions.includes(`${ext}`)) {
isVideo.value = true
previewOpt.value = {
liveui: false,
controls: true,
suppressNotSupportedError: true,
autoplay: false,
preload: 'auto',
sources: [
{
type: fileType,
src: previewUrl.value,
},
],
2020-04-07 17:56:46 +02:00
}
2023-01-11 10:54:25 +01:00
} else {
isVideo.value = false
2020-04-07 17:56:46 +02:00
}
}
2020-04-17 15:02:11 +02:00
2024-04-08 17:07:03 +02:00
function processSource(process: boolean) {
showSourceModal.value = false
if (process) {
if (editId.value === -1) {
playlistStore.playlist.push(newSource.value)
playlistStore.playlist = processPlaylist(
configStore.startInSec,
configStore.playlistLength,
playlistStore.playlist,
false
)
} else {
playlistStore.playlist[editId.value] = newSource.value
playlistStore.playlist = processPlaylist(
configStore.startInSec,
configStore.playlistLength,
playlistStore.playlist,
false
)
}
2023-01-11 10:54:25 +01:00
}
2020-04-22 17:19:41 +02:00
2023-01-11 10:54:25 +01:00
editId.value = -1
newSource.value = {
begin: 0,
in: 0,
out: 0,
duration: 0,
category: '',
custom_filter: '',
source: '',
audio: '',
uid: genUID(),
2023-01-11 10:54:25 +01:00
}
2020-04-22 17:19:41 +02:00
}
2023-01-11 10:54:25 +01:00
function editPlaylistItem(i: number) {
editId.value = i
2020-04-22 17:19:41 +02:00
2023-01-11 10:54:25 +01:00
newSource.value = {
begin: playlistStore.playlist[i].begin,
in: playlistStore.playlist[i].in,
out: playlistStore.playlist[i].out,
duration: playlistStore.playlist[i].duration,
category: playlistStore.playlist[i].category,
custom_filter: playlistStore.playlist[i].custom_filter,
source: playlistStore.playlist[i].source,
audio: playlistStore.playlist[i].audio,
uid: playlistStore.playlist[i].uid,
2023-01-11 10:54:25 +01:00
}
2020-04-22 17:19:41 +02:00
}
2023-01-11 10:54:25 +01:00
function isAd(evt: any) {
if (evt.target.checked) {
newSource.value.category = 'advertisement'
} else {
newSource.value.category = ''
}
2020-04-22 17:19:41 +02:00
}
2023-01-11 10:54:25 +01:00
function deletePlaylistItem(index: number) {
playlistStore.playlist.splice(index, 1)
}
2023-01-11 10:54:25 +01:00
function loopClips() {
const tempList = []
let length = 0
while (length < configStore.playlistLength && playlistStore.playlist.length > 0) {
2023-01-11 10:54:25 +01:00
for (const item of playlistStore.playlist) {
if (length < configStore.playlistLength) {
tempList.push($_.cloneDeep(item))
length += item.out - item.in
} else {
break
}
}
}
2023-01-11 10:54:25 +01:00
playlistStore.playlist = processPlaylist(configStore.startInSec, configStore.playlistLength, tempList, false)
}
2024-04-08 21:33:28 +02:00
async function importPlaylist(imp: boolean) {
showImportModal.value = false
2023-01-11 10:54:25 +01:00
2024-04-08 21:33:28 +02:00
if (imp) {
if (!textFile.value || !textFile.value[0]) {
return
2023-01-11 10:54:25 +01:00
}
2024-04-08 21:33:28 +02:00
const formData = new FormData()
formData.append(textFile.value[0].name, textFile.value[0])
playlistIsLoading.value = true
await $fetch(
`/api/file/${configStore.configGui[configStore.configID].id}/import/?file=${
textFile.value[0].name
}&date=${listDate}`,
{
method: 'PUT',
headers: authStore.authHeader,
body: formData,
}
)
.then(() => {
indexStore.msgAlert('alert-success', 'Import success!', 2)
playlistStore.getPlaylist(listDate.value)
})
.catch((e: string) => {
indexStore.msgAlert('alert-error', e, 4)
})
}
2023-01-11 10:54:25 +01:00
playlistIsLoading.value = false
2023-01-11 10:54:25 +01:00
textFile.value = null
fileImport.value.value = null
}
2024-04-08 21:33:28 +02:00
async function savePlaylist(save: boolean) {
showCopyModal.value = false
2024-04-08 21:33:28 +02:00
if (save) {
if (playlistStore.playlist.length === 0) {
return
}
2023-01-11 10:54:25 +01:00
2024-04-08 21:33:28 +02:00
playlistStore.playlist = processPlaylist(
configStore.startInSec,
configStore.playlistLength,
playlistStore.playlist,
true
)
const saveList = playlistStore.playlist.map(({ begin, ...item }) => item)
await $fetch(`/api/playlist/${configStore.configGui[configStore.configID].id}/`, {
method: 'POST',
headers: { ...contentType, ...authStore.authHeader },
body: JSON.stringify({
channel: configStore.configGui[configStore.configID].name,
date: targetDate.value,
program: saveList,
}),
2023-01-11 10:54:25 +01:00
})
2024-04-08 21:33:28 +02:00
.then((response: any) => {
indexStore.msgAlert('alert-success', response, 2)
})
.catch((e: any) => {
if (e.status === 409) {
indexStore.msgAlert('alert-warning', e.data, 2)
} else {
indexStore.msgAlert('alert-error', e, 4)
}
})
}
2020-05-12 12:12:18 +02:00
}
2024-04-08 21:33:28 +02:00
async function deletePlaylist(del: boolean) {
showDeleteModal.value = false
2024-04-08 21:33:28 +02:00
if (del) {
await $fetch(`/api/playlist/${configStore.configGui[configStore.configID].id}/${listDate}`, {
method: 'DELETE',
headers: { ...contentType, ...authStore.authHeader },
}).then(() => {
playlistStore.playlist = []
2024-04-08 21:33:28 +02:00
indexStore.msgAlert('alert-warning', 'Playlist deleted...', 2)
})
}
}
2023-01-11 10:54:25 +01:00
</script>
2020-04-27 11:57:14 +02:00
2023-01-11 10:54:25 +01:00
<style lang="scss" scoped>
.filename,
.browser-item {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
2020-04-27 11:57:14 +02:00
}
2023-01-11 10:54:25 +01:00
.loading-overlay {
width: 100%;
height: 100%;
2020-04-22 17:19:41 +02:00
}
2023-01-11 10:54:25 +01:00
.player-container {
position: relative;
width: 100%;
max-width: 100%;
height: calc(100% - 140px);
2021-10-31 14:59:21 +01:00
}
2023-01-11 10:54:25 +01:00
.playlist-container {
height: 100%;
border: 1px solid $border-color;
border-top: none;
border-left: none;
border-radius: $b-radius;
2022-09-07 13:43:17 +02:00
}
2023-01-11 10:54:25 +01:00
.player-container .media-browser-scroll {
height: calc(100% - 39px);
2020-04-22 17:19:41 +02:00
}
2023-01-11 10:54:25 +01:00
.active-playlist-clip {
background-color: #565e6a !important;
2020-04-22 17:19:41 +02:00
}
2020-04-17 15:02:11 +02:00
.list-row {
2024-02-09 11:21:52 +01:00
height: calc(100% - 480px);
2020-04-22 17:19:41 +02:00
min-height: 300px;
2020-04-07 17:56:46 +02:00
}
2020-04-08 17:25:06 +02:00
.pane-row {
2020-04-17 15:02:11 +02:00
margin: 0;
2020-04-08 17:25:06 +02:00
}
2020-04-12 21:15:10 +02:00
.playlist-container {
width: 100%;
2020-04-17 15:02:11 +02:00
height: 100%;
2020-04-12 21:15:10 +02:00
}
2020-04-22 17:19:41 +02:00
.timecode {
2023-01-11 10:54:25 +01:00
min-width: 65px;
2020-04-24 13:58:47 +02:00
max-width: 90px;
}
.playlist-input {
2023-01-11 10:54:25 +01:00
min-width: 42px;
2020-04-24 13:58:47 +02:00
max-width: 60px;
}
2023-01-11 10:54:25 +01:00
.playlist-list-group,
#playlist-group {
height: 100%;
}
.playlist-item {
2023-01-11 10:54:25 +01:00
height: 38px;
}
2023-01-11 10:54:25 +01:00
.playlist-item:nth-of-type(odd) {
2020-04-24 13:58:47 +02:00
background-color: #3b424a;
}
2023-01-11 10:54:25 +01:00
.playlist-item:hover {
background-color: #1c1e22;
2021-10-31 14:59:21 +01:00
}
.overLength {
background-color: #ed890641 !important;
}
#generateModal .modal-body {
height: 600px;
}
.browser-col,
.template-col {
height: 532px;
}
#generateModal {
--bs-modal-width: 800px;
}
#generateModal .media-browser-scroll {
height: calc(100% - 35px);
}
#generateModal .browser-div li:nth-of-type(odd) {
background-color: #3b424a;
}
.select-all-div {
margin-right: 20px;
}
.active-playlist-clip {
background-color: #405f51 !important;
}
2020-04-07 17:56:46 +02:00
</style>
<style>
@media (max-width: 575px) {
2023-01-11 10:54:25 +01:00
.mobile-hidden {
display: none;
}
2024-04-08 09:35:31 +02:00
/*.splitpanes__splitter {
2023-01-11 10:54:25 +01:00
display: none !important;
2024-04-08 09:35:31 +02:00
}*/
2023-01-11 10:54:25 +01:00
.playlist-pane {
width: 100% !important;
}
}
</style>