mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-13 14:44:49 -04:00
Misc soundcloud issues fixed
This commit is contained in:
parent
bde9f7adec
commit
5ad725569d
4 changed files with 12 additions and 4 deletions
|
@ -48,7 +48,7 @@ class Downloadable(ABC):
|
||||||
await self._download(path, callback)
|
await self._download(path, callback)
|
||||||
|
|
||||||
async def size(self) -> int:
|
async def size(self) -> int:
|
||||||
if self._size is not None:
|
if hasattr(self, "_size") and self._size is not None:
|
||||||
return self._size
|
return self._size
|
||||||
|
|
||||||
async with self.session.head(self.url) as response:
|
async with self.session.head(self.url) as response:
|
||||||
|
@ -290,6 +290,7 @@ class SoundcloudDownloadable(Downloadable):
|
||||||
async def _download_original(self, path: str, callback):
|
async def _download_original(self, path: str, callback):
|
||||||
downloader = BasicDownloadable(self.session, self.url, "flac")
|
downloader = BasicDownloadable(self.session, self.url, "flac")
|
||||||
await downloader.download(path, callback)
|
await downloader.download(path, callback)
|
||||||
|
self.size = downloader.size
|
||||||
engine = converter.FLAC(path)
|
engine = converter.FLAC(path)
|
||||||
await engine.convert(path)
|
await engine.convert(path)
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,9 @@ class SoundcloudClient(Client):
|
||||||
}
|
}
|
||||||
resp, status = await self._api_request(f"search/{media_type}s", params=params)
|
resp, status = await self._api_request(f"search/{media_type}s", params=params)
|
||||||
assert status == 200
|
assert status == 200
|
||||||
|
if media_type == "track":
|
||||||
|
for item in resp["collection"]:
|
||||||
|
item["id"] = self._get_custom_id(item)
|
||||||
return [resp]
|
return [resp]
|
||||||
|
|
||||||
async def get_downloadable(self, item_info: str, _) -> SoundcloudDownloadable:
|
async def get_downloadable(self, item_info: str, _) -> SoundcloudDownloadable:
|
||||||
|
|
|
@ -18,7 +18,10 @@ logger = logging.getLogger("streamrip")
|
||||||
def remove_artwork_tempdirs():
|
def remove_artwork_tempdirs():
|
||||||
logger.debug("Removing dirs %s", _artwork_tempdirs)
|
logger.debug("Removing dirs %s", _artwork_tempdirs)
|
||||||
for path in _artwork_tempdirs:
|
for path in _artwork_tempdirs:
|
||||||
|
try:
|
||||||
shutil.rmtree(path)
|
shutil.rmtree(path)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
async def download_artwork(
|
async def download_artwork(
|
||||||
|
|
|
@ -224,7 +224,8 @@ class AlbumMetadata:
|
||||||
safe_get(track, "publisher_metadata", "explicit", default=False),
|
safe_get(track, "publisher_metadata", "explicit", default=False),
|
||||||
bool,
|
bool,
|
||||||
)
|
)
|
||||||
genre = typed(track["genre"], str)
|
genre = typed(track["genre"], str | None)
|
||||||
|
genres = [genre] if genre is not None else []
|
||||||
artist = typed(safe_get(track, "publisher_metadata", "artist"), str | None)
|
artist = typed(safe_get(track, "publisher_metadata", "artist"), str | None)
|
||||||
artist = artist or typed(track["user"]["username"], str)
|
artist = artist or typed(track["user"]["username"], str)
|
||||||
albumartist = artist
|
albumartist = artist
|
||||||
|
@ -259,7 +260,7 @@ class AlbumMetadata:
|
||||||
album_title,
|
album_title,
|
||||||
albumartist,
|
albumartist,
|
||||||
year,
|
year,
|
||||||
genre=[genre],
|
genre=genres,
|
||||||
covers=covers,
|
covers=covers,
|
||||||
albumcomposer=None,
|
albumcomposer=None,
|
||||||
comment=None,
|
comment=None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue