Migrate uTorrent to Deluge

Suggestions and discussion of future versions
kukuryku
New User
New User
Posts: 6
Joined: Fri Jan 24, 2014 11:57 am

Re: Help on Script to auto add torrents from uTorrent/BitTor

Post by kukuryku »

You are great!!!! .. now Terminal is showing stuff .. but after launching Deluge - no new torrents :/

Code: Select all

kukuryku-mac:utorrent-to-deluge user$ php /Users/user/Desktop/utorrent-to-deluge/resume_decode.php
PHP Warning:  Illegal string offset 'path' in /Users/user/Desktop/utorrent-to-deluge/resume_decode.php on line 54
PHP Stack trace:
PHP   1. {main}() /Users/user/Desktop/utorrent-to-deluge/resume_decode.php:0

Warning: Illegal string offset 'path' in /Users/user/Desktop/utorrent-to-deluge/resume_decode.php on line 54

Call Stack:
    0.0005     242984   1. {main}() /Users/user/Desktop/utorrent-to-deluge/resume_decode.php:0

PHP Warning:  Illegal string offset 'path' in /Users/user/Desktop/utorrent-to-deluge/resume_decode.php on line 61
PHP Stack trace:
PHP   1. {main}() /Users/user/Desktop/utorrent-to-deluge/resume_decode.php:0

Warning: Illegal string offset 'path' in /Users/user/Desktop/utorrent-to-deluge/resume_decode.php on line 61

Call Stack:
    0.0005     242984   1. {main}() /Users/user/Desktop/utorrent-to-deluge/resume_decode.php:0

Torrent File: /Users/user/Library/Application Support/uTorrent/.fileguard
Save path: 
[ERROR] !! NOT Adding to deluge! ... 

Torrent File: /Users/user/Library/Application Support/uTorrent/-XXXXXXXXXXXXXXXX.1.torrent
Save path: /Volumes/My Book/TV/
Adding to deluge! ... 
Usage: deluge-console-bin [options] [actions]

deluge-console-bin: error: no such option: -u
Torrent File: /Users/user/Library/Application Support/uTorrent/XXXXXXXXXXXXXXXX.pdf.1.torrent
Save path: /Volumes/My Book/TV/
[ERROR] !! WRONG PATH  !! NOT Adding to deluge! ... 


Torrent File: /Users/user/Library/Application Support/uTorrent/XXXXXXXXXXXXXxxxx.torrent
Save path: /Volumes/My Book/purple/
Adding to deluge! ... 
Usage: deluge-console-bin [options] [actions]

deluge-console-bin: error: no such option: -u
Torrent File: /Users/user/Library/Application Support/uTorrent/3XXXXXXXXXXXXXXXXXXXXs.1.torrent
Save path: /Volumes/My Book/TV/
Adding to deluge! ... 
Usage: deluge-console-bin [options] [actions]

.
.
.

deluge-console-bin: error: no such option: -u
Torrent File: /Users/user/Library/Application Support/uTorrent/\[Flac\] XXXXXXX.torrent
Save path: /Volumes/My Book/Muzyka/
Adding to deluge! ... 
Usage: deluge-console-bin [options] [actions]

deluge-console-bin: error: no such option: -u
PHP Notice:  Undefined index: path in /Users/user/Desktop/utorrent-to-deluge/resume_decode.php on line 54
PHP Stack trace:
PHP   1. {main}() /Users/user/Desktop/utorrent-to-deluge/resume_decode.php:0

Notice: Undefined index: path in /Users/user/Desktop/utorrent-to-deluge/resume_decode.php on line 54

Call Stack:
    0.0005     242984   1. {main}() /Users/user/Desktop/utorrent-to-deluge/resume_decode.php:0

[MAJOR ERROR] !! NO PATH?! ... 


Torrent File: /Users/user/Library/Application Support/uTorrent/xxxxxxxxxxx.torrent
Save path: /Volumes/My Book/purple/
[ERROR] !! WRONG PATH  !! NOT Adding to deluge! ... 


Torrent File: /Users/user/Library/Application Support/uTorrent/xxxxxxxxxxxxxxxxx.torrent
Save path: /Volumes/My Book/purple/
[ERROR] !! WRONG PATH  !! NOT Adding to deluge! ... 


Torrent File: /Users/user/Library/Application Support/uTorrent/xxxxxxxxxxxxxxxxx.torrent
Save path: /Volumes/My Book/purple/
[ERROR] !! WRONG PATH  !! NOT Adding to deluge! ... 


Array
(
    [0] => /Users/user/Library/Application Support/uTorrent/xx.torrent
    [1] => /Users/user/Library/Application Support/uTorrent/xx.torrent
    [2] => /Users/user/Library/Application Support/uTorrent/xx.pdf.torrent
    [3] => /Users/user/Library/Application Support/uTorrent/xx.pdf.torrent
    [4] => /Users/user/Library/Application Support/uTorrent/xx.pdf.1.torrent
    [5] => /Users/user/Library/Application Support/uTorrent/xx.pdf.torrent
    [6] => /Users/user/Library/Application Support/uTorrent/xx.mp4.torrent
    [7] => /Users/user/Library/Application Support/uTorrent/xx.doc.torrent
    [8] => /Users/user/Library/Application Support/uTorrent/xx.torrent
    [9] => /Users/user/Library/Application Support/uTorrent/xx.torrent
    [10] => /Users/user/Library/Application Support/uTorrent/xxx.1.torrent
    [11] => /Users/user/Library/Application Support/uTorrent/xx.torrent
    [12] => /Users/user/Library/Application Support/uTorrent/xx.torrent
    [13] => /Users/user/Library/Application Support/uTorrent/xxx.torrent
    [14] => /Users/user/Library/Application Support/uTorrent/xx.torrent
    [15] => /Users/user/Library/Application Support/uTorrent/txxxx.torrent
    [16] => /Users/user/Library/Application Support/uTorrent/xx.torrent
    [17] => /Users/user/Library/Application Support/uTorrent/txx.torrent
)
Array
(
    [0] => /Users/user/Library/Application Support/uTorrent/.fileguard
    [1] => /Users/user/Library/Application Support/uTorrent/xx-DON.torrent
    [2] => /Users/user/Library/Application Support/uTorrent/xxtrack.torrent
)
Array
(
    [0] => 
)
kukuryku-mac:utorrent-to-deluge user$ 

line 54:
if ($info[$key]['path']){

line 61:
$SAVE_PATH = $info[$key]['path'];
User avatar
Cha0s
Member
Member
Posts: 24
Joined: Sun Dec 28, 2008 10:48 am

Re: Help on Script to auto add torrents from uTorrent/BitTor

Post by Cha0s »

You can ignore PHP's warnings, they are just informational.
As I mentioned this script was written in a hurry to simply migrate my uTorrent torrents to Deluge, so I didn't put much work in it.

But the real error seems to be with deluge.

It looks that the syntax and the executable for adding torrents from the command line has changed since 2009 that I wrote this script.
I haven't used Deluge since then actually, so I haven't kept up with the changes.

You could edit resume_decode.php to update the deluge syntax on line 85.
I am not sure what the new executable or syntax is so I cannot help you any further.
During times of universal deceit, telling the truth becomes a revolutionary act.
kukuryku
New User
New User
Posts: 6
Joined: Fri Jan 24, 2014 11:57 am

Re: Help on Script to auto add torrents from uTorrent/BitTor

Post by kukuryku »

Thank you for your input and your time trying to help me though.

I think I will move to another torrent, because every time I change download location it always download to default one - /user

Best regards
Raen
New User
New User
Posts: 4
Joined: Tue Jul 01, 2014 7:49 pm

Re: Help on Script to auto add torrents from uTorrent/BitTor

Post by Raen »

Hi all,

I'm also on the move from uTorrent to Deluge in my Win7 machine, as uTorrent is getting more and more bloated and I've been using Deluge on my Linux Mint install.

First of all, thanks Cha0s for making this script! I have nearly a thousand torrents, and moving them manually would be a nightmare.

Secondly, I've followed greenwich's instructions but can't get the torrents to be added to Deluge.
All of them are actually read by the script, but none gets added, as they seem to get "[ERROR] !! WRONG PATH !! NOT Adding to deluge!" and also one "[MAJOR ERROR] !! NO PATH?!" is shown.

It's probably related to what you've said, that the syntax and the executable for adding torrents from the command line has changed. How can we know what's the new syntax?
I tried to inspect and run deluge-console.exe with the "add" command but get "Failed to connect to 127.0.0.1:58846 with reason: No connection could be made because the target machine actively refused it.". The daemon is set to accept remote connection, if that's the problem, so I don't know what's the reason of the error.

Would installing an older version of Deluge, import the torrents using the script, and then update Deluge to the latest version, to circumvent the problem, possibly work?
User avatar
Cha0s
Member
Member
Posts: 24
Joined: Sun Dec 28, 2008 10:48 am

Re: Help on Script to auto add torrents from uTorrent/BitTor

Post by Cha0s »

Hello Raen,

According to the error you get, it looks that maybe your uTorrent resume.dat file is not getting read correctly so it cannot find any torrents to add to Deluge.
Have you edited the configuration variables at the top of the script to match your paths?


By the way every once and a while that someone tries to use this script and I check my code again I can see how bad my script is :lol:
During times of universal deceit, telling the truth becomes a revolutionary act.
Raen
New User
New User
Posts: 4
Joined: Tue Jul 01, 2014 7:49 pm

Re: Help on Script to auto add torrents from uTorrent/BitTor

Post by Raen »

Hi,

Yes, I've edited the conf vars to match Deluge and uTorrent paths. I tried to use 'C:\\Users\\Administrator\\AppData\\Roaming\\uTorrent' and 'C:\Users\Administrator\AppData\Roaming\uTorrent', but with the same result.
I'm not PHP savvy, and running deluge-console.exe from the command line shows that the add command syntax hasn't changed from "add -p c:\mytorrents c:\new.torrent", so I can't figure out the problem on my own.

When ran, the script runs through all torrents but they all have the error:
"Torrent File: C:/Users/Administrator/AppData/Roaming/uTorrent/filename.torrent
Save path:
[ERROR] !! WRONG PATH !! NOT Adding to deluge! ..."

And the last one is preceded by a "[MAJOR ERROR] !! NO PATH?! ...".

After the errors listing, the script lists all torrents in the following form before exiting:

"Array
(
[0] => C:/Users/Administrator/AppData/Roaming/uTorrent/.fileguard
[1] => C:/Users/Administrator/AppData/Roaming/uTorrent/filename.torrent
...
[820] => C:/Users/Administrator/AppData/Roaming/uTorrent/filename.torrent
)
Array
(
[0] =>
)

I presume that the script is reading resume.dat correctly, or else it wouldn't list all the torrents. I even tried to edit resume.dat using BEncode Editor and remove the .fileguard key, but it didn't have any effect.
I can't stop to notice that the script uses paths with "/" instead of "\" (Windows uses "\" for paths). Is that related to how PHP functions?

At a given time, I configured uTorrent to store torrent files in a "uTorrent\Torrents" folder, so some of the torrents are not placed in uTorrent's base folder, where resume.dat is. Those torrents are also listed correctly, but with two "/" at the end: "[418] => C:/Users/Administrator/AppData/Roaming/uTorrent/Torrents//filename.torrent".

I tried to edit the script and change "/" to "\" in some places but errors occur when trying to parse and run it.
greenwich
Member
Member
Posts: 20
Joined: Tue Oct 18, 2011 10:53 pm

Re: Help on Script to auto add torrents from uTorrent/BitTor

Post by greenwich »

Raen: here's the full windows 7 modified version of resume_decode.php: http://pastebucket.com/47164
I used it with the latest version when I tried this in spring 2013, I think it was 1.3.5 or 1.3.6, not very old versions!

Edit: it's apparently still in my signature :)
Deluge 1.3.6 with Libtorrent 0.15.10.0 and GTK+ Runtime 2.24.10 on Windows 7 x64 SP1.
Raen
New User
New User
Posts: 4
Joined: Tue Jul 01, 2014 7:49 pm

Re: Help on Script to auto add torrents from uTorrent/BitTor

Post by Raen »

Thanks greenwich, I've edited the script, gave it a run, and indeed the script now runs fine. Problem is, even though it says it's adding the torrents, after it ends, no torrents are added :x

I tried it on v1.3.7, so I will give it a spin on v1.3.6 to see if it makes any difference.
greenwich
Member
Member
Posts: 20
Joined: Tue Oct 18, 2011 10:53 pm

Re: Help on Script to auto add torrents from uTorrent/BitTor

Post by greenwich »

@Raen:
Could php version might have something to do with it? :)
I have these installers of PHP saved: php-5.3.23-Win32-VC9-x86.msi
and php-5.2.17-nts-Win32-VC6-x86.msi
(I've re-installed the OS since then)
User avatar
Cha0s
Member
Member
Posts: 24
Joined: Sun Dec 28, 2008 10:48 am

Re: Help on Script to auto add torrents from uTorrent/BitTor

Post by Cha0s »

Hello guys,

It seems that there is an interest on the script (I wonder if it has anything to do with uTorrent/BitTorrent becoming adwares in recent versions :P) so I tried to prepare a new version with some fixes so that it would work on Windows out of the box (well... at least in theory :P).
Unfortunately my programming skills are limited to PHP and PHP on Windows to put it simply... sucks :P

Nonetheless, here is the new version: http://www.cha0s.gr/utorrent-to-deluge0.2.rar

I have included the php.exe binary and a batch file so that executing the script will be a matter of editing 1 file and running import.bat

I've included a basic readme file with instructions on how to use the import script.


I believe that those who ran the old script and no torrents would get added to Deluge was because deluge-console.exe won't work unless deluged.exe is running.
If deluged.exe is not running then deluge-console.exe won't add any torrents to Deluge as it cannot connect to the daemon port (by default 58846).
I describe the issue and how to run deluged.exe on the README.txt file.

Known bug (which I don't know how to fix, and I don't know if there's even a fix for this type of script - php) is that filenames and directories with unicode characters will not get processed properly by PHP thus they won't be added to Deluge.
I spent quite some time searching for a solution but it seems that this is a Windows filesystem limitation along with PHP (Or simply I don't know how to search for winblows peculiarities :P).

On linux of course this is not the case (so I never encountered this problem when I wrote the first version of the script - which was strictly written for linux).


I hope this script will help those that wish to migrate to Deluge.
I believe a "uTorrent/BitTorrent migrate wizard" would be a nice built-in feature for Deluge to have.
I think it would be quite easy to add such a feature (it's a matter of simply parsing the resume.dat file and adding the torrents to deluge pretty much)
During times of universal deceit, telling the truth becomes a revolutionary act.
Post Reply