2019-12-27 22:15:56 +00:00
|
|
|
{% extends '_main.html' %}
|
2018-12-09 20:23:51 +00:00
|
|
|
|
2019-12-27 22:15:56 +00:00
|
|
|
{% block title %}Series - Bazarr{% endblock %}
|
2018-12-09 20:23:51 +00:00
|
|
|
|
2020-01-01 22:15:50 +00:00
|
|
|
{% block bcleft %}
|
2020-01-29 01:46:35 +00:00
|
|
|
<div class="">
|
2020-02-13 09:12:23 +00:00
|
|
|
<button class="btn btn-outline" id="mass_edit"
|
|
|
|
onclick="window.location.href = '{{ url_for('serieseditor') }}';">
|
2020-01-29 01:46:35 +00:00
|
|
|
<div><i class="fas fa-list align-top text-themecolor text-center font-20" aria-hidden="true"></i></div>
|
|
|
|
<div class="align-bottom text-themecolor small text-center">Mass Edit</div>
|
2020-01-01 22:15:50 +00:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
{% endblock bcleft %}
|
2018-12-09 20:23:51 +00:00
|
|
|
|
2020-01-01 22:15:50 +00:00
|
|
|
{% block bcright %}
|
2020-01-29 01:46:35 +00:00
|
|
|
|
2020-01-01 22:15:50 +00:00
|
|
|
{% endblock bcright %}
|
2018-12-09 20:23:51 +00:00
|
|
|
|
2019-12-28 16:43:48 +00:00
|
|
|
{% block body %}
|
2020-01-01 22:15:50 +00:00
|
|
|
<table id="series" class="table table-striped" style="width:100%">
|
|
|
|
<thead>
|
2020-02-13 09:12:23 +00:00
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Path Exist</th>
|
2021-01-19 04:49:51 +00:00
|
|
|
<th>Audio Profile Languages</th>
|
|
|
|
<th>Languages Profile</th>
|
2020-02-13 09:12:23 +00:00
|
|
|
<th>Subtitles</th>
|
|
|
|
<th></th>
|
|
|
|
</tr>
|
2020-01-01 22:15:50 +00:00
|
|
|
</thead>
|
|
|
|
</table>
|
|
|
|
|
2020-01-25 17:08:20 +00:00
|
|
|
<div id="editModal" class="modal" tabindex="-1" role="dialog">
|
|
|
|
<div class="modal-dialog modal-lg" role="document">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<h5 class="modal-title"><span id="edit_series_title_span"></span></h5><br>
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<form class="form" name="edit_form" id="edit_form">
|
|
|
|
<div class="modal-body">
|
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-sm-3 text-right">
|
2021-01-19 04:49:51 +00:00
|
|
|
Audio Profile Languages
|
2020-01-25 17:08:20 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group col-sm-8 pl-sm-0">
|
|
|
|
<span id="edit_audio_language_span"></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-01-19 04:49:51 +00:00
|
|
|
<br>
|
2020-01-25 17:08:20 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-sm-3 text-right">
|
2021-01-19 04:49:51 +00:00
|
|
|
Languages Profile
|
2020-01-25 17:08:20 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group col-sm-8 pl-sm-0">
|
2021-01-19 04:49:51 +00:00
|
|
|
<select class="selectpicker" id="edit_languages_select" name="languages"></select>
|
2020-01-25 17:08:20 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2020-02-13 09:12:23 +00:00
|
|
|
<input type="hidden" id="edit_sonarrSeriesId" name="sonarrSeriesId" value=""/>
|
2020-01-25 17:08:20 +00:00
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
2020-08-13 13:33:12 +00:00
|
|
|
<button type="submit" id="edit_save_button" class="btn btn-info"><span id="edit_save_button_span">Save</span></button>
|
2020-01-25 17:08:20 +00:00
|
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2019-12-27 22:15:56 +00:00
|
|
|
{% endblock body %}
|
2018-12-09 20:23:51 +00:00
|
|
|
|
2019-12-28 16:43:48 +00:00
|
|
|
{% block tail %}
|
2019-12-29 10:56:34 +00:00
|
|
|
<script>
|
|
|
|
$(document).ready(function () {
|
2021-01-19 04:49:51 +00:00
|
|
|
getLanguagesProfiles();
|
2020-01-25 17:08:20 +00:00
|
|
|
|
2020-02-13 09:12:23 +00:00
|
|
|
events.on('event', function (event) {
|
2020-01-25 17:08:20 +00:00
|
|
|
var event_json = JSON.parse(event);
|
|
|
|
if (event_json.type === 'series' && event_json.action === 'insert') {
|
|
|
|
$.ajax({
|
|
|
|
url: "{{ url_for('api.series') }}?seriesid=" + event_json.series,
|
|
|
|
success: function (data) {
|
|
|
|
if (data.data.length) {
|
|
|
|
$('#series').DataTable().rows.add(data.data);
|
|
|
|
$('#series').DataTable().columns.adjust().draw(false);
|
|
|
|
$('[data-toggle="tooltip"]').tooltip({html: true});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
} else if (event_json.type === 'series' && event_json.action === 'update') {
|
|
|
|
var rowId = $('#series').DataTable().row('#row_' + event_json.series);
|
|
|
|
if (rowId.length) {
|
|
|
|
$.ajax({
|
|
|
|
url: "{{ url_for('api.series') }}?seriesid=" + event_json.series,
|
|
|
|
success: function (data) {
|
|
|
|
if (data.data.length) {
|
2020-02-12 17:41:40 +00:00
|
|
|
$('#series').DataTable().row(rowId).data(data.data[0]).draw('page');
|
2020-01-25 17:08:20 +00:00
|
|
|
$('[data-toggle="tooltip"]').tooltip({html: true});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
} else if (event_json.type === 'series' && event_json.action === 'delete') {
|
|
|
|
var rowId = $('#series').DataTable().row('#row_' + event_json.series);
|
|
|
|
if (rowId.length) {
|
|
|
|
$('#series').DataTable().row(rowId).remove();
|
|
|
|
$('#series').DataTable().columns.adjust().draw(false);
|
|
|
|
$('[data-toggle="tooltip"]').tooltip({html: true});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-12-29 10:56:34 +00:00
|
|
|
var table = $('#series').DataTable({
|
2020-02-13 09:12:23 +00:00
|
|
|
dom:
|
|
|
|
"<'row'<'col-sm-12'tr>>" +
|
|
|
|
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
|
|
|
processing: true,
|
|
|
|
serverSide: true,
|
2020-02-12 17:41:40 +00:00
|
|
|
language: {
|
|
|
|
zeroRecords: 'No Series Found',
|
|
|
|
processing: "Loading Series..."
|
|
|
|
},
|
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.series') }}",
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
data: null,
|
|
|
|
render: function (data) {
|
2020-02-05 03:50:35 +00:00
|
|
|
return '<a href="' + "{{ url_for( 'episodes', no='tempvalue' ) }}".replace("tempvalue", data.sonarrSeriesId) + '">' + data.title + '</a>';
|
2020-01-02 06:16:00 +00:00
|
|
|
}
|
|
|
|
},
|
2019-12-29 10:56:34 +00:00
|
|
|
{
|
2020-02-13 09:12:23 +00:00
|
|
|
data: null,
|
|
|
|
className: "dt-center",
|
|
|
|
responsivePriority: 1,
|
|
|
|
render: function (data) {
|
2019-12-29 16:29:07 +00:00
|
|
|
if (data.exist === false) {
|
2020-01-01 22:15:50 +00:00
|
|
|
return '<i class="fas fa-exclamation-triangle" data-toggle="tooltip" data-placement="right" title="This path doesn\'t seem to be valid: ' + data.mapped_path + '"></i>';
|
2019-12-29 16:29:07 +00:00
|
|
|
} else if (data.exist === true) {
|
2020-01-01 22:15:50 +00:00
|
|
|
return '<i class="fas fa-check" data-toggle="tooltip" data-placement="right" title="This path seems to be valid: ' + data.mapped_path + '"></i>';
|
2019-12-29 10:56:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2021-01-19 04:49:51 +00:00
|
|
|
data: 'audio_language',
|
2020-02-13 09:12:23 +00:00
|
|
|
render: function (data) {
|
2021-01-19 04:49:51 +00:00
|
|
|
var audio_languages = '';
|
|
|
|
data.forEach(appendFunc);
|
|
|
|
return audio_languages;
|
2019-12-29 04:39:13 +00:00
|
|
|
|
2019-12-29 10:56:34 +00:00
|
|
|
function appendFunc(value) {
|
2021-01-19 04:49:51 +00:00
|
|
|
audio_languages = audio_languages + '<span class="badge badge-secondary">' + value.name + '</span> ';
|
2019-12-29 10:56:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2020-01-01 22:15:50 +00:00
|
|
|
{
|
2021-01-19 04:49:51 +00:00
|
|
|
data: "profileId.name",
|
2020-02-13 09:12:23 +00:00
|
|
|
className: "dt-center"
|
2019-12-29 16:29:07 +00:00
|
|
|
},
|
2019-12-29 10:56:34 +00:00
|
|
|
{
|
2020-02-13 09:12:23 +00:00
|
|
|
data: null,
|
|
|
|
responsivePriority: 2,
|
|
|
|
render: function (data) {
|
2019-12-29 10:56:34 +00:00
|
|
|
var total = data.episodeFileCount;
|
|
|
|
var completed = data.episodeFileCount - data.episodeMissingCount;
|
|
|
|
var completed_style = '';
|
|
|
|
var completed_text = '';
|
2021-01-19 04:49:51 +00:00
|
|
|
if (data.episodeFileCount && data.profileId.id !== null) {
|
2019-12-29 10:56:34 +00:00
|
|
|
completed_style = ' style="width: ' + completed / total * 100 + '%;"';
|
|
|
|
completed_text = completed + '/' + total;
|
|
|
|
}
|
|
|
|
return '<div class="progress"><div class="progress-bar" role="progressbar"' + completed_style + ' aria-valuenow="' + completed + '" aria-valuemin="0" aria-valuemax="' + total + '">' + completed_text + '</div></div>'
|
|
|
|
}
|
2020-01-25 17:08:20 +00:00
|
|
|
},
|
|
|
|
{
|
2020-02-13 09:12:23 +00:00
|
|
|
data: null,
|
|
|
|
render: function (data) {
|
2021-01-19 04:49:51 +00:00
|
|
|
return '<a href="" class="edit_button badge badge-secondary" data-sonarrSeriesId=' + data.sonarrSeriesId + ' data-audiolanguage=\'' + JSON.stringify(data.audio_language) + '\' data-title="' + data.title + '" data-languages_profile=' + data.profileId.id + ' data-hi="' + data.hearing_impaired + '" data-forced="' + data.forced + '"><i class="fas fa-wrench"></i></a>';
|
2020-01-25 17:08:20 +00:00
|
|
|
}
|
2019-12-29 10:56:34 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
});
|
|
|
|
});
|
2020-01-25 17:08:20 +00:00
|
|
|
|
2020-02-13 09:12:23 +00:00
|
|
|
$('#series').on('click', '.edit_button', function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
$("#edit_series_title_span").html($(this).data('title'));
|
2021-01-19 04:49:51 +00:00
|
|
|
$("#edit_audio_language_span").empty();
|
|
|
|
$.each($(this).data('audiolanguage'), function (i, item) {
|
|
|
|
$("#edit_audio_language_span").append('<div class="badge badge-secondary">' + item['name'] + '</div> ');
|
|
|
|
})
|
2020-02-13 09:12:23 +00:00
|
|
|
$('#edit_sonarrSeriesId').val($(this).data('sonarrseriesid'));
|
2020-01-25 17:08:20 +00:00
|
|
|
|
|
|
|
|
2020-02-13 09:12:23 +00:00
|
|
|
$('#edit_languages_select').empty();
|
2021-01-19 04:49:51 +00:00
|
|
|
$('#edit_languages_select').append('<option value="None">None</option>');
|
|
|
|
$.each(languagesProfiles, function (i, item) {
|
|
|
|
$('#edit_languages_select').append('<option value="' + item.profileId + '">' + item.name + '</option>');
|
2020-02-13 09:12:23 +00:00
|
|
|
});
|
|
|
|
$("#edit_languages_select").selectpicker("refresh");
|
2021-01-19 04:49:51 +00:00
|
|
|
$('#edit_languages_select').selectpicker('val', (($(this).data('languages_profile')) ? $(this).data('languages_profile') : 'None'));
|
2020-01-25 17:08:20 +00:00
|
|
|
|
2020-02-13 09:12:23 +00:00
|
|
|
$('#editModal')
|
|
|
|
.modal({
|
|
|
|
focus: false
|
|
|
|
});
|
|
|
|
});
|
2020-01-25 17:08:20 +00:00
|
|
|
|
2020-02-13 09:12:23 +00:00
|
|
|
$('#edit_form').on('submit', function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
var formdata = new FormData(document.getElementById("edit_form"));
|
2020-01-25 17:08:20 +00:00
|
|
|
|
2020-02-13 09:12:23 +00:00
|
|
|
$.ajax({
|
|
|
|
url: "{{ url_for('api.series') }}?seriesid=" + $('#edit_sonarrSeriesId').val(),
|
|
|
|
data: formdata,
|
|
|
|
processData: false,
|
|
|
|
contentType: false,
|
|
|
|
type: 'POST',
|
2020-08-13 13:33:12 +00:00
|
|
|
beforeSend: function () {
|
|
|
|
$('#edit_save_button_span').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
|
|
|
success: function () {
|
|
|
|
$('#editModal').modal('hide');
|
2020-08-13 13:33:12 +00:00
|
|
|
$('#edit_save_button_span').html('Save');
|
2020-02-13 09:12:23 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2020-01-25 17:08:20 +00:00
|
|
|
|
2021-01-19 04:49:51 +00:00
|
|
|
function getLanguagesProfiles() {
|
2020-01-25 17:08:20 +00:00
|
|
|
$.ajax({
|
2021-01-19 04:49:51 +00:00
|
|
|
url: "{{ url_for('api.languagesprofiles') }}",
|
2020-02-13 09:12:23 +00:00
|
|
|
success: function (data) {
|
2021-01-19 04:49:51 +00:00
|
|
|
languagesProfiles = data['data'];
|
2020-01-25 17:08:20 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-12-29 10:56:34 +00:00
|
|
|
</script>
|
2019-12-27 22:15:56 +00:00
|
|
|
{% endblock tail %}
|