#254 MOSTLY DONE! At last, this took a while.

So currently if a series exists then we will correctly monitor the episodes selected.

TODO: When the series doesn't exist in sonarr we need to add the series and then wait for the episode metadata to be populated.

Also need to add in all of the regular checks  and notification e.g. whitelist etc.
This commit is contained in:
tidusjar 2016-07-24 18:02:43 +01:00
commit b14fd36ecd
21 changed files with 1380 additions and 861 deletions

View file

@ -538,6 +538,7 @@ $(function () {
});
$('#episodesModal').on('show.bs.modal', function (event) {
finishLoading("episodesRequest", "primary");
var button = $(event.relatedTarget); // Button that triggered the modal
var id = button.data('identifier'); // Extract info from data-* attributes
var url = createBaseUrl(base, '/search/episodes/');
@ -552,8 +553,6 @@ $(function () {
$content.html("");
$('#selectedEpisodeId').val(id);
results.forEach(function (result) {
var episodes = buildEpisodesView(result);
if (!seenSeasons.find(x => x === episodes.season)) {
@ -572,6 +571,42 @@ $(function () {
}
});
// Save Modal click
$("#episodesRequest").click(function (e) {
e.preventDefault();
var tvId = $('#selectedEpisodeId').val();
$("#episodesRequest").prop("disabled", true);
loadingButton("episodesRequest", "primary");
var $form = $('#form' + tvId);
var model = [];
var $checkedEpisodes = $('.selectedEpisodes:checkbox:checked');
$checkedEpisodes.each(function (index, element) {
var $element = $('#' + element.id);
var tempObj = {};
tempObj.episodeNumber = $element.attr("epNumber");
tempObj.seasonNumber = $element.attr("epSeason");
model.push(tempObj);
});
var finalObj = {
ShowId: tvId,
Episodes: model
}
var url = createBaseUrl(mainBaseUrl, "search/request/tvEpisodes");
var type = $form.prop('method');
sendRequestAjax(JSON.stringify(finalObj), type, url, tvId);
});
function buildSeasonsContext(result) {
var context = {
id: result

View file

@ -8,6 +8,8 @@
return s;
}
var mainBaseUrl = $('#baseUrl').text();
function Humanize(date) {
var mNow = moment();
var mDate = moment(date).local();