mikedld / bt-migrate

Torrent state migration tool
GNU General Public License v3.0
89 stars 15 forks source link

Only part of torrents migrated #10

Closed luckiestone closed 4 years ago

luckiestone commented 4 years ago

Hi mikedld, thank you for making this amazing tool.

I've spent two whole days to deal with the environment building, and finally cmake found boost libraries.

My platform is Windows 10, and I run the compiled exe file in debug folder(I guess it's correct)

In cmd i run D:\bt-migrate\_build\Debug>BtMigrate.exe --source utorrent --source-dir D:\uTorrent --target transmission --target-dir D:\transmission

However, there were errors during I run the program, and only part of torrents are extracted. And the exported .resume and .torrent file hava extensions like xxxxxx.tmp.20191202T203504.416060. I guess it might have something to do with early abort. The error is shown in picture. Snipaste_2019-12-02_20-35-57

It seems that something like UTF-8 or else is not supported, I've got many torrents containing Japanese and Chinese characters, none of them is extracted. I guess this might be the reason the programe is aborted.

Do you have any idea how to fix this problem?

Great great thanks for the tool, I've got thousands of torrents need to be migrated to transmission.

mikedld commented 4 years ago

Hi @luckiestone, I'm currently on vacation in Cuba (until December 9) and am unable to properly assist. I'll have to look at it closer once I get back, but my hope is that the tool does support Unicode. When you get this dialog window popping up, could you try clicking the Retry button and then posting the callstack/backtrace that will be displayed in one of Visual Studio's tool windows (usually at the bottom)?

luckiestone commented 4 years ago

@mikedld Thanks for your reply! Sorry for posting the issue during your vacation! Please enjoy your vacation first! I debugged it in VS2017 and the detailed error is shown in the picture, and I also copied the call stack here:

  ucrtbased.dll!7abefd10()  Unknown
  [External Code]   
  BtMigrate.exe!boost::filesystem::basic_ifstream<char,std::char_traits<char> >::open(const boost::filesystem::path & p, int mode) Line 92  C++
  BtMigrate.exe!MigrationTransaction::GetReadStream(const boost::filesystem::path & path) Line 105  C++
  BtMigrate.exe!`anonymous namespace'::uTorrentTorrentStateIterator::GetNext(Box & nextBox) Line 188    C++
  BtMigrate.exe!DebugTorrentStateIterator::GetNext(Box & nextBox) Line 97   C++
  BtMigrate.exe!ImportHelper::ImportImpl(const boost::filesystem::path & targetDataDir, IForwardIterator<Box> & boxes, ImportHelper::Result & result) Line 84   C++
  [External Code]   

Snipaste_2019-12-03_09-36-43

Thanks, and have a nice vacation!

Update with the environment: Boost: 1.68.0 CMake: 3.16.0 VS: 2017 OS: Win10 Pro 18363.476

mikedld commented 4 years ago

@luckiestone, please try this build to see if it fixes things (seems to do the job on my side): https://trtc.mikedld.com/viewLog.html?buildId=76375&buildTypeId=BtMigrate_WindowsX64&tab=artifacts#%2Fbinaries.zip

luckiestone commented 4 years ago

@mikedld Thank you for the build, but it still not working. It runs without error, but only a part was extracted, and it's 67 out of 434 torrents. The output resume and torrent files are still with additional extensions, it seems that the tool did not finish the whole process, which is similar to my build, but just without errors shown. I've looked into some files and someone says boost has an abnormal support of unicode. I have no clue of it, it's beyond my knowledge. Snipaste_2019-12-10_21-49-03

mikedld commented 4 years ago

Does it finish successfully, with no "Error: ..." lines in console at the very end and no questions asked? Are you running a clean import, i.e. are those files being created anew or were they maybe created during some earlier import attempts?

luckiestone commented 4 years ago

@mikedld Yes it ran without questions nor any error in each line. In console it shows those torrents with Chinese or Japanese characters are exported successfully, but the Unicode characters shown in console become some random characters which were not they supposed to be. I ran it with a clean export, and have deleted everything in the export folder.

mikedld commented 4 years ago

One more thing, when the tool runs do you see 434 torrents being printed in the console as being processed or only 67? In the latter case, would you mind sending me (mikedld@\<ditto>.com) the "resume.dat" file residing in your --source-dir directory?

luckiestone commented 4 years ago

Sent with cmd log.

mikedld commented 4 years ago

Here's another build for you to try: https://trtc.mikedld.com/viewLog.html?buildId=76377&buildTypeId=BtMigrate_WindowsX64&tab=artifacts#%2Fbinaries.zip

It should now hopefully pass with your data, but will issue a few warnings concerning invalid (non-UTF-8) paths. Save the log somewhere and see if those torrents are fine or need to be removed and migrated manually.

luckiestone commented 4 years ago

@mikedld Sorry for the late reply. I don't what tricks you have done, but this build works flawlessly! But there's another issue here. In the resume files the the destination is , and then I stop transmission, copy the remuse and torrents folder to where they should be. Then I start transmission. All the torrents I added began to download, and I found that their destination folder was changed to transmission default download folder let's say . It seems Transmission is just ignoring the resume file and only load the torrent. And if I just let transmission download the file, I can not find any modifications to the resume file, and no new resume file is created in the resume folder. Transmission is in a Docker container, it's so weird. I run Transmission in Docker in my DS918, and the folder is a mounted SMB folder, with all R/W access.

==================EDIT================== I found that the resume and torrent file names should be <torrent file name>.<hash?>.resume/.torrent but the output files are all only <hash?>.resume/.torrent, <torrent file name> was missing. image And also in the export folder, there were some temp files but all 434 resume and torrent files are exported successfully, just with wrong name. The build runs with no error:

[2019-Dec-11 21:56:05.522496] [I] Finished: 434 succeeded, 0 failed, 0 skipped
[2019-Dec-11 21:56:05.523490] [I] Committing changes

I think chances are that there were some unicode named .torrent files and they caused the whole process failure and missing of the <torrent file name> part in the exported files.

mikedld commented 4 years ago

If you're using Transmission 2.9x or older, please read https://github.com/mikedld/bt-migrate/issues/6#issuecomment-500030280. Basically, you'd want to set BT_MIGRATE_TRANSMISSION_2_9X environment variable to any value when running BtMigrate so that torrent and resume files are named the old way.

luckiestone commented 4 years ago

If you're using Transmission 2.9x or older, please read #6 (comment). Basically, you'd want to set BT_MIGRATE_TRANSMISSION_2_9X environment variable to any value when running BtMigrate so that torrent and resume files are named the old way.

Thanks for the info, and sorry for the silly question, but how can I set BT_MIGRATE_TRANSMISSION_2_9X to any value say 1 while running BtMigrate using cmd? Is this correct? >BtMigrate.exe BT_MIGRATE_TRANSMISSION_2_9X=1 --source utorrent --source-dir C:\Users\willw\Desktop\uTorrent --target transmission --target-dir C:\Users\willw\Desktop\transmission

mikedld commented 4 years ago

On Windows with cmd, you'd use set command to modify the environment, e.g.

> set BT_MIGRATE_TRANSMISSION_2_9X=1
> BtMigrate.exe ...
luckiestone commented 4 years ago

Thanks problem solved!