Migrate uTorrent to Deluge

Suggestions and discussion of future versions
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 »

Late reply, but better late than never..

Thanks, it worked!
All I have done is commenting out lines: 37,38,59,61-65,67,80,81, and modified line 85 to:

Code: Select all

exec ($DELUGE ." \"add -p \"\"".$SAVE_PATH. "\"\" \"\"". $TORRENT_PATH. "\"\"\"");
and ofc configured the vars:

Code: Select all

$BITTORRENT_PATH = 'C:\\Users\\username\\AppData\\Roaming\\uTorrent'; // Path to resume.dat without the trailing slash (/)
$DELUGE = 'C:\\Progs\\Deluge\\deluge-console.exe'; // Path to deluge executable
I had 166 torrents to import and it correctly added 113 of those.

47 torrents got "[ERROR] !! WRONG PATH !! NOT Adding to deluge!"
Most were missed because I had moved them, either by relocating the files or the whole torrent, or renamed the torrent (in µTorrent that is, the same way you can relocate/rename torrents and files in Deluge). However, couple of those had not been moved or renamed but still got this error. :?:
Example, failed:

Code: Select all

Torrent File: randomstuff.torrent 
Save path: F:/
real path: F:\MP\randomstuff
While another one were added correctly:

Code: Select all

Torrent File: morerandomstuff.torrent 
Save path: F:/MP/
real path: F:\MP\morerandomstuff
6 torrents got "[ERROR] !! NOT Adding to deluge!"
They all had a save path with non standard characters "åäö" etc.. Also it started with a torrent a torrent named .fileguard :?:, with an empty path, which resulted in error ofc..

I had no "[MAJOR ERROR] !! NO PATH?!" messages.


Despite of the few errors, this is so much better than having to add them all manually. Without it I would have gone crazy. So thanks a lot! :D
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 »

Great!

Now that I see the error messages etc, it's pretty bad/non descriptive :P I wrote this as a quick fix to import my hundreds of torrents to Deluge at the time.
It certainly could have been written much better.

Anyway I am glad it helped you :)
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 »

Is this possible to run this script on OSX 10.9.1?
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 »

I guess so. If you have PHP Cli on your OSX system then it should run without problems. As far as I remember the script does not use any linux specific functions.
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 »

I add this to terminal:

Code: Select all

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5
I changed vars to:

Code: Select all

$BITTORRENT_PATH = '/Users/user/Library/Application Support/uTorrent'; // Path to resume.dat without the trailing slash (/)
$DELUGE = '/Applications/Deluge.app/Contents/MacOS/'; // Path to deluge executable
But after running resume_decode.php in Terminal I'm recessing this error:

Code: Select all

kukuryku-mac:~ user$ /Users/user/Desktop/utorrent-to-deluge/resume_decode.php 
-bash: /Users/user/Desktop/utorrent-to-deluge/resume_decode.php: Permission denied
I'm not that tech savvy, what could be a reason of this?
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 are actually trying to execute a PHP script.

You need to run the script with PHP Cli like: /path/to/php /path/to/script.php
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 »

Ok, I see.

I triend this:

Code: Select all

kukuryku-mac:~ user$ /usr/local/php5/ /Users/user/Desktop/utorrent-to-deluge/resume_decode.php 
-bash: /usr/local/php5/: is a directory
Then I tried this:

Code: Select all

kukuryku-mac:~ user$ sudo chmod +x /usr/local/php5 /Users/user/Desktop/utorrent-to-deluge/resume_decode.php 
Password:
kukuryku-mac:~ user$
But nothing happen.
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 »

/usr/local/php5 is a directory as the error suggests.

You need to find the php CLI executable.

Try: php /Users/user/Desktop/utorrent-to-deluge/resume_decode.php

On linux you can use 'which php' and will give you the full path to php cli executable.

I don't use OSX so I don't know how to find the executable on it or where it is by default.
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 »

Unfortunately: php /Users/user/Desktop/utorrent-to-deluge/resume_decode.php doesn't work, not such command.

But I instaled this: http://www.mamp.info/en/mamp/index.html

And path to executable is: /Applications/MAMP/bin/php/php5.5.3/bin/php

After running this in Terminal:

Code: Select all

/Applications/MAMP/bin/php/php5.5.3/bin/php /Users/user/Desktop/utorrent-to-deluge/resume_decode.php 
It doesn't show any errors, but after running deluge, no torrents were added.

I forgot to paste this in Terminal:

Code: Select all

 export PATH=/usr/local/php5/bin:$PATH
Thats why it didn't work, but now I've this:

Code: Select all

kukuryku-mac:~ user$ which php
/usr/local/php5/bin/php
kukuryku-mac:~ user$ php -v
PHP 5.5.8 (cli) (built: Jan 12 2014 18:50:29) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
kukuryku-mac:~ user$ php /Users/user/Desktop/utorrent-to-deluge/resume_decode.php 
PHP Warning:  require(./BDecode.php): failed to open stream: No such file or directory in /Users/user/Desktop/utorrent-to-deluge/resume_decode.php on line 41
PHP Stack trace:
PHP   1. {main}() /Users/user/Desktop/utorrent-to-deluge/resume_decode.php:0

Warning: require(./BDecode.php): failed to open stream: No such file or directory in /Users/user/Desktop/utorrent-to-deluge/resume_decode.php on line 41

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

PHP Fatal error:  require(): Failed opening required './BDecode.php' (include_path='.:/usr/local/php5/lib/php') in /Users/user/Desktop/utorrent-to-deluge/resume_decode.php on line 41
PHP Stack trace:
PHP   1. {main}() /Users/user/Desktop/utorrent-to-deluge/resume_decode.php:0

Fatal error: require(): Failed opening required './BDecode.php' (include_path='.:/usr/local/php5/lib/php') in /Users/user/Desktop/utorrent-to-deluge/resume_decode.php on line 41

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

kukuryku-mac:~ user$ 
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 »

Change the current directory to where the resume_decode.php is located first and then run the command.

eg:

Code: Select all

cd /Users/user/Desktop/utorrent-to-deluge/
php /Users/user/Desktop/utorrent-to-deluge/resume_decode.php
During times of universal deceit, telling the truth becomes a revolutionary act.
Post Reply