Few minor fixes and implemented delete_files option via shutil.rmtree

This commit is contained in:
Dean Gardiner
2013-08-01 17:02:58 +12:00
parent 577baeca59
commit 317c3afb7a
2 changed files with 9 additions and 7 deletions

View File

@@ -54,8 +54,7 @@ config = [{
{
'name': 'delete_files',
'label': 'Remove files',
'default': False,
'hidden': True,
'default': True,
'type': 'bool',
'advanced': True,
'description': 'Also remove the leftover files.',

View File

@@ -1,6 +1,7 @@
from base64 import b16encode, b32decode
from datetime import timedelta
from hashlib import sha1
import shutil
import traceback
from bencode import bencode, bdecode
@@ -39,10 +40,10 @@ class rTorrent(Downloader):
return self.rt
def _update_provider_group(self, name, data):
if data.get('seed_time') is not None:
if data.get('seed_time'):
log.info('seeding time ignored, not supported')
if name is None or data.get('seed_ratio') is None:
if not name or not data.get('seed_ratio'):
return False
if not self.connect():
@@ -179,7 +180,9 @@ class rTorrent(Downloader):
if torrent is None:
return False
if delete_files:
log.info('not deleting files, not supported')
torrent.erase() # just removes the torrent, doesn't delete data
return torrent.erase() # just removes the torrent, doesn't delete data
if delete_files:
shutil.rmtree(item['folder'], True)
return True