bazarr/views/historyseries.html

132 lines
6.3 KiB
HTML
Raw Normal View History

2019-12-28 16:43:48 +00:00
{% extends '_main.html' %}
2018-05-02 10:25:42 +00:00
2019-12-28 16:43:48 +00:00
{% block title %}History (Series) - Bazarr{% endblock %}
2018-05-02 10:25:42 +00:00
2020-01-01 22:15:50 +00:00
{% block bcleft %}
2020-02-10 03:36:40 +00:00
2020-01-01 22:15:50 +00:00
{% endblock bcleft %}
2018-05-02 10:25:42 +00:00
2020-01-01 22:15:50 +00:00
{% block bcright %}
2020-02-10 03:36:40 +00:00
2020-01-01 22:15:50 +00:00
{% endblock bcright %}
2018-05-02 10:25:42 +00:00
2019-12-28 16:43:48 +00:00
{% block body %}
2020-01-01 22:15:50 +00:00
<table id="history_series" class="table table-striped" style="width:100%">
<thead>
2020-02-13 09:12:23 +00:00
<tr>
<th>Action</th>
<th>Name</th>
<th>Episode</th>
<th>Episode Title</th>
<th>Date</th>
2020-02-15 13:03:44 +00:00
<th style="max-width: 40%;">Description</th>
2020-07-19 20:02:38 +00:00
<th>Actions</th>
2020-02-13 09:12:23 +00:00
</tr>
2020-01-01 22:15:50 +00:00
</thead>
</table>
2019-12-28 16:43:48 +00:00
{% endblock body %}
2018-05-02 10:25:42 +00:00
2019-12-28 16:43:48 +00:00
{% block tail %}
2019-12-29 10:56:34 +00:00
<script>
$(document).ready(function () {
var table = $('#history_series').DataTable({
2020-02-13 09:12:23 +00:00
processing: true,
serverSide: true,
2020-02-12 17:41:40 +00:00
language: {
zeroRecords: 'Nothing Found In Series History',
processing: "Loading Series History..."
},
2020-02-13 09:12:23 +00:00
searching: false,
ordering: false,
lengthChange: false,
responsive: true,
pageLength: {{ settings.general.page_size }},
ajax: "{{ url_for('api.historyseries') }}",
columns: [
{
data: "action",
render: function (data) {
2020-02-10 03:36:40 +00:00
if (data === 0) {
return "<i class='fas fa-trash' title='Subtitle file has been erased.' data-toggle='tooltip' data-placement='right'></i>";
} else if (data === 1) {
return "<i class='fas fa-download' title='Subtitle file has been downloaded.' data-toggle='tooltip' data-placement='right'></i>";
} else if (data === 2) {
return "<i class='fas fa-user' title='Subtitle file has been manually downloaded.' data-toggle='tooltip' data-placement='right'></i>";
} else if (data === 3) {
return "<i class='fas fa-recycle' title='Subtitle file has been upgraded.' data-toggle='tooltip' data-placement='right'></i>";
} else if (data === 4) {
return "<i class='fas fa-cloud-upload-alt' title='Subtitle file has been manually uploaded.' data-toggle='tooltip' data-placement='right'></i>";
} else if (data === 5) {
return "<i class='fas fa-clock' title='Subtitle file has been synced.' data-toggle='tooltip' data-placement='right'></i>";
2020-02-10 03:36:40 +00:00
}
}
},
2020-02-13 09:12:23 +00:00
{
data: null,
render: function (data) {
2020-02-10 03:36:40 +00:00
return '<a href="' + "{{ url_for( 'episodes', no='tempvalue' ) }}".replace("tempvalue", data.sonarrSeriesId) + '">' + data.seriesTitle + '</a>';
}
},
2020-02-13 09:12:23 +00:00
{data: "episode_number"},
{data: "episodeTitle"},
{data: "timestamp"},
{
data: null,
render: function (data) {
2020-02-10 03:36:40 +00:00
if (data.upgradable) {
return "<i class='fas fa-recycle' title='This Subtitles File Is Eligible For An Upgrade.' style='color: green;' data-toggle='tooltip' data-placement='right'></i> " + data.description;
} else {
return data.description;
}
}
2020-07-19 20:02:38 +00:00
},
{
data: null,
render: function (data) {
if (data.subs_id && data.subtitles_path && !data.blacklisted) {
2020-09-10 18:26:37 +00:00
return '<a href="" class="blacklist_subtitles badge badge-secondary" data-toggle="tooltip" data-placement="right" title="Blacklist this subtitles" data-sonarrSeriesId="' + data.sonarrSeriesId + '" data-sonarrEpisodeId="' + data.sonarrEpisodeId + '" data-language="' + data.language.code2 + '" data-forced="' + data.language.forced + '" data-hi="' + data.language.hi + '" data-provider="' + data.provider + '" data-subs_id="' + data.subs_id + '" data-video_path="' + data.path + '" data-subtitles_path="' + data.mapped_subtitles_path + '"><i class="far fa-file-excel"></i></a>';
2020-07-19 20:02:38 +00:00
} else {
return null;
}
}
2020-02-10 03:36:40 +00:00
}
2019-12-29 10:56:34 +00:00
]
});
2020-02-12 17:41:40 +00:00
2020-07-19 20:02:38 +00:00
$('#history_series').on('click', '.blacklist_subtitles', function (e) {
$(this).tooltip('dispose');
e.preventDefault();
const values = {
sonarr_series_id: $(this).attr('data-sonarrseriesid'),
sonarr_episode_id: $(this).attr('data-sonarrepisodeid'),
provider: $(this).attr('data-provider'),
subs_id: $(this).attr('data-subs_id'),
language: $(this).attr('data-language'),
forced: $(this).attr('data-forced'),
2020-09-10 18:26:37 +00:00
hi: $(this).attr('data-hi'),
2020-07-19 20:02:38 +00:00
video_path: $(this).attr('data-video_path'),
subtitles_path: $(this).attr('data-subtitles_path')
};
var cell = $(this).parent();
$.ajax({
url: "{{ url_for('api.blacklistepisodesubtitlesadd') }}",
type: "POST",
dataType: "json",
data: values,
beforeSend: function () {
cell.html('<div class="spinner-border spinner-border-sm" role="status"><span class="sr-only">Loading...</span></div>');
}
});
});
2020-02-13 09:12:23 +00:00
events.on('event', function (event) {
2020-02-12 17:41:40 +00:00
var event_json = JSON.parse(event);
2020-07-19 20:02:38 +00:00
if (event_json.type === 'episodeHistory' || event_json.type === 'episodeBlacklist') {
2020-02-13 09:12:23 +00:00
$('#history_series').DataTable().ajax.reload(resetPaging = false);
2020-02-12 17:41:40 +00:00
$('[data-toggle="tooltip"]').tooltip({html: true});
}
});
2020-02-13 09:12:23 +00:00
});
2019-12-29 10:56:34 +00:00
</script>
2019-12-28 16:43:48 +00:00
{% endblock tail %}