47 lines
891 B
Python
47 lines
891 B
Python
# import urwid
|
|
|
|
# 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)
|