mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-13 06:34:45 -04:00
Misc fixes/optimizations
This commit is contained in:
parent
246d69cb30
commit
6cfd068a97
5 changed files with 12 additions and 11 deletions
|
@ -44,6 +44,7 @@ class DownloadCommand(Command):
|
|||
|
||||
def handle(self):
|
||||
global outdated
|
||||
global newest_version
|
||||
|
||||
# Use a thread so that it doesn't slow down startup
|
||||
update_check = threading.Thread(target=is_outdated, daemon=True)
|
||||
|
@ -102,7 +103,7 @@ class DownloadCommand(Command):
|
|||
)
|
||||
|
||||
md_header = re.compile(r"#\s+(.+)")
|
||||
bullet_point = re.compile(r"-\s*(.+)")
|
||||
bullet_point = re.compile(r"-\s+(.+)")
|
||||
code = re.compile(r"`([^`]+)`")
|
||||
issue_reference = re.compile(r"(#\d+)")
|
||||
|
||||
|
|
|
@ -459,7 +459,7 @@ class RipCore(list):
|
|||
for item, url in zip(soundcloud_items, soundcloud_urls)
|
||||
)
|
||||
|
||||
logger.debug(f"Parsed urls: {parsed}")
|
||||
logger.debug("Parsed urls: %s", parsed)
|
||||
|
||||
return parsed
|
||||
|
||||
|
@ -501,7 +501,7 @@ class RipCore(list):
|
|||
# This will match somthing like "Test (Person Remix]" though, so its not perfect
|
||||
banned_words_plain = re.compile(r"(?i)(?:(?:re)?mix|live|karaoke)")
|
||||
banned_words = re.compile(
|
||||
rf"(?i)[\(\[][^\)\]]*?(?:(?:re)?mix|live|karaoke)[^\)\]]*[\]\)]"
|
||||
r"(?i)[\(\[][^\)\]]*?(?:(?:re)?mix|live|karaoke)[^\)\]]*[\]\)]"
|
||||
)
|
||||
|
||||
def search_query(title, artist, playlist) -> bool:
|
||||
|
|
|
@ -45,7 +45,7 @@ class Database:
|
|||
)
|
||||
command = f"CREATE TABLE {self.name} ({params})"
|
||||
|
||||
logger.debug(f"executing {command}")
|
||||
logger.debug("executing %s", command)
|
||||
|
||||
conn.execute(command)
|
||||
|
||||
|
|
|
@ -681,7 +681,7 @@ class DeezloaderClient(Client):
|
|||
"""
|
||||
quality = min(DeezloaderClient.max_quality, quality)
|
||||
url = f"{DEEZER_DL}/{get_quality(quality, 'deezloader')}/{DEEZER_BASE}/track/{meta_id}"
|
||||
logger.debug(f"Download url {url}")
|
||||
logger.debug("Download url %s", url)
|
||||
return {"url": url}
|
||||
|
||||
|
||||
|
|
|
@ -466,7 +466,7 @@ class Track(Media):
|
|||
def download_cover(self, width=999999, height=999999):
|
||||
"""Download the cover art, if cover_url is given."""
|
||||
self.cover_path = os.path.join(gettempdir(), f"cover{hash(self.cover_url)}.jpg")
|
||||
logger.debug(f"Downloading cover from {self.cover_url}")
|
||||
logger.debug("Downloading cover from %s", self.cover_url)
|
||||
|
||||
if not os.path.exists(self.cover_path):
|
||||
_cover_download(self.cover_url, self.cover_path)
|
||||
|
@ -1193,7 +1193,7 @@ class Tracklist(list):
|
|||
kwargs["sampling_rate"],
|
||||
)
|
||||
else:
|
||||
logger.debug(f"Downsampling to {sr/1000}kHz")
|
||||
logger.debug("Downsampling to %skHz", sr / 1000)
|
||||
|
||||
for track in self:
|
||||
track.convert(codec, **kwargs)
|
||||
|
@ -1430,7 +1430,7 @@ class Album(Tracklist, Media):
|
|||
# choose optimal cover size and download it
|
||||
cover_path = os.path.join(gettempdir(), f"cover_{hash(self)}.jpg")
|
||||
embed_cover_size = kwargs.get("embed_cover_size", "large")
|
||||
secho(f"Downloading {embed_cover_size} cover art", bold=True)
|
||||
secho(f"Downloading cover art ({embed_cover_size})", bold=True)
|
||||
|
||||
assert (
|
||||
embed_cover_size in self.cover_urls
|
||||
|
@ -1775,7 +1775,7 @@ class Playlist(Tracklist, Media):
|
|||
)
|
||||
)
|
||||
|
||||
logger.debug(f"Loaded {len(self)} tracks from playlist {self.name}")
|
||||
logger.debug("Loaded %d tracks from playlist %s", len(self), self.name)
|
||||
|
||||
def _prepare_download(self, parent_folder: str = "StreamripDownloads", **kwargs):
|
||||
if kwargs.get("folder_format"):
|
||||
|
@ -1978,8 +1978,8 @@ class Artist(Tracklist, Media):
|
|||
self.folder = parent_folder
|
||||
|
||||
logger.debug("Artist folder: %s", folder)
|
||||
logger.debug(f"Length of tracklist {len(self)}")
|
||||
logger.debug(f"Filters: {filters}")
|
||||
logger.debug("Length of tracklist %d", len(self))
|
||||
logger.debug("Filters: %s", filters)
|
||||
|
||||
final: Iterable
|
||||
if "repeats" in filters:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue