items selected NOT to be included in the download are still downloaded. #4364

Closed
opened 2026-02-21 17:16:38 -05:00 by deekerman · 6 comments
Owner

Originally created by @ManilaByNight on GitHub (Jun 11, 2016).

When I select particular items in the torrent not to be included in the download by unchecking them, they appear not to be included when I start the torrent download but once the process has been completed and I go to the completed downloads folder, I discover that everything has been downloaded.

For example if a particular torrent contains 5 elements for example in a movie say there is the actual movie file itself, a sample movie file, and three extra text files. If I select only the movie file and unselect all the rest, once I start the download it will appear on the download process that only the movie file is being downloaded and a progress bar appears next to it and not on the others. However, when the download is complete and I check the downloads folder, I discover that everything appears to have been downloaded so I still have to manually delete the ones I chose not to be downloaded. I only select the files I need in order to save on the download time.

Originally created by @ManilaByNight on GitHub (Jun 11, 2016). When I select particular items in the torrent not to be included in the download by unchecking them, they appear not to be included when I start the torrent download but once the process has been completed and I go to the completed downloads folder, I discover that everything has been downloaded. For example if a particular torrent contains 5 elements for example in a movie say there is the actual movie file itself, a sample movie file, and three extra text files. If I select only the movie file and unselect all the rest, once I start the download it will appear on the download process that only the movie file is being downloaded and a progress bar appears next to it and not on the others. However, when the download is complete and I check the downloads folder, I discover that everything appears to have been downloaded so I still have to manually delete the ones I chose not to be downloaded. I only select the files I need in order to save on the download time.
Author
Owner

@re-l124c41plus commented on GitHub (Jun 12, 2016):

Are those deselected files really downloaded completely or are they only downloaded partially?
This could simply be related to this question in the FAQ.
But since text files in particular are relatively small they might actually be downloaded completely by chance.
To test if this is an issue of partial downloads as described in the FAQ link above you could test if this issue is reproducible with bigger files excluded.

If this isn't the issue described in the FAQ then could you tell me if qBT shows those unwanted files as they are on the disk (i.e. 100% downloaded) or if qBT claims it didn't download them, and then please tell me your OS, your qBT version and the versions of your libraries (Help -> About -> Libraries).
Thanks!

@re-l124c41plus commented on GitHub (Jun 12, 2016): Are those deselected files really downloaded completely or are they only downloaded partially? This could simply be related to [this question in the FAQ.](https://github.com/qbittorrent/qBittorrent/wiki/Frequently-Asked-Questions#I_configured_qBittorrent_to_not_download_some_files_in_a_torrent_but_they_still_appear_on_my_hard_disk_why_is_that) But since text files in particular are relatively small they might actually be downloaded completely by chance. To test if this is an issue of partial downloads as described in the FAQ link above you could test if this issue is reproducible with bigger files excluded. If this isn't the issue described in the FAQ then could you tell me if qBT shows those unwanted files as they are on the disk (i.e. 100% downloaded) or if qBT claims it didn't download them, and then please tell me your OS, your qBT version and the versions of your libraries (Help -> About -> Libraries). Thanks!
Author
Owner

@aleqx commented on GitHub (Jun 14, 2016):

This (bug) has been a long-time frustration for me too. Yes, sometimes files bigger than the BT chunk size are being downloaded and placed next to the files selected for download - but not always, which made it hard to reproduce until now.

Suggestion: Why don't you guys just move into the .unwanted folder everything that was **de**selected? be it small files from needed chunks or not (i.e. bug or not).

The user obviously doesn't want those files in the same folder with the selected files, even if they are part of the needed chunks. That would solve most of the issues, bug or not bug.

One frustration it causes me is that I have scrapers scanning folders, and some of the files I deselect show up in the scraped content when they should not (e.g. sample videos, promo videos, etc etc).

I had this issue in v3.2.5 (which I'm using now) but also all pretty much all v3.x versions up to v3.3.4 that I tried. It was never reliable.

@aleqx commented on GitHub (Jun 14, 2016): This (bug) has been a long-time frustration for me too. Yes, sometimes files bigger than the BT chunk size are being downloaded and placed next to the files selected for download - but not always, which made it hard to reproduce until now. **Suggestion:** Why don't you guys just move into the `.unwanted` folder everything that was **_de_**selected? be it small files from needed chunks or not (i.e. bug or not). The user obviously doesn't want those files in the same folder with the selected files, even if they are part of the needed chunks. That would solve most of the issues, bug or not bug. One frustration it causes me is that I have scrapers scanning folders, and some of the files I deselect show up in the scraped content when they should not (e.g. sample videos, promo videos, etc etc). I had this issue in v3.2.5 (which I'm using now) but also all pretty much all v3.x versions up to v3.3.4 that I tried. It was never reliable.
Author
Owner

@re-l124c41plus commented on GitHub (Jun 15, 2016):

Suggestion: Why don't you guys just move into the .unwanted folder everything that was deselected? be it small files from needed chunks or not (i.e. bug or not).

Are you suggesting that we simply hide the downloaded files or am I missing something here? If those files are really being downloaded you waste bandwith and disk space on unwanted data. This really should be fixed properly.
As far as I understand it qBT already does hide unwanted files though.
See src/base/bittorrent/torrenthandle.cpp line: 1834

void TorrentHandle::prioritizeFiles(const QVector<int> &priorities)
{
    if (!hasMetadata()) return;
    if (priorities.size() != filesCount()) return;

    // Save first/last piece first option state
    bool firstLastPieceFirst = hasFirstLastPiecePriority();

    // Reset 'm_hasSeedStatus' if needed in order to react again to
    // 'torrent_finished_alert' and eg show tray notifications
    QVector<qreal> progress = filesProgress();
    QVector<int> oldPriorities = filePriorities();
    for (int i = 0; i < oldPriorities.size(); ++i) {
        if ((oldPriorities[i] == 0) && (priorities[i] > 0) && (progress[i] < 1.0)) {
            m_hasSeedStatus = false;
            break;
        }
    }

    qDebug() << Q_FUNC_INFO << "Changing files priorities...";
    SAFE_CALL(prioritize_files, priorities.toStdVector());

    qDebug() << Q_FUNC_INFO << "Moving unwanted files to .unwanted folder and conversely...";
    QString spath = savePath(true);
    for (int i = 0; i < priorities.size(); ++i) {
        QString filepath = filePath(i);
        // Move unwanted files to a .unwanted subfolder
        if (priorities[i] == 0) {
            QString oldAbsPath = QDir(spath).absoluteFilePath(filepath);
            QString parentAbsPath = Utils::Fs::branchPath(oldAbsPath);
            // Make sure the file does not already exists
            if (QDir(parentAbsPath).dirName() != ".unwanted") {
                QString unwantedAbsPath = parentAbsPath + "/.unwanted";
                QString newAbsPath = unwantedAbsPath + "/" + Utils::Fs::fileName(filepath);
                qDebug() << "Unwanted path is" << unwantedAbsPath;
                if (QFile::exists(newAbsPath)) {
                    qWarning() << "File" << newAbsPath << "already exists at destination.";
                    continue;
                }

                bool created = QDir().mkpath(unwantedAbsPath);
                qDebug() << "unwanted folder was created:" << created;
#ifdef Q_OS_WIN
                if (created) {
                    // Hide the folder on Windows
                    qDebug() << "Hiding folder (Windows)";
                    std::wstring winPath =  Utils::Fs::toNativePath(unwantedAbsPath).toStdWString();
                    DWORD dwAttrs = ::GetFileAttributesW(winPath.c_str());
                    bool ret = ::SetFileAttributesW(winPath.c_str(), dwAttrs | FILE_ATTRIBUTE_HIDDEN);
                    Q_ASSERT(ret != 0); Q_UNUSED(ret);
                }
#endif
                QString parentPath = Utils::Fs::branchPath(filepath);
                if (!parentPath.isEmpty() && !parentPath.endsWith("/"))
                    parentPath += "/";
                renameFile(i, parentPath + ".unwanted/" + Utils::Fs::fileName(filepath));
            }
        }

        // Move wanted files back to their original folder
        if (priorities[i] > 0) {
            QString parentRelPath = Utils::Fs::branchPath(filepath);
            if (QDir(parentRelPath).dirName() == ".unwanted") {
                QString oldName = Utils::Fs::fileName(filepath);
                QString newRelPath = Utils::Fs::branchPath(parentRelPath);
                if (newRelPath.isEmpty())
                    renameFile(i, oldName);
                else
                    renameFile(i, QDir(newRelPath).filePath(oldName));

                // Remove .unwanted directory if empty
                qDebug() << "Attempting to remove .unwanted folder at " << QDir(spath + "/" + newRelPath).absoluteFilePath(".unwanted");
                QDir(spath + "/" + newRelPath).rmdir(".unwanted");
            }
        }
    }

    // Restore first/last piece first option if necessary
    if (firstLastPieceFirst)
        setFirstLastPiecePriority(true);

    updateStatus();
}

So you see as far as I understand it the code that hides those unwanted files depends on their priority being 0 (i.e. set to ignore).
Now there might be an error somewhere in there but I can't see one and the fact that those files even got downloaded in the first place suggests that their priorities are NOT correct, due to some bug elsewhere.

By the way, do you deselect those files through the web UI?
Because I found this code snippet in src/gui/properties/propertieswidget.cpp line: 489

// XXX: We don't update file priorities regularly for performance
// reasons. This means that priorities will not be updated if
// set from the Web UI.

Just what I have found so far.

@re-l124c41plus commented on GitHub (Jun 15, 2016): > Suggestion: Why don't you guys just move into the .unwanted folder everything that was deselected? be it small files from needed chunks or not (i.e. bug or not). Are you suggesting that we simply hide the downloaded files or am I missing something here? If those files are really being downloaded you waste bandwith and disk space on unwanted data. This really should be fixed properly. As far as I understand it qBT already does hide unwanted files though. See src/base/bittorrent/torrenthandle.cpp line: 1834 ``` c++ void TorrentHandle::prioritizeFiles(const QVector<int> &priorities) { if (!hasMetadata()) return; if (priorities.size() != filesCount()) return; // Save first/last piece first option state bool firstLastPieceFirst = hasFirstLastPiecePriority(); // Reset 'm_hasSeedStatus' if needed in order to react again to // 'torrent_finished_alert' and eg show tray notifications QVector<qreal> progress = filesProgress(); QVector<int> oldPriorities = filePriorities(); for (int i = 0; i < oldPriorities.size(); ++i) { if ((oldPriorities[i] == 0) && (priorities[i] > 0) && (progress[i] < 1.0)) { m_hasSeedStatus = false; break; } } qDebug() << Q_FUNC_INFO << "Changing files priorities..."; SAFE_CALL(prioritize_files, priorities.toStdVector()); qDebug() << Q_FUNC_INFO << "Moving unwanted files to .unwanted folder and conversely..."; QString spath = savePath(true); for (int i = 0; i < priorities.size(); ++i) { QString filepath = filePath(i); // Move unwanted files to a .unwanted subfolder if (priorities[i] == 0) { QString oldAbsPath = QDir(spath).absoluteFilePath(filepath); QString parentAbsPath = Utils::Fs::branchPath(oldAbsPath); // Make sure the file does not already exists if (QDir(parentAbsPath).dirName() != ".unwanted") { QString unwantedAbsPath = parentAbsPath + "/.unwanted"; QString newAbsPath = unwantedAbsPath + "/" + Utils::Fs::fileName(filepath); qDebug() << "Unwanted path is" << unwantedAbsPath; if (QFile::exists(newAbsPath)) { qWarning() << "File" << newAbsPath << "already exists at destination."; continue; } bool created = QDir().mkpath(unwantedAbsPath); qDebug() << "unwanted folder was created:" << created; #ifdef Q_OS_WIN if (created) { // Hide the folder on Windows qDebug() << "Hiding folder (Windows)"; std::wstring winPath = Utils::Fs::toNativePath(unwantedAbsPath).toStdWString(); DWORD dwAttrs = ::GetFileAttributesW(winPath.c_str()); bool ret = ::SetFileAttributesW(winPath.c_str(), dwAttrs | FILE_ATTRIBUTE_HIDDEN); Q_ASSERT(ret != 0); Q_UNUSED(ret); } #endif QString parentPath = Utils::Fs::branchPath(filepath); if (!parentPath.isEmpty() && !parentPath.endsWith("/")) parentPath += "/"; renameFile(i, parentPath + ".unwanted/" + Utils::Fs::fileName(filepath)); } } // Move wanted files back to their original folder if (priorities[i] > 0) { QString parentRelPath = Utils::Fs::branchPath(filepath); if (QDir(parentRelPath).dirName() == ".unwanted") { QString oldName = Utils::Fs::fileName(filepath); QString newRelPath = Utils::Fs::branchPath(parentRelPath); if (newRelPath.isEmpty()) renameFile(i, oldName); else renameFile(i, QDir(newRelPath).filePath(oldName)); // Remove .unwanted directory if empty qDebug() << "Attempting to remove .unwanted folder at " << QDir(spath + "/" + newRelPath).absoluteFilePath(".unwanted"); QDir(spath + "/" + newRelPath).rmdir(".unwanted"); } } } // Restore first/last piece first option if necessary if (firstLastPieceFirst) setFirstLastPiecePriority(true); updateStatus(); } ``` So you see as far as I understand it the code that hides those unwanted files depends on their priority being 0 (i.e. set to ignore). Now there might be an error somewhere in there but I can't see one and the fact that those files even got downloaded in the first place suggests that their priorities are NOT correct, due to some bug elsewhere. By the way, do you deselect those files through the web UI? Because I found this code snippet in src/gui/properties/propertieswidget.cpp line: 489 ``` c++ // XXX: We don't update file priorities regularly for performance // reasons. This means that priorities will not be updated if // set from the Web UI. ``` Just what I have found so far.
Author
Owner

@tp0 commented on GitHub (Jun 28, 2016):

I think it has been mentioned that the long-term plan is to use single part/data file (like in uTorrent) now that libtorrent finally supports it. Once implemented it would do away with this and other related issues and annoyances.

I have suggested enabling the .!qB extension setting by default which would at least be less confusing (#5023).

@tp0 commented on GitHub (Jun 28, 2016): I think it has been mentioned that the long-term plan is to use single part/data file (like in uTorrent) now that libtorrent finally supports it. Once implemented it would do away with this and other related issues and annoyances. I have suggested enabling the .!qB extension setting by default which would at least be less confusing (#5023).
Author
Owner

@BloodyRain2k commented on GitHub (Jul 20, 2016):

There's a kinda related issue with downloaded files marked not to be downloaded:
when a torrent is completed and you mark a file as unwanted it gets moved into the .unwanted folder as intended, but the UI doesn't care about that and when you select a different torrent and then again the one from where you marked a file as unwanted it's checked again even though it is still in the .unwanted directory.

This bug existed a year ago or so before, was fixed, and then brokened again in a somewhat recent version (like 3 or more updates ago) : (

@BloodyRain2k commented on GitHub (Jul 20, 2016): There's a kinda related issue with downloaded files marked not to be downloaded: when a torrent is completed and you mark a file as unwanted it gets moved into the .unwanted folder as intended, but the UI doesn't care about that and when you select a different torrent and then again the one from where you marked a file as unwanted it's checked again even though it is still in the .unwanted directory. This bug existed a year ago or so before, was fixed, and then brokened again in a somewhat recent version (like 3 or more updates ago) : (
Author
Owner

@thalieht commented on GitHub (Dec 23, 2017):

Duplicate of #2659

Version 4.0.x is released. It uses libtorrent 1.1.x which puts the unwanted part files in the hidden file
".<torrent_hash>.parts" which is put in the same folder as the root folder(if any) of the torrent.
For the moment it's not possible to put that file somewhere else.

@thalieht commented on GitHub (Dec 23, 2017): Duplicate of #2659 Version 4.0.x is released. It uses libtorrent 1.1.x which puts the unwanted part files in the hidden file ".<torrent_hash>.parts" which is put in the same folder as the root folder(if any) of the torrent. For the moment it's not possible to put that file somewhere else.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/qBittorrent#4364
No description provided.