Commits

Erik Svensson committed a8fe7ef

Fixed RPC Version handling in Torrent.
Fixed Client.set_files handling of priority.

Comments (0)

Files changed (3)

 ^html/*
 .+\.egg-info/*
 ^doc/out/*
+^\.idea/*
+^\hgmessage

transmissionrpc/client.py

 Torrent ids
 
 Many functions in Client takes torrent id. A torrent id can either be id or
-hashString. When suppling multiple id's it is possible to use a list mixed
+hashString. When supplying multiple id's it is possible to use a list mixed
 with both id and hashString.
 
 Timeouts
         ===================== ==== =============================================================
         ``bandwidthPriority`` 8 -  Priority for this transfer.
         ``download_dir``      1 -  The directory where the downloaded contents will be saved in.
-        ``filename``          1 -  A filepath or URL to a torrent file or a magnet link.
+        ``filename``          1 -  A file path or URL to a torrent file or a magnet link.
         ``files_unwanted``    1 -  A list of file id's that shouldn't be downloaded.
         ``files_wanted``      1 -  A list of file id's that should be downloaded.
         ``metainfo``          1 -  The content of a torrent file, base64 encoded.
 
     def set_files(self, items, timeout=None):
         """
-        Set file properties. Takes a dictonary with similar contents as the result
+        Set file properties. Takes a dictionary with similar contents as the result
     	of `get_files`.
 
     	::
                 continue
             wanted = []
             unwanted = []
-            priority_high = []
-            priority_normal = []
-            priority_low = []
+            high = []
+            normal = []
+            low = []
             for fid, file_desc in files.iteritems():
                 if not isinstance(file_desc, dict):
                     continue
                     unwanted.append(fid)
                 if 'priority' in file_desc:
                     if file_desc['priority'] == 'high':
-                        priority_high.append(fid)
+                        high.append(fid)
                     elif file_desc['priority'] == 'normal':
-                        priority_normal.append(fid)
+                        normal.append(fid)
                     elif file_desc['priority'] == 'low':
-                        priority_low.append(fid)
-            self.change([tid], files_wanted = wanted
-                        , files_unwanted = unwanted
-                        , priority_high = priority_high
-                        , priority_normal = priority_normal
-                        , priority_low = priority_low, timeout=timeout)
+                        low.append(fid)
+            args = {
+                'timeout': timeout,
+                'files_wanted': wanted,
+                'files_unwanted': unwanted,
+            }
+            if len(high) > 0:
+                args['priority_high'] = high
+            if len(normal) > 0:
+                args['priority_normal'] = normal
+            if len(low) > 0:
+                args['priority_low'] = low
+            self.change([tid], **args)
 
     def list(self, timeout=None):
         """list all torrents"""

transmissionrpc/torrent.py

 
     def _rpc_version(self):
         if self.client:
-            return self.client.rpc_version()
+            return self.client.rpc_version
         return 2
     
     def _status_old(self, code):