Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Linux specific questions, problems.
rumanzo
VIP
VIP
Posts: 91
Joined: Fri Dec 29, 2017 6:46 pm

Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Post by rumanzo »

Original topic viewtopic.php?f=14&t=5889

Disappointed in the existing application on the ruby, which could not handle all my torrents, I wrote my own application on golang.
I tested it on my own torrent database (3k+) and test torrents on Bittorrent/uTorrent clients (version 3+).
Features:
  • Processing all torrents
  • Processing torrents with subdirectories and without subdirectories
  • Processing torrents with renamed files
  • Processing torrents with non-standard encodings (for example, cp1251)
  • Processing of torrents in the not ready state *
  • Save date, metrics, status. **
  • Import of tags and labels
  • Multithreading
  • Path replace mechanism
* This torrents will not be done (0%) and will need force rehash
* If you migrate from windows to linux and use replace function attention that multiple flags -r processing one by one
* If you migrate from windows to linux and yours torrent files saves to some place you must use flag --search with actual paths in yours system
* If you migrate from windows to linux you may need to define path separathor with --sep flag
** The calculation of the completed parts is based only on the priority of the files in torrent
*** Partially downloaded torrents will be visible as 100% completed, but in fact you will need to do a rehash. Without rehash torrents not will be valid. This is due to the fact that conversion of .dat files in which parts of objects are stored is not implemented.

Don't forget before use make backup bittorrent\utorrent, qbittorrent folder. and config %APPDATA%/Roaming/qBittorrent/qBittorrent.ini. Close all this program before.

Usage:
If you MacOs user or Linux user don't forget to make the file executable:

Code: Select all

$ chmod +x bt2qbt_v1.3_amd64_macos
1.) Help (from cmd or powerwhell)

Code: Select all

 C:\Users\user\Downloads\bt2qbt_v1.3_amd64.exe [OPTIONS]

Application Options:
  -s, --source=         Source directory that contains resume.dat and torrents
                        files (default:
                        C:\Users\user\AppData\Roaming\uTorrent\)
  -d, --destination=    Destination directory BT_backup (as default) (default:
                        C:\Users\user\AppData\Local\qBittorrent\BT_backup\)
  -c, --config=         Source directory that contains resume.dat and torrents
                        files (default:
                        C:\Users\user\AppData\Roaming\qBittorrent\qBittorren-

                        t.ini)
      --without-labels  Do not export/import labels
      --without-tags    Do not export/import tags
  -t, --search=         Additional search path for torrents files
                        Example: --search='/mnt/olddisk/savedtorrents'
                        --search='/mnt/olddisk/workstorrents'
  -r, --replace=        Replace paths.
                        Delimiter for from/to is comma - ,
                        Example: -r "D:\films,/home/user/films" -r
                        "D:\music,/home/user/music"

      --sep=            Default path separator that will use in all paths. You
                        may need use this flag if you migrating from windows to
                        linux in some cases (default: \)

Help Options:
  -h, --help            Show this help message
2.) If you just run application, it will processing torrents from %APPDATA%\uTorrent\ to %LOCALAPPDATA%\qBittorrent\BT_BACKUP\
Example:

Code: Select all

It will be performed processing from directory C:\Users\user\AppData\Roaming\uTorrent\ to directory C:\Users\user\AppData\Local\qBittorrent\BT_backup\
Check that the qBittorrent is turned off and the directory C:\Users\user\AppData\Local\qBittorrent\BT_backup\ and config C:\Users\user\AppData\Roaming\qBittorrent\qBittorrent.ini is backed up.


Press Enter to start

Started
1/2 Sucessfully imported 1.torrent
2/2 Sucessfully imported 2.torrent

Press Enter to exit
3.) Run application from cmd or powershell with keys, if you want change source dir or destination dir, or export/import behavior
Example:

Code: Select all

C:\Users\user\Downloads> .\bt2qbt_v1.3_amd64.exe -s C:\Users\user\AppData\Roaming\BitTorrent\
It will be performed processing from directory C:\Users\user\AppData\Roaming\BitTorrent\ to directory C:\Users\user\AppData\Local\qBittorrent\BT_backup\
Check that the qBittorrent is turned off and the directory C:\Users\user\AppData\Local\qBittorrent\BT_backup\ is backed up.

Press Enter to start
Started
1/3233 Sucessfully imported 1.torrent
2/3233 Sucessfully imported 2.torrent
3/3233 Sucessfully imported 3.torrent
...
3231/3233 Sucessfully imported 3231.torrent
3232/3233 Sucessfully imported 3232.torrent
3233/3233 Sucessfully imported 3233.torrent

Press Enter to exit
Known issuses:
  • Unknown
Here's the project: https://github.com/rumanzo/bt2qbt
Code:  https://github.com/rumanzo/bt2qbt/blob/master/bt2qbt.go
Releases: https://github.com/rumanzo/bt2qbt/releases
x86_64 binary: https://github.com/rumanzo/bt2qbt/relea ... _amd64.exe
i386 binary: https://github.com/rumanzo/bt2qbt/relea ... 6_i386.exe
x86_64 Linux binary: https://github.com/rumanzo/bt2qbt/relea ... md64_linux
i386 Linux binary: https://github.com/rumanzo/bt2qbt/relea ... i386_linux
x86_64 MacOs binary: https://github.com/rumanzo/bt2qbt/relea ... md64_macos
i386 MacOs binary: https://github.com/rumanzo/bt2qbt/relea ... i386_macos

Deluge branch:
Here's the project: https://github.com/rumanzo/deluge2qbt
code: https://github.com/rumanzo/deluge2qbt/b ... uge2qbt.go
Releases: https://github.com/rumanzo/deluge2qbt/releases
x86_64 binary: https://github.com/rumanzo/deluge2qbt/r ... _amd64.exe
i386 binary: https://github.com/rumanzo/deluge2qbt/r ... 3_i386.exe
x86_64 Linux binary: https://github.com/rumanzo/deluge2qbt/r ... md64_linux
i386 Linux binary: https://github.com/rumanzo/deluge2qbt/r ... i386_linux
x86_64 MacOs binary: https://github.com/rumanzo/deluge2qbt/r ... md64_macos
i386 MacOs binary: https://github.com/rumanzo/deluge2qbt/r ... i386_macos

If there are any errors or if it help you - write there
DarthDobber
Newbie
Newbie
Posts: 4
Joined: Thu Apr 02, 2020 7:42 am

Re: Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Post by DarthDobber »

Thank you for the work you have put into this tool!

I am attempting to use it to migrate from utorrent 3.2.1 running on Windows to qbittorrent running on Ubuntu 18.04. I have ran the following command but I must be doing something wrong with the replace function.

Code: Select all

./bt2qbt_v1.2_amd64_linux -s /media/utorrent/john/AppData/Roaming/uTorrent/ --replace "S:\,/media/torrents;\,/"
I'm using that replace statement because my torrents are not stored in the same directory as the resume.dat. They are all saved in my S: drive. When I run this command it doesn't import my torrents and gives this error message for all torrents.

Code: Select all

XXXX/XXXX Can't decode torrent file /media/utorrent/john/AppData/Roaming/uTorrent/S:\Torrent\Completed\TorrentName.torrent for S:\Torrents\Completed\TorrentName.torrent
Thanks again!
rumanzo
VIP
VIP
Posts: 91
Joined: Fri Dec 29, 2017 6:46 pm

Re: Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Post by rumanzo »

DarthDobber wrote: Thu Apr 02, 2020 7:48 am Thank you for the work you have put into this tool!

I am attempting to use it to migrate from utorrent 3.2.1 running on Windows to qbittorrent running on Ubuntu 18.04. I have ran the following command but I must be doing something wrong with the replace function.

Code: Select all

./bt2qbt_v1.2_amd64_linux -s /media/utorrent/john/AppData/Roaming/uTorrent/ --replace "S:\,/media/torrents;\,/"
I'm using that replace statement because my torrents are not stored in the same directory as the resume.dat. They are all saved in my S: drive. When I run this command it doesn't import my torrents and gives this error message for all torrents.

Code: Select all

XXXX/XXXX Can't decode torrent file /media/utorrent/john/AppData/Roaming/uTorrent/S:\Torrent\Completed\TorrentName.torrent for S:\Torrents\Completed\TorrentName.torrent
Thanks again!
Seems like a bug. I fix this soon
DarthDobber
Newbie
Newbie
Posts: 4
Joined: Thu Apr 02, 2020 7:42 am

Re: Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Post by DarthDobber »

Thank you so much!

Let me know if you need any more data from me.

Thanks!
rumanzo
VIP
VIP
Posts: 91
Joined: Fri Dec 29, 2017 6:46 pm

Re: Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Post by rumanzo »

DarthDobber wrote: Thu Apr 02, 2020 6:39 pm Thank you so much!

Let me know if you need any more data from me.

Thanks!
I check you case, and it's difficult case. It's not about the replace flag. The fact is that when a utorrent saves a torrent, it puts the torrent file in its directory (in AppData\Roaming\uTorrent) and the key in the resume.dat is relative torrent file name, but if the torrent file is saved in another place, then the key is absolute torrent file path such as S:\Torrent\Completed\TorrentName.torrent . In code I use construction

Code: Select all

if ok := filepath.IsAbs(key); ok {
		newstructure.TorrentFilePath = key
	} else {
		newstructure.TorrentFilePath = flags.bitDir + key
	}
In Linux system windows file path not considered as absolute path in function in filepath.IsAbs (https://golang.org/pkg/path/filepath/#IsAbs).
This could be circumvented, but access to the torrent file is needed, and in the case of a system migrated to Linux, it is impossible to determine whether the former paths were mounted and where they were mounted. In other words, I can’t find in the Linux system where the torrent file is located, which was previously on the way S:\Torrent\Completed\TorrentName.torrent
I can try adding a flag to search for torrent files in a specific directory, may be it helps
Torrent files with utorrent can be in different directories or in only one?
DarthDobber
Newbie
Newbie
Posts: 4
Joined: Thu Apr 02, 2020 7:42 am

Re: Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Post by DarthDobber »

uTorrent can be configured to store completed torrents in a specific directory and incomplete torrents in a specific directory. That is how I have it setup.

I mapped the S:\ Drive to /media/torrents on the new linux box.
rumanzo
VIP
VIP
Posts: 91
Joined: Fri Dec 29, 2017 6:46 pm

Re: Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Post by rumanzo »

DarthDobber wrote: Fri Apr 03, 2020 8:54 pm uTorrent can be configured to store completed torrents in a specific directory and incomplete torrents in a specific directory. That is how I have it setup.

I mapped the S:\ Drive to /media/torrents on the new linux box.
Try new version https://github.com/rumanzo/bt2qbt/relea ... md64_linux
In your case you usage will be like this:
./bt2qbt_v1.3_amd64_linux -s /media/utorrent/john/AppData/Roaming/uTorrent/ --replace 'S:\,/media/torrents' --search /media/torrents/Completed/
DarthDobber
Newbie
Newbie
Posts: 4
Joined: Thu Apr 02, 2020 7:42 am

Re: Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Post by DarthDobber »

I apologize for the long time between responses. I have gotten busy with work and this slipped to the bottom of my priority list. However, I tried the new version today and it worked like a charm!

Thank you so much for such a wonderful tool!
rumanzo
VIP
VIP
Posts: 91
Joined: Fri Dec 29, 2017 6:46 pm

Re: Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Post by rumanzo »

DarthDobber wrote: Tue Apr 21, 2020 11:20 pm I apologize for the long time between responses. I have gotten busy with work and this slipped to the bottom of my priority list. However, I tried the new version today and it worked like a charm!

Thank you so much for such a wonderful tool!
Glad to see that :-)
undercover
Newbie
Newbie
Posts: 1
Joined: Thu May 21, 2020 3:58 pm

Re: Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Post by undercover »

Man this looks like a nice tool, but i have to oposite problem, ive been running my torrents in my laptop using qBitorrent and now i'm trying to move them and that same HDD to my raspberry pi running transmission.

My knowledge in go is zero and programming knowledge is quite low, how hard would it be to make the tool work the other way around?
rumanzo
VIP
VIP
Posts: 91
Joined: Fri Dec 29, 2017 6:46 pm

Re: Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Post by rumanzo »

undercover wrote: Thu May 21, 2020 4:01 pm Man this looks like a nice tool, but i have to oposite problem, ive been running my torrents in my laptop using qBitorrent and now i'm trying to move them and that same HDD to my raspberry pi running transmission.

My knowledge in go is zero and programming knowledge is quite low, how hard would it be to make the tool work the other way around?
Since the transmission uses its own library to work with the torrent and differs significantly from the programs using the liborrent, it is rather laborious to create a program for migration from qBittorrent to the transmission.
If you will do this, I advise you to take a python (great reason to start programming), it will be much easier than writing it with golang
User avatar
fixxOrz
Newbie
Newbie
Posts: 3
Joined: Sun May 31, 2020 4:49 pm

Re: Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Post by fixxOrz »

Hi rumanzo, this looks like an interesting tool. I'm currently running Linux Mint 19.3 and Deluge 2.0.3. I'm about to migrate from Deluge to qBt 3.3.16 (I know it's a very old version, but it's the one I need to use.) Anyway, I downloaded the bt2qbt_v1.5_amd64_linux binary, but I don't know how to use it. The usage information I could find (here and on git-hub) all seem to be for Windows. How can I use your tool in linux to migrate from Deluge 2.0.3 to qBt 3.3.16?

Code: Select all

if ( hasFever() ) {
return ((Cowbell) Prescription.getInstance ())++;
}
rumanzo
VIP
VIP
Posts: 91
Joined: Fri Dec 29, 2017 6:46 pm

Re: Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Post by rumanzo »

fixxOrz wrote: Sun May 31, 2020 9:16 pm Hi rumanzo, this looks like an interesting tool. I'm currently running Linux Mint 19.3 and Deluge 2.0.3. I'm about to migrate from Deluge to qBt 3.3.16 (I know it's a very old version, but it's the one I need to use.) Anyway, I downloaded the bt2qbt_v1.5_amd64_linux binary, but I don't know how to use it. The usage information I could find (here and on git-hub) all seem to be for Windows. How can I use your tool in linux to migrate from Deluge 2.0.3 to qBt 3.3.16?
Hi, I don't know how it will work with 3.3.16 (really, build new version), because it's different version of libtorrent, it may affect. And of course bt2qbt
and bt2qbt crossplatform utility, just get right version, make binary executable (chmod +x deluge2qbt_v*). For you will be ease run from linux and define source directory of utorrent\bittorrent (-s flag)
Qbites
Newbie
Newbie
Posts: 9
Joined: Tue May 19, 2020 9:42 am

Re: Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Post by Qbites »

Hi

I'm using qBittorrent and am running the tool on Mint 20. Just did a clean install from Mint 19.3 to Mint 20 couple of days ago.

I simply want to change the username in the torrent paths.

This string and some others i've tried, give me "Can't find uTorrent\Bittorrent resume file"

Code: Select all

./bt2qbt_v1.6_amd64_linux -s /home/mint20/.local/share/data/qBittorrent/BT_backup/ -d /home/mint20/.local/share/data/qBittorrent/BT_backup/ -c /home/mint20/.config/qBittorrent/qBittorrent.conf -r "/media/mint19.3/DATA,/media/mint20/DATA"
Help me out please. I don't get why it's not working. Thanks
Last edited by Qbites on Wed Sep 30, 2020 11:24 am, edited 2 times in total.
Qbites
Newbie
Newbie
Posts: 9
Joined: Tue May 19, 2020 9:42 am

Re: Linux tool for migration from Bittorrent/uTorrent/Deluge to qBittorrent

Post by Qbites »

finally. qbtchangetracker did the trick in a windows vm. not bt2qbt_v1.6_amd64_linux or the exe
qbtchangetracker also didn't work on linux
Post Reply