I have a magnet link from a torrent site that should open this program called transmission.How do i open it with Python?
i’m on ubuntu btw.
I heard this thing called xdg-open can do the trick but how do i use it for opening the magnet link?
and if that’s not the code i’m looking for, what should i use to run the magnet link?
Taking a look at the command line arguments of
transmission-gtkhelps:A quick and dirty approach for a python solution is using the
osmodule:A much better and more sophisticated way to do such calls to external programms is using the
subprocessmodule. A few more examples can be found under python – how to create a subprocess?.xdg-openworks pretty much the same way. But instead of calling the transmission client directly, it chooses the preferred Torrent application (preferred in this case means default application, which can be set by using the default applications menu in the Ubuntu system settings). Repeatedly pointing you at the help texts given by calling the programm from commandline, it might be interesting to inspect the exit codes ofxdg-open: