working with reactive stuff
This commit is contained in:
1 parent
7ad56fa4be
commit
6c4e9c40b1
25 files changed
+20867
-20649
No files matched your search
+65
-65
@@ -1,65 +1,65 @@
|
||||
import xml.etree.ElementTree
|
||||
|
||||
import Artist
|
||||
|
||||
|
||||
class ArtistIndex:
|
||||
name: str
|
||||
artists: list[Artist.Artist]
|
||||
|
||||
def __init__(self, indexInfo: dict, artists: list[dict]):
|
||||
self.name = indexInfo['name']
|
||||
|
||||
self.artists = []
|
||||
for artist in artists:
|
||||
self.artists.append(Artist.Artist(
|
||||
artist['id'],
|
||||
artist['name'],
|
||||
artist['albumCount'],
|
||||
artist['coverArt'],
|
||||
artist['artistImageUrl']
|
||||
))
|
||||
|
||||
|
||||
|
||||
class ArtistIndexes:
|
||||
indexes: list[ArtistIndex]
|
||||
|
||||
def __init__(self, xml_data: bytes):
|
||||
self._parseXml(xml_data.decode('utf-8'))
|
||||
|
||||
def _parseXml(self, xml_data: str):
|
||||
root = xml.etree.ElementTree.fromstring(xml_data)
|
||||
|
||||
self.indexes: list[ArtistIndex] = []
|
||||
|
||||
if root.get('status') != 'ok':
|
||||
return None
|
||||
|
||||
in_index = False
|
||||
artists = []
|
||||
index_info = None
|
||||
for item in root.iter():
|
||||
print(item.tag, dict(item.items()))
|
||||
|
||||
if item.tag == '{http://subsonic.org/restapi}index':
|
||||
|
||||
if in_index:
|
||||
in_index = not in_index
|
||||
|
||||
self.indexes.append(ArtistIndex(index_info, artists))
|
||||
|
||||
artists = []
|
||||
else:
|
||||
in_index = not in_index
|
||||
index_info = dict(item.items())
|
||||
|
||||
elif item.tag == '{http://subsonic.org/restapi}artist':
|
||||
artists.append(dict(item.items()))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import xml.etree.ElementTree
|
||||
|
||||
import Artist
|
||||
|
||||
|
||||
class ArtistIndex:
|
||||
name: str
|
||||
artists: list[Artist.Artist]
|
||||
|
||||
def __init__(self, indexInfo: dict, artists: list[dict]):
|
||||
self.name = indexInfo['name']
|
||||
|
||||
self.artists = []
|
||||
for artist in artists:
|
||||
self.artists.append(Artist.Artist(
|
||||
artist['id'],
|
||||
artist['name'],
|
||||
artist['albumCount'],
|
||||
artist['coverArt'],
|
||||
artist['artistImageUrl']
|
||||
))
|
||||
|
||||
|
||||
|
||||
class ArtistIndexes:
|
||||
indexes: list[ArtistIndex]
|
||||
|
||||
def __init__(self, xml_data: bytes):
|
||||
self._parseXml(xml_data.decode('utf-8'))
|
||||
|
||||
def _parseXml(self, xml_data: str):
|
||||
root = xml.etree.ElementTree.fromstring(xml_data)
|
||||
|
||||
self.indexes: list[ArtistIndex] = []
|
||||
|
||||
if root.get('status') != 'ok':
|
||||
return None
|
||||
|
||||
in_index = False
|
||||
artists = []
|
||||
index_info = None
|
||||
for item in root.iter():
|
||||
print(item.tag, dict(item.items()))
|
||||
|
||||
if item.tag == '{http://subsonic.org/restapi}index':
|
||||
|
||||
if in_index:
|
||||
in_index = not in_index
|
||||
|
||||
self.indexes.append(ArtistIndex(index_info, artists))
|
||||
|
||||
artists = []
|
||||
else:
|
||||
in_index = not in_index
|
||||
index_info = dict(item.items())
|
||||
|
||||
elif item.tag == '{http://subsonic.org/restapi}artist':
|
||||
artists.append(dict(item.items()))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user