mirror of
https://github.com/KevinMidboe/delugeClient.git
synced 2025-10-29 12:00:13 +00:00
Compare commits
5 Commits
py2-compat
...
refactor
| Author | SHA1 | Date | |
|---|---|---|---|
| 57b1b4e1f2 | |||
| fada382a32 | |||
| 8d943cb1ad | |||
| bd516f34d8 | |||
| cfe14dd1ba |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
|||||||
|
deluge_cli.log
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
|||||||
@@ -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 [--destroy | --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
|
||||||
|
|
||||||
@@ -24,7 +24,6 @@ Options:
|
|||||||
--debug Print all debug log
|
--debug Print all debug log
|
||||||
--warning Print only logged warnings
|
--warning Print only logged warnings
|
||||||
--error Print error messages (Error/Warning)
|
--error Print error messages (Error/Warning)
|
||||||
--destroy When removing choose to remove file on disk
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@@ -151,7 +150,7 @@ class Deluge(object):
|
|||||||
|
|
||||||
print('Response:', response)
|
print('Response:', response)
|
||||||
|
|
||||||
def remove(self, name, destroyFiles=False):
|
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))
|
||||||
|
|
||||||
@@ -159,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, destroyFiles)
|
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):
|
||||||
@@ -300,7 +299,9 @@ def main():
|
|||||||
|
|
||||||
elif arguments['rm']:
|
elif arguments['rm']:
|
||||||
destroy = arguments['--destroy']
|
destroy = arguments['--destroy']
|
||||||
logger.info('Remove by name: {}. Destroy files: {}'.format(name, destroy))
|
logger.info('Remove by name: {}.'.format(name))
|
||||||
|
if destroy:
|
||||||
|
logger.info('Destroy set, removing files')
|
||||||
deluge.remove(name, destroy)
|
deluge.remove(name, destroy)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ asn1crypto==0.24.0
|
|||||||
bcrypt==3.1.4
|
bcrypt==3.1.4
|
||||||
cffi==1.11.5
|
cffi==1.11.5
|
||||||
colored==1.3.5
|
colored==1.3.5
|
||||||
cryptography==2.3
|
cryptography==2.5
|
||||||
deluge-client==1.6.0
|
deluge-client==1.6.0
|
||||||
docopt==0.6.2
|
docopt==0.6.2
|
||||||
idna==2.7
|
idna==2.7
|
||||||
|
|||||||
Reference in New Issue
Block a user