You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bazarr/views/wantedmovies.html

117 lines
4.8 KiB

5 years ago
{% extends '_main.html' %}
5 years ago
{% block title %}Wanted (Movies) - Bazarr{% endblock %}
5 years ago
{% block bcleft %}
5 years ago
<button class="btn btn-outline" id="search_button">
5 years ago
<div><i class="fas fa-search align-top text-themecolor text-center font-20" aria-hidden="true"></i></div>
<div class="align-bottom text-themecolor small text-center">Search All</div>
</button>
5 years ago
{% endblock bcleft %}
5 years ago
{% block bcright %}
5 years ago
{% endblock bcright %}
5 years ago
{% block body %}
<table id="wanted_movies" class="table table-striped" style="width:100%">
<thead>
5 years ago
<tr>
<th>Movies</th>
<th>Missing Subtitle(s)</th>
</tr>
5 years ago
</thead>
</table>
{% endblock body %}
5 years ago
{% block tail %}
<script>
$(document).ready(function () {
var table = $('#wanted_movies').DataTable({
5 years ago
processing: true,
serverSide: true,
5 years ago
language: {
zeroRecords: 'No Missing Movies Subtitles',
processing: "Loading Missing Movies Subtitles..."
},
5 years ago
searching: false,
ordering: false,
lengthChange: false,
responsive: true,
pageLength: {{ settings.general.page_size }},
ajax: "{{ url_for('api.wantedmovies') }}",
columns: [
{
data: null,
render: function (data) {
5 years ago
return '<a href="' + "{{ url_for( 'movie', no='tempvalue' ) }}".replace("tempvalue", data.radarrId) + '">' + data.title + '</a>';
}
},
5 years ago
{
data: null,
render: function (data) {
5 years ago
if (data.missing_subtitles !== 'None') {
var languages = '';
data.missing_subtitles.forEach(appendFunc);
return languages;
} else {
return null;
}
function appendFunc(value) {
5 years ago
languages = languages + '<a href="" class="get_subtitle badge badge-secondary" data-toggle="tooltip" data-placement="right" title="' + value.name + ((value.forced) ? ' forced' : '') + '" data-moviepath="' + data.mapped_path + '" data-scenename="' + data.sceneName + '" data-movietitle="' + data.title + '" data-language="' + value.code3 + '" data-hi="' + data.hearing_impaired + '" data-forced="' + value.forced + '" data-radarrid=' + data.radarrId + '>' + value.code2 + ((value.forced) ? ':forced' : '') + ' <i class="fas fa-search"></i></a> ';
5 years ago
}
}
}
5 years ago
]
});
5 years ago
$('#search_button').on('click', function (e) {
5 years ago
e.preventDefault();
$.ajax({
url: "{{ url_for('api.searchwantedmovies') }}",
type: 'GET',
5 years ago
beforeSend: function () {
5 years ago
$('#search_button').find("i").addClass('fa-spin');
},
5 years ago
complete: function () {
5 years ago
$('#search_button').find("i").removeClass('fa-spin');
}
});
});
5 years ago
$('#wanted_movies').on('click', '.get_subtitle', function (e) {
5 years ago
$(this).tooltip('dispose');
e.preventDefault();
const values = {
moviePath: $(this).attr("data-moviepath"),
sceneName: $(this).attr("data-scenename"),
language: $(this).attr("data-language"),
hi: $(this).attr("data-hi"),
forced: $(this).attr("data-forced"),
radarrId: $(this).attr("data-radarrid"),
title: $(this).attr("data-movietitle")
};
var cell = $(this).parent();
$.ajax({
url: "{{ url_for('api.moviesubtitlesdownload') }}",
type: "POST",
dataType: "json",
data: values,
5 years ago
beforeSend: function () {
5 years ago
cell.html('<div class="spinner-border spinner-border-sm" role="status"><span class="sr-only">Loading...</span></div>');
}
});
});
5 years ago
events.on('event', function (event) {
5 years ago
var event_json = JSON.parse(event);
if (event_json.type === 'movie') {
5 years ago
$('#wanted_movies').DataTable().ajax.reload(resetPaging = false);
5 years ago
$('[data-toggle="tooltip"]').tooltip({html: true});
}
});
5 years ago
});
5 years ago
</script>
{% endblock tail %}