cl-transmission
2020-03-25
No Description
1CL-Transmission
1.1Usage
1.1.1Loading
Lets start by loadingCL-TRANSMISSION
and defining our connection. Connectionsare thread-safe in the way that you can use a one or more connection in multiplethreads. (ql:quickload :cl-transmission)
(defvar *conn* (make-instance 'cl-transmission:transmission-connection
:host "your.ip" ;; the host is "localhost" by default.
:credentials '("libreman" "super-secret-password")))
*CONN*
Please note that this package is not (yet) in Quicklisp so you will have to add it to your local projects to be able to load it. See the Quicklisp FAQ on how to do this.
1.1.2Searching
So lets get some torrents. First lets get all torrents and of every torrent getthe id, name and eta. This is done by using theCL-TRANSMISSION:TRANSMISSION-GET
method. (cl-transmission:transmission-get *conn* #(:name :id :eta) :strict t)
(#<HASH-TABLE :TEST EQUAL :COUNT 3 {1014218D23}> #<HASH-TABLE :TEST EQUAL :COUNT 3 {10142193B3}> #<HASH-TABLE :TEST EQUAL :COUNT 3 {1014241C83}>) NIL
As shown for every live torrent a hash-table is returned. So lets see how it is structured:
(alexandria:hash-table-plist
(elt (cl-transmission:transmission-get *conn* #(:name :id :eta) :strict t)
0))
:NAME | debian-8.7.1-amd64-DVD-1.iso | :ID | 72 | :ETA | 1368 |
So it simply contains the fields we specified. Searching is done by or passing a id, if you know it this is the fastest way, or mapping over the return value.
1.1.3Adding
Adding torrents is done by theCL-TRANSMISSION:TRANSMISSION-ADD
function. It accepts a :FILENAME
argument which should be a filenameto a torrent file or a magnet link, and :METAINFO
which should be abase64-encoded torrent file.So lets say we want to add a nice debian torrent to seed:
(cl-transmission:transmission-add *conn* :filename "http://cdimage.debian.org/debian-cd/current/amd64/bt-dvd/debian-8.7.1-amd64-DVD-2.iso.torrent")
#<HASH-TABLE :TEST EQUAL :COUNT 3 {10174B6333}> :TORRENT-ADDED
We get a hash-table of our new torrent with an ID
, NAME
and HASH-STRING
,
and the second return value is indicating this is a new torrent. So if we would
add the same torrent again this would be :TORRENT-DUPLICATE
.
1.1.4Others
At the moment the entire section 3 of the RPC spec is implemented. Simply seethe exported method and their docstrings. Development is active and section 4will be implemented.1.2Author
- Thomas Schaper (Thomas@libremail.nl)