PEP8
This commit is contained in:
@ -2,28 +2,32 @@ from librb.rbRadios import RadioBrowser
|
||||
|
||||
rb = RadioBrowser()
|
||||
|
||||
|
||||
def getstations_byname(query):
|
||||
results = rb.stations_byname(query)
|
||||
stations = []
|
||||
for st in results:
|
||||
try:
|
||||
station = {'stationname': st['name'], 'id':st['id'], 'codec':st['codec'], 'bitrate':st['bitrate'], 'country':st['country'], 'homepage':st['homepage'], 'genre':st['tags']}
|
||||
station = {'stationname': st['name'], 'id': st['id'], 'codec': st['codec'], 'bitrate': st['bitrate'], 'country': st['country'], 'homepage': st['homepage'], 'genre': st['tags']}
|
||||
stations.append(station)
|
||||
except:
|
||||
pass
|
||||
return stations
|
||||
|
||||
|
||||
def geturl_byid(id):
|
||||
url = rb.playable_station(id)['url']
|
||||
if url != None:
|
||||
if url is not None:
|
||||
return url
|
||||
else:
|
||||
return "-1"
|
||||
|
||||
|
||||
def getstationname_byid(id):
|
||||
return rb.stations_byid(id)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
r = getstations_byname('r.sh')
|
||||
stationinfo = getstationname_byid(96748)
|
||||
pass
|
||||
pass
|
||||
|
@ -180,4 +180,3 @@ class RadioBrowser:
|
||||
kwargs["params"] = params
|
||||
endpoint = self.builder.produce_endpoint(endpoint="station_search")
|
||||
return request(endpoint, **kwargs)
|
||||
|
Reference in New Issue
Block a user