Clutch Bookmarklet (esp. for iPhone)
-
- Posts: 1
- Joined: Thu Aug 07, 2008 6:36 pm
Clutch Bookmarklet (esp. for iPhone)
Love the Clutch integration on the new Transmission, especially for checking on torrent progress from the iPhone. I did notice that there is no way to add a new torrent from the iPhone interface, even though it is possible from a standard web browser. This makes sense, since there is no copy/paste and no local file storage, it would be impossible (or very difficult) to enter a torrent file.
One way that this could be accomplished is through a bookmarklet. Create a bookmarklet (customizable either by hand, or, ideally, have it autogenerated from the web interface to include the Clutch server IP) that could be run from a torrent site. Have the bookmarklet convert the web link to the torrent file into a link to submit that torrent file's URL to the Clutch interface. This sort of link manipulation is possible through a bookmarklet, as long as the link can be manipulated into a form that the Clutch interface will accept.
I would try it myself, but my web skills are pretty basic and I thought I'd put the suggestion out there in case someone could whip one up easily. If that doesn't happen in the next couple of weeks, I'll give it a go.
Good luck, and keep up the great work!
One way that this could be accomplished is through a bookmarklet. Create a bookmarklet (customizable either by hand, or, ideally, have it autogenerated from the web interface to include the Clutch server IP) that could be run from a torrent site. Have the bookmarklet convert the web link to the torrent file into a link to submit that torrent file's URL to the Clutch interface. This sort of link manipulation is possible through a bookmarklet, as long as the link can be manipulated into a form that the Clutch interface will accept.
I would try it myself, but my web skills are pretty basic and I thought I'd put the suggestion out there in case someone could whip one up easily. If that doesn't happen in the next couple of weeks, I'll give it a go.
Good luck, and keep up the great work!
Re: Clutch Bookmarklet (esp. for iPhone)
I have a JS bookmarklet on my iPhone that, when activated, sends the download link for a torrent to my Transmission box where a PHP script downloads the torrent file and passes it to Transmission. It works really well, but it would be great for this functionality to be built into Transmission/Clutch.
Re: Clutch Bookmarklet (esp. for iPhone)
Might you be willing to share the code for that? I'm pretty sure we could easily adapt it to work with Clutch. If I recall correctly it's already possible to add a torrent via a link, you just need to create the link!ximon wrote:I have a JS bookmarklet on my iPhone that, when activated, sends the download link for a torrent to my Transmission box where a PHP script downloads the torrent file and passes it to Transmission. It works really well, but it would be great for this functionality to be built into Transmission/Clutch.
Re: Clutch Bookmarklet (esp. for iPhone)
I got the original code here: http://www.macosxhints.com/article.php? ... 5111252241
I can post my modified version over the weekend if you like. My version shows a confirmation page offering a link to Clutch, plus it's modified to use wget instead of curl (curl doesn't work on my NAS).

I can post my modified version over the weekend if you like. My version shows a confirmation page offering a link to Clutch, plus it's modified to use wget instead of curl (curl doesn't work on my NAS).

Last edited by ximon on Fri Aug 08, 2008 2:04 pm, edited 1 time in total.
Re: Clutch Bookmarklet (esp. for iPhone)
It's my understanding that we should be able to simply pass Clutch the URL of a torrent file the same way you can "add via url" in the interface. I know I figured out how at some point...ximon wrote:I got the original code here: http://www.macosxhints.com/article.php? ... 5111252241
I can post my modified version over the weekend if you like. My version shows a confirmation page offering a link to Clutch, plus it's modified to use wget instead of curl (curl doesn't work on my NAS).
Re: Clutch Bookmarklet (esp. for iPhone)
I had a dig around in the Clutch scripts and I think I found that adding a torrent url submits a form using the format:
So we need to change the ($_GET['torrent_url'], null) part to a torrent file URL that the PHP script can use. I'm afraid I'm no JavaScript programmer (or any kind of programmer for that matter) so this is about as far as I can take this, can you shed any light?
Code: Select all
http://example.com:8081/clutch/remote/index.php?action=addTorrentByURL($_GET['torrent_url'], null)
Re: Clutch Bookmarklet (esp. for iPhone)
I'm using the built-in Clutch in Transmission 1.3x which has apparently removed the add-by-url function (though the button is still there in the gui... I have a post asking about this in the Support forum)ximon wrote:I had a dig around in the Clutch scripts and I think I found that adding a torrent url submits a form using the format:
So we need to pass the torrent url to Clutch's remote PHP in a format it understands. I'm afraid I'm no JavaScript programmer (or any kind of programmer for that matter) so this is about as far as I can take this, can you shed any light?Code: Select all
http://example.com:8081/clutch/remote/index.php?action=addTorrentByURL($_GET['torrent_url'], null)
But I do have an answer for you, and I'm curious if it works!
Try this bookmarklet:
Code: Select all
javascript:(function()%20{%20var%20host%20=%20"http://example.com:8081/clutch/remote/index.php?action=addTorrentByURL¶m=";%20for%20(var%20i%20=%200;%20i%20<%20document.links.length;%20i++)%20{%20document.links[i].href%20=%20"javascript:(function()%20{%20var%20img%20=%20document.createElement('img');%20img.setAttribute('src',%20'"+%20host%20+%20"?action=uploadTorrent&torrent_file="%20+%20encodeURIComponent(document.links[i].href)%20+%20"');%20img.setAttribute('style',%20'visibility:hidden');%20document.body.appendChild(img);%20setTimeout('window.open(\""%20+%20host%20+%20(navigator.userAgent.match(/iP(hone|od)/i)%20?%20"iphone/i.html"%20:%20"")%20+%20"\",%20\"_self\");',%204000);%20})();";%20}%20})();
This bookmarklet will (should) temporarily alter URLs on a page that end in .torrent to be add-to-clutch links.
Re: Clutch Bookmarklet (esp. for iPhone)
Tried it, when I click the bookmarklet then a .torrent link it thinks for a little while then sends me to and I get a 404.
I assume that it's supposed to send me to a success page (i.html) which doesn't exist after sending the URL to clutch, which explains the 404, but nothing is happening in Clutch and it seems to be trying to invoke addTorrentByURL for the success page too.
It's probably not worth spending any more time on this if, as you say, this is no longer going to work with 1.3 - the package maintainer for my NAS is updating to 1.3 this weekend and I will be installing it shortly after. I think maybe we should wait until things settle dow a bit from a 1.22->1.3 point of view before coming back to this problem.
Code: Select all
http://example.com:8081/clutch/remote/index.php?action=addTorrentByURL¶m=iphone/i.html
I assume that it's supposed to send me to a success page (i.html) which doesn't exist after sending the URL to clutch, which explains the 404, but nothing is happening in Clutch and it seems to be trying to invoke addTorrentByURL for the success page too.
It's probably not worth spending any more time on this if, as you say, this is no longer going to work with 1.3 - the package maintainer for my NAS is updating to 1.3 this weekend and I will be installing it shortly after. I think maybe we should wait until things settle dow a bit from a 1.22->1.3 point of view before coming back to this problem.
Re: Clutch Bookmarklet (esp. for iPhone)
Seems like a good idea. I also can't think of a scenario where I'd need a torrent so badly that I couldn't wait until I was at a real computer 

Re: Clutch Bookmarklet (esp. for iPhone)
im afraid the add by url is no longer functional after the change to JSON-RPC however we will work on getting it back up and running. for now, there is no way to add torrents through an iphone.
Re: Clutch Bookmarklet (esp. for iPhone)
I noticed that the Web Interface sniffs out the iPhone user agent and hides the "add" button (and filter and inspector buttons). Pretty cool!
Re: Clutch Bookmarklet (esp. for iPhone)
Heh, it seems FoolsRun tried to use my old uTorrent bookmarklet with Transmission. That obviously won't work. 
Here's a version I made to work with Transmission: http://forum.transmissionbt.com/viewtop ... f=8&t=6937

Here's a version I made to work with Transmission: http://forum.transmissionbt.com/viewtop ... f=8&t=6937
Re: Clutch Bookmarklet (esp. for iPhone)
http://hlounge.net/iPhoneTransBookmarklet/
Hey peeps,
After searching relentlessly and coming to this thread and few other places I sorta pieced together a few things to get the ball rolling again:
The link above is a small app that I made to create the bookmarklet and PHP script needed to add a torrent using the iPhone.
Previous postings about bookmarklets are not working on the newer transmission versions because the "RPC" now requires some fancy session id stuff to put into the headers.
So I gave up and just made the bookmarklet hit a PHP file which inturns downloads the .torrent and adds it to Transmission.
I will admit that for my situation I made this for an HDX 1000 Network Media Tank. For your situation there maybe some post editing/modding needed.
If you have issues or want to add something to the link please message me.
The Link:
http://hlounge.net/iPhoneTransBookmarklet/
Hey peeps,
After searching relentlessly and coming to this thread and few other places I sorta pieced together a few things to get the ball rolling again:
The link above is a small app that I made to create the bookmarklet and PHP script needed to add a torrent using the iPhone.
Previous postings about bookmarklets are not working on the newer transmission versions because the "RPC" now requires some fancy session id stuff to put into the headers.
So I gave up and just made the bookmarklet hit a PHP file which inturns downloads the .torrent and adds it to Transmission.
I will admit that for my situation I made this for an HDX 1000 Network Media Tank. For your situation there maybe some post editing/modding needed.
If you have issues or want to add something to the link please message me.
The Link:
http://hlounge.net/iPhoneTransBookmarklet/
Re: Clutch Bookmarklet (esp. for iPhone)
It looks like brownrl's site is no longer up. Please see this thread for my final response regarding bookmarklets: http://forum.transmissionbt.com/viewtop ... f=8&t=6937
Re: Clutch Bookmarklet (esp. for iPhone)
There is a nice new solution to this which works well using a bookmarklet and a few files on the server:
viewtopic.php?f=8&t=11355&p=52996&hilit ... let#p52996
viewtopic.php?f=8&t=11355&p=52996&hilit ... let#p52996