Migrate uTorrent to Deluge

Suggestions and discussion of future versions

Migrate uTorrent to Deluge

Postby Cha0s » Sun Dec 28, 2008 11:11 am

Hello everyone.

I'm trying to write a script that will read all the torrents from utorrent and 'add' them to deluge.

The read script is ready i guess (based on some useful posts I found on utorrent forums).
It reads resume.dat from utorrent folder and extracts the info I need to import those data on any other client.

The thing is during the export/import procedure the paths will automatically changed to the linux paths (since utorrent has the old 'windows' paths).
I know (well I guess :P) that everything will have to be force checked again in order for Deluge to start seeding anything but I'm ok with that since it will be an automated process oposed to add over 1000 torrents I have on uTorrent to Deluge :?

So, so far i have the export script from utorrent that gives me all the added torrents I have on utorrent and their paths with the .torrent files.

My question is how can I import all the data I have from the script to Deluge?
Not UI based but cli based (i guess) or even more 'hardcore' to write directly on the Deluge conf files.

I searched a bit the forum and the deluge homepage for clues on how to import torrents without the gui but I didn't find out anything helpful.

The read script works with PHP-Cli and a solution that doesn't involve Python or C would be helpful since I only know PHP :oops:
Any ideas would be appreciated :)

Thank you and Merry Christmas to all :)
Last edited by Cha0s on Tue Sep 16, 2014 5:23 pm, edited 2 times in total.
During times of universal deceit, telling the truth becomes a revolutionary act.
User avatar
Cha0s
Member
Member
 
Posts: 21
Joined: Sun Dec 28, 2008 10:48 am

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

Postby Cha0s » Sun Dec 28, 2008 2:02 pm

I did some more searching and I found that torrents.state is the file where the list of loaded torrents on Deluge is.

Any ideas of the format used on that file?
During times of universal deceit, telling the truth becomes a revolutionary act.
User avatar
Cha0s
Member
Member
 
Posts: 21
Joined: Sun Dec 28, 2008 10:48 am

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

Postby andar » Sun Dec 28, 2008 9:23 pm

It might easiest to just write a UI script: http://dev.deluge-torrent.org/wiki/Development/UiClient

This would be the best way to do it since it could easily be integrated into a plugin later on.. Something like an 'Importer' plugin that the user could use to import sessions from other clients.

But you could write a converter that creates a deluge compatible torrents.state file.. You can find the format of the state file in deluge.core.torrentmanager .. It is saved to disk as a pickled object.

It would be a lot easier to accomplish this using Python.
andar
Top Bloke
Top Bloke
 
Posts: 1050
Joined: Fri Jun 08, 2007 8:38 pm
Location: Victoria, BC

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

Postby Cha0s » Mon Dec 29, 2008 10:27 am

Hello,
Thanks for your help.

As I mentioned I don't know Python so forgive me if something I say sounds noob or stupid :P :oops: .

Yesterday I searched a bit more the torrents.state file and it seems I cannot find a way to read or write it with another language than Python.
That pickle thingy I think it's for writing python structured data into a readable format (which according to Python Reference page it does not save disk space since it is not binary).
unpickle does the opossite (if I have understood correctly the whole thing).

The idea to create a plugin would be great but my knowledge is restricted on PHP.
On the other hand I like better the scenario on which I create a new torrents.state file if I can find a way to do that pickle (serialization in PHP) thingy.
That way will give me 'freedom' to add all the torrents exactly the way I need.

Appart from the above method, is there a way to add new torrents to deluge from terminal? (not from the CLI - with which by the way I could not add any torrent whatsoever on version 1.1.0rc1).

If there is such way then there is no need to write the torrents.state file as i could give the terminal commands via my utorrent read script I have ready.
During times of universal deceit, telling the truth becomes a revolutionary act.
User avatar
Cha0s
Member
Member
 
Posts: 21
Joined: Sun Dec 28, 2008 10:48 am

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

Postby andar » Mon Dec 29, 2008 6:40 pm

Cha0s wrote:Hello,
Thanks for your help.

As I mentioned I don't know Python so forgive me if something I say sounds noob or stupid :P :oops: .

Yesterday I searched a bit more the torrents.state file and it seems I cannot find a way to read or write it with another language than Python.
That pickle thingy I think it's for writing python structured data into a readable format (which according to Python Reference page it does not save disk space since it is not binary).
unpickle does the opossite (if I have understood correctly the whole thing).

The idea to create a plugin would be great but my knowledge is restricted on PHP.
On the other hand I like better the scenario on which I create a new torrents.state file if I can find a way to do that pickle (serialization in PHP) thingy.
That way will give me 'freedom' to add all the torrents exactly the way I need.

Appart from the above method, is there a way to add new torrents to deluge from terminal? (not from the CLI - with which by the way I could not add any torrent whatsoever on version 1.1.0rc1).

If there is such way then there is no need to write the torrents.state file as i could give the terminal commands via my utorrent read script I have ready.


This should work (in RC2 or later) and as long as you have the deluged running:
Code: Select all
$ deluge -u console -a 'add <filename>'
andar
Top Bloke
Top Bloke
 
Posts: 1050
Joined: Fri Jun 08, 2007 8:38 pm
Location: Victoria, BC

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

Postby Cha0s » Mon Dec 29, 2008 8:17 pm

Sounds great!

Where can I get the RC2 version?
During times of universal deceit, telling the truth becomes a revolutionary act.
User avatar
Cha0s
Member
Member
 
Posts: 21
Joined: Sun Dec 28, 2008 10:48 am

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

Postby andar » Mon Dec 29, 2008 8:23 pm

Cha0s wrote:Sounds great!

Where can I get the RC2 version?


It should be out in the next few hours, we're building the packages as we speak..
andar
Top Bloke
Top Bloke
 
Posts: 1050
Joined: Fri Jun 08, 2007 8:38 pm
Location: Victoria, BC

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

Postby Cha0s » Sun Feb 08, 2009 3:39 pm

Since, it seems to be an interest on the script I wrote to migrate from uTorrent/BitTorrent to Deluge/Transmission you can download it from here:

Linux (OLD) version
http://www.cha0s.gr/utorrent-to-deluge.rar

Windows (ONLY) version
http://www.cha0s.gr/utorrent-to-deluge0.2.rar


:)
Last edited by Cha0s on Tue Sep 16, 2014 5:23 pm, edited 1 time in total.
During times of universal deceit, telling the truth becomes a revolutionary act.
User avatar
Cha0s
Member
Member
 
Posts: 21
Joined: Sun Dec 28, 2008 10:48 am

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

Postby greenwich » Mon Mar 25, 2013 11:58 pm

Cha0s wrote:Since, it seems to be an interest on the script I wrote to migrate from uTorrent/BitTorrent to Deluge/Transmission you can download it from here:

http://www.cha0s.gr/utorrent-to-deluge.rar

:)


Hello, I tried your script, migrating some torrents from µTorrent to Deluge on a Windows 7 machine.
I got it working after commenting away the linux replacement paths and modifying the add command so that it worked with deluge-console.exe
Code: Select all
-u console -a 'add <torrent> --path=<path>'
to
"add -p <path> <torrent>"

but I quickly ran into problems, first it wouldn't allow spaces, so i modified it to
Code: Select all
"add -p ""<path>"" ""<torrent>"""

but then I noticed there was still problems, but with special chars like parentheses () and brackets [] in the torrent names and path..
Looks like this:
Code: Select all
Real file name: "Music Album (1994) [MP3].torrent"
What the script sends to deluge: "Music Album ^(1994^) ^[MP3^].torrent"

these seem to work though: =-

Any idea how to make it work with special characters?
Deluge 1.3.6 with Libtorrent 0.15.10.0 and GTK+ Runtime 2.24.10 on Windows 7 x64 SP1.
greenwich
Member
Member
 
Posts: 19
Joined: Tue Oct 18, 2011 10:53 pm

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

Postby Cha0s » Tue Mar 26, 2013 5:34 pm

Hello greenwich,

I think that by commenting out lines 59 & 67 those ^ characters will go away.
Lines:
Code: Select all
$TORRENT_PATH = escapeshellcmd ($TORRENT_PATH);

and
Code: Select all
$SAVE_PATH = escapeshellcmd ($SAVE_PATH);


I haven't used Deluge on windows (or PHP for that matter) so I am not 100% sure if that's the problem.


Let me know if that works for you, otherwise I'll set up deluge and php on a windows box to figure it out :)
During times of universal deceit, telling the truth becomes a revolutionary act.
User avatar
Cha0s
Member
Member
 
Posts: 21
Joined: Sun Dec 28, 2008 10:48 am

Next

Return to Development

Who is online

Users browsing this forum: No registered users and 0 guests