aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Christopher Rosell <chrippa@tanuki.se>2012-06-14 01:02:15 +0200
committerGravatar Christopher Rosell <chrippa@tanuki.se>2012-06-14 01:02:15 +0200
commit6f788fe8bc1cdc087bea5d6e057c95dc3c2c06da (patch)
tree83387a29e372a854cb2ccbd942d9d7a55c627a64
parentc125a8406d7a37f3f56f2c291ba22c2aaa0d0ac3 (diff)
Improved livestreamerrc reading.
- Now supports comments prefixed with '#'. - Now handles arguments with no value.
-rw-r--r--src/livestreamer/utils.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/livestreamer/utils.py b/src/livestreamer/utils.py
index 5735695..4cef351 100644
--- a/src/livestreamer/utils.py
+++ b/src/livestreamer/utils.py
@@ -8,10 +8,16 @@ SWF_KEY = b"Genuine Adobe Flash Player 001"
class ArgumentParser(argparse.ArgumentParser):
def convert_arg_line_to_args(self, line):
+ if line[0] == "#":
+ return
+
split = line.find("=")
- key = line[:split].strip()
- val = line[split+1:].strip()
- yield "--%s=%s" % (key, val)
+ if split > 0:
+ key = line[:split].strip()
+ val = line[split+1:].strip()
+ yield "--%s=%s" % (key, val)
+ else:
+ yield "--%s" % line
def urlopen(url, data=None, timeout=None, opener=None):
try: