Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Remove functionality to Sickbeard View #290

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions interfaces/default/html/sickbeard_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ <h1 class="page-header page-title" data-showid="${tvdbid}">
<li>
<a href="#" class="rescan-files">Rescan files</a>
</li>
<li>
<a href="#" class="remove-show">Remove show</a>
</li>
</ul>
</div>
</h1>
Expand Down
38 changes: 38 additions & 0 deletions interfaces/default/js/sickbeard_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ function loadShowData(showid){
evt.preventDefault();
forceFullUpdate(showid, data.show_name);
});

$('.remove-show', menu).click(function(evt) {
evt.preventDefault();
removeShow(showid, data.show_name);
});

renderSeasonTabs(showid, data.season_list);
},
Expand Down Expand Up @@ -268,6 +273,39 @@ function rescanFiles(tvdbid, name) {
});
}

function removeShow(tvdbid, name) {
if (confirm('Are you sure you want to remove ' + name +'?')) {
var modalcontent = $('<div>');
modalcontent.append($('<p>').html('Removing &quot;' + name +' &quot; from list'));
modalcontent.append($('<div>').html('<div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div>'));
showModal('Removing...', modalcontent, {});

$.ajax({
url: WEBDIR + 'sickbeard/RemoveShow?tvdbid=' + tvdbid,
type: 'get',
dataType: 'json',
timeout: 15000,
success: function (data) {
// If result is not 'succes' it must be a failure
if (data.result != 'success') {
notify('Error', data.message, 'error');
return;
} else {
notify('OK', data.message, 'success');
document.location.href = '../';
return;
}
},
error: function (data) {
notify('Error', 'Unable to remove tv show from list.', 'error', 1);
},
complete: function (data) {
hideModal();
}
});
}
}

function searchEpisode(tvdbid, season, episode, name) {
var modalcontent = $('<div>');
modalcontent.append($('<p>').html('Looking for episode &quot;'+ name +'&quot;.'));
Expand Down
7 changes: 7 additions & 0 deletions modules/sickbeard.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ def ForceFullUpdate(self, tvdbid):
def RescanFiles(self, tvdbid):
self.logger.debug("Rescan all local files for tvdbid " + tvdbid)
return self.fetch("show.refresh&tvdbid=" + tvdbid)

@cherrypy.expose()
@require()
@cherrypy.tools.json_out()
def RemoveShow(self, tvdbid):
self.logger.debug("Removing Show tvdbid " + tvdbid)
return self.fetch("show.delete&tvdbid=" + tvdbid)

@cherrypy.expose()
@require()
Expand Down