qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
27.14k stars 3.9k forks source link

[Wishlist] Make it possible to strip the first subdir on multi torrents #588

Closed darkstar closed 7 years ago

darkstar commented 11 years ago

...like what µTorrent does. If the Torrent is called "Foo Torrent" and has, e.g., files a/1.dat, b/2.dat and c/3.dat, qBittorrent downloads it into /Foo Torrent/a/1.dat etc. instead of /a/1.dat

Maybe add a checkbox in the torrent download dialog, i.e. "create subdirectory for this torrent" or something like that

This is the only missing µTorrent feature that I really need :)

sledgehammer999 commented 11 years ago

Maybe I don't undertand you but: The "Foo Torrent" folder is created because it is actually defined in the .torrent file. It is a part of the file structure. There other torrents that have many files which aren't contained in a folder. Then these files are downloaded exactly where you chose to be saved.

darkstar commented 11 years ago

No, what is defined in the .torrent file is the name of the torrent. qBittorrent uses this as a (mandatory) subdirectory when adding the torrent file. µTorrent lets you chose (in 3.3.1 at least) if you want the "additional" subdir or not. Try it, just compare µTorrent to qBittorrent and you'll see what I mean

darkstar commented 11 years ago

Here are two screenshots for comparison.

uTorrent: http://imgbin.org/index.php?page=image&id=12839 qBittorrent: http://imgbin.org/index.php?page=image&id=12840

Note the checkbox (on uTorrent) named "Create Subfolder" which, when checked, will create a subfolder with the name of the torrent. However, if you uncheck this, the files (as seen on the right) will be dropped flat into the directory you specify.

also note that qBittorrent lacks such a checkbox and by defaults drops everything into such a subfolder (which, additionally, cannot be renamed, which is also bad if the description is non-ASCII, but that's a different problem)

I hope I made it understandable now :)

sledgehammer999 commented 11 years ago

Hmmm, you are right. It is handled differently. This will require some rework in the UI and quite a bit in the code logic. Also you can rename the root folder. Just right-click on it and select "Rename..."

darkstar commented 11 years ago

Ah, this will be at least a workaround for now. Thanks for the hint!

sledgehammer999 commented 11 years ago

One possible workaround is this:

  1. Let's say you want to save the files into C:\anime
  2. qBittorrent with its current behavior will save it into C:\anime\bleach
  3. Open the torrent file and select to save it into C:\
  4. Then rename the root folder to "anime" and add to the download list.
  5. Now the files should be dropped into C:\anime and not into C:\anime\bleach
D-Kalck commented 11 years ago

As darkstar I would love this feature, the problem for me is that I download movies to G:\ so there's no workaround in this case.

avih commented 11 years ago

I'd also like to see this feature implemented.

Some single-file torrents have only a name (which is also used as the file name - qb doesn't create a new folder for those) while other single-file torrents have both a name and a path (file name) - at which case qb does create a new folder (torrent-name) for the torrent file.

While in many multi-files torrents using a new folder for all the files is usually useful IMO (but still there could be exceptions), for single files torrents, I'd guess that most people would NOT want a new folder with a single file in it.

I'd suggest to implement it as follows:

  1. On the new torrent dialog, display a checkbox: "Use subfolder: |torrent-name|", where the name might appear in a textbox for editing before adding the torrent.
  2. qb will remember the last user choice WRT to this checkbox: For torrents with a single file (defaults to unchecked), and for torrents with multiple files (Defaults to checked).

As a stop-gap, or just an alternative if the logic for the above is annoying, at the new torrent dialog, show the folder (torrent) name in a texbox, and allow to rename it before the torrent is added. While less elegant than the solution above, it will still greatly reduce the hussle of handling such torrents IMO.

Regardless, keep rocking qb! :)

fellipecorr commented 10 years ago

And what about skip all the folders: I am asking for the option of use no folders at all. For example: there is a tv show with 5 seasons with a foler for each season, and a subfolder for each season with subtitles. If I want to download in the "C:/downloads/torrents/trueblood/" folder, the file for the subtitles of the 1st episode would be like that: "C:/downloads/torrents/trueblood/trueblood/season1/subtitles/S01E01name.srt"

I would like it to be: "C:/downloads/torrents/trueblood/S01E01name.srt" Just in the folder I selected, like all the files, with no exceptions. I am asking for the option of not creating any foldres at all.

Thank you very much.

sledgehammer999 commented 10 years ago

I am asking for the option of not creating any foldres at all.

I don't know if this is possible. But I feel that such an option should not be implemented. I don't want to have too many options especially when the benefit from the option is minimal. However, your case can be mitigated partially when #439 gets implemented.

fbreve commented 10 years ago

This option is really important. Using uTorrent, every time MAME is updated I can just point the new ROMs torrent to the old directory and it will only download new files. This is impossible in qBitTorrent as I would have to download everything again.

sledgehammer999 commented 10 years ago

Before adding the new torrent, in the torrent details rename the root folder accordingly.

fbreve commented 10 years ago

I know I can rename the root folder, but it's pointless as qBitTorrent will create an unwanted subfolder inside it.

fellipecorr commented 10 years ago

This is not a root folder issue. Sometimes the torrents come with a folder in itself, and the most of the times, we don't want it, in order to keep our library in the order we want.

It is nice to have the minimal options, but not if it means to make unwanted folders for obligation.

sledgehammer999 commented 10 years ago

I am not against this option. As you can see I have marked it for v3.2.0 (look at top of the issue). I am just showing some hacks/workarounds in the meantime.

fbreve commented 10 years ago

Now I understood I can change the root folder inside the torrent (the subdirectory). I though you were talking about the download folder. This workaround works for me. Thank you.

gitrivad commented 9 years ago

Glad to see this is scheduled to be fixed for 3.2.0.

One note, though -- the proposed workaround (renaming the root folder inside the torrent) doesn't seem to work. See #2362.

This issue seems to be regarding removal of the root folder. Issue #2362 is an issue with the proposed workaround (renaming of the root folder), which doesn't work and creates spurious directories.

maxgalbu commented 9 years ago

+1 to get nofitications

Matth7878 commented 9 years ago

Will it be possible to have this as an option in the rss downloader by adding a checkbox after "save to" ? It would be a real plus for auto downloaded files.

Kitlard commented 9 years ago

Yes please! Can you add a setting in the preferences dialog to make this (no new dir) the default behavior?

sledgehammer999 commented 9 years ago

I had a look at the code and I think I'll need to do extensive workarounds in the core code. That code is old and complex. @glassez has done serious refactoring that will get merged after v3.2.0. I am worried that any possible changes to that code for fixing this bug will create too much extra work on his part to redo his patches. Plus, I am positive that after his refactoring the solution to this bug will be far easier to implement. Frankly, I don't even want to look at the current core code. Moving this to v3.3.0. (may retarget back into the v3.2.x series).

dpankov commented 9 years ago

+1 to get notifications ... and to mention two problems with the current workaround (the one with renaming the root folder before starting the download) which hopefully will be taken into account when refactoring:

  1. If I choose not to download all the files in the torrent the selected ones get downloaded to the correctly renamed root folder but qBittorrent (v3.2.0) still creates a folder with the original name and places a hidden folder called ".unwanted" in it
  2. The workaround works only if there are multiple files in the torrent. If there is a single file there is no UI for renaming the root folder and as a result the user is forced to save it in the unwanted folder with original name. I see the logic of hiding the UI for selecting files if there is a single file and nothing else in the torrent but if the author was dumb enough to also add a folder (with a single file) why not let the user select what he wants to do with it?

Is there a fix/workaround for these two situations?

chrishirst commented 9 years ago

The libtorrent protocol engine use in qbittorrent does not create a folder for the payload at all, you can download any Linux Mint iso to prove that for yourself. If there is a 'sub-folder' for a single file, it was there when the payload was created. So the answer to;

Is there a fix/workaround for these two situations?

The answer is absolutely not whatever the torrent creator did is there and done, and cannot be 'undone' without 'breaking' the payload in the process. The hash ID includes the folder name and the checksums of the file(s) include the folder start/end markers.

wilflare commented 9 years ago

+1 for notifications this would really help with seeding files in the long run

chrishirst commented 9 years ago

3141 can be the result of not segregating payloads.

Keyrlis commented 8 years ago

Okay, so just to confirm, as this page has gotten pretty hinky-looking, and hard to follow: Stripping the most top-level folders from the payload and allowing a single file download has NOT yet been implemented? I just D/l v3.3.2, and don't see any option for that, though it was planned for v3.3.0. So are there any updates on when you will be able to work this into the prog? Brilliant work, BTW- much neater and trim than uTorrent has been for years. This is the only feature from utorrent I regret not having in QBT.

Deptacon commented 8 years ago

I just switched to qB, but was amazed this feature doesnt exist. I dont need a sub folder created for every torrent with 2 or more files. Please add this feature to save the contents of the torrent directly to the designated save path, instead of automatically creating a subfolder.

Suprised this has been discussed for 2 years and its still not implemented. This could be be a deal breaker, I may have to find another client.

chrishirst commented 8 years ago

I dont need a sub folder created for every torrent with 2 or more files

Neither qbittorrent or libtorrent create a sub-folder when initialising a payload .. any folder that does exist IS part of the payload when it was created. All bittorrent clients create a multi-file payload in the same way, you specify a single folder containing the files that are needed for the payload which obviously becomes the 'top-most folder and IS and must be created when the torrent task is loaded or started. If you do NOT want a "sub-folder" then YOU have to put the payload in the ROOT of a drive or a filing system. Trying to remove the parent folder of a payload that IS detailed in the metadata and therefore IS** part of the checksums for pieces AND the torrent hash_id, is fraught with serious risks of corrupting the payload for the local client THUS making it impossible to start or complete.

chrishirst commented 8 years ago

Oh and uTorrent can do this because it DOES add an additional folder for single and multi-file tasks, having a 'check box' to remove the folder simply makes it work CORRECTLY!

Deptacon commented 8 years ago

No one cares that its part of the payload. Its almost 2016, it should be an option to not have that subdolder created if the users file and folder structure doesnt meed or want it. It does create a folder.... Qb creates a folder for multifilentirrents that other clients have the option not to have created.

Deptacon commented 8 years ago

I dont need need another layer of folders created for 2 file torrents, when i want them to save to the directory i sep ifi ed in tye save path and then oh wait, look, it created another folder.... Glad this software in 2016 is so "slim" it doesnt have an option for not doing that like other clients do....

Oh and when you bring it up as a reccommendation there are always those who reply (in nerd voice) " well actually its part if the payload so its utorrent that is wrong..... Why do you need that? You dont need that and didnt explai it right"

This one option is why MANY people still use utorrent and have not ditched it for better clients like QB

Keyrlis commented 8 years ago

Indeed. I am unconcerned with apologetic (or worse, unapologetic and accusatory) excuses made by people that offer no useful input. To be frank, I couldn't give a quantic bit's uncertainty about the health of the payload, CRC Checksums, or the sha_hash-whatever AFTER I complete a transfer. If it is SUCH a problem with the programming to modify the layer cake of file contents while it is being actively completed, why not make the User Choice option take effect once the torrent is removed from the active list? That way, it can use all those useless "unwanted" folders it creates as well as the original structure to maintain stability. Then, once the file is no longer transferring or under the "protection" of the torrent client itself, and is actually MY file, to do or store where ever I wish, THEN proceed to put it where I stated that I want it, automatically, and remove all superfluous folders. Not really a solution, as I could not enqueue said files in a playlist, as they would be moved after torrent completion, but still a workaround for the file system.

chrishirst commented 8 years ago

To be frank, I couldn't give a quantic bit's uncertainty about the health of the payload, CRC Checksums, or the sha_hash-whatever AFTER I complete a transfer.

You should because that is what prevents your client from sending "bad data" to other peers, and frankly you not 'caring' demonstrates a lack of understanding of the tool and processes you are using.

Then, once the file is no longer transferring or under the "protection" of the torrent client itself, and is actually MY file, to do or store where ever I wish,

Of course it is and of course you can. However changing the payload in ANY way shape or form precludes you from seeding, or reloading and re-seeding that torrent metadata and payload at any time in the future, because it has been irrevocably altered and will no longer match the metadata checksums (that is what a 'force recheck' does just in case you are not aware of that point).

Once the payload IS complete and removed from the client, you can do all the renaming, moving and deleting that you wish with complete alacrity, but while ever you are downloading and require the task payload to be available for seeding, you and the client are bound by the requirements of the bittorrent protocol.

This one option is why MANY people still use utorrent and have not ditched it for better clients like QB

If they are comfortable with uTorrent then there is no need for them to change, ditching uTorrent is not a requirement. Though the major difference is that qbittorrent needs a bit more knowledge of how the protocol works than the average uTorrent user has. So normally when they have learned that bit more about the whole thing, they find out that uTorrent etc. is somewhat limiting and they are prepared to move on to something a little more advanced.

Deptacon commented 8 years ago

You are making a huge deal about the heatkh of the torrent and the payload but you are just making an excuse. You are blowing the risks and issues out if proportion. For some reason you dont want the option.... At this point it might be spite. You can still seed a torrent elsewhere when removing the folder, other clients remove the folder and u can still add other torrents and seed all day long.....its just a folder. Its archaic its being forced....

Deptacon commented 8 years ago

You dont have anything to add, you dont want to adf the option, and adding the option will not negatively impact the software or you.... So why are you commenting?

chrishirst commented 8 years ago

If you can show me a multi-file torrent payload without a 'top-level' folder that appears as a sub-folder I will accept the idea that it can be done without any problem, ... ... Until then you should probably read this documentation.

Deptacon commented 8 years ago

Use another client and watch what you can do with software in 2016.... Many orher clients do it all day long.

Deptacon commented 8 years ago

I have TV show series, 12 episodes a piece, that are in 1 folder instead if 12 subfolders and they were placed that are time if download with no need to move, rename, etc after downloanding. The clent put it where i told it to put it and didnt add a folder. And it still seeds

darkstar commented 8 years ago

Guys, seriously, calm down a bit.

It seems clear that QBittorrent is intent on following the bittorrent spec to the letter, even if it doesn't make sense for the end-user. Following standards just for the sake of the standard is not always the best option, just look at the Linux guys for some very harsh opinions on that matter.

I accept that you just don't want QBittorrent to be compatible to every other torrent client on the planet, and that's okay. I simply won't use it then and stick to uTorrent and Tixati which work fine for me.

In addition, QBittorrent is neither faster nor more stable with huge torrents (>1TB) or torrents with >60k files than uTorrent (it takes dozens of minutes to start and freezes until everything is loaded) so there's no real reason for me to switch (especially since I couldn't continue my multi-terabyte torrents without problems because of that path issue)

If the QBittorrent devs don't want to listen to their users that's fine, it's their decision. But I think looking at Linus' way of doing things might open their eyes a little

naikel commented 8 years ago

The way I think Open Source works is, if you want a feature in an Open Source project, then you code it and submit a Pull Request. If you don't know how to code, then you can ask for the feature to be added, but if the devs are not interested then you're out of luck. Sometimes I feel people is demanding features.

For instance, I'm not against that option, but I would definitely NOT use it. I have an extremely big Downloads folder and I do need to know from which torrent my files suddenly appeared. So I definitely want to see a folder per torrent, and inside of that folder, everything pertinent to that torrent.

Again, I'm not against that option. If you don't want to use qBittorrent, fine. But demanding features to be implemented like if you were paying the devs millions of dollars won't do any good, unless of course you do want to pay millions of dollars :smile:

Also and finally, I'm not even sure if this can be done in the qBittorrent code, so maybe (I'm not sure) you're even yelling to the wrong people. Isn't libtorrent in charge of all of this?

naikel commented 8 years ago

If you can show me a multi-file torrent payload without a 'top-level' folder that appears as a sub-folder I will accept the idea that it can be done without any problem, ... ... Until then you should probably read this documentation.

The top-level folder is added by the client automatically in multi-files torrents. It is a convention, but not a rule.

You can open a .torrent with a notepad (or an hex editor if the pieces gibberish bother you) and look for the files section (Ctrl-F and type files). You'll see something like this:

filesld6:lengthi1271955456e4:pathl14:example123.isoeed6:lengthi4464e4:pathl12:example1.nfoeee4:name12:torrent-name:piece lengthi2097152e6:pieces12140:

That torrent has two files:

But libtorrent (I think it's libtorrent) will create:

torrent-name\example123.iso torrent-name\example1.nfo

And that's IMHO the right thing to do, but it seems it bothers some people.

naikel commented 8 years ago

This is definitely not a qBittorrent "issue", I just checked the code.

If the torrent is multifile, then the parser of the files section (inside libtorrent's parse_info_section() function) is called like this:

        if (!files_node)
        {
            // if there's no list of files, there has to be a length
            // field.
            if (!extract_single_file(info, files, "", info_ptr_diff, true, ec))
                return false;

            m_multifile = false;
        }
        else
        {
            if (!extract_files(files_node, files, name, info_ptr_diff, ec))
                return false;
            m_multifile = true;
        }

And the extract_files footprint is:

    // root_dir is the name of the torrent, unless this is a single file
    // torrent, in which case it's empty.
    bool extract_files(bdecode_node const& list, file_storage& target
        , std::string const& root_dir, ptrdiff_t info_ptr_diff, error_code& ec)

As you can see the name of the torrent is used as root_dir in case of multitorrent files. To change that to be an option, well, the libtorrent guys would have to pass an empty string instead of the name of the torrent just like they do if it's a single file.

I hope you can understand the code. You can read the whole code @ https://github.com/arvidn/libtorrent/blob/master/src/torrent_info.cpp

But the summary is:

1.- At first glance, it's not a qBittorrent issue, but if the libtorrent guys implement it, maybe some modifications are needed in qBittorrent to comply with it.

2.- Libtorrent have to define a flag for this. Luckily they already defined the argument flags for the parse_info_section() function, even though they haven't used it. Clever guys!

3.- qBittorrent would need to create the option and pass it as torrent parameter to libtorrent and libtorrent depending on this value set the flag or not.

4.- You're welcome. Now you code it and submit the PR to both projects!

sledgehammer999 commented 8 years ago

I am locking this converstaion. I have already a PR ready. But it needs careful testing. We already have problems with the saving path without it. And we're trying to fix them first. The PR is #4081. Please, only programmers comment there. Others that need notification click the Subscribe button in the right panel of either this bug or #4081. When the feature is implemented the bugs will close and you'll get notified.

This feature request is well understood on what it asks. There's no point discussing it further. Only programmers for implementation details.

sledgehammer999 commented 7 years ago

Implemented by #5465. It will appear in v3.4.0.