mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-09 14:11:55 -04:00
Added config command
This commit is contained in:
parent
4bd3b6fae3
commit
c74b4b655a
1 changed files with 23 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
import logging
|
||||
from getpass import getpass
|
||||
import os
|
||||
|
||||
import click
|
||||
|
@ -166,6 +167,28 @@ def discover(ctx, **kwargs):
|
|||
none_chosen()
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option("-o", "--open", is_flag=True, help='Open the config file')
|
||||
@click.option("-q", "--qobuz", is_flag=True, help='Set Qobuz credentials')
|
||||
@click.option("-t", "--tidal", is_flag=True, help='Set Tidal credentials')
|
||||
@click.pass_context
|
||||
def config(ctx, **kwargs):
|
||||
"""Manage the streamrip configuration."""
|
||||
|
||||
if kwargs['open']:
|
||||
click.launch(CONFIG_PATH)
|
||||
|
||||
if kwargs['qobuz']:
|
||||
config.file['qobuz']['email'] = input("Qobuz email: ")
|
||||
config.file['qobuz']['password'] = getpass()
|
||||
config.save()
|
||||
|
||||
if kwargs['tidal']:
|
||||
config.file['tidal']['email'] = input("Tidal email: ")
|
||||
config.file['tidal']['password'] = getpass()
|
||||
config.save()
|
||||
|
||||
|
||||
def none_chosen():
|
||||
click.secho("No items chosen, exiting.", fg="bright_red")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue