Author Topic: Export selected torrents to a list / import a torrent list  (Read 131 times)

akem

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Export selected torrents to a list / import a torrent list
« on: September 23, 2019, 12:00:37 AM »
Hello,

Not sure where to post, so i post it there...

I'm working a bit on qBittorrent because i'd like to add Export/Import capabilities:

    -Export all selected torrents to an XML list with all important informations.
        The magnet links and tracker informations i think.
        If possible the torrent files themselves to a folder or zipped archive...
        Also current save path, so that when reimporting it, it will get the different paths for each an every torrent to sync back what's already finished/downloaded.

    -Import torrents from an XML file.
        Import listed torrents, the downloaded paths should be available in the list.
        Also it would be nice to be able to scan drives for the torrent files; if they are already somwhere on the disk even partialy, ask for using this as download folder.
           (As much as it is fesable)

So my question is regarding the informations needed for exporting, i was looking at:
Code: [Select]
"base/bittorrent/torrenthandle.h"
But it's not so clear what i should export, because i think i need to choose only data that are needed when reimporting/recreating the torrent files.
But on the other hand some informations could be usefull for other purposes than just reimporting.
So if some of the devs can tell me what they think about my project, cause i could have missed something ofc, and if you think it is interesting and
have some informations about the data to be exported or other informations.

Actually i added the options in the "Tools" section, and i can list selected torrent names/paths to the log window:



It's just minimal additions to the code, and adding the icons files.
I build it with MSYS2 on Windows 7 64b (Chocobo1 build instructions).
« Last Edit: September 23, 2019, 01:23:46 AM by akem »

akem

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Export selected torrents to a list / import a torrent list
« Reply #1 on: September 26, 2019, 04:12:04 AM »
I got the XML(basic torrents data) -and .torrent files- import/export functionnal.  8)
But for the .torrent files, i would like them to be zipped in one archive ultimately, but it's not so important for now.
I can reload the torrents keeping the download paths and infos, and it synchronise the torrent list correctly even offline.
I still have to do some cleaning and testing, for example i'm not sure it will behave correctly with renamed torrents or filenames.
Also i need to export trackers infos and filenames to XML, just export current tracker atm.
Anyway i'm pretty satisfied with it at the moment.  ;)

akem

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Export selected torrents to a list / import a torrent list
« Reply #2 on: September 26, 2019, 09:36:54 PM »
[EDIT]

Here is a first look at my import/export functions for qBittorrent.
Added entries in the menubar, check "Tools >" then "Export.../Import...".

What is it used for:
        Let says you downloaded a bunch of torrents in different directories on your external hard drives, and you want to
        seed all or part of that from another computer; you export from computer A and you import on computer B, and you are
        done, the torrents will be added to the list and synchronised, download paths are preserved.

        Another example is if you reinstalled your computer OS, you just re-import on your new installation.

Export: Export an XML file listing selected torrents and all their .torrent files to the selected directory
        (ultimately everything in a .zip would be better i guess)

Import: Import the XML file and load the .torrents with maintained save paths, categories, tags...
        (or load the magnet links if torrent files cannot be loaded)

Limitations:

        SUPPORTED:
        -Export torrents to XML with some -but not all- data, and .torrent files.
        -Import torrents from XML and .torrent files or hash(fallback).
        -Save path (download location).
        -Category.
        -Tags.
        -Download/upload limits.
        -Paused/Forced.
        -First last pieces priority.
        -Sequential download.
        -Automatic(AutoTMM)

        UNTESTED/UNSUPPORTED YET:
        -Trackers XML import/export.
        -Renamed torrent files.
        -Create subfolders.
        -Partial torrent files selection(only download selected files).

How to test it:
        -->Run the app and load few torrents with different download folders (save path).
         (Choose some small sized ones so you can have few of them completed quikly).
        -->Wait for the fast/small ones to complete at least.
        -->Select some torrents and click "Tool>Export..."
        -->Remove the selected torrents from qBittorrents' list
         (but keep the files, don't check the box in the remove dialog).
        -->Optionnaly disconnect from network for testing purposes.
        -->Click "Tool>Import..." and choose the XML file that was exported.

        All the torrents will be back with their specific paths. You can also import on another computer or a virtual machine of course,
        It should synchronise as long as the downloaded files are there with the correct paths(ex: E:\Ebooks\, F:\Music ...)
        Note: Don't forget to select "All" for "Categories"/"Tags"/"Trackers" to see all the torrents in the list.
                 If you don't see the torrents... :P

Download and video: https://qbforums.shiki.hu/index.php/topic,7557.msg32334.html#msg32334

[EDIT]

I think maybe the "Generic" section of the forum was not very adapted for my thread...  :-X
Do you think my feature could make it to the official qBittorrent when ready? @ sledgehammer999, chobobo1, glassez and devs?
About the code it's basicly just 2 methods and few lines to add up the icons or menu entries. There is a bit of translation to do ofc for the message boxes etc.
But i didn't touch any other part of the code.
I'm learning how to use git, i don't know much about it, i know i can do my own qBittorrent fork and start from there i think, any tips about this is appreciated.

Thanks.
« Last Edit: September 29, 2019, 01:22:24 AM by akem »

Nemo

  • qBittorrent Forum
  • Administrator
  • Forum addict
  • *****
  • Posts: 1517
  • Karma: +94/-0
    • View Profile
Re: Export selected torrents to a list / import a torrent list
« Reply #3 on: September 26, 2019, 11:28:55 PM »
Quote
Do you think my feature could make it to the official qBittorrent when ready? @ sledgehammer999, chobobo1, glassez and devs?

akem, read my pm I have sended you :).
Forum Rules and Guidelines

Forum Admin.
Dutch & Turkish Translator.




akem

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Export selected torrents to a list / import a torrent list
« Reply #4 on: September 27, 2019, 02:01:47 PM »
I answered your PM Nemo  ;)

Seems like i cannot create a single .zip file export(with the .torrent files and the .XML inside) without adding another depency (like libzip)
which i don't want to. So i'll have to keep the export method exporting all the .torrent to the choosen directory + the .XML file.

akem

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Export selected torrents to a list / import a torrent list
« Reply #5 on: September 27, 2019, 06:26:32 PM »

So i think i got the bases for Git,  ::)

Now i think - and one the dev tell me if i'm right please -,
In order to try to get my feature to qBittorrent later, i fork the main qBittorrent source tree on my Git,
I push my changes to my forked version, and when ready it could be reviewed, discussed and ultimatly merged to the original source tree ?

That's the process right?  ???

Regards.

akem

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Export selected torrents to a list / import a torrent list
« Reply #6 on: September 28, 2019, 11:42:46 PM »
A little update: i got nearly all basic parameters import/export working now,
including automatic, upload limit, download limit, first last piece priority,  paused, forced ...

Here is the build, if you want to test it, i'm interested in feedback:

https://drive.google.com/open?id=1aZ04fE5BM_TGiE6506hBf4uc60ibS8Le

Here is a video demo:

https://www.youtube.com/watch?v=q_vnwxnhL70


Thanks!  ;)
« Last Edit: September 29, 2019, 02:14:15 AM by akem »