scaffolding mt_clockwheel.py
This commit is contained in:
parent
242343e601
commit
b730441f65
|
@ -0,0 +1,56 @@
|
|||
import argparse
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
|
||||
# globals
|
||||
mediadir = "/var/lib/ffplayout/tv-media"
|
||||
playlistdir = "/var/lib/ffplayout/playlists"
|
||||
channel = "newellijaytelevision"
|
||||
verbose = False
|
||||
from_date = datetime.date.today()
|
||||
to_date = datetime.date.today()
|
||||
|
||||
def main():
|
||||
parse_config()
|
||||
|
||||
def parse_config():
|
||||
global mediadir, playlistdir, channel, verbose, from_date, to_date
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="mt_clockwheel",
|
||||
description="a simple clockwheel playlist generator for ffplayout",
|
||||
epilog="brought to you by your friends at Mountain Town Technology and Community Media Network"
|
||||
)
|
||||
|
||||
parser.add_argument('-d', '--directory', dest='mediadir', help='root directory for media library')
|
||||
parser.add_argument('-p', '--playlists', dest='playlistdir', help='root directory for playlists')
|
||||
parser.add_argument('-c', '--channel', dest='channel', help='channel name to generate playlists for')
|
||||
parser.add_argument('-v', '--verbose', action='store_true', help='provide verbose output logging')
|
||||
parser.add_argument('-f', '--from', dest='from_date', help='first date to generate playlist for')
|
||||
parser.add_argument('-t', '--to', dest='to_date', help='last date to generate playlist for')
|
||||
|
||||
args = parser.parse_args()
|
||||
if args.verbose:
|
||||
verbose = True
|
||||
if args.mediadir:
|
||||
mediadir = args.mediadir
|
||||
if args.playlistdir:
|
||||
playlistdir = args.playlistdir
|
||||
if args.channel:
|
||||
channel = args.channel
|
||||
if args.from_date:
|
||||
from_date = datetime.strptime(args.from_date, "%Y-%m-%d")
|
||||
if args.to_date:
|
||||
to_date = datetime.strptime(args.to_date, "%Y-%m-%d")
|
||||
|
||||
if verbose:
|
||||
print("Arguments parsed, config:")
|
||||
print("mediadir:", mediadir)
|
||||
print("playlistdir:", playlistdir)
|
||||
print("channel:", channel)
|
||||
print("from_date:", from_date)
|
||||
print("to_date:", to_date)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in New Issue