diff --git a/intake/app.py b/intake/app.py index 14221d7..328724d 100644 --- a/intake/app.py +++ b/intake/app.py @@ -115,10 +115,23 @@ def root(): if channels_config_path.exists(): channels = json.loads(channels_config_path.read_text(encoding="utf8")) + channel_counts = { + channel: len( + [ + item + for source in sources + for item in LocalSource(data_path, source).get_all_items() + if not item.is_hidden + ] + ) + for channel, sources in channels.items() + } + return render_template( "home.jinja2", sources=sources, channels=channels, + channel_counts=channel_counts, ) diff --git a/intake/templates/home.jinja2 b/intake/templates/home.jinja2 index 36d4128..bbf20d2 100644 --- a/intake/templates/home.jinja2 +++ b/intake/templates/home.jinja2 @@ -46,7 +46,13 @@ summary:focus {

No channels found.

{% else %} {% for channel in channels %} -

{{ channel }}

+

+{%- if channel_counts[channel] -%} +({{ channel_counts[channel] }}) {{ channel }} +{%- else -%} +{{ channel }} +{%- endif -%} +

{% endfor %} {% endif %}

Edit channels