diff --git a/interfaces/default/js/transmission.js b/interfaces/default/js/transmission.js index 8e892cff8..51f0170a3 100644 --- a/interfaces/default/js/transmission.js +++ b/interfaces/default/js/transmission.js @@ -51,8 +51,20 @@ function getTorrents(){ // Round to 2 decimals ratio = Math.round(torrent.uploadRatio*100) / 100; - // Action button + // Button group + buttons = $('
').addClass('btn-group'); + + // Action button (pause or resume) actionButton = generateTorrentActionButton(torrent); + buttons.append(actionButton); + + // Remove button + removeButton = $(''). + addClass('btn btn-mini'). + html(''). + attr('href', WEBDIR + 'transmission/remove/' + torrent.id). + attr('title', 'Remove torrent'); + buttons.append(removeButton); tr.append( $('').html(torrent.name @@ -63,7 +75,7 @@ function getTorrents(){ $('').text(getReadableTime(torrent.eta)), $('').text(torrentStatus(torrent.status)), $('').addClass('span3').html(progress), - $('').addClass('torrent-action').append(actionButton) + $('').addClass('torrent-action').append(buttons) ); $('#torrent-queue').append(tr); }); diff --git a/modules/transmission.py b/modules/transmission.py index b4c0c6693..c7701f36b 100644 --- a/modules/transmission.py +++ b/modules/transmission.py @@ -58,6 +58,15 @@ def stop(self, torrentId): return False return self.fetch('torrent-stop', {'ids': torrentId}) + @cherrypy.expose() + @cherrypy.tools.json_out() + def remove(self, torrentId): + try: + torrentId = int(torrentId) + except ValueError: + return False + return self.fetch('torrent-remove', {'ids': torrentId}) + # Wrapper to access the Transmission Api # If the first call fails, there probably is no valid Session ID so we try it again def fetch(self, method, arguments=''):