From 8ea341bc7ecce08e251600624dd0b5102eb66ef5 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Wed, 20 Nov 2024 15:35:40 -0500 Subject: [PATCH] Add missing template for complete film info --- src/letsrolld/webcli/cli.py | 4 +-- .../webcli/templates/film-full.template | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 src/letsrolld/webcli/templates/film-full.template diff --git a/src/letsrolld/webcli/cli.py b/src/letsrolld/webcli/cli.py index f883e5b..4b451a2 100644 --- a/src/letsrolld/webcli/cli.py +++ b/src/letsrolld/webcli/cli.py @@ -62,7 +62,7 @@ def directors_get(): for director in get_directors.sync(client=client): director_reports.append(list_director(director)) - print("\n\n".join(director_reports)) + print("\n".join(director_reports)) @cli.group() @@ -113,7 +113,7 @@ def films_query( for film in films: film_reports.append(report_film(film)) - print("\n\n".join(film_reports)) + print("\n".join(film_reports)) if __name__ == "__main__": diff --git a/src/letsrolld/webcli/templates/film-full.template b/src/letsrolld/webcli/templates/film-full.template new file mode 100644 index 0000000..889eeca --- /dev/null +++ b/src/letsrolld/webcli/templates/film-full.template @@ -0,0 +1,25 @@ +>>> +{{ film.title }} +>>> + 📅:{{ film.year }} | 📽:{{ film.directors|map(attribute='name')|join(', ') }} + ⌛:{{ film.runtime }}m ⭐:{{ film.rating }} 📎:{{ film.genres|join(',') }} +{%- set ns = namespace(all_country_names=[]) -%} +{%- for country in film.countries -%} + {%- set ns.all_country_names = ns.all_country_names + [country.flag + country.name] -%} +{%- endfor %} + Countries: {{ ns.all_country_names|join(', ') }} + --- + Letterboxd: {{ film.lb_url }} + JustWatch: {{ film.jw_url }} + Trailer: {{ film.trailer_url }} + --- +{{ film.description|wordwrap(70)|indent(2, first=True) }} + --- + Available @ + {% for offer in film.offers|selectattr("name", "in", offers) -%} + {%- if offer.url -%} + {{ offer.name }}: {{ offer.url }} + {% else -%} + {{ offer.name }} + {% endif -%} + {% endfor -%}