cli: Add --can-handle-url option, useful for scripting.

This commit is contained in:
Christopher Rosell 2014-12-20 18:56:07 +01:00
parent 3cd7f604b9
commit fe0d72f825
3 changed files with 31 additions and 1 deletions

View File

@ -1,8 +1,20 @@
Version 1.12.0 (Under development)
----------------------------------
CLI:
- Added :option:`--can-handle-url` option, useful for scripting.
Plugins:
- hitbox: Updated for services changes. (#648)
- youtube: Now handles more URL types.
Version 1.11.1 (2014-12-12)
---------------------------
Plugins:
- twitch: Updated for API changes. (#633)
- twitch: Updated for API changes. (#633)
Version 1.11.0 (2014-12-10)

View File

@ -201,6 +201,17 @@ general.add_argument(
Print a list of all currently installed plugins.
"""
)
general.add_argument(
"--can-handle-url",
metavar="URL",
help="""
Check if Livestreamer has a plugin that can handle the specified URL.
Returns status code 1 for false and 0 for true.
Useful for external scripting.
"""
)
general.add_argument(
"--config",
action="append",

View File

@ -844,6 +844,13 @@ def main():
if args.plugins:
print_plugins()
elif args.can_handle_url:
try:
livestreamer.resolve_url(args.can_handle_url)
except NoPluginError:
sys.exit(1)
else:
sys.exit(0)
elif args.url:
try:
setup_options()