idk what im doing at this point with the audio shit

This commit is contained in:
JISAUAY committed 2025-01-16 16:32:30 -06:00
1 parent 6edcd1db98
commit 6897b684ee
4 files changed
+67 -24

No files matched your search

+1
View File
@@ -0,0 +1 @@
__pycache__
+23 -19
View File
@@ -8,9 +8,9 @@ import xml.etree
import xml.etree.ElementTree import xml.etree.ElementTree
import requests import requests
import libsonic # import libsonic
import simpleaudio # import simpleaudio
# import pyaudio import pyaudio
u = 'pseudo' u = 'pseudo'
@@ -215,7 +215,17 @@ class SubpyConn:
return songs 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?' url = self.base_url + '/rest/stream?'
payload = self._getBasePayload() payload = self._getBasePayload()
@@ -243,25 +253,19 @@ yakui_id = "7f6ca9951af294420382442061a2d6ee"
# for album in yakui_albums: # for album in yakui_albums:
# print(album.name) # print(album.name)
helios_songs = conn.getAlbumSongs(helios_id) # helios_songs = conn.getAlbumSongs(helios_id)
for song in helios_songs: # for song in helios_songs:
print(song.trackNumber, song.title) # print(song.trackNumber, song.title)
# class Artist: # artists = conn.getArtists()
# id: str # for artist in artists:
# imageUrl: str # print(artist.name)
# name: str
# albumCount: int
# def __init__(self): echidna_id = "937004317800a879f0cddd471fb82387"
# pass
# 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]: # def getArtists() -> list[Artist]:
# tree = xml.etree.ElementTree.parse("artist_response.xml") # tree = xml.etree.ElementTree.parse("artist_response.xml")
View File
Whitespace-only changes.
+43 -5
View File
@@ -1,8 +1,46 @@
import urwid # import urwid
txt = urwid.Text("hello world") # txt = urwid.Text("hello world")
fill = urwid.Filler(txt, "top") # fill = urwid.Filler(txt, "top")
loop = urwid.MainLoop(fill) # loop = urwid.MainLoop(fill)
loop.run() # 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)