Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
nathom committed Sep 26, 2021
2 parents 908ed62 + 35262cb commit 6cd62f6
Show file tree
Hide file tree
Showing 19 changed files with 387 additions and 432 deletions.
106 changes: 106 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Bug report
description: Create a report to help us improve streamrip
labels: bug
body:
# types: dropdown, textarea, input
# - type: dropdown
# validations:
# required: true
# attributes:
# label: Are you using "tree-sitter" branch?
# options:
# - 'Yes'
# - 'No'

- type: textarea
validations:
required: true
attributes:
label: Describe the bug
description: A clear and concise description of the bug.

- type: textarea
validations:
required: true
attributes:
label: Command Used
description: |
The command that you typed that caused the error
placeholder: |
For example:
`rip url https://example.com`
- type: markdown
attributes:
value: "```\n"

- type: textarea
validations:
required: true
attributes:
label: Debug Traceback
description: |
Run your command, with `-vvv` appended to it, and paste the output here.
For example, if the problematic command was `rip url https://example.com`, then
you would run `rip url https://example.com -vvv` to get the debug logs.
Make sure to check the logs for any personal information such as emails and remove them.
- type: markdown
attributes:
value: "```"

- type: markdown
attributes:
value: "```toml\n"

- type: textarea
validations:
required: true
attributes:
label: Config File
description: |
Find the config file using `rip config --open` and paste the contents here.
Make sure you REMOVE YOUR CREDENTIALS!
- type: markdown
attributes:
value: "```"

- type: input
validations:
required: true
attributes:
label: Operating System
placeholder: e.g. Windows, Linux, macOS...

- type: markdown
attributes:
value: "```\n"

- type: input
validations:
required: true
attributes:
label: streamrip version
description: Run `rip --version` to check.
placeholder: e.g. 1.5

- type: markdown
attributes:
value: "```"

- type: textarea
attributes:
label: Screenshots and recordings
description: |
If applicable, add screenshots to help explain your problem.
You can also record an asciinema session: https://asciinema.org/
- type: textarea
attributes:
label: Additional context
description: Add any other context about the problem here.

- type: markdown
attributes:
value: "Thanks for completing our form!"
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
35 changes: 17 additions & 18 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "streamrip"
version = "1.5"
version = "1.6"
description = "A fast, all-in-one music ripper for Qobuz, Deezer, Tidal, and SoundCloud"
authors = ["nathom <nathanthomas707@gmail.com>"]
license = "GPL-3.0-only"
Expand Down
Empty file added rg
Empty file.
44 changes: 11 additions & 33 deletions rip/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ def handle(self):
if len(core) > 0:
core.download()
elif not urls and path is None:
self.line(
"<error>Must pass arguments. See </><cmd>rip url -h</cmd>."
)
self.line("<error>Must pass arguments. See </><cmd>rip url -h</cmd>.")

update_check.join()
if outdated:
Expand All @@ -115,16 +113,10 @@ def handle(self):
"https://api.github.com/repos/nathom/streamrip/releases/latest"
).json()["body"]

release_notes = md_header.sub(
r"<header>\1</header>", release_notes
)
release_notes = bullet_point.sub(
r"<options=bold>•</> \1", release_notes
)
release_notes = md_header.sub(r"<header>\1</header>", release_notes)
release_notes = bullet_point.sub(r"<options=bold>•</> \1", release_notes)
release_notes = code.sub(r"<cmd>\1</cmd>", release_notes)
release_notes = issue_reference.sub(
r"<options=bold>\1</>", release_notes
)
release_notes = issue_reference.sub(r"<options=bold>\1</>", release_notes)

self.line(release_notes)

Expand Down Expand Up @@ -154,9 +146,7 @@ class SearchCommand(Command):

def handle(self):
query = self.argument("query")
source, type = clean_options(
self.option("source"), self.option("type")
)
source, type = clean_options(self.option("source"), self.option("type"))

config = Config()
core = RipCore(config)
Expand Down Expand Up @@ -219,18 +209,14 @@ def handle(self):
from streamrip.constants import QOBUZ_FEATURED_KEYS

if chosen_list not in QOBUZ_FEATURED_KEYS:
self.line(
f'<error>Error: list "{chosen_list}" not available</error>'
)
self.line(f'<error>Error: list "{chosen_list}" not available</error>')
self.line(self.help)
return 1
elif source == "deezer":
from streamrip.constants import DEEZER_FEATURED_KEYS

if chosen_list not in DEEZER_FEATURED_KEYS:
self.line(
f'<error>Error: list "{chosen_list}" not available</error>'
)
self.line(f'<error>Error: list "{chosen_list}" not available</error>')
self.line(self.help)
return 1

Expand Down Expand Up @@ -318,9 +304,7 @@ def handle(self):
self.line(f"<info>{CONFIG_PATH}</info>")

if self.option("open"):
self.line(
f"Opening <url>{CONFIG_PATH}</url> in default application"
)
self.line(f"Opening <url>{CONFIG_PATH}</url> in default application")
launch(CONFIG_PATH)

if self.option("reset"):
Expand Down Expand Up @@ -367,19 +351,15 @@ def handle(self):
self.line("<b>Sucessfully logged in!</b>")

except AuthenticationError:
self.line(
"<error>Could not log in. Double check your ARL</error>"
)
self.line("<error>Could not log in. Double check your ARL</error>")

if self.option("qobuz"):
import getpass
import hashlib

self._config.file["qobuz"]["email"] = self.ask("Qobuz email:")
self._config.file["qobuz"]["password"] = hashlib.md5(
getpass.getpass(
"Qobuz password (won't show on screen): "
).encode()
getpass.getpass("Qobuz password (won't show on screen): ").encode()
).hexdigest()
self._config.save()

Expand Down Expand Up @@ -631,9 +611,7 @@ def create_io(self, input=None, output=None, error_output=None):
formatter.set_style("path", Style("green", options=["bold"]))
formatter.set_style("cmd", Style("magenta"))
formatter.set_style("title", Style("yellow", options=["bold"]))
formatter.set_style(
"header", Style("yellow", options=["bold", "underline"])
)
formatter.set_style("header", Style("yellow", options=["bold", "underline"]))
io.output.set_formatter(formatter)
io.error_output.set_formatter(formatter)

Expand Down
15 changes: 7 additions & 8 deletions rip/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ class Config:
values.
"""

default_config_path = os.path.join(
os.path.dirname(__file__), "config.toml"
)
default_config_path = os.path.join(os.path.dirname(__file__), "config.toml")

with open(default_config_path) as cfg:
defaults: Dict[str, Any] = tomlkit.parse(cfg.read().strip())
Expand All @@ -57,10 +55,7 @@ def __init__(self, path: str = None):

if os.path.isfile(self._path):
self.load()
if (
self.file["misc"]["version"]
!= self.defaults["misc"]["version"]
):
if self.file["misc"]["version"] != self.defaults["misc"]["version"]:
secho(
"Updating config file to new version. Some settings may be lost.",
fg="yellow",
Expand Down Expand Up @@ -188,7 +183,11 @@ def creds(self, source: str):
if source == "deezer":
return {"arl": self.file["deezer"]["arl"]}
if source == "soundcloud":
return {}
soundcloud = self.file["soundcloud"]
return {
"client_id": soundcloud["client_id"],
"app_version": soundcloud["app_version"],
}

raise InvalidSourceError(source)

Expand Down
5 changes: 4 additions & 1 deletion rip/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ deezloader_warnings = true
[soundcloud]
# Only 0 is available for now
quality = 0
# This changes periodically, so it needs to be updated
client_id = ""
app_version = ""

[youtube]
# Only 0 is available for now
Expand Down Expand Up @@ -164,4 +167,4 @@ progress_bar = "dainty"

[misc]
# Metadata to identify this config file. Do not change.
version = "1.5"
version = "1.6"
Loading

0 comments on commit 6cd62f6

Please sign in to comment.