holomorph / transmission

Emacs interface to a Transmission session
GNU General Public License v3.0
85 stars 11 forks source link

neewb Q, dont i need to require transmission? #1

Closed zeltak closed 9 years ago

zeltak commented 9 years ago

hi. i cloned the repo and added it to my load path. but when i try to require it i get an error:

executing Emacs-Lisp code block... eval-buffer: Cannot open load file: not a directory, let-alist

this is the relevant config bit i have

(add-to-list 'load-path "/home/zeltak/.emacs.g/transmission/") (require 'transmission)

sorry for the neewbish question

z

holomorph commented 9 years ago
Cannot open load file: not a directory, let-alist

You need to install the dependencies (the things required in transmission.el). I think let-alist and seq are the only ones that aren't built into emacs 24--both are on GNU ELPA

zeltak commented 9 years ago

Thx for the response. installing let-alist worked great now im facing the cuztimization issues :)

i have managed to set this

(setq transmission-host "10.0.0.2")

but i get json-read: JSON readtable error

i assume i need to config user, password, url etc but cant find any documentation on that.

if you want i can also add all that as documentation later

best

Z

holomorph commented 9 years ago

There's just no support for authorization (username, password) yet :P

holomorph commented 9 years ago

I added support for rpc username and password in 0a008b0

zeltak commented 9 years ago

great! thx alot

would you mind giving an example on how to configure this? is it something like this: (setq transmission-rpc-auth user:pass)

sorry for the silly question but i have zero coding skills ;-)

z

holomorph commented 9 years ago

it's a plist like '(:username "me" :password "secret"). you can just use the customize interface

zeltak commented 9 years ago

thx for your continuing patience with me :)

so something like this

(add-to-list 'load-path "/home/zeltak/.emacs.g/transmission/") (require 'transmission) (setq transmission-host "10.0.0.2") (setq transmission-rpc-path "/transmission/web/") (setq transmission-rpc-auth '(username zeltak password XXXXX ) )

this still give the error : json-read: JSON readtable error

thx again

z

holomorph commented 9 years ago

your setting of transmission-rpc-auth looks wrong. As I wrote, I have the keys prepended with a colon, and the fields are strings, like '(:username "zeltak" :password "XXXXXX"). See the defcustom

(defcustom transmission-rpc-auth nil
  "Authorization (username, password) for using the RPC interface."
  :type '(choice (const :tag "None" nil)
                 (plist :tag "Username/password"
                        :options ((:username string)
                                  (:password string))))
  :group 'transmission)

Did you update your clone? In addition to adding username/password, I also made it so that more errors are caught. In the event that something else is going on, try doing M-x toggle-debug-on-error RET beforehand and paste the backtrace here

zeltak commented 9 years ago

thx again

this is my current config:

(add-to-list 'load-path "/home/zeltak/.emacs.g/transmission/")
(require 'transmission)
(setq transmission-host "10.0.0.2")
(setq transmission-rpc-path "/transmission/web/")
(setq transmission-rpc-auth '(:username "zeltak" :password "XXXX" ) )

as requested here is the debug outpout

Debugger entered--Lisp error: (json-readtable-error)
  signal(json-readtable-error nil)
  json-read()
  (save-current-buffer (set-buffer (process-buffer process)) (while (and (not (transmission--content-finished-p)) (process-live-p process)) (accept-process-output process 1)) (transmission--status) (transmission--move-to-content) (json-read))
  transmission-wait(#<process transmission>)
  transmission-send(#<process transmission> "{\"method\":\"torrent-get\",\"arguments\":{\"fields\":[\"id\",\"name\",\"status\",\"eta\",\"rateDownload\",\"rateUpload\",\"percentDone\",\"sizeWhenDone\",\"uploadRatio\"]},\"tag\":null}")
  (condition-case nil (transmission-send process content) (transmission-conflict (transmission-send process content)))
  (unwind-protect (condition-case nil (transmission-send process content) (transmission-conflict (transmission-send process content))) (if (and process (process-live-p process)) (progn (delete-process process) (kill-buffer (process-buffer process)))))
  (let ((process (transmission-ensure-process)) (content (json-encode (list (quote :method) method (quote :arguments) arguments (quote :tag) tag)))) (unwind-protect (condition-case nil (transmission-send process content) (transmission-conflict (transmission-send process content))) (if (and process (process-live-p process)) (progn (delete-process process) (kill-buffer (process-buffer process))))))
  transmission-request("torrent-get" (:fields ("id" "name" "status" "eta" "rateDownload" "rateUpload" "percentDone" "sizeWhenDone" "uploadRatio")))
  apply(transmission-request ("torrent-get" (:fields ("id" "name" "status" "eta" "rateDownload" "rateUpload" "percentDone" "sizeWhenDone" "uploadRatio"))))
  (let* ((request (list "torrent-get" arguments)) (response (apply (function transmission-request) request))) (cdr (cadr (assq (quote arguments) response))))
  transmission-torrents((:fields ("id" "name" "status" "eta" "rateDownload" "rateUpload" "percentDone" "sizeWhenDone" "uploadRatio")))
  (let ((torrents (transmission-torrents (list (quote :fields) transmission-torrent-get-fields)))) (erase-buffer) (let* ((seq torrents) (length (if (listp seq) nil (seq-length seq))) (index (if length 0 seq))) (while (if length (< index length) (consp index)) (let ((element (if length (prog1 ... ...) (car-safe ...)))) (let ((alist element)) (let ((\.eta ...) (\.percentDone ...) (\.sizeWhenDone ...) (\.rateDownload ...) (\.rateUpload ...) (\.uploadRatio ...) (\.status ...) (\.name ...) (\.id ...)) (let (...) (transmission-insert-entry vec ...))))))))
  transmission-draw-torrents()
  funcall(transmission-draw-torrents)
  (let* ((old-buffer (current-buffer)) (old-window-start (window-start)) (old-window-point (window-point)) (old-mark (if (region-active-p) (progn (let ((beg ...)) (if (= old-window-point beg) (region-end) beg)))))) (funcall fun) (if (not (equal (current-buffer) old-buffer)) (goto-char (point-min)) (goto-char old-window-point) (set-window-start nil old-window-start) (and old-mark (set-mark old-mark))))
  transmission-draw(transmission-draw-torrents)
  (let* ((name "*transmission*") (buffer (or (get-buffer name) (generate-new-buffer name)))) (switch-to-buffer-other-window buffer) (transmission-mode) (transmission-draw (quote transmission-draw-torrents)))
  transmission()
  call-interactively(transmission record nil)
  command-execute(transmission record)
  helm-M-x(nil "transmission")
  call-interactively(helm-M-x nil nil)
  command-execute(helm-M-x)

best

z

holomorph commented 9 years ago

That wasn't as useful as I thought it would be.

     (skip-chars-forward "HTTP/")
     (skip-chars-forward "[0-9].")
     (let* ((buffer (current-buffer))
            (status (read buffer)))
+      (message "%s" (buffer-string))
       (pcase status
         ((or 301 404 405) (signal 'transmission-wrong-rpc-path status))
         (401 (signal 'transmission-unauthorized status))

I suppose you could add this line here (in transmission--status) and inspect the HTTP in *Messages* (F1 e). I'm curious what the HTTP status code is and whether or not you're actually getting a JSON response back. The response should look like

HTTP/1.1 200 OK^M
Server: Transmission^M
Content-Type: application/json; charset=UTF-8^M
Date: Sun, 14 Jun 2015 18:20:19 GMT^M
Content-Length: 1671^M
^M
{"arguments":{"torrents":[{"eta":34969,"id":1,"nam <snip>
zeltak commented 9 years ago

Hi again

Just to update you that latest v 0.41 and using the customize group options to config it seems to work!

thx so much!

Z

holomorph commented 9 years ago

yay! i'm glad