add argparse for playlist file
This commit is contained in:
parent
82b908aa45
commit
5ecad321f0
26
ffplayout.py
26
ffplayout.py
@ -115,15 +115,22 @@ _playout = SimpleNamespace(
|
|||||||
# logging
|
# logging
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
stdin_parser = ArgumentParser(description="python and ffmpeg based playout")
|
stdin_parser = ArgumentParser(
|
||||||
|
description="python and ffmpeg based playout",
|
||||||
|
epilog="don't use parameters if you want to take the settings from config")
|
||||||
|
|
||||||
stdin_parser.add_argument(
|
stdin_parser.add_argument(
|
||||||
"-l", "--log", help="file to write log to (default '" + _log.path + "')"
|
"-l", "--log", help="file path for logfile"
|
||||||
|
)
|
||||||
|
|
||||||
|
stdin_parser.add_argument(
|
||||||
|
"-f", "--file", help="playlist file"
|
||||||
)
|
)
|
||||||
|
|
||||||
# If the log file is specified on the command line then override the default
|
# If the log file is specified on the command line then override the default
|
||||||
stdin_args = stdin_parser.parse_args()
|
stdin_args = stdin_parser.parse_args()
|
||||||
if stdin_args.log:
|
if stdin_args.log:
|
||||||
_log.path = stdin_args.log
|
_log.path = stdin_args.log
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logger.setLevel(_log.level)
|
logger.setLevel(_log.level)
|
||||||
@ -651,16 +658,19 @@ class GetSourceIter:
|
|||||||
|
|
||||||
self.src = None
|
self.src = None
|
||||||
self.seek = 0
|
self.seek = 0
|
||||||
self.out = 60
|
self.out = 20
|
||||||
self.duration = 60
|
self.duration = 20
|
||||||
self.ad = False
|
self.ad = False
|
||||||
self.ad_last = False
|
self.ad_last = False
|
||||||
self.ad_next = False
|
self.ad_next = False
|
||||||
|
|
||||||
def get_playlist(self):
|
def get_playlist(self):
|
||||||
year, month, day = self.list_date.split('-')
|
if stdin_args.file:
|
||||||
self.json_file = os.path.join(
|
self.json_file = stdin_args.file
|
||||||
_playlist.path, year, month, self.list_date + '.json')
|
else:
|
||||||
|
year, month, day = self.list_date.split('-')
|
||||||
|
self.json_file = os.path.join(
|
||||||
|
_playlist.path, year, month, self.list_date + '.json')
|
||||||
|
|
||||||
if file_exist(self.json_file):
|
if file_exist(self.json_file):
|
||||||
# check last modification from playlist
|
# check last modification from playlist
|
||||||
|
Loading…
x
Reference in New Issue
Block a user