qBittorrent
|
#include <rss_autodownloader.h>
Public Types | |
enum class | RulesFileFormat { Legacy , JSON } |
Signals | |
void | processingStateChanged (bool enabled) |
void | ruleAdded (const QString &ruleName) |
void | ruleChanged (const QString &ruleName) |
void | ruleRenamed (const QString &ruleName, const QString &oldRuleName) |
void | ruleAboutToBeRemoved (const QString &ruleName) |
Public Member Functions | |
bool | isProcessingEnabled () const |
void | setProcessingEnabled (bool enabled) |
QStringList | smartEpisodeFilters () const |
void | setSmartEpisodeFilters (const QStringList &filters) |
QRegularExpression | smartEpisodeRegex () const |
bool | downloadRepacks () const |
void | setDownloadRepacks (bool enabled) |
bool | hasRule (const QString &ruleName) const |
AutoDownloadRule | ruleByName (const QString &ruleName) const |
QList< AutoDownloadRule > | rules () const |
void | insertRule (const AutoDownloadRule &rule) |
bool | renameRule (const QString &ruleName, const QString &newRuleName) |
void | removeRule (const QString &ruleName) |
QByteArray | exportRules (RulesFileFormat format=RulesFileFormat::JSON) const |
void | importRules (const QByteArray &data, RulesFileFormat format=RulesFileFormat::JSON) |
Static Public Member Functions | |
static AutoDownloader * | instance () |
Private Slots | |
void | process () |
void | handleTorrentDownloadFinished (const QString &url) |
void | handleTorrentDownloadFailed (const QString &url) |
void | handleNewArticle (const Article *article) |
Private Member Functions | |
AutoDownloader () | |
~AutoDownloader () override | |
void | timerEvent (QTimerEvent *event) override |
void | setRule_impl (const AutoDownloadRule &rule) |
void | resetProcessingQueue () |
void | startProcessing () |
void | addJobForArticle (const Article *article) |
void | processJob (const QSharedPointer< ProcessingJob > &job) |
void | load () |
void | loadRules (const QByteArray &data) |
void | loadRulesLegacy () |
void | store () |
void | storeDeferred () |
QByteArray | exportRulesToJSONFormat () const |
void | importRulesFromJSONFormat (const QByteArray &data) |
QByteArray | exportRulesToLegacyFormat () const |
void | importRulesFromLegacyFormat (const QByteArray &data) |
Private Attributes | |
CachedSettingValue< bool > | m_storeProcessingEnabled |
SettingValue< QVariant > | m_storeSmartEpisodeFilter |
SettingValue< bool > | m_storeDownloadRepacks |
QTimer * | m_processingTimer |
QThread * | m_ioThread |
AsyncFileStorage * | m_fileStorage |
QHash< QString, AutoDownloadRule > | m_rules |
QList< QSharedPointer< ProcessingJob > > | m_processingQueue |
QHash< QString, QSharedPointer< ProcessingJob > > | m_waitingJobs |
bool | m_dirty = false |
QBasicTimer | m_savingTimer |
QRegularExpression | m_smartEpisodeRegex |
Static Private Attributes | |
static QPointer< AutoDownloader > | m_instance = nullptr |
Friends | |
class | ::Application |
Definition at line 63 of file rss_autodownloader.h.
|
strong |
Enumerator | |
---|---|
Legacy | |
JSON |
Definition at line 74 of file rss_autodownloader.h.
|
private |
Definition at line 100 of file rss_autodownloader.cpp.
References computeSmartFilterRegex(), ConfFolderName(), Config, Log::CRITICAL, BitTorrent::Session::downloadFromUrlFailed(), BitTorrent::Session::downloadFromUrlFinished(), Utils::Fs::expandPathAbs(), AsyncFileStorage::failed(), Utils::Fs::fileName(), handleTorrentDownloadFailed(), handleTorrentDownloadFinished(), BitTorrent::Session::instance(), isProcessingEnabled(), load(), LogMsg(), m_fileStorage, m_instance, m_ioThread, m_processingTimer, m_smartEpisodeRegex, process(), smartEpisodeFilters(), specialFolderLocation(), and startProcessing().
|
overrideprivate |
Definition at line 146 of file rss_autodownloader.cpp.
References m_ioThread, and store().
|
private |
Definition at line 363 of file rss_autodownloader.cpp.
References RSS::Article::data(), RSS::Article::feed(), m_processingQueue, m_processingTimer, m_waitingJobs, RSS::Article::torrentUrl(), and RSS::Feed::url().
Referenced by handleNewArticle(), and resetProcessingQueue().
bool AutoDownloader::downloadRepacks | ( | ) | const |
Definition at line 316 of file rss_autodownloader.cpp.
References SettingValue< T >::get(), and m_storeDownloadRepacks.
Referenced by OptionsDialog::loadOptions(), and AppController::preferencesAction().
QByteArray AutoDownloader::exportRules | ( | AutoDownloader::RulesFileFormat | format = RulesFileFormat::JSON | ) | const |
Definition at line 221 of file rss_autodownloader.cpp.
References exportRulesToJSONFormat(), exportRulesToLegacyFormat(), and Legacy.
Referenced by AutomatedRssDownloader::on_exportBtn_clicked().
|
private |
Definition at line 244 of file rss_autodownloader.cpp.
References asConst(), and rules().
Referenced by exportRules().
|
private |
Definition at line 259 of file rss_autodownloader.cpp.
References asConst(), and rules().
Referenced by exportRules().
|
privateslot |
Definition at line 352 of file rss_autodownloader.cpp.
References addJobForArticle(), RSS::Article::isRead(), and RSS::Article::torrentUrl().
Referenced by setProcessingEnabled(), and startProcessing().
|
privateslot |
Definition at line 346 of file rss_autodownloader.cpp.
References m_waitingJobs.
Referenced by AutoDownloader().
|
privateslot |
Definition at line 336 of file rss_autodownloader.cpp.
References RSS::Session::instance(), RSS::Article::KeyId, and m_waitingJobs.
Referenced by AutoDownloader().
bool AutoDownloader::hasRule | ( | const QString & | ruleName | ) | const |
Definition at line 159 of file rss_autodownloader.cpp.
References m_rules.
Referenced by insertRule(), and renameRule().
void AutoDownloader::importRules | ( | const QByteArray & | data, |
const AutoDownloader::RulesFileFormat | format = RulesFileFormat::JSON |
||
) |
Definition at line 232 of file rss_autodownloader.cpp.
References importRulesFromJSONFormat(), importRulesFromLegacyFormat(), and Legacy.
Referenced by AutomatedRssDownloader::on_importBtn_clicked().
|
private |
Definition at line 253 of file rss_autodownloader.cpp.
References asConst(), insertRule(), and anonymous_namespace{rss_autodownloader.cpp}::rulesFromJSON().
Referenced by importRules().
|
private |
Definition at line 273 of file rss_autodownloader.cpp.
References asConst(), RSS::AutoDownloadRule::fromLegacyDict(), and insertRule().
Referenced by importRules().
void AutoDownloader::insertRule | ( | const AutoDownloadRule & | rule | ) |
Definition at line 174 of file rss_autodownloader.cpp.
References hasRule(), m_dirty, RSS::AutoDownloadRule::name(), resetProcessingQueue(), ruleAdded(), ruleByName(), ruleChanged(), setRule_impl(), store(), and storeDeferred().
Referenced by AutomatedRssDownloader::handleFeedCheckStateChange(), importRulesFromJSONFormat(), importRulesFromLegacyFormat(), loadRulesLegacy(), AutomatedRssDownloader::on_addRuleBtn_clicked(), AutomatedRssDownloader::saveEditedRule(), and RSSController::setRuleAction().
|
static |
Definition at line 154 of file rss_autodownloader.cpp.
References m_instance.
Referenced by AutomatedRssDownloader::AutomatedRssDownloader(), Application::cleanup(), computeEpisodeName(), AutomatedRssDownloader::handleFeedCheckStateChange(), AutomatedRssDownloader::handleRuleChanged(), OptionsDialog::loadOptions(), RSS::AutoDownloadRule::matchesSmartEpisodeFilter(), RSSController::matchingArticlesAction(), AutomatedRssDownloader::on_addRuleBtn_clicked(), AutomatedRssDownloader::on_exportBtn_clicked(), AutomatedRssDownloader::on_importBtn_clicked(), AutomatedRssDownloader::on_removeRuleBtn_clicked(), AppController::preferencesAction(), RSSController::removeRuleAction(), RSSController::renameRuleAction(), AutomatedRssDownloader::renameSelectedRule(), RSSController::rulesAction(), AutomatedRssDownloader::saveEditedRule(), OptionsDialog::saveOptions(), AppController::setPreferencesAction(), RSSController::setRuleAction(), AutomatedRssDownloader::updateFeedList(), AutomatedRssDownloader::updateMatchingArticles(), and AutomatedRssDownloader::updateRuleDefinitionBox().
bool AutoDownloader::isProcessingEnabled | ( | ) | const |
Definition at line 475 of file rss_autodownloader.cpp.
References m_storeProcessingEnabled.
Referenced by AutoDownloader(), OptionsDialog::loadOptions(), AppController::preferencesAction(), and resetProcessingQueue().
|
private |
Definition at line 415 of file rss_autodownloader.cpp.
References Log::CRITICAL, loadRules(), loadRulesLegacy(), LogMsg(), m_fileStorage, RulesFileName(), and AsyncFileStorage::storageDir().
Referenced by AutoDownloader().
|
private |
Definition at line 428 of file rss_autodownloader.cpp.
References Log::CRITICAL, LogMsg(), Exception::message(), rules(), anonymous_namespace{rss_autodownloader.cpp}::rulesFromJSON(), and setRule_impl().
Referenced by load().
|
private |
Definition at line 443 of file rss_autodownloader.cpp.
References Profile::applicationSettings(), RSS::AutoDownloadRule::fromLegacyDict(), insertRule(), Profile::instance(), rules(), and anonymous_namespace{addnewtorrentdialog.cpp}::settings().
Referenced by load().
|
privateslot |
Definition at line 326 of file rss_autodownloader.cpp.
References m_processingQueue, m_processingTimer, and processJob().
Referenced by AutoDownloader().
|
signal |
Referenced by AutomatedRssDownloader::AutomatedRssDownloader(), and setProcessingEnabled().
|
private |
Definition at line 376 of file rss_autodownloader.cpp.
References BitTorrent::AddTorrentParams::addPaused, BitTorrent::Session::addTorrent(), BitTorrent::AddTorrentParams::category, BitTorrent::AddTorrentParams::contentLayout, BitTorrent::Session::instance(), RSS::Session::instance(), RSS::Article::KeyId, RSS::Article::KeyTorrentURL, m_dirty, m_rules, m_waitingJobs, BitTorrent::AddTorrentParams::savePath, storeDeferred(), and BitTorrent::AddTorrentParams::useAutoTMM.
Referenced by process().
void AutoDownloader::removeRule | ( | const QString & | ruleName | ) |
Definition at line 210 of file rss_autodownloader.cpp.
References m_dirty, m_rules, ruleAboutToBeRemoved(), and store().
Referenced by AutomatedRssDownloader::on_removeRuleBtn_clicked(), and RSSController::removeRuleAction().
bool AutoDownloader::renameRule | ( | const QString & | ruleName, |
const QString & | newRuleName | ||
) |
Definition at line 196 of file rss_autodownloader.cpp.
References hasRule(), m_dirty, m_rules, ruleRenamed(), RSS::AutoDownloadRule::setName(), and store().
Referenced by RSSController::renameRuleAction(), and AutomatedRssDownloader::renameSelectedRule().
|
private |
Definition at line 480 of file rss_autodownloader.cpp.
References addJobForArticle(), asConst(), RSS::Session::instance(), isProcessingEnabled(), and m_processingQueue.
Referenced by insertRule(), and startProcessing().
|
signal |
Referenced by AutomatedRssDownloader::AutomatedRssDownloader(), and removeRule().
|
signal |
Referenced by AutomatedRssDownloader::AutomatedRssDownloader(), and insertRule().
AutoDownloadRule AutoDownloader::ruleByName | ( | const QString & | ruleName | ) | const |
Definition at line 164 of file rss_autodownloader.cpp.
References m_rules.
Referenced by AutomatedRssDownloader::handleFeedCheckStateChange(), insertRule(), RSSController::matchingArticlesAction(), AutomatedRssDownloader::updateFeedList(), AutomatedRssDownloader::updateMatchingArticles(), and AutomatedRssDownloader::updateRuleDefinitionBox().
|
signal |
Referenced by AutomatedRssDownloader::AutomatedRssDownloader(), and insertRule().
|
signal |
Referenced by AutomatedRssDownloader::AutomatedRssDownloader(), and renameRule().
QList< AutoDownloadRule > AutoDownloader::rules | ( | ) | const |
Definition at line 169 of file rss_autodownloader.cpp.
References m_rules.
Referenced by exportRulesToJSONFormat(), exportRulesToLegacyFormat(), loadRules(), loadRulesLegacy(), and RSSController::rulesAction().
void AutoDownloader::setDownloadRepacks | ( | bool | enabled | ) |
Definition at line 321 of file rss_autodownloader.cpp.
References m_storeDownloadRepacks.
Referenced by OptionsDialog::saveOptions(), and AppController::setPreferencesAction().
void AutoDownloader::setProcessingEnabled | ( | bool | enabled | ) |
Definition at line 498 of file rss_autodownloader.cpp.
References handleNewArticle(), RSS::Session::instance(), m_processingQueue, m_storeProcessingEnabled, RSS::Item::newArticle(), processingStateChanged(), and startProcessing().
Referenced by OptionsDialog::saveOptions(), and AppController::setPreferencesAction().
|
private |
Definition at line 358 of file rss_autodownloader.cpp.
References m_rules, and RSS::AutoDownloadRule::name().
Referenced by insertRule(), and loadRules().
void AutoDownloader::setSmartEpisodeFilters | ( | const QStringList & | filters | ) |
Definition at line 308 of file rss_autodownloader.cpp.
References computeSmartFilterRegex(), m_smartEpisodeRegex, and m_storeSmartEpisodeFilter.
Referenced by OptionsDialog::saveOptions(), and AppController::setPreferencesAction().
QStringList AutoDownloader::smartEpisodeFilters | ( | ) | const |
Definition at line 286 of file rss_autodownloader.cpp.
References SettingValue< T >::get(), and m_storeSmartEpisodeFilter.
Referenced by AutoDownloader(), OptionsDialog::loadOptions(), and AppController::preferencesAction().
QRegularExpression AutoDownloader::smartEpisodeRegex | ( | ) | const |
Definition at line 303 of file rss_autodownloader.cpp.
References m_smartEpisodeRegex.
Referenced by computeEpisodeName().
|
private |
Definition at line 492 of file rss_autodownloader.cpp.
References handleNewArticle(), RSS::Session::instance(), RSS::Item::newArticle(), and resetProcessingQueue().
Referenced by AutoDownloader(), and setProcessingEnabled().
|
private |
Definition at line 455 of file rss_autodownloader.cpp.
References asConst(), m_dirty, m_fileStorage, m_rules, m_savingTimer, RulesFileName(), and AsyncFileStorage::store().
Referenced by insertRule(), removeRule(), renameRule(), timerEvent(), and ~AutoDownloader().
|
private |
Definition at line 469 of file rss_autodownloader.cpp.
References m_savingTimer.
Referenced by insertRule(), and processJob().
|
overrideprivate |
Definition at line 517 of file rss_autodownloader.cpp.
References store().
|
friend |
Definition at line 68 of file rss_autodownloader.h.
|
private |
Definition at line 145 of file rss_autodownloader.h.
Referenced by insertRule(), processJob(), removeRule(), renameRule(), and store().
|
private |
Definition at line 141 of file rss_autodownloader.h.
Referenced by AutoDownloader(), load(), and store().
|
staticprivate |
Definition at line 133 of file rss_autodownloader.h.
Referenced by AutoDownloader(), and instance().
|
private |
Definition at line 140 of file rss_autodownloader.h.
Referenced by AutoDownloader(), and ~AutoDownloader().
|
private |
Definition at line 143 of file rss_autodownloader.h.
Referenced by addJobForArticle(), process(), resetProcessingQueue(), and setProcessingEnabled().
|
private |
Definition at line 139 of file rss_autodownloader.h.
Referenced by addJobForArticle(), AutoDownloader(), and process().
|
private |
Definition at line 142 of file rss_autodownloader.h.
Referenced by hasRule(), processJob(), removeRule(), renameRule(), ruleByName(), rules(), setRule_impl(), and store().
|
private |
Definition at line 146 of file rss_autodownloader.h.
Referenced by store(), and storeDeferred().
|
private |
Definition at line 147 of file rss_autodownloader.h.
Referenced by AutoDownloader(), setSmartEpisodeFilters(), and smartEpisodeRegex().
|
private |
Definition at line 137 of file rss_autodownloader.h.
Referenced by downloadRepacks(), and setDownloadRepacks().
|
private |
Definition at line 135 of file rss_autodownloader.h.
Referenced by isProcessingEnabled(), and setProcessingEnabled().
|
private |
Definition at line 136 of file rss_autodownloader.h.
Referenced by setSmartEpisodeFilters(), and smartEpisodeFilters().
|
private |
Definition at line 144 of file rss_autodownloader.h.
Referenced by addJobForArticle(), handleTorrentDownloadFailed(), handleTorrentDownloadFinished(), and processJob().