idk what im doing at this point with the audio shit
This commit is contained in:
1 parent
6edcd1db98
commit
6897b684ee
4 files changed
+67
-24
No files matched your search
@@ -0,0 +1 @@
|
||||
__pycache__
|
||||
+23
-19
@@ -8,9 +8,9 @@ import xml.etree
|
||||
import xml.etree.ElementTree
|
||||
|
||||
import requests
|
||||
import libsonic
|
||||
import simpleaudio
|
||||
# import pyaudio
|
||||
# import libsonic
|
||||
# import simpleaudio
|
||||
import pyaudio
|
||||
|
||||
|
||||
u = 'pseudo'
|
||||
@@ -215,7 +215,17 @@ class SubpyConn:
|
||||
|
||||
return songs
|
||||
|
||||
def stream(self, song_id: str):
|
||||
def getArtists(self) -> list[Artist]:
|
||||
artistIndexes: ArtistIndexes = self.getIndexes()
|
||||
|
||||
artists: list[Artist] = []
|
||||
for artistIndex in artistIndexes.indexes:
|
||||
artists.extend(artistIndex.artists)
|
||||
|
||||
return artists
|
||||
|
||||
# Returns a requests Response object, the data stream can be found in Response.content
|
||||
def stream(self, song_id: str) -> requests.Response:
|
||||
url = self.base_url + '/rest/stream?'
|
||||
|
||||
payload = self._getBasePayload()
|
||||
@@ -243,25 +253,19 @@ yakui_id = "7f6ca9951af294420382442061a2d6ee"
|
||||
# for album in yakui_albums:
|
||||
# print(album.name)
|
||||
|
||||
helios_songs = conn.getAlbumSongs(helios_id)
|
||||
for song in helios_songs:
|
||||
print(song.trackNumber, song.title)
|
||||
# helios_songs = conn.getAlbumSongs(helios_id)
|
||||
# for song in helios_songs:
|
||||
# print(song.trackNumber, song.title)
|
||||
|
||||
# class Artist:
|
||||
# artists = conn.getArtists()
|
||||
|
||||
# id: str
|
||||
# imageUrl: str
|
||||
# name: str
|
||||
# albumCount: int
|
||||
# for artist in artists:
|
||||
# print(artist.name)
|
||||
|
||||
# def __init__(self):
|
||||
# pass
|
||||
echidna_id = "937004317800a879f0cddd471fb82387"
|
||||
|
||||
# print(conn.stream(echidna_id).content)
|
||||
|
||||
# def fromDict(self, d: dict):
|
||||
# self.id = d['id']
|
||||
# self.imageUrl = d['artistImageUrl']
|
||||
# self.name = d['name']
|
||||
# self.albumCount = d['albumCount']
|
||||
|
||||
# def getArtists() -> list[Artist]:
|
||||
# tree = xml.etree.ElementTree.parse("artist_response.xml")
|
||||
|
||||
Whitespace-only changes.
@@ -1,8 +1,46 @@
|
||||
import urwid
|
||||
# import urwid
|
||||
|
||||
txt = urwid.Text("hello world")
|
||||
fill = urwid.Filler(txt, "top")
|
||||
loop = urwid.MainLoop(fill)
|
||||
loop.run()
|
||||
# txt = urwid.Text("hello world")
|
||||
# fill = urwid.Filler(txt, "top")
|
||||
# loop = urwid.MainLoop(fill)
|
||||
# loop.run()
|
||||
|
||||
import wave
|
||||
|
||||
import SubSonic
|
||||
import pyaudio
|
||||
|
||||
u = 'pseudo'
|
||||
p = 'telegram9dock-MICHEL'
|
||||
conn = SubSonic.SubpyConn(u, p, "https://music.0x01fe.net")
|
||||
|
||||
echidna_id = "937004317800a879f0cddd471fb82387"
|
||||
|
||||
def play_song(song_id: str):
|
||||
r = conn.stream(song_id)
|
||||
|
||||
# print(len(r.content))
|
||||
|
||||
stream_data: bytes = r.content
|
||||
|
||||
def callback(in_data, frame_count, time_info, status):
|
||||
|
||||
return (stream_data, pyaudio.paContinue)
|
||||
|
||||
|
||||
|
||||
audio = pyaudio.PyAudio()
|
||||
|
||||
stream = audio.open(format=audio.get_format_from_width(2),
|
||||
channels=2,
|
||||
rate=44100,
|
||||
output=True,
|
||||
stream_callback=callback)
|
||||
|
||||
# r.content.
|
||||
|
||||
# def stream_callback(in_data)
|
||||
|
||||
|
||||
|
||||
play_song(echidna_id)
|
||||
Reference in new issue
Block a user