mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-15 08:01:05 +08:00
Use respective subcategory for "watched" torrents
Assign respective Subcategory of configured Category to torrents if Automatic Torrent Management Mode is set for Watched folder. PR #15603.
This commit is contained in:
parent
090199f9de
commit
4f20769a6c
@ -504,8 +504,16 @@ void TorrentFilesWatcher::Worker::processFolder(const QString &path, const QStri
|
|||||||
if (path != watchedFolderPath)
|
if (path != watchedFolderPath)
|
||||||
{
|
{
|
||||||
const QString subdirPath = watchedDir.relativeFilePath(path);
|
const QString subdirPath = watchedDir.relativeFilePath(path);
|
||||||
|
if (addTorrentParams.useAutoTMM)
|
||||||
|
{
|
||||||
|
addTorrentParams.category = addTorrentParams.category.isEmpty()
|
||||||
|
? subdirPath : (addTorrentParams.category + QLatin1Char('/') + subdirPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
addTorrentParams.savePath = QDir::cleanPath(QDir(addTorrentParams.savePath).filePath(subdirPath));
|
addTorrentParams.savePath = QDir::cleanPath(QDir(addTorrentParams.savePath).filePath(subdirPath));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (filePath.endsWith(QLatin1String(".magnet"), Qt::CaseInsensitive))
|
if (filePath.endsWith(QLatin1String(".magnet"), Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
@ -575,8 +583,16 @@ void TorrentFilesWatcher::Worker::processFailedTorrents()
|
|||||||
if (exactDirPath != dir.path())
|
if (exactDirPath != dir.path())
|
||||||
{
|
{
|
||||||
const QString subdirPath = dir.relativeFilePath(exactDirPath);
|
const QString subdirPath = dir.relativeFilePath(exactDirPath);
|
||||||
|
if (addTorrentParams.useAutoTMM)
|
||||||
|
{
|
||||||
|
addTorrentParams.category = addTorrentParams.category.isEmpty()
|
||||||
|
? subdirPath : (addTorrentParams.category + QLatin1Char('/') + subdirPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
addTorrentParams.savePath = QDir(addTorrentParams.savePath).filePath(subdirPath);
|
addTorrentParams.savePath = QDir(addTorrentParams.savePath).filePath(subdirPath);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
emit torrentFound(result.value(), addTorrentParams);
|
emit torrentFound(result.value(), addTorrentParams);
|
||||||
Utils::Fs::forceRemove(torrentPath);
|
Utils::Fs::forceRemove(torrentPath);
|
||||||
|
Loading…
Reference in New Issue
Block a user