mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-10 14:57:52 +00:00
Add create subfolder option to RSS auto-download rules
This commit is contained in:
parent
d12468ffb5
commit
325f36fa4f
@ -385,6 +385,7 @@ void AutoDownloader::processJob(const QSharedPointer<ProcessingJob> &job)
|
|||||||
params.savePath = rule.savePath();
|
params.savePath = rule.savePath();
|
||||||
params.category = rule.assignedCategory();
|
params.category = rule.assignedCategory();
|
||||||
params.addPaused = rule.addPaused();
|
params.addPaused = rule.addPaused();
|
||||||
|
params.createSubfolder = rule.createSubfolder();
|
||||||
if (!rule.savePath().isEmpty())
|
if (!rule.savePath().isEmpty())
|
||||||
params.useAutoTMM = TriStateBool::False;
|
params.useAutoTMM = TriStateBool::False;
|
||||||
const auto torrentURL = job->articleData.value(Article::KeyTorrentURL).toString();
|
const auto torrentURL = job->articleData.value(Article::KeyTorrentURL).toString();
|
||||||
|
@ -102,6 +102,7 @@ const QString Str_AssignedCategory(QStringLiteral("assignedCategory"));
|
|||||||
const QString Str_LastMatch(QStringLiteral("lastMatch"));
|
const QString Str_LastMatch(QStringLiteral("lastMatch"));
|
||||||
const QString Str_IgnoreDays(QStringLiteral("ignoreDays"));
|
const QString Str_IgnoreDays(QStringLiteral("ignoreDays"));
|
||||||
const QString Str_AddPaused(QStringLiteral("addPaused"));
|
const QString Str_AddPaused(QStringLiteral("addPaused"));
|
||||||
|
const QString Str_CreateSubfolder(QStringLiteral("createSubfolder"));
|
||||||
const QString Str_SmartFilter(QStringLiteral("smartFilter"));
|
const QString Str_SmartFilter(QStringLiteral("smartFilter"));
|
||||||
const QString Str_PreviouslyMatched(QStringLiteral("previouslyMatchedEpisodes"));
|
const QString Str_PreviouslyMatched(QStringLiteral("previouslyMatchedEpisodes"));
|
||||||
|
|
||||||
@ -123,6 +124,7 @@ namespace RSS
|
|||||||
QString savePath;
|
QString savePath;
|
||||||
QString category;
|
QString category;
|
||||||
TriStateBool addPaused = TriStateBool::Undefined;
|
TriStateBool addPaused = TriStateBool::Undefined;
|
||||||
|
TriStateBool createSubfolder = TriStateBool::Undefined;
|
||||||
|
|
||||||
bool smartFilter = false;
|
bool smartFilter = false;
|
||||||
QStringList previouslyMatchedEpisodes;
|
QStringList previouslyMatchedEpisodes;
|
||||||
@ -144,6 +146,7 @@ namespace RSS
|
|||||||
&& (savePath == other.savePath)
|
&& (savePath == other.savePath)
|
||||||
&& (category == other.category)
|
&& (category == other.category)
|
||||||
&& (addPaused == other.addPaused)
|
&& (addPaused == other.addPaused)
|
||||||
|
&& (createSubfolder == other.createSubfolder)
|
||||||
&& (smartFilter == other.smartFilter);
|
&& (smartFilter == other.smartFilter);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -439,6 +442,7 @@ QJsonObject AutoDownloadRule::toJsonObject() const
|
|||||||
, {Str_LastMatch, lastMatch().toString(Qt::RFC2822Date)}
|
, {Str_LastMatch, lastMatch().toString(Qt::RFC2822Date)}
|
||||||
, {Str_IgnoreDays, ignoreDays()}
|
, {Str_IgnoreDays, ignoreDays()}
|
||||||
, {Str_AddPaused, triStateBoolToJsonValue(addPaused())}
|
, {Str_AddPaused, triStateBoolToJsonValue(addPaused())}
|
||||||
|
, {Str_CreateSubfolder, triStateBoolToJsonValue(createSubfolder())}
|
||||||
, {Str_SmartFilter, useSmartFilter()}
|
, {Str_SmartFilter, useSmartFilter()}
|
||||||
, {Str_PreviouslyMatched, QJsonArray::fromStringList(previouslyMatchedEpisodes())}};
|
, {Str_PreviouslyMatched, QJsonArray::fromStringList(previouslyMatchedEpisodes())}};
|
||||||
}
|
}
|
||||||
@ -455,6 +459,7 @@ AutoDownloadRule AutoDownloadRule::fromJsonObject(const QJsonObject &jsonObj, co
|
|||||||
rule.setSavePath(jsonObj.value(Str_SavePath).toString());
|
rule.setSavePath(jsonObj.value(Str_SavePath).toString());
|
||||||
rule.setCategory(jsonObj.value(Str_AssignedCategory).toString());
|
rule.setCategory(jsonObj.value(Str_AssignedCategory).toString());
|
||||||
rule.setAddPaused(jsonValueToTriStateBool(jsonObj.value(Str_AddPaused)));
|
rule.setAddPaused(jsonValueToTriStateBool(jsonObj.value(Str_AddPaused)));
|
||||||
|
rule.setCreateSubfolder(jsonValueToTriStateBool(jsonObj.value(Str_CreateSubfolder)));
|
||||||
rule.setLastMatch(QDateTime::fromString(jsonObj.value(Str_LastMatch).toString(), Qt::RFC2822Date));
|
rule.setLastMatch(QDateTime::fromString(jsonObj.value(Str_LastMatch).toString(), Qt::RFC2822Date));
|
||||||
rule.setIgnoreDays(jsonObj.value(Str_IgnoreDays).toInt());
|
rule.setIgnoreDays(jsonObj.value(Str_IgnoreDays).toInt());
|
||||||
rule.setUseSmartFilter(jsonObj.value(Str_SmartFilter).toBool(false));
|
rule.setUseSmartFilter(jsonObj.value(Str_SmartFilter).toBool(false));
|
||||||
@ -584,6 +589,16 @@ void AutoDownloadRule::setAddPaused(const TriStateBool &addPaused)
|
|||||||
m_dataPtr->addPaused = addPaused;
|
m_dataPtr->addPaused = addPaused;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TriStateBool AutoDownloadRule::createSubfolder() const
|
||||||
|
{
|
||||||
|
return m_dataPtr->createSubfolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoDownloadRule::setCreateSubfolder(const TriStateBool &createSubfolder)
|
||||||
|
{
|
||||||
|
m_dataPtr->createSubfolder = createSubfolder;
|
||||||
|
}
|
||||||
|
|
||||||
QString AutoDownloadRule::assignedCategory() const
|
QString AutoDownloadRule::assignedCategory() const
|
||||||
{
|
{
|
||||||
return m_dataPtr->category;
|
return m_dataPtr->category;
|
||||||
|
@ -79,6 +79,8 @@ namespace RSS
|
|||||||
void setSavePath(const QString &savePath);
|
void setSavePath(const QString &savePath);
|
||||||
TriStateBool addPaused() const;
|
TriStateBool addPaused() const;
|
||||||
void setAddPaused(const TriStateBool &addPaused);
|
void setAddPaused(const TriStateBool &addPaused);
|
||||||
|
TriStateBool createSubfolder() const;
|
||||||
|
void setCreateSubfolder(const TriStateBool &createSubfolder);
|
||||||
QString assignedCategory() const;
|
QString assignedCategory() const;
|
||||||
void setCategory(const QString &category);
|
void setCategory(const QString &category);
|
||||||
|
|
||||||
|
@ -269,6 +269,12 @@ void AutomatedRssDownloader::updateRuleDefinitionBox()
|
|||||||
else if (m_currentRule.addPaused() == TriStateBool::False)
|
else if (m_currentRule.addPaused() == TriStateBool::False)
|
||||||
index = 2;
|
index = 2;
|
||||||
m_ui->comboAddPaused->setCurrentIndex(index);
|
m_ui->comboAddPaused->setCurrentIndex(index);
|
||||||
|
index = 0;
|
||||||
|
if (m_currentRule.createSubfolder() == TriStateBool::True)
|
||||||
|
index = 1;
|
||||||
|
else if (m_currentRule.createSubfolder() == TriStateBool::False)
|
||||||
|
index = 2;
|
||||||
|
m_ui->comboCreateSubfolder->setCurrentIndex(index);
|
||||||
m_ui->spinIgnorePeriod->setValue(m_currentRule.ignoreDays());
|
m_ui->spinIgnorePeriod->setValue(m_currentRule.ignoreDays());
|
||||||
QDateTime dateTime = m_currentRule.lastMatch();
|
QDateTime dateTime = m_currentRule.lastMatch();
|
||||||
QString lMatch;
|
QString lMatch;
|
||||||
@ -308,6 +314,8 @@ void AutomatedRssDownloader::clearRuleDefinitionBox()
|
|||||||
m_ui->spinIgnorePeriod->setValue(0);
|
m_ui->spinIgnorePeriod->setValue(0);
|
||||||
m_ui->comboAddPaused->clearEditText();
|
m_ui->comboAddPaused->clearEditText();
|
||||||
m_ui->comboAddPaused->setCurrentIndex(-1);
|
m_ui->comboAddPaused->setCurrentIndex(-1);
|
||||||
|
m_ui->comboCreateSubfolder->clearEditText();
|
||||||
|
m_ui->comboCreateSubfolder->setCurrentIndex(-1);
|
||||||
updateFieldsToolTips(m_ui->checkRegex->isChecked());
|
updateFieldsToolTips(m_ui->checkRegex->isChecked());
|
||||||
updateMustLineValidity();
|
updateMustLineValidity();
|
||||||
updateMustNotLineValidity();
|
updateMustNotLineValidity();
|
||||||
@ -341,6 +349,12 @@ void AutomatedRssDownloader::updateEditedRule()
|
|||||||
else if (m_ui->comboAddPaused->currentIndex() == 2)
|
else if (m_ui->comboAddPaused->currentIndex() == 2)
|
||||||
addPaused = TriStateBool::False;
|
addPaused = TriStateBool::False;
|
||||||
m_currentRule.setAddPaused(addPaused);
|
m_currentRule.setAddPaused(addPaused);
|
||||||
|
TriStateBool createSubfolder; // Undefined by default
|
||||||
|
if (m_ui->comboCreateSubfolder->currentIndex() == 1)
|
||||||
|
createSubfolder = TriStateBool::True;
|
||||||
|
else if (m_ui->comboCreateSubfolder->currentIndex() == 2)
|
||||||
|
createSubfolder = TriStateBool::False;
|
||||||
|
m_currentRule.setCreateSubfolder(createSubfolder);
|
||||||
m_currentRule.setIgnoreDays(m_ui->spinIgnorePeriod->value());
|
m_currentRule.setIgnoreDays(m_ui->spinIgnorePeriod->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,6 +322,42 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="lblCreateSubfolder">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Create Subfolder:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboCreateSubfolder">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Use global settings</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Always</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Never</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -435,6 +471,7 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also
|
|||||||
<tabstop>lineSavePath</tabstop>
|
<tabstop>lineSavePath</tabstop>
|
||||||
<tabstop>spinIgnorePeriod</tabstop>
|
<tabstop>spinIgnorePeriod</tabstop>
|
||||||
<tabstop>comboAddPaused</tabstop>
|
<tabstop>comboAddPaused</tabstop>
|
||||||
|
<tabstop>comboCreateSubfolder</tabstop>
|
||||||
<tabstop>listFeeds</tabstop>
|
<tabstop>listFeeds</tabstop>
|
||||||
<tabstop>treeMatchingArticles</tabstop>
|
<tabstop>treeMatchingArticles</tabstop>
|
||||||
<tabstop>importBtn</tabstop>
|
<tabstop>importBtn</tabstop>
|
||||||
|
Loading…
Reference in New Issue
Block a user