aboutsummaryrefslogtreecommitdiffstats
path: root/transmission-remote-cli
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2012-04-25 15:24:23 +0100
committerJonathan McCrohan <jmccrohan@gmail.com>2012-04-25 15:24:23 +0100
commit1a38ea642ac2187716b6a76cb751e0ae4a7f4599 (patch)
tree27835ce6c3417022a5cee0efc0ce9741748e1f25 /transmission-remote-cli
parent835447e7e3e485368f408c8fc70f8657a96b57b3 (diff)
downloadtransmission-remote-cli-1a38ea642ac2187716b6a76cb751e0ae4a7f4599.tar.gz
Imported Upstream version 1.2upstream/1.2
Diffstat (limited to '')
-rw-r--r--transmission-remote-cli.1161
-rwxr-xr-xtransmission-remote-cli.py21
2 files changed, 77 insertions, 105 deletions
diff --git a/transmission-remote-cli.1 b/transmission-remote-cli.1
index 3f57ebc..169170c 100644
--- a/transmission-remote-cli.1
+++ b/transmission-remote-cli.1
@@ -1,104 +1,69 @@
-.Dd Oct 25, 2011
-.Dt TRANSMISSION-REMOTE-CLI 1
-.Os
-.Sh NAME
-.Nm transmission-remote-cli
-.Nd a console client for the Transmission BitTorrent client
-.Sh SYNOPSIS
-.Nm
-.Op OPTION
-.Op Ar filename-or-URL
-.Sh DESCRIPTION
-.Nm
-is a console client for the Transmission BitTorrent client
-.Sh OPTIONS
-.Bl -tag -with Ds
-.It Fl -version
-Show version number and exit
-.It Fl h Fl -help
-Show this help message and exit
-.It Fl "c \fICONNECTION\fR" Fl -connect=\fICONNECTION\fR
-Point to the server using pattern: [username:password@]host[:port]/[path]
-.It Fl s Fl -ssl
-Connect to Transmission via SSL
-.It Fl "f \fICONFIGFILE\fR" Fl -config=\fICONFIGFILE\fR
-Path to configuration file
-.It Fl -create-config
-Create configuration file \fICONFIGFILE\fR
-.It Fl n Fl -netrc
-Get authentication info from your ~/.netrc file
-.It Fl -
-Forward options after '--' and auth info to transmission-remote
-.Sh FILES
-Settings can be saved in ~/.config/transmission-remote-cli/settings.cfg, authentication settings in ~/.netrc
-.Sh EXAMPLES
-Connection information
-
-.Ed
-Authentication and host/port can be set via command line with one of these patterns:
-.Bd -literal -offset indent
-$ transmission-remote-cli \-c homeserver
-$ transmission-remote-cli \-c homeserver:1234
-$ transmission-remote-cli \-c johndoe:secretbirthday@homeserver
-$ transmission-remote-cli \-c johndoe:secretbirthday@homeserver:1234
-
-.Ed
-Configuration file
-
-.Ed
-You can write this (and other settings) to a configuration file:
-.Bd -literal -offset indent
-$ transmission-remote-cli.py \-c johndoe:secretbirthday@homeserver:1234 \-\-create-config
+.\"Created with GNOME Manpages Editor Wizard
+.\"http://sourceforge.net/projects/gmanedit2
+.TH transmission-remote-cli 1 "April 22, 2012" "" "transmission-remote-cli"
-.Ed
-No configuration file is created automatically, you have to do this somehow. However, if the file exists, it is re-written when trcli exits to remember some settings. This means you shouldn't have trcli running when editing your configuration file.
+.SH NAME
+transmission-remote-cli \- a console client for the Transmission BitTorrent
+client
-.Ed
-If you don't like the default configuration file path ~/.config/transmission-remote-cli/settings.cfg, change it:
-.Bd -literal -offset indent
-$ transmission-remote-cli.py -f ~/.trclirc --create-config
+.SH SYNOPSIS
+.B transmission-remote-cli
+.RI [ options ]
+.RI [ filename-or-URL ]
+.br
-.Ed
-Calling transmission-remote
+.SH DESCRIPTION
+.B transmission-remote-cli
+is a curses interface for the daemon of the BitTorrent client Transmission.
-.Ed
-transmission-remote-cli forwards all arguments after '--' to transmission-remote. This is useful if your daemon requires authentication and/or doesn't listen on the default localhost:9091 for instructions. transmission-remote-cli reads HOST:PORT and authentication from the config file and forwards them on to transmission-remote, along with your arguments.
-
-.Ed
-Some examples:
-.Bd -literal -offset indent
-$ transmission-remote-cli.py -- -l
-$ transmission-remote-cli.py -- -t 2 -i
-$ transmission-remote-cli.py -- -as
-
-.Ed
-Add torrents
+.SH OPTIONS
+.B
+.IP "--version"
+Show version number and exit
+.B
+.IP "-h --help"
+Show usage information and a list of options
+.B
+.IP "-c \fICONNECTION\fB --connect=\fICONNECTION\fR"
+Point to the server. \fICONNECTION\fR must match the following pattern:
+.br
+[username:password@]host[:port][path]
+.br
+Default: localhost:9091
+.B
+.IP "-s --ssl"
+Use SSL to connect to the server.
+.br
+Default: don't use SSL
+.B
+.IP "--create-config"
+Create configuration file with default values.
+.br
+\fINOTE:\fR A config file won't be created unless you provide this option at
+least once. After that, it is rewritten whenever transmission-remote-cli
+exits.
+.IP "-f \fICONFIGFILE\fB --config=\fICONFIGFILE\fR"
+Set path to configuration file.
+.br
+Default: ~/.config/transmission-remote-cli/settings.cfg
+.B
+.IP "-n --netrc"
+Get authentication info from ~/.netrc.
+.B
+.IP "-- \fIOPTIONS\fR"
+Use the known server connection to pass \fIOPTIONS\fR on to
+\fBtransmission-remote\fR.
+.B
-.Pp
-If you provide only one command line argument and it doesn't start with '-', it's treated like a torrent file/URL and submitted to the daemon via transmission-remote.
-This is useful because you can instruct Firefox to open torrent files with transmission-remote-cli.py.
-.Bd -literal -offset indent
-$ transmission-remote-cli.py http://link/to/file.torrent
-$ transmission-remote-cli.py path/to/some/torrent-file
-.El
-.Sh AUTHOR
-.An -nosplit
-.An Benjamin (fagga),
-.An contributors .
-.Sh SEE ALSO
-.Xr transmission-create 1 ,
-.Xr transmission-daemon 1 ,
-.Xr transmission-edit 1 ,
-.Xr transmission-gtk 1 ,
-.Xr transmission-qt 1 ,
-.Xr transmission-remote 1 ,
-.Xr transmission-show 1
-.Sh COPYRIGHT
-Copyright (C) 2011 Ben Thompson.
+.SH FILES
+transmission-remote-cli overwrites the configuration file on exit. Keep that
+in mind if you edit it manually.
-Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.3
-or any later version published by the Free Software Foundation;
-with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
-A copy of the license is included in the section entitled "GNU
-Free Documentation License" <\fBhttp://www.gnu.org/copyleft/fdl.html\fR>.
+.SH SEE ALSO
+.BR transmission-create (1),
+.BR transmission-daemon (1),
+.BR transmission-edit (1),
+.BR transmission-gtk (1),
+.BR transmission-qt (1),
+.BR transmission-remote (1),
+.BR transmission-show (1).
diff --git a/transmission-remote-cli.py b/transmission-remote-cli.py
index e7dfb9e..8a2497b 100755
--- a/transmission-remote-cli.py
+++ b/transmission-remote-cli.py
@@ -16,10 +16,10 @@
# http://www.gnu.org/licenses/gpl-3.0.txt #
########################################################################
-VERSION = '1.1.1'
+VERSION = '1.2'
TRNSM_VERSION_MIN = '1.90'
-TRNSM_VERSION_MAX = '2.50'
+TRNSM_VERSION_MAX = '2.51'
RPC_VERSION_MIN = 8
RPC_VERSION_MAX = 14
@@ -183,7 +183,6 @@ class TransmissionRequest:
if session_id:
self.http_request.add_header('X-Transmission-Session-Id', session_id)
self.open_request = urllib2.urlopen(self.http_request)
- debug(self.http_request.get_data() + "\n\n")
except AttributeError:
# request data (http_request) isn't specified yet -- data will be available on next call
pass
@@ -221,7 +220,6 @@ class TransmissionRequest:
authhandler.retried = 0
try:
data = json.loads(unicode(response))
- debug(data)
except ValueError:
quit("Cannot parse response: %s\n" % response, JSON_ERROR)
self.open_request = None
@@ -253,11 +251,11 @@ class Transmission:
'peersConnected', 'uploadLimit', 'downloadLimit',
'uploadLimited', 'downloadLimited', 'bandwidthPriority',
'peersSendingToUs', 'peersGettingFromUs',
- 'seedRatioLimit', 'seedRatioMode' ]
+ 'seedRatioLimit', 'seedRatioMode', 'isPrivate' ]
DETAIL_FIELDS = [ 'files', 'priorities', 'wanted', 'peers', 'trackers',
'activityDate', 'dateCreated', 'startDate', 'doneDate',
- 'totalSize', 'leftUntilDone', 'comment', 'isPrivate',
+ 'totalSize', 'leftUntilDone', 'comment',
'hashString', 'pieceCount', 'pieceSize', 'pieces',
'downloadedEver', 'corruptEver', 'peersFrom' ] + LIST_FIELDS
@@ -1091,7 +1089,7 @@ class Interface:
if self.selected_torrent == -1:
options = [('uploading','_Uploading'), ('downloading','_Downloading'),
('active','Ac_tive'), ('paused','_Paused'), ('seeding','_Seeding'),
- ('incomplete','In_complete'), ('verifying','Verif_ying'),
+ ('incomplete','In_complete'), ('verifying','Verif_ying'), ('private','P_rivate'),
('invert','In_vert'), ('','_All')]
choice = self.dialog_menu(('Show only','Filter all')[self.filter_inverse], options,
map(lambda x: x[0]==self.filter_list, options).index(True)+1)
@@ -1197,6 +1195,7 @@ class Interface:
self.selected_torrent = -1
self.details_category_focus = 0
server.remove_torrent(self.torrents[self.focus]['id'])
+ self.focus_next_after_delete()
def remove_torrent_local_data(self, c):
if self.focus > -1:
@@ -1207,6 +1206,12 @@ class Interface:
self.selected_torrent = -1
self.details_category_focus = 0
server.remove_torrent_local_data(self.torrents[self.focus]['id'])
+ self.focus_next_after_delete()
+
+ def focus_next_after_delete(self):
+ """ Focus next torrent after user deletes torrent """
+ new_focus = min(self.focus + 1, len(self.torrents) - 2)
+ self.focused_id = self.torrents[new_focus]['id']
def add_tracker(self):
if server.get_rpc_version() < 10:
@@ -1419,6 +1424,8 @@ class Interface:
or t['status'] == Transmission.STATUS_SEED_WAIT]
elif self.filter_list == 'incomplete':
self.torrents = [t for t in self.torrents if t['percentDone'] < 100]
+ elif self.filter_list == 'private':
+ self.torrents = [t for t in self.torrents if t['isPrivate']]
elif self.filter_list == 'active':
self.torrents = [t for t in self.torrents if t['peersGettingFromUs'] > 0 \
or t['peersSendingToUs'] > 0 \