mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-13 14:44:49 -04:00
Handle ItemExists in core.py
Signed-off-by: nathom <nathanthomas707@gmail.com>
This commit is contained in:
parent
835c8d4cc6
commit
26cb32b9a4
2 changed files with 11 additions and 5 deletions
|
@ -49,6 +49,7 @@ from . import db
|
||||||
from streamrip.exceptions import (
|
from streamrip.exceptions import (
|
||||||
AuthenticationError,
|
AuthenticationError,
|
||||||
PartialFailure,
|
PartialFailure,
|
||||||
|
ItemExists,
|
||||||
MissingCredentials,
|
MissingCredentials,
|
||||||
NonStreamable,
|
NonStreamable,
|
||||||
NoResultsFound,
|
NoResultsFound,
|
||||||
|
@ -303,6 +304,9 @@ class MusicDL(list):
|
||||||
for failed_item in e.failed_items:
|
for failed_item in e.failed_items:
|
||||||
self.failed_db.add(failed_item)
|
self.failed_db.add(failed_item)
|
||||||
continue
|
continue
|
||||||
|
except ItemExists as e:
|
||||||
|
click.secho(f'"{e!s}" already exists. Skipping.', fg="yellow")
|
||||||
|
continue
|
||||||
|
|
||||||
if hasattr(item, "id"):
|
if hasattr(item, "id"):
|
||||||
self.db.add([item.id])
|
self.db.add([item.id])
|
||||||
|
|
|
@ -207,10 +207,13 @@ class Track(Media):
|
||||||
raise ItemExists(self.final_path)
|
raise ItemExists(self.final_path)
|
||||||
|
|
||||||
if hasattr(self, "cover_url"):
|
if hasattr(self, "cover_url"):
|
||||||
self.download_cover(
|
try:
|
||||||
width=kwargs.get("max_artwork_width", 999999),
|
self.download_cover(
|
||||||
height=kwargs.get("max_artwork_height", 999999),
|
width=kwargs.get("max_artwork_width", 999999),
|
||||||
) # only downloads for playlists and singles
|
height=kwargs.get("max_artwork_height", 999999),
|
||||||
|
) # only downloads for playlists and singles
|
||||||
|
except ItemExists as e:
|
||||||
|
logger.debug(e)
|
||||||
|
|
||||||
self.path = os.path.join(gettempdir(), f"{hash(self.id)}_{self.quality}.tmp")
|
self.path = os.path.join(gettempdir(), f"{hash(self.id)}_{self.quality}.tmp")
|
||||||
|
|
||||||
|
@ -230,7 +233,6 @@ class Track(Media):
|
||||||
:param progress_bar: turn on/off progress bar
|
:param progress_bar: turn on/off progress bar
|
||||||
:type progress_bar: bool
|
:type progress_bar: bool
|
||||||
"""
|
"""
|
||||||
# raise NonStreamable
|
|
||||||
self._prepare_download(
|
self._prepare_download(
|
||||||
quality=quality,
|
quality=quality,
|
||||||
parent_folder=parent_folder,
|
parent_folder=parent_folder,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue