holomorph / transmission

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

Suggestion: Prompt & Handling magnet links #26

Open thanosapollo opened 10 months ago

thanosapollo commented 10 months ago

Thank you for making this package.

Some changes I personally believe would improve the user experience:

Adding custom variables such as :

I'm using those var names as an example for reference

Changing transmission-add in the following ways

From a quick look at transmission.el maybe something like this would be useful:

(defun transmission-add--prompt ()
  "Add magnet link from clipboard or prompt for torrent file."
  (let ((clipboard (gui-get-selection 'CLIPBOARD)))
    (if (and (>= (length clipboard) 6)
             (string-equal "magnet" (substring-no-properties clipboard 0 6)))
        (completing-read
         "Add torrent: "
         (cons clipboard (directory-files transmission-torrents-dir t "\\.torrent$")))
      (read-file-name "Add torrent: " transmission-torrents-dir))))

Something like the scratch function above could be used as the input of transmission-add, simplifying it's current implementation as well.