{#- The audiobook job inline on Prepare (#391, DESIGN.md "Job inline"; screens making.png and failed.png): running, paused, failed or done. `card` comes from pages.making_card. Every button is drawn disabled; app.js enables each once its click is attached (#350, #427). Import it "with context". -#} {% from "_icons.html" import icon %} {#- One bar per chapter: done ones full, the current one as far as it is spoken (`part`, 0 to 100), later ones empty (#1054). Bars, not width styles: the CSP forbids style attributes. The line under them says the same to a screen reader. -#} {% macro segments(list, part=0) -%} {% if list %}{% endif %} {%- endmacro %} {#- Freeing the cache deletes every spoken sentence, so it asks first, as Cancel does (D-733) -#} {% macro free_button(card) -%} {% if card.cache %}
{{ t('making.free', size=card.cache_text) }}

{{ t('making.free_goes', size=card.cache_text) }}

{% endif %} {%- endmacro %} {% macro making(card, document) %} {% set job = card.job %}

{{ t('making.title') }}

{% if card.state == 'running' %}

{{ card.head }}{{ card.left }}

{{ segments(card.segments, card.chapter_part) }}

{{ card.chapter_line }}

{{ card.sentences }}

{#- the chapters are playable as they are spoken (#723): the first one opens Listen (#724); app.js shows the link when the first one is ready -#}

{{ icon('speaker', 's') }}{{ t('player.start_listening') }}

{{ t('making.leave') }}

{{ t('making.cancel') }}

{{ t('making.cancel_goes') }} {{ t('making.cancel_size', size=card.cache_text) }}

{{ t('making.cancel_stays') }}

{{ t('making.pause_hint') }}

{% elif card.state == 'done' %}

{{ t('job.done_title') }}

{{ icon('speaker', 's') }}{{ t('listen.link') }}

{% if card.folder %}

{{ t('job.folder', folder=card.folder) }}

{% endif %} {% if job.progress and job.progress.reused %}

{{ t('job.reused', n=job.progress.reused) }}

{% endif %} {% if card.skipped %}

{{ t('job.skipped') }}

{% endif %}

{% if card.cache %}{{ t('job.cache', size=card.cache_text) }}{% else %}{{ t('job.cache_freed') }}{% endif %}

{% if card.cache %}
{{ free_button(card) }}
{% endif %} {% elif card.changed %} {#- the chapters made so far were made with other settings (#726, D-909): nothing is mixed silently; the person keeps those settings for the new chapters or replaces them all -#}
{{ icon('alert', 'l') }}

{{ t('making.changed_title') }}

{{ t('making.changed_text') }}

{% if card.changes %}
    {% for change in card.changes %}
  • {{ change }}
  • {% endfor %}
{% endif %}

{{ t('making.keep_hint') }}

{{ t('making.replace_hint') }}

{% elif card.exists %}
{{ icon('alert', 'l') }}

{{ job.failure.reason }}

{% if job.failure.details %}

{{ t('common.details') }} {{ job.failure.details }}

{% endif %} {#- replacing reuses the spoken sentences; freeing the cache is never needed for it (D-733) #} {% if card.cache %}

{{ t('making.kept_replace') }}

{% endif %}

{{ t('making.same_settings') }}

{% else %}
{{ icon('alert' if card.state == 'failed' else 'pausejob', 'l') }}

{{ card.title }}

{% if card.state == 'failed' %}

{{ job.failure.reason }}{% if job.failure.details %} {{ t('common.details') }} {{ job.failure.details }}{% endif %}

{% endif %} {% if card.kept %}

{{ card.kept }}

{% endif %}
{{ segments(card.segments) }} {% if card.playable %}

{{ icon('speaker', 's') }}{{ t('listen.link') }}

{% endif %}
{{ free_button(card) }}

{{ t('making.same_settings') }}

{% endif %}
{% endmacro %}