diff --git a/interfaces/default/html/sickbeard_view.html b/interfaces/default/html/sickbeard_view.html index ca395fdb0..af95b9a99 100644 --- a/interfaces/default/html/sickbeard_view.html +++ b/interfaces/default/html/sickbeard_view.html @@ -15,6 +15,9 @@

  • Rescan files
  • +
  • + Remove show +
  • diff --git a/interfaces/default/js/sickbeard_view.js b/interfaces/default/js/sickbeard_view.js index 17c4a53f8..0985f6feb 100644 --- a/interfaces/default/js/sickbeard_view.js +++ b/interfaces/default/js/sickbeard_view.js @@ -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); }, @@ -268,6 +273,39 @@ function rescanFiles(tvdbid, name) { }); } +function removeShow(tvdbid, name) { + if (confirm('Are you sure you want to remove ' + name +'?')) { + var modalcontent = $('
    '); + modalcontent.append($('

    ').html('Removing "' + name +' " from list')); + modalcontent.append($('

    ').html('
    ')); + 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 = $('
    '); modalcontent.append($('

    ').html('Looking for episode "'+ name +'".')); diff --git a/modules/sickbeard.py b/modules/sickbeard.py index 015a83c25..87b95815d 100644 --- a/modules/sickbeard.py +++ b/modules/sickbeard.py @@ -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()