working on cover art

This commit is contained in:
0x01FE committed 2025-01-24 14:48:57 -06:00
1 parent ee479940b6
commit 2d97c921af
4 files changed
+26 -2

No files matched your search

+12
View File
@@ -374,6 +374,18 @@ class SubpyConn:
return requests.get(url + self._encodePayload(payload), stream=True)
# Saves cover art id
def getCoverArt(self, cover_art_id: str, path: str | None = None) -> None:
url = self.base_url + '/rest/getCoverArt?'
payload = self._getBasePayload()
payload['id'] = cover_art_id
r = requests.get(url + self._encodePayload(payload))
with open(path if path else 'cover.png', 'wb') as file:
file.write(r.content)
def getSong(self, song_id: str) -> Song:
url = self.base_url + '/rest/getSong?'
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

+4 -2
View File
@@ -100,8 +100,10 @@ class SubPyPlayer:
# for song in conn.getStarredSongs():
# print(song.title)
for song in conn.getPlaylist('9d76a86b-901f-4727-a2ec-01210157ff01'):
print(song.title)
# for song in conn.getPlaylist('9d76a86b-901f-4727-a2ec-01210157ff01'):
# print(song.title)
conn.getCoverArt('al-1d2749574810ce63fa1c47b57e8e3e73_678fdf31')
# player.play_song(echidna_id)
+10
View File
@@ -0,0 +1,10 @@
from rich_pixels import Pixels
from rich.console import Console
from PIL import Image
console = Console()
with Image.open("cover.png") as image:
pixels = Pixels.from_image(image, resize=(60, 60))
console.print(pixels)