Kodi Community Forum

Full Version: [REQUEST] Favorite-able way to pause/resume utorrent
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,

The utorrent plugin does not work very smoothly, for me at least.

What i am looking for is a solution to streaming content such as youtube through XBMC when my crappy ISP banddwith is taken up by torrents.

I would love to be able to set as a favorite a button that would pause / resume utorrent via utorrent's webui.

(Even better would be a script that did this automatically when streaming content was played but i imagine that would be impossible!)

Another potential solution would be to quit the utorrent application and then re-launch it.

If anyone could set me in the right direction on how to achieve this I'd be so grateful.

Thanks Smile
Okay, this has to be a little bit work on your end ;-) Guessing you are on Windows?

My suggestion would be to use the uTorrent-Web-API, a Batch-File and the advanced launcher addon in conjunction.
Here is what I would do:
1. Create a batch/bash-file which stops every active torrent currently running (via wget or curl (also available for windows Wink) ) - just call the URL that is needed in order for utorrent to stop the downloads.
2. Create a batch/bash-file which does the opposite (i.e. starts active torrents)
3. Install the AL-Addon
4. Create launchers for the start/stop-script respectively
5. Mark those launchers as favorites
6. Add shortcuts to the home-screen via the favorites.

Edit:
Just saw that utorrent only supports stopping/starting of specific torrents, not all at once.
A solution would be to actually handle the data retrieved, get a list of all torrents, and then start/stop each of those torrents. If you're really eager to do this, I could probably throw a little application in c# together, although that would take a little bit (probably around next week). But that of course would only work on Windows...
(2012-06-13, 12:00)HenryFord Wrote: [ -> ]Okay, this has to be a little bit work on your end ;-) Guessing you are on Windows?

My suggestion would be to use the uTorrent-Web-API, a Batch-File and the advanced launcher addon in conjunction.
Here is what I would do:
1. Create a batch/bash-file which stops every active torrent currently running (via wget or curl (also available for windows Wink) ) - just call the URL that is needed in order for utorrent to stop the downloads.
2. Create a batch/bash-file which does the opposite (i.e. starts active torrents)
3. Install the AL-Addon
4. Create launchers for the start/stop-script respectively
5. Mark those launchers as favorites
6. Add shortcuts to the home-screen via the favorites.

Edit:
Just saw that utorrent only supports stopping/starting of specific torrents, not all at once.
A solution would be to actually handle the data retrieved, get a list of all torrents, and then start/stop each of those torrents. If you're really eager to do this, I could probably throw a little application in c# together, although that would take a little bit (probably around next week). But that of course would only work on Windows...

Thanks so much for the reply. A windows only solution would be fine by me...if you do have time to put the application together it would certainly be amazing!

Steps 4-6 were exactly what i had in mind if such favorites were possible. Would steps 1-3 not be simpler if the goal were just to quit utorrent altogether and then launch it? Only problem with that method is that utorrent is running on a different machine on my network...

Anyway anything you could do in c# towards this goal would be hugely appreciated!

Thanks again Smile
Ah yes - was completely oblivious to that part - that would be a solution as well...
That would be as easy as a batch-file which stops utorrent and one which starts it (more like a shortcut), but I don't think it's easy to do this via batch since utorrent runs on a different machine.
Mhm... C# would certainly be faster for me, so I'd go with that. Actually... thinking about it, it might be a good thing for myself, so I'll just go ahead and throw it together, should be fairly easy to do... you can expect something around next week to pop up in this thread Smile
(2012-06-13, 16:17)HenryFord Wrote: [ -> ]Ah yes - was completely oblivious to that part - that would be a solution as well...
That would be as easy as a batch-file which stops utorrent and one which starts it (more like a shortcut), but I don't think it's easy to do this via batch since utorrent runs on a different machine.
Mhm... C# would certainly be faster for me, so I'd go with that. Actually... thinking about it, it might be a good thing for myself, so I'll just go ahead and throw it together, should be fairly easy to do... you can expect something around next week to pop up in this thread Smile

Wow..very excited about that....this has been an issue for a long time for me....I love watching youtube music videos on XBMC but it's very un-slick having to go into a different room to pause the torrents each time.

I've tried using my router's QOS to prioritise the bandwidth automatically but never with good results on my slow (220 kB/s ish down) connection.

Thanks again Smile

Edit:

Another thought might be just to pause the downloads but leave the uploads running as they shouldn't affect streaming..or would they?....
Hi HenryFord,

Just a quick thought while you're working on this (if you've had time!)

Occasionally it's easy to forget to resume torrents....it might be cool if it were easy to add a line which would auto-resume all torrents after x minutes. What do you think?

Thanks
Didn't implement that yet... sorry, you have to do this on your own Wink

However, here you go:
http://tbueter.com/tools/uTorrent_Interfacer.zip

Downloader the file and extract it. Then edit the config-file to match your settings (remember to enable uTorrents-WebUI via the settings):
Code:
<uTorrent_Interfacer.Properties.Settings>
            <setting name="uTorrent_URL" serializeAs="String">
                <value>http://localhost</value>
            </setting>
            <setting name="uTorrent_Port" serializeAs="String">
                <value>80</value>
            </setting>
            <setting name="uTorrent_User" serializeAs="String">
                <value>admin</value>
            </setting>
            <setting name="uTorrent_Password" serializeAs="String">
                <value>password</value>
            </setting>
</uTorrent_Interfacer.Properties.Settings>

The exe will aquire a token on itself and work with that, so you shouldn't have any problems.
For information on how to use the exe, call the exe with "--help" as the command-line-param.
Thanks so much HenryFord - this seems totally perfect

Unfortunately I can't get this to work over the network.

It works perfectly on the utorrent-running machine

However if I run it on either of the other two windows computers on the network with it says "pausing torrents" for a while but the torrents remain unaffected...

Any idea why this might be happening?

Thanks again
But the exe doesn't throw up? i.e.: You don't get an error-message? (If the window closes too fast for you to actually see the error message, try running it directly from the cmd - you should get an error message...)
Did you check your firewall-settings?
(of course you have to change the URL in the app-config to the one your utorrent responds to - i.e. the IP of the machine that is running uTorrent)
(2012-06-21, 14:28)HenryFord Wrote: [ -> ]But the exe doesn't throw up? i.e.: You don't get an error-message?

Not for a long time....after several minutes of "pausing torrents" message it does report back "Something went wrong while pausing the torrents. The sytem timed out".

Quote:Did you check your firewall-settings?

To test, I disabled the firewall on both machines (utorrent host and remote XBMC machine). Still times out Sad


Quote:(of course you have to change the URL in the app-config to the one your utorrent responds to - i.e. the IP of the machine that is running uTorrent)

Yeah, triple checked the app-config. The exact same details used in Chrome on the XBMC machine provide a fully functioning utorrent WebUI.

Let me know if there's anything else I can do to help troubleshoot this....Are there any settings in utorrent that should be configured? Or if WebUI is working fine through the browser is that not the problem?

Thanks so much again - very tantalising being so close to a solution to this long standing problem.
Ah - I see where the problem is, the cookie is set to the wrong domain... wait, I'll fix it in a second.

Edit: Now... thinking about it, that shouldn't be the problem, because you would be getting a 401 - unauthorized.... strange.
A TimeOut usually means unreachable - did you also disable the firewall on the client? Maybe an exception is missing...
I tested it over here and it works flawless.

Take this version, it fixes the problem I mentioned above and adds a lot of logging (it will log to the folder you run it from). Try that version and post your log (at pastebin.org), maybe I can nail down the problem.
However - I'm away this weekend, so the analysis of the log has to wait a little bit.

Link is the same, just re-download it.
Thanks very much for the new version - unfortunately still the same problem.

Tried with firewall disabled at both ends and with two different machines running utorrent.

Anyway - here's the log - the program hangs where the log ends.... Whenever you have time to look into it I really appreciate it Smile

Thanks!
I really can't figure out what it's wrong. It seems to be a network-problem though... The Timeout is what confuses me, that shouldn't happen - as said: It means that the destination is not reachable...
You probably could try it with something like this:
http://technet.microsoft.com/en-us/sysin...97553.aspx

And then just run the program on the actual utorrent-machine. I really cannot explain why it isn't working on your end...

Edit:
Now, looking at it:
It seems more like a load-problem... maybe the request are firing too fast and utorrent doesn't respond well to it...
Because it can actually fetch the hashes, it is clear that the connection can in fact be established...
I'll try minimizing the requests and probably put some time between execution.

Edit2:
New version is up - try it with that one.

Edit3:
If it still doesn't work, please delete your old logfile, try again and post the resulting logfile (by the way: You now have to append "--debug" in order to actually enable debug-logging)
Happy to report that it works beautifully now - thanks so so much for fulfilling a long held desire for my HTPC setup. (I first requested this capability years ago in the utorrent plugin threads).

I hope more people get to find out about your little tool - I can't believe there wouldn't be many people like me who would hugely appreciate it.

Just being greedy now, but if you ever planned on fiddling with it a couple of cool extra features would be : (and I've now idea how easy / difficult these might be to implement)

-Auto unpause x minutes after pressing pause.
- Ability to only pause downloads / limit download speed to x kbps

Either of of those would mitigate the inevitable "oops i forgot to resume the torrents" situations that will definitely arise from time to time.

Anyway - like I said - I'm just being greedy. As it stands this little program will change my life in a silly but awesome way! Thanks so very much for making it Smile
Glad I could help Smile
I'll look into the features at some point, I'm sure about that, but it has to wait....
Pages: 1 2