def get_category_directories(): my_stations_yaml = get_stations_yaml() categories = [] if my_stations_yaml: for category in my_stations_yaml: categories.append( generic.Directory(category, len(get_stations_by_category(category)))) return categories
def get_language_directories(): language_directories = [] apicall = 'languages' if not SHOW_BROKEN_STATIONS: apicall += '?hidebroken=true' languages_raw = request(apicall) for language_raw in languages_raw: if get_json_attr(language_raw, 'name') and get_json_attr(language_raw, 'stationcount') and \ int(get_json_attr(language_raw, 'stationcount')) > MINIMUM_COUNT_LANGUAGE: language_directories.append(generic.Directory(get_json_attr(language_raw, 'name'), get_json_attr(language_raw, 'stationcount'))) return language_directories
def get_country_directories(): country_directories = [] apicall = 'countries' if not SHOW_BROKEN_STATIONS: apicall += '?hidebroken=true' countries_raw = request(apicall) 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: country_directories.append(generic.Directory(get_json_attr(country_raw, 'name'), get_json_attr(country_raw, 'stationcount'))) return country_directories
def get_genre_directories(): genre_directories = [] apicall = 'tags' if not SHOW_BROKEN_STATIONS: apicall += '?hidebroken=true' genres_raw = request(apicall) 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: genre_directories.append(generic.Directory(get_json_attr(genre_raw, 'name'), get_json_attr(genre_raw, 'stationcount'))) return genre_directories