From 079c006f1f8c76572b2c972ada9f45d465f642fc Mon Sep 17 00:00:00 2001 From: "Andrew C. Martin" Date: Thu, 7 Mar 2013 20:23:14 -0700 Subject: [PATCH] error check argument passed into epgdump --- support/epgdump | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/support/epgdump b/support/epgdump index 1c440db5..d0db4a30 100755 --- a/support/epgdump +++ b/support/epgdump @@ -15,7 +15,7 @@ # along with this program. If not, see . # """ -Dump EPG in human readable format for analysis +Dump Electronic Program Guide (EPG) in human readable format for analysis """ # System libs @@ -26,6 +26,12 @@ import pprint sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib', 'py')) import tvh.htsmsg as htsmsg +if len(sys.argv) < 2: + sys.exit('Usage: %s epg-path' % sys.argv[0]) + +if not os.path.exists(sys.argv[1]): + sys.exit('ERROR: epg "%s" was not found!' % sys.argv[1]) + # Open file fp = open(sys.argv[1], 'rb') for msg in htsmsg.deserialize(fp, True):