Skip to content

Commit

Permalink
cli: Deprecate --best-stream-default and add --default-stream instead.
Browse files Browse the repository at this point in the history
Resolves chrippa#381.
  • Loading branch information
chrippa authored and cheah committed Aug 17, 2014
1 parent 837e3ef commit 57f6f58
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
13 changes: 7 additions & 6 deletions docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,13 @@ Command line options
Stream options
^^^^^^^^^^^^^^

.. cmdoption:: --default-stream stream

Open this stream when no stream argument is specified
on the command line, e.g. ``best``

.. versionadded:: 1.9.0

.. cmdoption:: --retry-streams delay

Will retry fetching streams until streams are found
Expand Down Expand Up @@ -337,12 +344,6 @@ Stream options
expression with a comma. For example ``>480p,>mobile_medium``
will exclude streams from two quality types.

.. cmdoption:: --best-stream-default

Use the 'best' stream if no stream is specified.

.. versionadded:: 1.8.0


HTTP options
^^^^^^^^^^^^
Expand Down
5 changes: 4 additions & 1 deletion src/livestreamer_cli/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ def filesize(value):
help=argparse.SUPPRESS)

group = parser.add_argument_group("stream options")
group.add_argument("--default-stream", type=comma_list, metavar="stream",
help="Open this stream when no stream argument is specified "
"on the command line, e.g. 'best'")
group.add_argument("--retry-streams", metavar="delay", type=float,
help="Will retry fetching streams until streams are found "
"while waiting <delay> (seconds) between each attempt")
Expand All @@ -142,7 +145,7 @@ def filesize(value):
"For example '>480p,>mobile_medium' will exclude "
"streams from two quality types.")
group.add_argument("--best-stream-default", action="store_true",
help="Use the 'best' stream if no stream is specified.")
help=argparse.SUPPRESS)

httpopt = parser.add_argument_group("HTTP options")
httpopt.add_argument("--http-proxy", metavar="http://hostname:port/",
Expand Down
12 changes: 10 additions & 2 deletions src/livestreamer_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,11 @@ def handle_url():
if not streams:
console.exit("No streams found on this URL: {0}", args.url)

if args.best_stream_default and not args.stream and not args.json:
args.stream = ["best"]
if args.best_stream_default:
args.default_stream = ["best"]

if args.default_stream and not args.stream and not args.json:
args.stream = args.default_stream

if args.stream:
validstreams = format_valid_streams(streams)
Expand Down Expand Up @@ -603,6 +606,11 @@ def setup_console():
"version 1.4.3 as hiding player output is now "
"the default.")

if args.best_stream_default:
console.logger.warning("The option --best-stream-default is deprecated "
"since version 1.9.0, use '--default-stream best' "
"instead.")

console.json = args.json

# Handle SIGTERM just like SIGINT
Expand Down

0 comments on commit 57f6f58

Please sign in to comment.