Skip to content

Commit

Permalink
Raise IneligibleError if featured lists are accessed with Deezloader
Browse files Browse the repository at this point in the history
  • Loading branch information
nathom committed Aug 20, 2021
1 parent 22d2a64 commit 0b22c36
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions rip/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class DiscoverCommand(Command):
"$ <cmd>rip discover</cmd>\n\n"
"Browse the best-sellers list\n"
"$ <cmd>rip discover best-sellers</cmd>\n\n"
"Available options for Qobuz <info>list</info>:\n\n"
"Available options for Qobuz <cmd>list</cmd>:\n\n"
" • most-streamed\n"
" • recent-releases\n"
" • best-sellers\n"
Expand All @@ -203,7 +203,7 @@ class DiscoverCommand(Command):
"$ <cmd>rip discover --source deezer</cmd>\n\n"
"Browse the Deezer charts\n"
"$ <cmd>rip discover --source deezer charts</cmd>\n\n"
"Available options for Deezer <info>list</info>:\n\n"
"Available options for Deezer <cmd>list</cmd>:\n\n"
" • releases\n"
" • charts\n"
" • selection\n"
Expand Down
8 changes: 8 additions & 0 deletions rip/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from streamrip.constants import MEDIA_TYPES
from streamrip.exceptions import (
AuthenticationError,
IneligibleError,
ItemExists,
MissingCredentials,
NonStreamable,
Expand Down Expand Up @@ -653,7 +654,14 @@ def search(
logger.debug("searching for %s", query)

client = self.get_client(source)

if isinstance(client, DeezloaderClient) and media_type == "featured":
raise IneligibleError(
"Must have premium Deezer account to access editorial lists."
)

results = client.search(query, media_type)

if media_type == "featured":
media_type = "album"

Expand Down
1 change: 0 additions & 1 deletion streamrip/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,6 @@ def search(
try:
if media_type == "featured":
if query:
print(query)
search_function = getattr(
self.client.api, f"get_editorial_{query}"
)
Expand Down
2 changes: 0 additions & 2 deletions streamrip/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ def download( # noqa
url_id = self.id

try:
print(url_id)
print(self.quality)
dl_info = self.client.get_file_url(url_id, self.quality)
except Exception as e:
logger.debug(repr(e))
Expand Down

0 comments on commit 0b22c36

Please sign in to comment.