mirror of
https://github.com/KevinMidboe/delugeClient.git
synced 2025-10-29 12:00:13 +00:00
Destroy flag added to remove function (default false) and argv parameters
This commit is contained in:
@@ -9,7 +9,7 @@ Usage:
|
|||||||
deluge_cli ls [--downloading | --seeding | --paused]
|
deluge_cli ls [--downloading | --seeding | --paused]
|
||||||
deluge_cli toggle TORRENT
|
deluge_cli toggle TORRENT
|
||||||
deluge_cli progress
|
deluge_cli progress
|
||||||
deluge_cli rm NAME [--debug | --warning | --error]
|
deluge_cli rm NAME [--destroy] [--debug | --warning | --error]
|
||||||
deluge_cli (-h | --help)
|
deluge_cli (-h | --help)
|
||||||
deluge_cli --version
|
deluge_cli --version
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ class Deluge(object):
|
|||||||
|
|
||||||
print('Response:', response)
|
print('Response:', response)
|
||||||
|
|
||||||
def remove(self, name):
|
def remove(self, name, destroy=False):
|
||||||
matches = list(filter(lambda t: t.name == name, self.get_all()))
|
matches = list(filter(lambda t: t.name == name, self.get_all()))
|
||||||
logger.info('Matches for {}: {}'.format(name, matches))
|
logger.info('Matches for {}: {}'.format(name, matches))
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ class Deluge(object):
|
|||||||
raise ValueError('Multiple files found matching key. Unable to remove.')
|
raise ValueError('Multiple files found matching key. Unable to remove.')
|
||||||
elif (len(matches) == 1):
|
elif (len(matches) == 1):
|
||||||
torrent = matches[0]
|
torrent = matches[0]
|
||||||
response = self.client.call('core.remove_torrent', torrent.key, False)
|
response = self.client.call('core.remove_torrent', torrent.key, destroy)
|
||||||
logger.info('Response: {}'.format(str(response)))
|
logger.info('Response: {}'.format(str(response)))
|
||||||
|
|
||||||
if (response == False):
|
if (response == False):
|
||||||
@@ -298,8 +298,11 @@ def main():
|
|||||||
deluge.togglePaused(_id)
|
deluge.togglePaused(_id)
|
||||||
|
|
||||||
elif arguments['rm']:
|
elif arguments['rm']:
|
||||||
logger.info('Remove by name: {}'.format(name))
|
destroy = arguments['--destroy']
|
||||||
deluge.remove(name)
|
logger.info('Remove by name: {}.'.format(name))
|
||||||
|
if destroy:
|
||||||
|
logger.info('Destroy set, removing files')
|
||||||
|
deluge.remove(name, destroy)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user