mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 12:59:56 -07:00
Support custom save path / label for RSS feeds using magnet links
This commit is contained in:
parent
e8cd92e245
commit
11e0b7c9b5
3 changed files with 18 additions and 5 deletions
|
@ -972,7 +972,17 @@ QTorrentHandle QBtSession::addMagnetUri(QString magnet_uri, bool resumed) {
|
||||||
add_torrent_params p = initializeAddTorrentParams(hash);
|
add_torrent_params p = initializeAddTorrentParams(hash);
|
||||||
|
|
||||||
// Get save path
|
// Get save path
|
||||||
const QString savePath(getSavePath(hash, false));
|
QString savePath;
|
||||||
|
if (!resumed && savepathLabel_fromurl.contains(magnet_uri)) {
|
||||||
|
QPair<QString, QString> savePath_label = savepathLabel_fromurl.take(magnet_uri);
|
||||||
|
if(!savePath_label.first.isEmpty())
|
||||||
|
savePath = savePath_label.first;
|
||||||
|
// Remember label
|
||||||
|
if(!savePath_label.second.isEmpty())
|
||||||
|
TorrentTempData::setLabel(hash, savePath_label.second);
|
||||||
|
}
|
||||||
|
if (savePath.isEmpty())
|
||||||
|
savePath = getSavePath(hash, false);
|
||||||
if(!defaultTempPath.isEmpty() && !TorrentPersistentData::isSeed(hash) && resumed) {
|
if(!defaultTempPath.isEmpty() && !TorrentPersistentData::isSeed(hash) && resumed) {
|
||||||
qDebug("addMagnetURI: Temp folder is enabled.");
|
qDebug("addMagnetURI: Temp folder is enabled.");
|
||||||
QString torrent_tmp_path = defaultTempPath.replace("\\", "/");
|
QString torrent_tmp_path = defaultTempPath.replace("\\", "/");
|
||||||
|
@ -2780,13 +2790,16 @@ void QBtSession::addMagnetInteractive(const QString& uri)
|
||||||
emit newMagnetLink(uri);
|
emit newMagnetLink(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QBtSession::addMagnetSkipAddDlg(const QString& uri) {
|
void QBtSession::addMagnetSkipAddDlg(const QString& uri, const QString& save_path, const QString& label) {
|
||||||
|
if (!save_path.isEmpty() || !label.isEmpty())
|
||||||
|
savepathLabel_fromurl[uri] = qMakePair(save_path, label);
|
||||||
addMagnetUri(uri, false);
|
addMagnetUri(uri, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QBtSession::downloadUrlAndSkipDialog(QString url, QString save_path, QString label) {
|
void QBtSession::downloadUrlAndSkipDialog(QString url, QString save_path, QString label) {
|
||||||
//emit aboutToDownloadFromUrl(url);
|
//emit aboutToDownloadFromUrl(url);
|
||||||
const QUrl qurl = QUrl::fromEncoded(url.toUtf8());
|
const QUrl qurl = QUrl::fromEncoded(url.toUtf8());
|
||||||
|
if (!save_path.isEmpty() || !label.isEmpty())
|
||||||
savepathLabel_fromurl[qurl] = qMakePair(save_path, label);
|
savepathLabel_fromurl[qurl] = qMakePair(save_path, label);
|
||||||
url_skippingDlg << qurl;
|
url_skippingDlg << qurl;
|
||||||
// Launch downloader thread
|
// Launch downloader thread
|
||||||
|
|
|
@ -164,7 +164,7 @@ public slots:
|
||||||
#endif
|
#endif
|
||||||
void addPeerBanMessage(QString msg, bool from_ipfilter);
|
void addPeerBanMessage(QString msg, bool from_ipfilter);
|
||||||
void processDownloadedFile(QString, QString);
|
void processDownloadedFile(QString, QString);
|
||||||
void addMagnetSkipAddDlg(const QString& uri);
|
void addMagnetSkipAddDlg(const QString& uri, const QString& save_path = QString(), const QString& label = QString());
|
||||||
void addMagnetInteractive(const QString& uri);
|
void addMagnetInteractive(const QString& uri);
|
||||||
void downloadFromURLList(const QStringList& urls);
|
void downloadFromURLList(const QStringList& urls);
|
||||||
void configureSession();
|
void configureSession();
|
||||||
|
|
|
@ -315,7 +315,7 @@ void RssFeed::downloadMatchingArticleTorrents() {
|
||||||
// Download the torrent
|
// Download the torrent
|
||||||
QBtSession::instance()->addConsoleMessage(tr("Automatically downloading %1 torrent from %2 RSS feed...").arg(item.title()).arg(displayName()));
|
QBtSession::instance()->addConsoleMessage(tr("Automatically downloading %1 torrent from %2 RSS feed...").arg(item.title()).arg(displayName()));
|
||||||
if (torrent_url.startsWith("magnet:", Qt::CaseInsensitive))
|
if (torrent_url.startsWith("magnet:", Qt::CaseInsensitive))
|
||||||
QBtSession::instance()->addMagnetSkipAddDlg(torrent_url);
|
QBtSession::instance()->addMagnetSkipAddDlg(torrent_url, matching_rule.savePath(), matching_rule.label());
|
||||||
else
|
else
|
||||||
QBtSession::instance()->downloadUrlAndSkipDialog(torrent_url, matching_rule.savePath(), matching_rule.label());
|
QBtSession::instance()->downloadUrlAndSkipDialog(torrent_url, matching_rule.savePath(), matching_rule.label());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue