warn when current time is before playlist start time, fix ffplayout:#705

This commit is contained in:
jb-alvarado 2024-07-22 10:32:21 +02:00
parent aa32865049
commit 4917337a7a
9 changed files with 522 additions and 473 deletions

View File

@ -162,11 +162,12 @@ defineProps({
})
onMounted(() => {
getPlaylist()
setTimeout(() => {
getPlaylist()
}, 150)
})
watch([listDate, configID], () => {
getPlaylist()
setTimeout(() => {
getPlaylist()
}, 800)

View File

@ -87,6 +87,7 @@ export default {
addBlock: 'Zeitblock hinzufügen',
infinitInfo: 'Die Wiedergabe läuft im unendlichen Modus. Es sind keine zeitbasierten Informationen möglich.',
generateDone: 'Wiedergabeliste generieren erledigt...',
dateYesterday: 'Aktuelle Uhrzeit liegt vor der Playlist-Startzeit!',
},
media: {
notExists: 'Speicher existiert nicht!',

View File

@ -87,6 +87,7 @@ export default {
addBlock: 'Add time block',
infinitInfo: 'Playout runs in infinite mode. No time based information is possible.',
generateDone: 'Generate Playlist done...',
dateYesterday: 'Current time is before the playlist start time!',
},
media: {
notExists: 'Storage not exist!',

View File

@ -87,6 +87,7 @@ export default {
addBlock: 'Adicionar bloco de tempo',
infinitInfo: 'O playout é executado no modo infinito. Nenhuma informação baseada em tempo é possível',
generateDone: 'Gerar lista de reprodução concluída...',
dateYesterday: 'Current time is before the playlist start time!',
},
media: {
notExists: 'O armazenamento não existe!',

View File

@ -87,6 +87,7 @@ export default {
addBlock: 'Добавить время начало передачи',
infinitInfo: 'Воспроизведение работает в бесконечном режиме. Никакая информация, основанная на времени, невозможна.',
generateDone: 'Генерация плейлиста завершена...',
dateYesterday: 'Current time is before the playlist start time!',
},
media: {
notExists: 'Папки не существует!',

936
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -16,14 +16,14 @@
"@nuxtjs/color-mode": "^3.4.2",
"@pinia/nuxt": "^0.5.1",
"@vueform/multiselect": "^2.6.8",
"@vuepic/vue-datepicker": "^8.8.1",
"@vuepic/vue-datepicker": "^9.0.1",
"@vueuse/nuxt": "^10.11.0",
"bootstrap-icons": "^1.11.3",
"dayjs": "^1.11.11",
"dayjs": "^1.11.12",
"jwt-decode": "^4.0.0",
"lodash": "^4.17.21",
"mpegts.js": "^1.7.3",
"nuxt": "3.12.3",
"nuxt": "3.12.4",
"pinia": "^2.1.7",
"sortablejs-vue3": "^1.2.11",
"splitpanes": "^3.1.5",
@ -33,15 +33,15 @@
"@nuxt/eslint": "^0.3.13",
"@nuxtjs/i18n": "^8.3.1",
"@nuxtjs/tailwindcss": "^6.12.1",
"@types/lodash": "^4.17.6",
"@types/lodash": "^4.17.7",
"@types/video.js": "^7.3.58",
"daisyui": "^4.12.10",
"mini-svg-data-uri": "^1.4.4",
"postcss": "^8.4.39",
"postcss-loader": "^8.1.1",
"sass": "^1.77.7",
"sass": "^1.77.8",
"sass-loader": "^14.2.1",
"vue": "^3.4.31",
"vue": "^3.4.33",
"vue-router": "^4.4.0"
}
}

View File

@ -2,7 +2,16 @@
<div class="h-full">
<PlayerControl />
<div class="flex justify-end p-1">
<div class="h-[32px]">
<div class="h-[32px] grid grid-cols-2">
<div class="text-warning flex justify-end p-2">
<div
v-if="firstLoad && beforeDayStart"
class="tooltip tooltip-right tooltip-warning"
:data-tip="$t('player.dateYesterday')"
>
<SvgIcon name="warning" />
</div>
</div>
<VueDatePicker
v-if="!configStore.playout.playlist.infinit && configStore.playout.processing.mode !== 'folder'"
v-model="listDate"
@ -16,6 +25,7 @@
:dark="colorMode.value === 'dark'"
input-class-name="input input-sm !input-bordered !w-[300px] text-right !pe-3"
required
@update:model-value=";(beforeDayStart = false), (firstLoad = false)"
/>
</div>
</div>
@ -215,8 +225,6 @@
</template>
<script setup lang="ts">
import { storeToRefs } from 'pinia'
const colorMode = useColorMode()
const { locale, t } = useI18n()
const { $_, $dayjs } = useNuxtApp()
@ -234,8 +242,9 @@ useHead({
title: `${t('button.player')} | ffplayout`,
})
const { listDate } = storeToRefs(usePlaylist())
const { listDate, firstLoad } = storeToRefs(usePlaylist())
const beforeDayStart = ref(false)
const targetDate = ref($dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD'))
const playlistTable = ref()
const editId = ref(-1)
@ -266,7 +275,19 @@ const newSource = ref({
uid: '',
} as PlaylistItem)
onMounted(() => {
onBeforeMount(() => {
const currentTime = $dayjs().utcOffset(configStore.utcOffset)
if (
firstLoad.value &&
currentTime.format('YYYY-MM-DD') === playlistStore.listDate &&
currentTime.format('HH:mm:ss') > '00:00:00' &&
currentTime.format('HH:mm:ss') < configStore.playout.playlist.day_start
) {
listDate.value = $dayjs(playlistStore.listDate).subtract(1, 'day').format('YYYY-MM-DD')
beforeDayStart.value = true
}
if (configStore.onetimeInfo && configStore.playout.playlist.infinit) {
indexStore.msgAlert('warning', t('player.infinitInfo'), 7)
configStore.onetimeInfo = false
@ -435,9 +456,9 @@ async function importPlaylist(imp: boolean) {
playlistStore.isLoading = true
await $fetch(
`/api/file/${configStore.configChannel[configStore.configID].id}/import/?file=${textFile.value[0].name}&date=${
listDate.value
}`,
`/api/file/${configStore.configChannel[configStore.configID].id}/import/?file=${
textFile.value[0].name
}&date=${listDate.value}`,
{
method: 'PUT',
headers: authStore.authHeader,

View File

@ -27,6 +27,7 @@ export const usePlaylist = defineStore('playlist', {
shift: 0,
playoutIsRunning: false,
last_channel: 0,
firstLoad: true,
}),
getters: {},