diff --git a/ycast/generic.py b/ycast/generic.py index e3e3776..0ef42a1 100644 --- a/ycast/generic.py +++ b/ycast/generic.py @@ -7,9 +7,13 @@ CACHE_PATH = VAR_PATH + '/cache' class Directory: - def __init__(self, name, item_count): + def __init__(self, name, item_count, displayname=None): self.name = name self.item_count = item_count + if displayname: + self.displayname = displayname + else: + self.displayname = name def generate_stationid_with_prefix(uid, prefix): diff --git a/ycast/radiobrowser.py b/ycast/radiobrowser.py index 0169cab..b220884 100644 --- a/ycast/radiobrowser.py +++ b/ycast/radiobrowser.py @@ -101,7 +101,8 @@ def get_language_directories(): 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'))) + get_json_attr(language_raw, 'stationcount'), + get_json_attr(language_raw, 'name').title())) return language_directories @@ -115,7 +116,8 @@ def get_genre_directories(): 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'))) + get_json_attr(genre_raw, 'stationcount'), + get_json_attr(genre_raw, 'name').capitalize())) return genre_directories diff --git a/ycast/server.py b/ycast/server.py index e3315f3..6d963da 100644 --- a/ycast/server.py +++ b/ycast/server.py @@ -47,7 +47,8 @@ def get_directories_page(subdir, directories, request): page.set_count(1) return page for directory in get_paged_elements(directories, request.args): - vtuner_directory = vtuner.Directory(directory.name, url_for(subdir, _external=True, directory=directory.name), + vtuner_directory = vtuner.Directory(directory.displayname, + url_for(subdir, _external=True, directory=directory.name), directory.item_count) page.add(vtuner_directory) page.set_count(len(directories))