Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:mrbadguy
qbittorrent
use-inotify.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File use-inotify.patch of Package qbittorrent
diff -ur a/src/base/torrentfileswatcher.cpp b/src/base/torrentfileswatcher.cpp --- a/src/base/torrentfileswatcher.cpp 2023-10-22 03:12:59.000000000 +0300 +++ b/src/base/torrentfileswatcher.cpp 2023-10-23 19:40:09.419944878 +0300 @@ -396,8 +396,24 @@ void TorrentFilesWatcher::Worker::processWatchedFolder(const Path &path) { + Path watchedPath = path; +#if defined Q_OS_LINUX + while ( !watchedPath.isEmpty() ) + { + if ( m_watchedFolders.contains(watchedPath) ) { + break; + } + watchedPath = watchedPath.parentPath(); + } + + if ( watchedPath.isEmpty() ) + return; + + const TorrentFilesWatcher::WatchedFolderOptions options = m_watchedFolders.value(watchedPath); +#else const TorrentFilesWatcher::WatchedFolderOptions options = m_watchedFolders.value(path); - processFolder(path, path, options); +#endif + processFolder(path, watchedPath, options); if (!m_failedTorrents.empty() && !m_retryTorrentTimer->isActive()) m_retryTorrentTimer->start(WATCH_INTERVAL); @@ -414,16 +430,7 @@ if (path != watchedFolderPath) { const Path subdirPath = watchedFolderPath.relativePathOf(path); - const bool useAutoTMM = addTorrentParams.useAutoTMM.value_or(!BitTorrent::Session::instance()->isAutoTMMDisabledByDefault()); - if (useAutoTMM) - { - addTorrentParams.category = addTorrentParams.category.isEmpty() - ? subdirPath.data() : (addTorrentParams.category + u'/' + subdirPath.data()); - } - else - { - addTorrentParams.savePath = addTorrentParams.savePath / subdirPath; - } + addTorrentParams.savePath = addTorrentParams.savePath / subdirPath; } if (filePath.hasExtension(u".magnet"_s)) @@ -474,6 +481,13 @@ if (options.recursive) { +#if defined Q_OS_LINUX + QDirIterator dirIter {path.data(), (QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories)}; + while (dirIter.hasNext()) { + const Path folderPath {dirIter.next()}; + m_watcher->addPath(folderPath.data()); + } +#else QDirIterator iter {path.data(), (QDir::Dirs | QDir::NoDotAndDotDot)}; while (iter.hasNext()) { @@ -482,6 +496,7 @@ if (!m_watchedFolders.contains(folderPath)) processFolder(folderPath, watchedFolderPath, options); } +#endif } } @@ -503,16 +518,7 @@ if (torrentPath != watchedFolderPath) { const Path subdirPath = watchedFolderPath.relativePathOf(torrentPath); - const bool useAutoTMM = addTorrentParams.useAutoTMM.value_or(!BitTorrent::Session::instance()->isAutoTMMDisabledByDefault()); - if (useAutoTMM) - { - addTorrentParams.category = addTorrentParams.category.isEmpty() - ? subdirPath.data() : (addTorrentParams.category + u'/' + subdirPath.data()); - } - else - { - addTorrentParams.savePath = addTorrentParams.savePath / subdirPath; - } + addTorrentParams.savePath = addTorrentParams.savePath / subdirPath; } emit torrentFound(loadResult.value(), addTorrentParams); @@ -572,11 +578,21 @@ { if (options.recursive) { +#if defined Q_OS_LINUX + m_watcher->addPath(path.data()); + + QDirIterator dirIter {path.data(), (QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories)}; + while (dirIter.hasNext()) { + const Path subDir {dirIter.next()}; + m_watcher->addPath(subDir.data()); + } +#else m_watcher->removePath(path.data()); m_watchedByTimeoutFolders.insert(path); if (!m_watchTimer->isActive()) m_watchTimer->start(WATCH_INTERVAL); +#endif } else {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor