Jump to content

Experimental uTorrent google gadget


hiddenriver

Recommended Posts

Edit

The Google gadget has moved. The new version of the gadget is at http://thinkpond.org/content/view/12/.

I wrote a google gadget that shows the status of all my torrents from my google home page.

To add it, go to http://www.google.com/ig, signing in if necessary. Click the link to customize your home page if you haven't done it already. Click "Add more to this page" in the top left. Click "Add by URL" to the right of the search button. Enter http://river.hidden.googlepages.com/uTorrent.xml as the URL. Click "Back to home page" in the top left. Then configure it. You'll need to enable the WebUI guest user and find out your IP address. It'll might take a while to load the first time.

Let me know what you think and I'll maybe make some improvements.

Edit

Doesn't work in Internet Explorer! And it probably never will. Sorry.

utorrent_gadget.gif

Edit (Ultima): Adding XML source in case the link ever goes down...

<iframe id="torrent_frame_0" width=0 height=0 scrolling=auto marginwidth=0 marginheight=0 frameborder=0 src=""></iframe> <iframe id="torrent_frame_1" width=0 height=0 scrolling=auto marginwidth=0 marginheight=0 frameborder=0 src=""></iframe> <script type="text/javascript"> var prefs = new _IG_Prefs(__MODULE_ID__); var address = prefs.getString("address"); var port = prefs.getInt("port"); var guest = prefs.getString("guest"); var period = prefs.getInt("period"); var guestUrl = "http://" + guest + "@" + address + ":" + port + "/gui/guest.html"; // document.write("<iframe id=\"torrent_frame\" width=100% height=100% scrolling=auto marginwidth=0 marginheight=0 frameborder=0 src=\"" + guestUrl + "\"></iframe>"); var currentFrameIdx = 0; function hideFrame(frameIdx) { var frame = _gel("torrent_frame_" + frameIdx); frame.width = 0; frame.height = 0; } function showFrame(frameIdx) { var frame = _gel("torrent_frame_" + frameIdx); frame.width = "100%"; frame.height = "100%"; } function refreshFrame(frameIdx) { var frame = _gel("torrent_frame_" + frameIdx); frame.src = guestUrl; } function handleTimeout() { var otherFrameIdx = 1 - currentFrameIdx; hideFrame(currentFrameIdx); showFrame(otherFrameIdx); refreshFrame(currentFrameIdx); currentFrameIdx = otherFrameIdx; window.setTimeout('handleTimeout()', period * 60 * 1000); } showFrame(1 - currentFrameIdx); refreshFrame(1 - currentFrameIdx); window.setTimeout('handleTimeout()', period * 60 * 1000); </script>

Link to comment
Share on other sites

Very cool idea!

I hope you don't mind, but I grabbed your source code and made a few improvement:

-Title changed to "µTorrent"

-Added: "Admin Login" setting, which is used to link gadget title to full WebUI

-Added: Show: 5/10/20/40 Torrents setting

-Shortened other option labels to avoid text wrapping @ 1024 screen resolution

http://conradpoohs.com/uTorrent.xml

If you want to host this version, I'll take it off my webspace to avoid confusing others.

Link to comment
Share on other sites

Thanks Conrad. I made a few cosmetic changes and updated the version I'm hosting. The most important change was adding your name as a contributor! I don't mind you hosting it, in fact I bet your server is more reliable than google pages! But I do intend to make more changes in the future and there is no need for the code to fork. If it ever gets popular, maybe I'll find somewhere more central to host it. Thanks again.

Link to comment
Share on other sites

You could always place everything in webui.zip, and access it via http://IP:port/gui/uTorrent.xml :P

Or if your files conflict, place it in a subdirectory of webui.zip, so that you access it via http://IP:port/gui/googlegadget/uTorrent.xml

Or something like that anyway. It makes sense too that way, since µTorrent has to be running for it to work. Of course, that means tiny modification with regards to login and stuff, but at least it sorta decentralizes everything.

Link to comment
Share on other sites

That's an interesting idea Ultima. I wouldn't have thought of that. There's at least one problem I think of. Google won't connect to a server using a username or password and the WebUI guest account still requires that you enter a username. If that was changed it should work though.

That's why the google gadget embeds the WebUI in a frame. The javascript security model prevents it from connecting to the utorrent server directly and it can't do it through the google content fetch system because of the username. If the username was removed, the gadget could ask google to fetch the WebUI page for it and then do stuff with the result, like remove columns that don't fit in a google gadget screen area and size the gadget automatically based on the number of torrents. It could also do stuff like notify you when torrents complete and a bunch of other stuff. Just an idea :)

Another useful feature for doing this kind of think would be an XML description of the torrents. HTML is okay but its more difficult to parse and it's likely to change with future versions of utorrent.

Link to comment
Share on other sites

Ultima: actually there's a chance it will work. I know for sure that the google gadget API does not allow you to fetch data from a username / protected site (because that was the first thing I tried!) But it may be possible for google to download the gadget xml with a username / password. I'll try that when I get a chance... I give it 50/50 :)

Edit

I don't think it works. I was able to put uTorrent.xml into WebUI.xml and view it in firefox locally with http://user:pass@address:port/gui/uTorrent.xml. I verified that the port was open on my firewall and tried the same URL with google and it said it couldn't download it. I tried using port 80 in case it didn't like unusual ports. Didn't work :( I'm pretty sure it just doesn't like URLs with a username or password and I can understand why!

Link to comment
Share on other sites

zman3: IE7 (like IE6) doesn't support username@host URLs. Microsoft disabled it a year or two ago after some security issues. Unfortunately, they don't offer any alternative way to send a username as part of an URL.

If you're lucky, the release version of WebUI might have an option to allow guest access without an account.

Link to comment
Share on other sites

During my mIRCscripting I did some research and found out that a http authorization (a username:password in a url) is sent as part of the request header to the web server as:

Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Where dXNlcm5hbWU6cGFzc3dvcmQ= is the base64 encoded username:password

Website that encodes/decodes base64:

http://makcoder.sourceforge.net/demo/base64.php?process=Encode&plain=username:password

I dunno if you can send custom headers and if its posible to encode base64 on the fly. In fact I know nothing about google gadgets but maybe it helps with the IE support...

Link to comment
Share on other sites

This is from a friend of mine GECS @ www.bitspyder.net .... he added this to a post of mine when I told everyone about the new WebUI

---------

If you are going to use this syntax http://user:pass@host.domin and you use IE6 then you have to be sure that you have disabled the security that prohibits this syntax.

"How to disable the new default behavior for handling user information in HTTP or HTTPS URLs

To disable the new default behavior in Windows Explorer and Internet Explorer, create iexplore.exe and explorer.exe DWORD values in one of the following registry keys and set their value data to 0.

For all users of the program, set the value in the following registry key:

HKEY_LOCAL_MACHINESoftwareMicrosoftInternet ExplorerMainFeatureControlFEATURE_HTTP_USERNAME_PASSWORD_DISABLE

For the current user of the program only, set the value in the following registry key:

HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerMainFeatureControlFEATURE_HTTP_USERNAME_PASSWORD_DISABLE"

Source : http://support.microsoft.com/kb/834489/en-us

Link to comment
Share on other sites

Does anyone who knows how feel like adding a feature in the settings that lets you choose whether you want to display downloading, uploading, all or active torrents? I'm seeding too many to display them all, and if I were to just be able to see the active torrents, this gadget would be far more useful. Thanks!

Link to comment
Share on other sites

I have never used google so I don't know the benifits of it ... but what I did do was use my Windows Active desktop. You can put about 4 or 5 different web pages/sites in as your wall paper ... works great ... If you leave user name and password blank it will prompt you for it when the page loads / computer boots.

Win XP

---------

Right click on desktop

Click properties

Click Desktop tab

at bottom click Customize Desktop

click Web tab

Click NEW

Put in any web page / site you want such as http://address:port/gui/guest.html or http://address:port/gui/uTorrent.xml

Click OK

"add item to active desktop?" Click OK or click customize to enter in a username and pass. (guest account doesn't work because password is required)

Once entered it will try to sync the page first ... this will fail if you did not use a username and password. That is OK.

Click OK

Click ok

etc ...

Blank Page will appear on screen and then a prompt for username and password.

Once user info is entered it will work normally.

To refresh your stats ... right click on anything ... a pop up list will appear ... click refresh.

I sort my torrents by clicking the DONE colum. It may seem that it doesn't work .. but in a few seconds the colum will be sorted .. I like the 0% at the top and the 100% at the bottom but you set it how you like :-)

Another page I like to have in my active desktop is

http://www.celebscentral.net/spreadtheword.asp

Use the right click refresh to change pics

Use right click open in a new window to see pic in full.

Anon

www.bitspyder.net

best e-Learning only tracker

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...