check only length
This commit is contained in:
parent
2468fbcbaf
commit
c6f448f2ce
@ -18,7 +18,7 @@ Features
|
|||||||
- overlay a logo
|
- overlay a logo
|
||||||
- overlay scrolling text
|
- overlay scrolling text
|
||||||
- trim and fade the last clip, to get full 24 hours
|
- 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
|
- 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)
|
- 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
|
- 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:
|
#### 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.
|
(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.
|
||||||
|
45
ffplayout.py
45
ffplayout.py
@ -26,12 +26,11 @@ import logging
|
|||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import smtplib
|
|
||||||
import signal
|
import signal
|
||||||
|
import smtplib
|
||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from datetime import date, datetime, timedelta
|
from datetime import date, datetime, timedelta
|
||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
@ -324,29 +323,27 @@ def check_sync(begin, encoder):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
# check begin and length
|
# check if playlist is long enough
|
||||||
def check_start_and_length(json_nodes, total_play_time):
|
def check_length(json_nodes, total_play_time):
|
||||||
if _playlist.start:
|
if 'length' in json_nodes:
|
||||||
# check if playlist is long enough
|
l_h, l_m, l_s = json_nodes["length"].split(':')
|
||||||
if 'length' in json_nodes:
|
if is_float(l_h) and is_float(l_m) and is_float(l_s):
|
||||||
l_h, l_m, l_s = json_nodes["length"].split(':')
|
length = float(l_h) * 3600 + float(l_m) * 60 + float(l_s)
|
||||||
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:
|
if 'date' in json_nodes:
|
||||||
date = json_nodes["date"]
|
date = json_nodes["date"]
|
||||||
else:
|
else:
|
||||||
date = get_date(True)
|
date = get_date(True)
|
||||||
|
|
||||||
if total_play_time < length - 5:
|
if total_play_time < length - 5:
|
||||||
mailer.error(
|
mailer.error(
|
||||||
'Playlist ({}) is not long enough!\n'
|
'Playlist ({}) is not long enough!\n'
|
||||||
'total play time is: {}'.format(
|
'total play time is: {}'.format(
|
||||||
date,
|
date,
|
||||||
timedelta(seconds=total_play_time))
|
timedelta(seconds=total_play_time))
|
||||||
)
|
)
|
||||||
logger.error('Playlist is only {} hours long!'.format(
|
logger.error('Playlist is only {} hours long!'.format(
|
||||||
timedelta(seconds=total_play_time)))
|
timedelta(seconds=total_play_time)))
|
||||||
|
|
||||||
|
|
||||||
# validate json values in new Thread
|
# validate json values in new Thread
|
||||||
@ -402,7 +399,7 @@ def validate_thread(clip_nodes):
|
|||||||
'values are missing:\n{}'.format(error)
|
'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 = Thread(name='check_json', target=check_json, args=(clip_nodes,))
|
||||||
validate.daemon = True
|
validate.daemon = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user