瀏覽代碼

obey line character limit and get rid of warnings

for the line width, 80 is ancient. we use 120.
milaq 6 年之前
父節點
當前提交
b79dfebbea
共有 2 個文件被更改,包括 23 次插入11 次删除
  1. 11 5
      ycast/radiobrowser.py
  2. 12 6
      ycast/server.py

+ 11 - 5
ycast/radiobrowser.py

@@ -44,7 +44,8 @@ def get_station_by_id(uid):
 
 
 def search(name):
 def search(name):
     stations = []
     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:
     for station_json in stations_json:
         stations.append(Station(station_json))
         stations.append(Station(station_json))
     return stations
     return stations
@@ -54,7 +55,8 @@ def get_countries():
     countries = []
     countries = []
     countries_raw = request('countries')
     countries_raw = request('countries')
     for country_raw in countries_raw:
     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'))
             countries.append(get_json_attr(country_raw, 'name'))
     return countries
     return countries
 
 
@@ -63,14 +65,17 @@ def get_genres():
     genres = []
     genres = []
     genres_raw = request('tags?hidebroken=true')
     genres_raw = request('tags?hidebroken=true')
     for genre_raw in genres_raw:
     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'))
             genres.append(get_json_attr(genre_raw, 'name'))
     return genres
     return genres
 
 
 
 
 def get_stations_by_country(country, limit=STATION_LIMIT_DEFAULT):
 def get_stations_by_country(country, limit=STATION_LIMIT_DEFAULT):
     stations = []
     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:
     for station_json in stations_json:
         stations.append(Station(station_json))
         stations.append(Station(station_json))
     return stations
     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):
 def get_stations_by_genre(genre, limit=STATION_LIMIT_DEFAULT):
     stations = []
     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:
     for station_json in stations_json:
         stations.append(Station(station_json))
         stations.append(Station(station_json))
     return stations
     return stations

+ 12 - 6
ycast/server.py

@@ -66,7 +66,8 @@ def custom_stations_landing():
         page.add(vtuner.Display("No stations found"))
         page.add(vtuner.Display("No stations found"))
     else:
     else:
         for category in sorted(my_stations, key=str.lower):
         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)
             page.add(directory)
     return page.to_string()
     return page.to_string()
 
 
@@ -79,7 +80,8 @@ def custom_stations_category(category):
         page.add(vtuner.Display("Category '" + category + "' not found"))
         page.add(vtuner.Display("Category '" + category + "' not found"))
     else:
     else:
         for station in sorted(my_stations[category], key=str.lower):
         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)
             page.add(station)
     return page.to_string()
     return page.to_string()
 
 
@@ -114,7 +116,8 @@ def radiobrowser_country_stations(country):
         page.add(vtuner.Display("No stations found for country '" + country + "'"))
         page.add(vtuner.Display("No stations found for country '" + country + "'"))
     else:
     else:
         for station in stations:
         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()
     return page.to_string()
 
 
 
 
@@ -137,7 +140,8 @@ def radiobrowser_genre_stations(genre):
         page.add(vtuner.Display("No stations found for genre '" + genre + "'"))
         page.add(vtuner.Display("No stations found for genre '" + genre + "'"))
     else:
     else:
         for station in stations:
         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()
     return page.to_string()
 
 
 
 
@@ -147,7 +151,8 @@ def radiobrowser_popular():
     page = vtuner.Page()
     page = vtuner.Page()
     page.add(vtuner.Previous(url_for('radiobrowser_landing', _external=True)))
     page.add(vtuner.Previous(url_for('radiobrowser_landing', _external=True)))
     for station in stations:
     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()
     return page.to_string()
 
 
 
 
@@ -170,5 +175,6 @@ def radiobrowser_search(path):
             page.add(vtuner.Display("No results for '" + query + "'"))
             page.add(vtuner.Display("No results for '" + query + "'"))
         else:
         else:
             for station in stations:
             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()
     return page.to_string()