working on cover art
This commit is contained in:
1 parent
ee479940b6
commit
2d97c921af
4 files changed
+26
-2
No files matched your search
+12
@@ -374,6 +374,18 @@ class SubpyConn:
|
|||||||
|
|
||||||
return requests.get(url + self._encodePayload(payload), stream=True)
|
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:
|
def getSong(self, song_id: str) -> Song:
|
||||||
url = self.base_url + '/rest/getSong?'
|
url = self.base_url + '/rest/getSong?'
|
||||||
|
|
||||||
|
|||||||
@@ -100,8 +100,10 @@ class SubPyPlayer:
|
|||||||
# for song in conn.getStarredSongs():
|
# for song in conn.getStarredSongs():
|
||||||
# print(song.title)
|
# print(song.title)
|
||||||
|
|
||||||
for song in conn.getPlaylist('9d76a86b-901f-4727-a2ec-01210157ff01'):
|
# for song in conn.getPlaylist('9d76a86b-901f-4727-a2ec-01210157ff01'):
|
||||||
print(song.title)
|
# print(song.title)
|
||||||
|
|
||||||
|
conn.getCoverArt('al-1d2749574810ce63fa1c47b57e8e3e73_678fdf31')
|
||||||
|
|
||||||
# player.play_song(echidna_id)
|
# player.play_song(echidna_id)
|
||||||
|
|
||||||
@@ -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)
|
||||||
Reference in new issue
Block a user