uTorrent to Deluge script

Specific support for Deluge on Microsoft Windows OS
Post Reply
laharah
Member
Member
Posts: 26
Joined: Wed Jan 08, 2014 2:41 am

uTorrent to Deluge script

Post by laharah »

UPDATE!(08/23/15) This script is now obsolete. Use the updated plugin version of the script: http://forum.deluge-torrent.org/viewtop ... =9&t=52145


UPDATE!(11/2/14): IdealChain was brave enough to patch in linux and wine support. I've merged in his changes.

Here's a little script I've written for windows that will import the torrents from uTorrent into deluge. The only other one I could find on the forums was written in PHP for use on linux, and it didn't work very well if you've renamed the torrents after download. So I wrote this one as a client script in python.
You can view the source on github: https://github.com/Laharah/uTorrent_to_Deluge

First a disclaimer:
I have never distributed anything in python, so I have no idea how to include the required dependencies or the relevant parts of the deluge client into a .egg or similar. I'd like to be able to distribute this for people of all technical ability, but I don't really know how. SO, you must at least have python and know how to install a python package.

If anyone would like to tell me how to make this script in to a user friendly, self contained egg, or wants to do it themselves I'd be glad to put it up here.

Requirements:

Download:
uTorrent_to_Deluge.zip
(4.88 KiB) Downloaded 688 times
Directions (Windows)
  • Place the script in the deluge-1.3.6.egg folder in your deluge install path. (usually C:\Program Files (x86)\Deluge\deluge-1.3.6-py2.6.egg) YOU MUST DO THIS FOR THE SCRIPT TO RUN UNLESS YOU HAVE INSTALLED DELUGE AS A PYTHON PATH
  • Shutdown uTorrent if it is running (script may not complete if a file from a torrent is in the "open" state. so close any media programs you may have open as well.)
  • Make sure deluge is running with CLASSIC MODE DISABLED. You can re-enable classic after the import.
  • Double click or use the command line to run the script.
Torrents will be added in the paused state and will then be set to do a recheck which may take a while.

The script will output a log of any torrents that could not be added successfully.

Notes
  • The script assumes that your uTorrent resume.dat is in the default location of %APPDATA%\uTorrent. if this is not the case, you must either include the full path of resume.dat as the first argument to the script or drag and drop resume.dat onto the script file.
  • Do not run the script on a backup or moved copy of resume.dat. uTorrent uses relative paths when storing the resume data so the script uses the resume.dat path as a relative path to find the .torrent files. The script doesn't edit resume.dat, but if you're paranoid you can make a backup beforehand.
  • I didn't comment the code because I'm lazy (sorry). If you've got questions or concerns let me know and I can answer them or go back and do the comments if there's a demand for them.
Linux
  • On Linux, the script first looks in the WINE configuration (~/.wine/drive_c/users/$USER/Application Data/uTorrent/resume.dat), and then in the user home dir (~/uTorrent/resume.dat). Of course, you can always give any other path as an argument.
  • In case of WINE, the script will try to resolve drive letter mappings (defined in ~/.wine/dosdevices) and replace them with their real Linux paths. If you don't fancy that, just add the '--no-wine-mapping' argument.
  • Please note that this script was just tested with the Windows version of uTorrent 3.4 running within WINE - no idea how any other version behaves.
[/s]
Last edited by laharah on Sun Aug 23, 2015 9:52 am, edited 1 time in total.
laharah
Member
Member
Posts: 26
Joined: Wed Jan 08, 2014 2:41 am

Re: uTorrent to Deluge script

Post by laharah »

added in linux/wine support
Skaeren

Re: uTorrent to Deluge script

Post by Skaeren »

I do not know what I am doing wrong, but this script does not work for me. Installed python 2.7; utorrent closed, deluge classic mode disable, double click and it does not migrate my torrents
laharah
Member
Member
Posts: 26
Joined: Wed Jan 08, 2014 2:41 am

Re: uTorrent to Deluge script

Post by laharah »

Skaeren wrote:I do not know what I am doing wrong, but this script does not work for me. Installed python 2.7; utorrent closed, deluge classic mode disable, double click and it does not migrate my torrents
The 3 most common problems with the script are:

* non matching version of python: the default build of deluge is python 2.6. The script won't work if you're not using the same python version as deluge to run it. If you don't wanna install python 2.6 you can get the (Windows) 2.7 version of deluge Here: http://download.deluge-torrent.org/windows/py2.7/

* not running the script in the deluge.egg folder. This will prevent the script from finding the deluge client library.

* not installing the python twisted library (see above)

If you're still having problems try running it from the command line and posting the output here, I might be able to help you figure out what's wrong.
larry
New User
New User
Posts: 6
Joined: Mon May 18, 2015 4:54 am

Re: uTorrent to Deluge script

Post by larry »

This script does port the torrents across from uTorrent to Deluge for me, but it hangs for me during the renaming process:

Code: Select all

Connection was successful! (Result: 10)
folder_renamed registered
file_renamed registered
Attempting to add Torrents...
Added 0/2 C:\Users\Ryan\Downloads\uTorrent\Echosmith - Cool Kids.mp4 (C:\Users\R
yan\Downloads\uTorrent\Echosmith - Cool Kids.mp4)
check done
Added 1/2 C:\Users\Ryan\Downloads\uTorrent\The Veronicas [2014] Pre-Order Tracks
 Only (MP3) (320) (C:\Users\Ryan\Downloads\uTorrent\The Veronicas [2014] Pre-Ord
er Tracks Only (MP3) (320))
check done
Renaming Echosmith - Cool Kids.mp4 => C:\Users\Ryan\Downloads\uTorrent\Echosmith
 - Cool Kids.mp4
Renaming The Veronicas [2014] Pre-Order Tracks Only (MP3) (320) => C:\Users\Ryan
\Downloads\uTorrent\The Veronicas [2014] Pre-Order Tracks Only (MP3) (320)
I have also found that the script doesn't handle utf-8 encoding inside torrent files every well. It added the file, but didn't like it the encoded long dash:

Code: Select all

Connection was successful! (Result: 10)
folder_renamed registered
file_renamed registered
Attempting to add Torrents...
Unhandled error in Deferred:


Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\twisted\protocols\policies.py", line 120,
in dataReceived
    self.wrappedProtocol.dataReceived(data)
  File "deluge\ui\client.py", line 179, in dataReceived

  File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 393, in c
allback
    self._startRunCallbacks(result)
  File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 501, in _
startRunCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 588, in _
runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "C:\Program Files (x86)\Deluge\deluge-1.3.11-py2.7.egg\uTorrent_to_Deluge
.py", line 170, in get_torrent_data
    print u"Added {}/{} {} ({})".format(done, len(self.torrentsToAdd), topLevelT
itle, fullSavePath)
  File "C:\Python27\lib\encodings\cp850.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_map)
exceptions.UnicodeEncodeError: 'charmap' codec can't encode character u'\u2013'
in position 57: character maps to <undefined>
Excuse some of the debug messages I added in to try and follow what was going on.
laharah
Member
Member
Posts: 26
Joined: Wed Jan 08, 2014 2:41 am

Re: uTorrent to Deluge script

Post by laharah »

larry wrote:This script does port the torrents across from uTorrent to Deluge for me, but it hangs for me during the renaming process:

...
Hmm, it looks like deluge never executes the renames. The script is supposed to listen for rename events from deluge, but there don't seem to be any happening. I'll do some testing to see if I can replicate the problem.
larry wrote:I have also found that the script doesn't handle utf-8 encoding inside torrent files every well. It added the file, but didn't like it the encoded long dash:

...
yeah, windows really doesn't like utf8 in the cmd line, usually it overlaps enough with latin-1 or whatever weird encoding windows uses, but some characters... I pushed a fix that just encodes the messages to the terminal. That should stop the errors at least. You can get the fixed script on the github page.

I'm gonna see if i can fix your first problem before I update the download here.
Post Reply