aboutsummaryrefslogtreecommitdiffstats
path: root/transmission-remote-cli.py
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.py
parent835447e7e3e485368f408c8fc70f8657a96b57b3 (diff)
downloadtransmission-remote-cli-1a38ea642ac2187716b6a76cb751e0ae4a7f4599.tar.gz
Imported Upstream version 1.2upstream/1.2
Diffstat (limited to 'transmission-remote-cli.py')
-rwxr-xr-xtransmission-remote-cli.py21
1 files changed, 14 insertions, 7 deletions
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 \