check only length

This commit is contained in:
jb-alvarado 2019-07-21 00:54:06 +02:00
parent 2468fbcbaf
commit c6f448f2ce
2 changed files with 23 additions and 26 deletions

View File

@ -18,7 +18,7 @@ Features
- overlay a logo
- overlay scrolling text
- trim and fade the last clip, to get full 24 hours
- when playlist is not 24 hours long, loop filler clip until time is full
- when playlist is not 24 hours long, loop filler clip until time is full
- set custom day start, so you can have playlist for example: from 6am to 6am, instate of 0am to 12pm
- copy mode, for more info's take a look in the [Wiki](https://github.com/ffplayout/ffplayout-engine/wiki/Copy-Mode)
- normal system requirements and no special tools
@ -67,7 +67,7 @@ JSON Playlist Example
}
```
`"length"` are optional, when you leave **day_start** in config blank, length check will be ignored and the playlist starts from the begin, without time awareness. If you leave **length** blank, the validation will not check if the real length of the playlist will match the length value.
`"length"` are optional, when you leave it blank, there will be no check if real playlist length is correct.
#### Warning:
(Endless) streaming over multiple days will only work when config have **day_start** value and the **length** value of the playlist is **24 hours**. If you need only some hours for every day, use a *cron* job, or something similar.

View File

@ -26,12 +26,11 @@ import logging
import math
import os
import random
import smtplib
import signal
import smtplib
import socket
import sys
import time
from argparse import ArgumentParser
from datetime import date, datetime, timedelta
from email.mime.multipart import MIMEMultipart
@ -324,29 +323,27 @@ def check_sync(begin, encoder):
sys.exit(1)
# check begin and length
def check_start_and_length(json_nodes, total_play_time):
if _playlist.start:
# check if playlist is long enough
if 'length' in json_nodes:
l_h, l_m, l_s = json_nodes["length"].split(':')
if is_float(l_h) and is_float(l_m) and is_float(l_s):
length = float(l_h) * 3600 + float(l_m) * 60 + float(l_s)
# check if playlist is long enough
def check_length(json_nodes, total_play_time):
if 'length' in json_nodes:
l_h, l_m, l_s = json_nodes["length"].split(':')
if is_float(l_h) and is_float(l_m) and is_float(l_s):
length = float(l_h) * 3600 + float(l_m) * 60 + float(l_s)
if 'date' in json_nodes:
date = json_nodes["date"]
else:
date = get_date(True)
if 'date' in json_nodes:
date = json_nodes["date"]
else:
date = get_date(True)
if total_play_time < length - 5:
mailer.error(
'Playlist ({}) is not long enough!\n'
'total play time is: {}'.format(
date,
timedelta(seconds=total_play_time))
)
logger.error('Playlist is only {} hours long!'.format(
timedelta(seconds=total_play_time)))
if total_play_time < length - 5:
mailer.error(
'Playlist ({}) is not long enough!\n'
'total play time is: {}'.format(
date,
timedelta(seconds=total_play_time))
)
logger.error('Playlist is only {} hours long!'.format(
timedelta(seconds=total_play_time)))
# validate json values in new Thread
@ -402,7 +399,7 @@ def validate_thread(clip_nodes):
'values are missing:\n{}'.format(error)
)
check_start_and_length(json_nodes, counter)
check_length(json_nodes, counter)
validate = Thread(name='check_json', target=check_json, args=(clip_nodes,))
validate.daemon = True