Need some help with Deluge userscript

General support for problems installing or using Deluge
Post Reply
Oscarius
Member
Member
Posts: 16
Joined: Fri Jun 11, 2010 8:39 pm

Need some help with Deluge userscript

Post by Oscarius »

Greetings!

First of all, I realize that this might be a bit much to ask, but I really need this function to use Deluge effectively, so if anyone would help me out I would be forever grateful.


I've been using this userscript to make it easier for me to add torrents to my Deluge server, but as of the new Deluge version (1.3.0_rc1), it no longer works and it seems the developer is nowhere to be found.

If you don't know what it does, it basically adds a button next to all .torrent links. When clicked, the button adds the torrent to the Deluge download queue.

Here's a screenshot of what happens when I try to use the script with Deluge 1.3.0_rc1:

Image

And here's the source code for the userscript.

Code: Select all

// ==UserScript==
// @name           Add Torrent links to Deluge new WebUI
// @namespace      Flo
// @include        *
// ==/UserScript==

// modifications by aidos for the new WebUI

//original author: Martijn Voncken ; mvoncken@gmail.com.
//url-based submit and parsing based on : "Add Torrents To utorrent" by Julien Couvreur

// these parameters need to be edited before using the script

var host = "192.168.1.10";
var port = "8112";
var password = 'deluge';
//========================


if (host == "") { alert('You need to configure the "Add Torrents To Deluge" user script with your Deluge parameters before using it.'); }

/* Image number: 
		0=deluge(blue)
		1=downloading(green)
		2 = active(blue+green)
		3 = seeding(blue)
		4 = loading
		5 = error
*/

images = {
	0:'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJTUUH1wkPFjUNUreV2QAAAnRJREFUOI19k0toE1EUhv/Mncykd5pMMtNkTDQKGrEWC5ZqXVQ36sJSqAvJztdKUItu3HTXhYggWLBFdyIiihQ3XYgLRUVKfUCpVFrow7TW2k7StGmSmUxmJhk3FmyT9Czv+c7HOefeC2wT3T397dd7Bo5tx7hqJS7cuie0Hdw/zbndZGxivvHR3Wtr1TimlqDBJz3RbSaslUkosjs6VIurKujqfhjn/cq5JY1A1Vkw9f7jN/pe367Gkq0HJ670hWU59PbbeIJX1VW44MAkdZAksT3Scnb4x4cXidqC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VMmlKZo+4f0K664B9B7q1uUl8+jRZY94Am97TjyKMcwy8Z/SAi573xCIGUFsV2dhqtxfv372bbl29ijcGL0JUKDBdLjNdLjM4c4YgQqrKf/k8z3u9NFWtVkU6GYBfvS8VnbMhSa5NXrqUHX78GNdus/n6NdY50kaDVJVGPs8/29tpS6RSUf3+rVcuOvfLB+Pj33xy9myWep2NKEK8Z9gYtkPgeb+ftkQWflP94Z1huubcQm5oaDZrjKoIiKAiJhYhUV2sqJbem8a9OB/bi7M90LUqsnEY+z8wyrjddZe8zwAAAABJRU5ErkJggg=='
};

var remote_download_dir = "";

function makeTorrentLink(link, i)
{
	var torrentLink = document.createElement('a');
	var id = 'deluge_link' + i;
	torrentLink.setAttribute("href", 'javascript:;');
	torrentLink.setAttribute("id", id);
	torrentLink.style.paddingLeft = "2px";
	torrentLink.innerHTML = "<img src=\"" + images[0] + "\" style='border: 0px' id='image_" + id + "' />";
	link.parentNode.insertBefore(torrentLink, link.nextSibling);
	
	domLink = document.getElementById(id);
	domLink.addEventListener("click", evt_callback_factory(link.href, id),false);
	
	return torrentLink;
}


function changeImageSrc(linkId, status, msg)
{
  msg = typeof(msg) != 'undefined' ? msg : "Blah";
	var imgIdx = 2;
	if( status == "ready" ) {imgIdx = 0;}
	if( status == "loading" ) {imgIdx = 4;}
	if( status == "done" ) {imgIdx = 1;}
	if( status == "error" ) {imgIdx = 5;}
	img = document.getElementById("image_"+linkId);
	img.src = images[imgIdx];
	img.title = msg;
}


function evt_callback_factory(url, linkId)
{
	function evt_torrent_submit(evt)
	{
		changeImageSrc(linkId, "loading");		
		GM_xmlhttpRequest( // first, login
		{
			method: "POST",
			url: "http://" + host + ":" + port + '/json',
			headers: {'Content-type':'application/x-www-form-urlencoded'},
			data: '{"method":"auth.login","params":["' + password + '"],"id":0}',
			onload: function(xhr)
			{
				res = JSON.parse(xhr.responseText);
				if (res.result == true && res.error == null)
				{
					GM_xmlhttpRequest( // second, download
					{
						method: "POST",
						url: "http://" + host + ":" + port + '/json',
						headers: {'Content-type':'application/x-www-form-urlencoded'},
						data: '{"method":"web.download_torrent_from_url","params":["' + url + '",""],"id":1}',
						onload: function(xhr)
						{
							res = JSON.parse(xhr.responseText);
							path = res.result;
							if (res.error == null)
							{
								GM_xmlhttpRequest( // third, get download path
								{
									method: "POST",
									url: "http://" + host + ":" + port + '/json',
									headers: {'Content-type':'application/x-www-form-urlencoded'},
									data: '{"method":"core.get_config","params":[],"id":2}',
									onload: function(xhr)
									{
										res = JSON.parse(xhr.responseText);
										if (res.error == null)
										{
											remote_download_dir = res.result.download_location;
											GM_xmlhttpRequest( // finally, add to deluge
											{
												method: "POST",
												url: "http://" + host + ":" + port + '/json',
												headers: {'Content-type':'application/x-www-form-urlencoded'},
												data: '{"method":"web.add_torrents","params":[[{"path":"'+ path + '","options":{"add_paused":false,"max_download_speed_per_torrent":-1,"prioritize_first_last_pieces":false,"max_upload_speed_per_torrent":-1,"max_connections_per_torrent":-1,"download_location":"' + remote_download_dir + '","compact_allocation":true,"max_upload_slots_per_torrent":-1,"file_priorities":[1,1]}}]],"id":126}',
												onload: function(xhr)
												{
													res = JSON.parse(xhr.responseText);
													if (res.error == null)
													{
														changeImageSrc(linkId, "done", "Adding successful : \n" + url + "\n");
													}
													else
													{
														changeImageSrc(linkId, "error", "Error adding torrent to webui:\n" + xhr.responseText);
													}
												},
												onerror:function(xhr)
												{
													changeImageSrc(linkId, "error", 'error submitting torrent URL');
												}
											});											
										}
										else
										{
											changeImageSrc(linkId, "error", "Error getting Deluge config:\n" + xhr.responseText);
										}
									},
									onerror:function(xhr)
									{
										changeImageSrc(linkId, "error", 'Error getting Deluge config (Request error)');
									}
								});
							}
							else
							{
								changeImageSrc(linkId, "error", 'Error downloading torrent:\n' + xhr.responseText);
							}
						},
						onerror:function(xhr)
						{
							changeImageSrc(linkId, "error", 'error downloading torrent');
						}
					});
				}
				else
				{
					changeImageSrc(linkId, "error", 'Error login into webui:\n' + xhr.responseText);
				}
			},
			onerror:function(xhr)
			{
				changeImageSrc(linkId, "error", 'error login in');
			}
		});
		return false;
	}
	return evt_torrent_submit;
}



function match(url) {

   // isohunt format
   if (url.match(/http:\/\/.*isohunt\.com\/download\//i)) {
       return true;
   }

   if (url.match(/\.torrent$/)) {
       return true;
   }

   if (url.match(/http:\/\/.*bt-chat\.com\/download\.php/)) {
       return true;
   }

   // TorrentReactor
   if (url.match(/http:\/\/dl\.torrentreactor\.net\/download.php\?/i)) {
       return true;
   }

   // Mininova
   if (url.match(/http:\/\/www\.mininova\.org\/get\//i)) {
       return true;
   }

   // Mininova
   if (url.match(/http:\/\/www\.mininova\.org\/get\//i)) {
       return true;
   }

   // TorrentSpy
   if (url.match(/http:\/\/ts\.searching\.com\/download\.asp\?/i)) {
       return true;
   }
   if (url.match(/http:\/\/www\.torrentspy\.com\/download.asp\?/i)) {
       return true;
   }

   // Seedler
   if (url.match(/http:\/\/.*seedler\.org\/download\.x\?/i)) {
       return true;
   }

   //Gazelle : (what.cd etc..)
   if (url.match(/http:\/\/.*\/torrents\.php\?action\=download/i)) {
       return true;
   }

   //Legal torrents.
   if (url.match(/http:\/\/.*legaltorrents\.com\/get\//i)) {
       return true;
   }

   // Demonoid format (from  userscripts comments)
   if (url.match(/http:\/\/www\.demonoid\.com\/files\/download\/HTTP\//i)) {
       return true;
   }

   // Demonoid format II (from  userscripts comments)
   if (url.match(/http:\/\/www\.demonoid\.com\/files\/download\//i)) {
       return true;
   }
   
   // BitSnoop
   if (url.match(/http:\/\/bitsnoop\.com\/get\//i)) {
       return true;
   }
   
   // no match
   return false;
}


function getLinks() {
   var doc_links = document.links;
   var links = new Array();
   for (var i=0; i < doc_links.length; i++){
       links.push(doc_links[i]);
   }
   return links;
}

function scanLinks()
{
  var links = getLinks();

  for (var i=0; i < links.length; i++)
  {
		var link = links[i];
		if (match(link.href))
		{
			makeTorrentLink(link, i);
		}
  }
}

scanLinks();

Thank you very much in advance!

Oscar
aidos
Member
Member
Posts: 20
Joined: Tue Nov 24, 2009 9:58 pm

Re: Need some help with Deluge userscript

Post by aidos »

The developer is right here :) And I just updated my Deluge to 1.3.0_rc1 to test, and it works fine here. So I think the problem must come from your installation of Deluge, maybe you should try reinstalling. The error message seems to support that, because what it says theoretically can't happen, the method that supposedly fails (get_config) does exist in 1.3.0_rc1, I double-checked.

In other news, I didn't know this script had been posted on userscripts, I wouldn't have minded a heads-up :|
Oscarius
Member
Member
Posts: 16
Joined: Fri Jun 11, 2010 8:39 pm

Re: Need some help with Deluge userscript

Post by Oscarius »

aidos wrote:The developer is right here :) And I just updated my Deluge to 1.3.0_rc1 to test, and it works fine here. So I think the problem must come from your installation of Deluge, maybe you should try reinstalling. The error message seems to support that, because what it says theoretically can't happen, the method that supposedly fails (get_config) does exist in 1.3.0_rc1, I double-checked.

In other news, I didn't know this script had been posted on userscripts, I wouldn't have minded a heads-up :|
Wow, that's surprising!

I guess I'll just have to mess around with my Deluge installation. Maybe I didn't upgrade correctly.

Good job on the script. It's very useful!
aidos
Member
Member
Posts: 20
Joined: Tue Nov 24, 2009 9:58 pm

Re: Need some help with Deluge userscript

Post by aidos »

I ran some more tests, I really couldn't get it to fail.
I just created a UserScripts.org account, and I posted the latest version there : http://userscripts.org/scripts/show/79003 . I doubt it'll make a difference, but you can always try it :) You will need to reinstall the script, as I've changed the name. Don't forget to delete the old one, and to update your credentials in the source.
Oscarius
Member
Member
Posts: 16
Joined: Fri Jun 11, 2010 8:39 pm

Re: Need some help with Deluge userscript

Post by Oscarius »

It seems that if I log in to the WebUI prior to adding a torrent with the script, it works, but if I try to add a torrent without logging in to the WebUI first, I get the error.

Oh, and another thing. I have enabled "Add torrents in paused state" in my Deluge settings, but if I use your script to add torrents, they won't be paused when added.
aidos
Member
Member
Posts: 20
Joined: Tue Nov 24, 2009 9:58 pm

Re: Need some help with Deluge userscript

Post by aidos »

Ah indeed, my bad, I had hardcoded some config values in the script. It's patched now.

[Edit] I forgot to comment on the other problem. There is indeed a error like you describe if I follow what you said, and it's because the Web UI doesn't automatically connect to the Deluge daemon like it used to. So every time you restart the webui, you first need to tell it to connect to the daemon, then it'll work for as long as the UI is running.

My opinion is that it's a Deluge bug. I can work around it, but honestly I'd prefer you take it to the Deluge developers before I invest the effort.

[Edit 2] Actually there's a quick and easy way to be done with it once and for all, and that's to open the "web.conf" WebUI config file, and change the "default_daemon": "" parameter to whatever your preferred daemon is, in my case I changed it to "default_daemon": "127.0.0.1:58846", and now, no more problems over restarts :)
Oscarius
Member
Member
Posts: 16
Joined: Fri Jun 11, 2010 8:39 pm

Re: Need some help with Deluge userscript

Post by Oscarius »

aidos wrote:Ah indeed, my bad, I had hardcoded some config values in the script. It's patched now.

[Edit] I forgot to comment on the other problem. There is indeed a error like you describe if I follow what you said, and it's because the Web UI doesn't automatically connect to the Deluge daemon like it used to. So every time you restart the webui, you first need to tell it to connect to the daemon, then it'll work for as long as the UI is running.

My opinion is that it's a Deluge bug. I can work around it, but honestly I'd prefer you take it to the Deluge developers before I invest the effort.

[Edit 2] Actually there's a quick and easy way to be done with it once and for all, and that's to open the "web.conf" WebUI config file, and change the "default_daemon": "" parameter to whatever your preferred daemon is, in my case I changed it to "default_daemon": "127.0.0.1:58846", and now, no more problems over restarts :)
Thanks for the patch, it works now.

Although the work-around for the daemon problem doesn't work. If I add a torrent after restarting Deluge, it logs in successfully but doesn't connect to the daemon (I know this by manually going to the WebUI, where I'm not being asked for authentication).
aidos
Member
Member
Posts: 20
Joined: Tue Nov 24, 2009 9:58 pm

Re: Need some help with Deluge userscript

Post by aidos »

So to make sure I got that right, you restart Deluge, you add a torrent by using the script, it fails with the same error message as before, but when you go to the WebUI page using your browser, you're not asked for a password so you know the script did log in, but you're still requested for a daemon to connect to ? Is that right ?

If that's the case, then please check that in your web.conf file the host is right. Also, the "default_daemon" : "<ip>:<port>" line should be terminated by a coma if it's not the last line before the closing "}" at the end of the file.
Oscarius
Member
Member
Posts: 16
Joined: Fri Jun 11, 2010 8:39 pm

Re: Need some help with Deluge userscript

Post by Oscarius »

aidos wrote:So to make sure I got that right, you restart Deluge, you add a torrent by using the script, it fails with the same error message as before, but when you go to the WebUI page using your browser, you're not asked for a password so you know the script did log in, but you're still requested for a daemon to connect to ? Is that right ?
Yes, exactly. But it's really no biggie, I'm happy enough with Deluge as it is, and it's just a minor inconvenience.
aidos
Member
Member
Posts: 20
Joined: Tue Nov 24, 2009 9:58 pm

Re: Need some help with Deluge userscript

Post by aidos »

Well if you're happy that way, I'm happy :)
But it's probably a configuration problem, if it works on my end, it should work on yours. If you want, either post here or PM me your web.conf file, I'll have a look.
Post Reply