From b90c05754c4ea1ad8d52a57197f254f687859b6d Mon Sep 17 00:00:00 2001 From: Justin Emter Date: Sat, 22 Jul 2017 20:49:57 -0700 Subject: [PATCH] Added help for cli args. --- PseudoChannel.py | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/PseudoChannel.py b/PseudoChannel.py index 5c46a78..e8f8670 100644 --- a/PseudoChannel.py +++ b/PseudoChannel.py @@ -17,6 +17,7 @@ from datetime import time import calendar import itertools import argparse +import textwrap from xml.dom import minidom import xml.etree.ElementTree as ET @@ -662,7 +663,7 @@ class PseudoChannel(): for i , entry in enumerate(daily_schedule): - print "+++++", str(i + 1)+".", entry[11], entry[8], entry[6], " - ", entry[3] + print "+++++", str(i + 1)+".", entry[8], entry[11], entry[6], " - ", entry[3] def exit_app(self): @@ -692,11 +693,18 @@ if __name__ == '__main__': #pseudo_channel.generate_daily_schedule() + banner = textwrap.dedent('''\ +# __ __ +# |__)_ _ _| _ / |_ _ _ _ _| _ +# | _)(-|_|(_|(_)\__| )(_|| )| )(-|. |_)\/ +# | / + + A Custom TV Channel for Plex +''') + parser = argparse.ArgumentParser( - description="Pseudo Channel for Plex. Update pseduo_config.py & pseudo_schedule.xml before this step.", - usage="PseudoChannel.py [-u] update local db with plex db [-xml] update db " \ - "with xml schedule data [-g] generate daily schedule [-r] run the app" - ) + formatter_class=argparse.RawDescriptionHelpFormatter, + description = banner) ''' * @@ -704,24 +712,36 @@ if __name__ == '__main__': * ''' - parser.add_argument('-u', action='store_true') - parser.add_argument('-xml', action='store_true') - parser.add_argument('-g', action='store_true') - parser.add_argument('-r', action='store_true') + parser.add_argument('-u', + action='store_true', + help='Update the local database with Plex linraries.') + parser.add_argument('-xml', + action='store_true', + help='Update the local database with the pseudo_schedule.xml.') + parser.add_argument('-g', + action='store_true', + help='Generate the daily schedule.') + parser.add_argument('-r', + action='store_true', + help='Run this program.') ''' * * Show connected clients: "python PseudoChannel.py -c" * ''' - parser.add_argument('-c', action='store_true') + parser.add_argument('-c', + action='store_true', + help='Show Plex clients.') ''' * * Show schedule (daily): "python PseudoChannel.py -s" * ''' - parser.add_argument('-s', action='store_true') + parser.add_argument('-s', + action='store_true', + help='Show scheduled media for today.') globals().update(vars(parser.parse_args())) @@ -753,7 +773,7 @@ if __name__ == '__main__': try: - print "##### Running TV Controller" + print banner print "+++++ To run this in the background:" print "+++++", "screen -d -m bash -c 'python PseudoChannel.py -r; exec sh'"