Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-f/--onlyfiles Option for deluge-console info #449

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions deluge/ui/console/cmdline/commands/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ def add_arguments(self, parser):
dest='detailed',
help=_('Show more detailed information including files and peers.'),
)
parser.add_argument(
'-f',
'--onlyfiles',
action='store_true',
default=False,
dest='onlyfiles',
help=_('Output only files used by torrent'),
)
parser.add_argument(
'-s',
'--state',
Expand Down Expand Up @@ -179,7 +187,7 @@ def on_torrents_status(status):
key=lambda x: x[1].get(sort_key),
reverse=sort_reverse,
):
self.show_info(key, status[key], options.verbose, options.detailed)
self.show_info(key, status[key], options.verbose, options.detailed, options.onlyfiles)

def on_torrents_status_fail(reason):
self.console.write('{!error!}Error getting torrent info: %s' % reason)
Expand Down Expand Up @@ -316,7 +324,7 @@ def show_peer_info(self, torrent_id, status):

self.console.write(s[:-1])

def show_info(self, torrent_id, status, verbose=False, detailed=False):
def show_info(self, torrent_id, status, verbose=False, detailed=False, onlyfiles=False):
"""
Writes out the torrents information to the screen.

Expand All @@ -331,7 +339,10 @@ def show_info(self, torrent_id, status, verbose=False, detailed=False):

sep = ' '

if verbose or detailed:
if onlyfiles:
for index, torrent_file in enumerate(status['files']):
self.console.write(status['download_location'] + "/" + torrent_file['path'])
elif verbose or detailed:
self.console.write('{!info!}Name: {!input!}%s' % (status['name']))
self.console.write('{!info!}ID: {!input!}%s' % (torrent_id))
s = '{{!info!}}State: {}{}'.format(
Expand Down