This commit is contained in:
Louis Vézina 2019-12-28 23:39:13 -05:00
parent db88156dc1
commit d91f68f163
4 changed files with 95 additions and 13 deletions

View file

@ -77,12 +77,12 @@ class Series(Resource):
# Add missing subtitles episode count
item.update({"episodeMissingCount": database.execute("SELECT COUNT(*) as count FROM table_episodes WHERE "
"sonarrSeriesId=? AND missing_subtitles is not null "
"AND missing_subtitles != '[]'", (seriesId,),
only_one=True)['count']})
"AND missing_subtitles != '[]'",
(item['sonarrSeriesId'],), only_one=True)['count']})
# Add episode count
item.update({"episodeFileCount": database.execute("SELECT COUNT(*) as count FROM table_episodes WHERE "
"sonarrSeriesId=?", (seriesId,),
"sonarrSeriesId=?", (item['sonarrSeriesId'],),
only_one=True)['count']})
return jsonify(draw=draw, recordsTotal=row_count, recordsFiltered=row_count, data=result)

View file

@ -461,6 +461,14 @@
clearTimeout(notificationTimeout);
});
</script>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
{% endblock tail_js %}
{% block tail %}
{% endblock tail %}

View file

@ -10,9 +10,9 @@
<table id="movies" class="mdl-data-table" style="width:100%">
<thead>
<tr>
<th>Monitored</th>
<th></th>
<th>Name</th>
<th>Path exist</th>
<th>Exist</th>
<th>Audio Language</th>
<th>Subtitles Languages</th>
<th>Hearing-Impaired</th>
@ -33,11 +33,49 @@
"lengthChange": false,
"ajax": "/api/movies",
"columns": [
{ "data": "monitored" },
{ "data": "title" },
{ "data": "exist" },
{ "data": "monitored",
"render": function ( data, type, row ) {
if (data === 'False') {
return '<i class="far fa-bookmark" data-toggle="tooltip" data-placement="right" title="Movie unmonitored in Radarr"></i>';
} else if (data === 'True') {
return '<i class="fas fa-bookmark" data-toggle="tooltip" data-placement="right" title="Movie monitored in Radarr"></i>';
}
}
},
{ "data": null,
"render": function ( data ) {
if (data.sceneName) {
return '<i class="fas fa-info-circle" data-toggle="tooltip" data-placement="right" title="' + data.sceneName + '"></i> ' + data.title;
} else {
return data.title;
}
}
},
{ "data": "exist",
"render": function ( data ) {
if (data === false) {
return '<i class="fas fa-exclamation-triangle" data-toggle="tooltip" data-placement="right" title="This path doesn\'t seem to be valid."></i>';
} else if (data === true) {
return '<i class="fas fa-check" data-toggle="tooltip" data-placement="right" title="This path seems to be valid."></i>';
}
}
},
{ "data": "audio_language.name" },
{ "data": "languages[, ].code2" },
{ "data": "languages",
"render": function ( data ) {
if (data !== 'None') {
var languages = '';
data.forEach(appendFunc);
return languages;
} else {
return null
}
function appendFunc(value) {
languages = languages + '<span class="badge badge-secondary" data-toggle="tooltip" data-placement="right" title="'+value.name+'">'+value.code2+'</span> ';
}
}
},
{ "data": "hearing_impaired" },
{ "data": "forced" }
]

View file

@ -11,11 +11,12 @@
<thead>
<tr>
<th>Name</th>
<th>Path exist</th>
<th>Exist</th>
<th>Audio Language</th>
<th>Subtitles Languages</th>
<th>Hearing-Impaired</th>
<th>Forced</th>
<th>Subtitles</th>
</tr>
</thead>
</table>
@ -33,11 +34,46 @@
"ajax": "/api/series",
"columns": [
{ "data": "title" },
{ "data": "exist" },
{ "data": "exist",
"render": function ( data ) {
if (data === false) {
return '<i class="fas fa-exclamation-triangle" data-toggle="tooltip" data-placement="right" title="This path doesn\'t seem to be valid."></i>';
} else if (data === true) {
return '<i class="fas fa-check" data-toggle="tooltip" data-placement="right" title="This path seems to be valid."></i>';
}
}
},
{ "data": "audio_language.name" },
{ "data": "languages[, ].code2" },
{ "data": "languages",
"render": function ( data ) {
if (data !== 'None') {
var languages = '';
data.forEach(appendFunc);
return languages;
} else {
return null;
}
function appendFunc(value) {
languages = languages + '<span class="badge badge-secondary" data-toggle="tooltip" data-placement="right" title="'+value.name+'">'+value.code2+'</span> ';
}
}
},
{ "data": "hearing_impaired" },
{ "data": "forced" }
{ "data": "forced" },
{ "data": null,
"render": function ( data ) {
var total = data.episodeFileCount;
var completed = data.episodeFileCount - data.episodeMissingCount;
var completed_style = '';
var completed_text = '';
if (completed/total*100 > 0 && data.languages !== 'None') {
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>'
}
}
]
} );
} );