Remote commands and Torrent Clients

Hello everybody. I finally got around installing some kind of Telegram on my Raspberry server to send it a couple of commands that I use often and see the outputs without having to connect remotely with SSH. What I'd like to add to all of this is the option to send it magnet links to simplify the downloads when they're needed. What torrent downloader has the option to send it a command to do such thing without me needing to open a console dedicated to it?

P.S. Transmission memory leaks on the Raspberry so I'd use if it's strictly necessary.

I believe deluge can do this iirc.

1 Like

It does. http://dev.deluge-torrent.org/wiki/UserGuide/ThinClient

You can use the normal UI to control the server remotely.

1 Like

Deluge can do it but it would be much easier to send the magnet links to the webui rather than using ssh. There are browser plugins and Android apps which will do this so all you have to do is click the link and it will be sent to your remote torrent client.

3 Likes

Thanks for the answers to all of you but maybe my intent was not that clear from the beginning. What I'd like to do is send to my Raspberry torrents through Telegram, that's it. I know the web UI is much easier to use but to use it remotely I should open ports, set fail2ban and firewall rules and so on.

1 Like

You would need some way for your raspberry to parse the telegram, and to my knowledge there is no ready to deploy software for your purpose, meaning you would need to do it yourself.

I'm not familiar with telegram, but if telegram outputs the message into a file you could parse the file for the magnet header, and then grab the rest and then use the command line to pipe that magnet into deluge and set it to auto download.

However you would need to do a fair bit of testing in order to see if what telegram gives you is even parse-able in it's native form.

EDIT: some further research shows that https://www.haykranen.nl/2014/12/02/howto-backup-your-telegram-chats/ this may be your friend, apparently telegram has a CLI that might let you dump the chat history into a file which you can then parse later.

As stated above it would require some scripting to get it to behave correctly however.

1 Like

Not really aware of why telegram is but you could get the pi to watch a Dropbox or similar folder?

1 Like

Thanks for the detailed answer, I really appreciated it. I've already set up Telegram and it answers in my own chat to commands I give him through a .lua script so on that end I'm good. Telegram can even read anything I send him and literally copy-paste into shell, execute it and send me back the output.
So the real deal of my question is: what's the command I can use to send magnets links to the Raspberry? As far as I've seen Transmission and Deluge are not able to read direct commands through the shell but need a "private console" to accept commands (except the ones that control the deamon obiviously).

This is a pretty interesting idea. Just yesterday I was looking at IFTTT and Raspberry.
Can you be more specific with your idea, please?

the command is (and you may need to install deluge-console if it isn't installed by default)

/usr/bin/deluge-console -c /var/lib/deluge/.config/deluge add -p download_path magnet_link

Where /var/lib/deluge/.config/deluge is the path to your deluge config file, download_path is where you want the file to download to, presumably if you leave out the -p option it will just download to the default location and magnet_link is the magnet link.

This is how I run deluge-console, the config file is probably locate in your home folder's .config directory, and you can probably just run deluge-console without the full path. I don't remember why I have it that way.

1 Like

You could just put the URL into a text file stored in drop box that is parsed by the pi, or a URL that the pi downloads, careful with that as a malicious file could be downloaded and run blindly by the pi. The benfit is you could get the pi to log to the Dropbox file as well. I was considering setting up a notification from my pi this way. I'd get a notification on my mobile and desktop when the pi updated the file then I could go and see what the problem was. You could do something similar with giving the pi an email address....

1 Like

Thanks a lot for the answer, that's what I was looking for!
Just to be sure: if I pass the command directly to the shell (with the appropriate changes obiviously) deluge will start a download, right?

I'm surely going to dig this option for other projects and fun stuff to try out. Thanks for opening my eyes on this new possibility!

Yeah that's right. You run that command either locally or over ssh and it adds the torrent to deluge. I found when running it that it wouldn't return to the console after running the command until I hit enter so in the script you may need to add an exit to the end or add ; exit to the end of the command, you might have to experiment with it.

1 Like

So looks like that command executes and opens the deluge console. That's why needs a ; exit at the end of it. I'll give it a try, thanks for specifing that.

Actually I tried it again and it exited properly, putting the magnet link in quotes helps. ; exit is probably the wrong thing to do anyway as it will close that terminal session or end any script. You'll just need to experiment with the command before you incorporate it in to your script or however you're going to do it.

EDIT: Did some more testing, putting the link in quotes makes it work properly

1 Like