MediaDash/templates/history.html

65 lines
2.1 KiB
HTML
Raw Permalink Normal View History

2021-08-29 13:03:28 +00:00
{%- extends "base.html" -%}
{%- from 'utils.html' import make_tabs -%}
{%- macro default(event,source) -%}
<h5>Unknown ({{source}})</h5>
<pre>{{event|tojson(indent=4)}}</pre>
{%- endmacro -%}
{%- macro downloadFolderImported(event,source) -%}
[{{event.seriesId}}/{{event.episodeId}}] Imported {{event.data.droppedPath}} from {{event.data.downloadClientName}} to {{event.data.importedPath}}
{%- endmacro -%}
{%- macro grabbed(event,source) -%}
[{{event.seriesId}}/{{event.episodeId}}] Grabbed <a href="{{event.data.guid}}">{{event.sourceTitle}}</a>
{%- endmacro -%}
{%- macro episodeFileDeleted(event,source) -%}
[{{event.seriesId}}/{{event.episodeId}}] Deleted {{event.sourceTitle}} because {{event.data.reason}}
{%- endmacro -%}
{%- macro episodeFileRenamed(event,source) -%}
[{{event.seriesId}}/{{event.episodeId}}] Renamed {{event.data.sourcePath}} to {{event.data.path}}
{%- endmacro -%}
{%- macro movieFileDeleted(event,source) -%}
Renamed {{event.data.sourcePath}} to {{event.data.path}}
{%- endmacro -%}
{%- macro movieFileRenamed(event,source) -%}
<h5>renamed</h5>
<pre>{{event|tojson(indent=4)}}</pre>
{%- endmacro -%}
{%- macro downloadFailed(event,source) -%}
<h5>downloadFailed</h5>
<pre>{{event|tojson(indent=4)}}</pre>
{%- endmacro -%}
{%- set handlers = {
'downloadFolderImported': downloadFolderImported,
'grabbed': grabbed,
'episodeFileDeleted': episodeFileDeleted,
'episodeFileRenamed': episodeFileRenamed,
'movieFileDeleted': movieFileDeleted,
'movieFileRenamed': movieFileRenamed,
'downloadFailed': downloadFailed,
None: default
} -%}
{%- macro history_page(history,source) -%}
<pre>
{%- for entry in history.records -%}
{{handlers.get(entry.eventType,handlers[None])(entry,source)}}{{'\n'}}
{%- endfor -%}
</pre>
{%- endmacro -%}
{%- block app_content -%}
<h2>History</h2>
<div class="row">
<div class="col">
{{make_tabs([('Sonarr',history_page(sonarr,'sonarr')),('Radarr',history_page(radarr,'radarr'))])}}
</div>
</div>
{%- endblock -%}