diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 540af4a06..d52acbe17 100644 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -952,7 +952,17 @@ QTorrentHandle QBtSession::addMagnetUri(QString magnet_uri, bool resumed, bool f add_torrent_params p = initializeAddTorrentParams(hash); // Get save path - const QString savePath(getSavePath(hash, fromScanDir, filePath)); + QString savePath; + if (!resumed && savepathLabel_fromurl.contains(magnet_uri)) { + QPair 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) { qDebug("addMagnetURI: Temp folder is enabled."); QString torrent_tmp_path = defaultTempPath.replace("\\", "/"); @@ -2647,14 +2657,17 @@ void QBtSession::addMagnetInteractive(const QString& 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); } void QBtSession::downloadUrlAndSkipDialog(QString url, QString save_path, QString label) { //emit aboutToDownloadFromUrl(url); const QUrl qurl = QUrl::fromEncoded(url.toUtf8()); - savepathLabel_fromurl[qurl] = qMakePair(save_path, label); + if (!save_path.isEmpty() || !label.isEmpty()) + savepathLabel_fromurl[qurl] = qMakePair(save_path, label); url_skippingDlg << qurl; // Launch downloader thread downloader->downloadTorrentUrl(url); diff --git a/src/qtlibtorrent/qbtsession.h b/src/qtlibtorrent/qbtsession.h index e3fe33b2d..55ca113a6 100644 --- a/src/qtlibtorrent/qbtsession.h +++ b/src/qtlibtorrent/qbtsession.h @@ -161,7 +161,7 @@ public slots: #endif void addPeerBanMessage(QString msg, bool from_ipfilter); 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 downloadFromURLList(const QStringList& urls); void configureSession(); diff --git a/src/rss/rssfeed.cpp b/src/rss/rssfeed.cpp index b615f791a..3cf96366a 100644 --- a/src/rss/rssfeed.cpp +++ b/src/rss/rssfeed.cpp @@ -296,7 +296,7 @@ void RssFeed::downloadMatchingArticleTorrents() { QString torrent_url = article->hasAttachment() ? article->torrentUrl() : article->link(); QBtSession::instance()->addConsoleMessage(tr("Automatically downloading %1 torrent from %2 RSS feed...").arg(article->title()).arg(displayName())); if (torrent_url.startsWith("magnet:", Qt::CaseInsensitive)) - QBtSession::instance()->addMagnetSkipAddDlg(torrent_url); + QBtSession::instance()->addMagnetSkipAddDlg(torrent_url, matching_rule.savePath(), matching_rule.label()); else QBtSession::instance()->downloadUrlAndSkipDialog(torrent_url, matching_rule->savePath(), matching_rule->label()); }