obey line character limit and get rid of warnings
for the line width, 80 is ancient. we use 120.
This commit is contained in:
parent
b0c29f0582
commit
b79dfebbea
2 changed files with 23 additions and 11 deletions
|
@ -44,7 +44,8 @@ def get_station_by_id(uid):
|
|||
|
||||
def search(name):
|
||||
stations = []
|
||||
stations_json = request('stations/search?order=votes&reverse=true&bitrateMin=' + MINIMUM_BITRATE + '&name=' + str(name))
|
||||
stations_json = request('stations/search?order=votes&reverse=true&bitrateMin=' +
|
||||
str(MINIMUM_BITRATE) + '&name=' + str(name))
|
||||
for station_json in stations_json:
|
||||
stations.append(Station(station_json))
|
||||
return stations
|
||||
|
@ -54,7 +55,8 @@ def get_countries():
|
|||
countries = []
|
||||
countries_raw = request('countries')
|
||||
for country_raw in countries_raw:
|
||||
if get_json_attr(country_raw, 'name') and get_json_attr(country_raw, 'stationcount') and int(get_json_attr(country_raw, 'stationcount')) > MINIMUM_COUNT_COUNTRY:
|
||||
if get_json_attr(country_raw, 'name') and get_json_attr(country_raw, 'stationcount') and \
|
||||
int(get_json_attr(country_raw, 'stationcount')) > MINIMUM_COUNT_COUNTRY:
|
||||
countries.append(get_json_attr(country_raw, 'name'))
|
||||
return countries
|
||||
|
||||
|
@ -63,14 +65,17 @@ def get_genres():
|
|||
genres = []
|
||||
genres_raw = request('tags?hidebroken=true')
|
||||
for genre_raw in genres_raw:
|
||||
if get_json_attr(genre_raw, 'name') and get_json_attr(genre_raw, 'stationcount') and int(get_json_attr(genre_raw, 'stationcount')) > MINIMUM_COUNT_GENRE:
|
||||
if get_json_attr(genre_raw, 'name') and get_json_attr(genre_raw, 'stationcount') and \
|
||||
int(get_json_attr(genre_raw, 'stationcount')) > MINIMUM_COUNT_GENRE:
|
||||
genres.append(get_json_attr(genre_raw, 'name'))
|
||||
return genres
|
||||
|
||||
|
||||
def get_stations_by_country(country, limit=STATION_LIMIT_DEFAULT):
|
||||
stations = []
|
||||
stations_json = request('stations/search?order=votes&reverse=true&bitrateMin=' + MINIMUM_BITRATE + '&limit=' + str(limit) + '&countryExact=true&country=' + str(country))
|
||||
stations_json = request('stations/search?order=votes&reverse=true&bitrateMin=' +
|
||||
str(MINIMUM_BITRATE) + '&limit=' + str(limit) +
|
||||
'&countryExact=true&country=' + str(country))
|
||||
for station_json in stations_json:
|
||||
stations.append(Station(station_json))
|
||||
return stations
|
||||
|
@ -78,7 +83,8 @@ def get_stations_by_country(country, limit=STATION_LIMIT_DEFAULT):
|
|||
|
||||
def get_stations_by_genre(genre, limit=STATION_LIMIT_DEFAULT):
|
||||
stations = []
|
||||
stations_json = request('stations/search?order=votes&reverse=true&bitrateMin=' + MINIMUM_BITRATE + '&limit=' + str(limit) + '&tagExact=true&tag=' + str(genre))
|
||||
stations_json = request('stations/search?order=votes&reverse=true&bitrateMin=' +
|
||||
str(MINIMUM_BITRATE) + '&limit=' + str(limit) + '&tagExact=true&tag=' + str(genre))
|
||||
for station_json in stations_json:
|
||||
stations.append(Station(station_json))
|
||||
return stations
|
||||
|
|
|
@ -66,7 +66,8 @@ def custom_stations_landing():
|
|||
page.add(vtuner.Display("No stations found"))
|
||||
else:
|
||||
for category in sorted(my_stations, key=str.lower):
|
||||
directory = vtuner.Directory(category, url_for('custom_stations_category', _external=True, category=category))
|
||||
directory = vtuner.Directory(category, url_for('custom_stations_category',
|
||||
_external=True, category=category))
|
||||
page.add(directory)
|
||||
return page.to_string()
|
||||
|
||||
|
@ -79,7 +80,8 @@ def custom_stations_category(category):
|
|||
page.add(vtuner.Display("Category '" + category + "' not found"))
|
||||
else:
|
||||
for station in sorted(my_stations[category], key=str.lower):
|
||||
station = vtuner.Station(None, station, None, my_stations[category][station], None, None, None, None, None, None)
|
||||
station = vtuner.Station(None, station, None, my_stations[category][station],
|
||||
None, None, None, None, None, None)
|
||||
page.add(station)
|
||||
return page.to_string()
|
||||
|
||||
|
@ -114,7 +116,8 @@ def radiobrowser_country_stations(country):
|
|||
page.add(vtuner.Display("No stations found for country '" + country + "'"))
|
||||
else:
|
||||
for station in stations:
|
||||
page.add(vtuner.Station(station.id, station.name, ', '.join(station.tags), station.url, station.icon, station.tags[0], station.country, station.codec, station.bitrate, None))
|
||||
page.add(vtuner.Station(station.id, station.name, ', '.join(station.tags), station.url, station.icon,
|
||||
station.tags[0], station.country, station.codec, station.bitrate, None))
|
||||
return page.to_string()
|
||||
|
||||
|
||||
|
@ -137,7 +140,8 @@ def radiobrowser_genre_stations(genre):
|
|||
page.add(vtuner.Display("No stations found for genre '" + genre + "'"))
|
||||
else:
|
||||
for station in stations:
|
||||
page.add(vtuner.Station(station.id, station.name, ', '.join(station.tags), station.url, station.icon, station.tags[0], station.country, station.codec, station.bitrate, None))
|
||||
page.add(vtuner.Station(station.id, station.name, ', '.join(station.tags), station.url, station.icon,
|
||||
station.tags[0], station.country, station.codec, station.bitrate, None))
|
||||
return page.to_string()
|
||||
|
||||
|
||||
|
@ -147,7 +151,8 @@ def radiobrowser_popular():
|
|||
page = vtuner.Page()
|
||||
page.add(vtuner.Previous(url_for('radiobrowser_landing', _external=True)))
|
||||
for station in stations:
|
||||
page.add(vtuner.Station(station.id, station.name, ', '.join(station.tags), station.url, station.icon, station.tags[0], station.country, station.codec, station.bitrate, None))
|
||||
page.add(vtuner.Station(station.id, station.name, ', '.join(station.tags), station.url, station.icon,
|
||||
station.tags[0], station.country, station.codec, station.bitrate, None))
|
||||
return page.to_string()
|
||||
|
||||
|
||||
|
@ -170,5 +175,6 @@ def radiobrowser_search(path):
|
|||
page.add(vtuner.Display("No results for '" + query + "'"))
|
||||
else:
|
||||
for station in stations:
|
||||
page.add(vtuner.Station(station.id, station.name, ', '.join(station.tags), station.url, station.icon, station.tags[0], station.country, station.codec, station.bitrate, None))
|
||||
page.add(vtuner.Station(station.id, station.name, ', '.join(station.tags), station.url, station.icon,
|
||||
station.tags[0], station.country, station.codec, station.bitrate, None))
|
||||
return page.to_string()
|
||||
|
|
Loading…
Reference in a new issue