Skip to content

Instantly share code, notes, and snippets.

@chrippa
Created December 30, 2012 22:57
Show Gist options
  • Save chrippa/4415832 to your computer and use it in GitHub Desktop.
Save chrippa/4415832 to your computer and use it in GitHub Desktop.
diff --git a/src/livestreamer/cli.py b/src/livestreamer/cli.py
index a60b184..d0148dd 100644
--- a/src/livestreamer/cli.py
+++ b/src/livestreamer/cli.py
@@ -310,9 +310,21 @@ def handle_url(args):
if len(streams) == 0:
exit("No streams found on this URL: {0}", args.url)
- keys = list(streams.keys())
- keys.sort()
- validstreams = (", ").join(keys)
+ validstreams = []
+ for name, stream in sorted(streams.items()):
+ if name in ("best", "worst"):
+ continue
+
+ synonyms = list(filter(lambda n: stream is streams[n] and n is not name,
+ streams.keys()))
+
+ if len(synonyms) > 0:
+ joined = ", ".join(synonyms)
+ name = "{0} ({1})".format(name, joined)
+
+ validstreams.append(name)
+
+ validstreams = ", ".join(validstreams)
if args.stream:
if args.stream == "best" or args.stream == "worst":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment