0

I'm trying to add torrents to transmission from python. The code is shown below...

def download_movie(magnet_link):
    os.system('transmission-gtk')
    #webbrowser.open(magnet_link)
    os.system('transmission-gtk ' + magnet_link)

As you can see I've tried 3 different options to add these torrents but none work.. I've also added XDG_RUNTIME_DIR="/run/user/1000" in the crontab file. The log in /var/mail is running the script but it shows: (transmission-gtk:14091): Gtk-WARNING **: cannot open display:. I've also run the command xhost + as said in http://www.thegeekstuff.com/2010/06/xhost-cannot-open-display/ but still the gtk-warning comes up. Anyone have any ideas? What I want eventually is that I run this script on a pi so if anyone has any alternatives, I'm all ears.. Thanks.

oldtechaa
  • 1,463
  • 1
  • 14
  • 26
Ocirne
  • 313
  • 6
  • 15

1 Answers1

1

It's because you are trying to use GUI app where console one would be appropriate.

See man transmission-remote for details:

DESCRIPTION

transmission-remote is a remote control utility for transmission(1) and transmission-daemon(1).

Serge
  • 6,088
  • 17
  • 27
  • 1
    so would u suggest using transmission-daemon? I don't wanna access the Pi remotely however. Can't I run a GUI app? – Ocirne May 22 '16 at 18:37
  • yes, I would. Otherwise, how do you see the scenario? The complete download could take a long time, especially if there are no seeders at the moment. Also, how do you see the use of a `GUI` version in an unattended cron-scheduled task, i.e. what for the GUI in this case? – Serge May 22 '16 at 22:15
  • I understand your point that GUI would be kind of a waste. I was reading the documentation of transmission and I can still access a GUI in a webpage, with transmission-rpc and daemon. I'll read the documentation more thoroughly and test it out on a real Pi. – Ocirne May 23 '16 at 12:19