Add unified class to represent parsed torrent metadata

* Add unified class to represent parsed torrent metadata
* Unify startup logic of "Add new torrent dialog"

PR #19301.
This commit is contained in:
Vladimir Golovnev
2023-07-21 08:40:16 +03:00
committed by GitHub
parent d554f4d44a
commit f27f2c20e0
18 changed files with 498 additions and 439 deletions

View File

@@ -41,8 +41,8 @@
#include <QVariant>
#include <QVector>
#include "../bittorrent/magneturi.h"
#include "../bittorrent/session.h"
#include "../bittorrent/torrentdescriptor.h"
#include "../asyncfilestorage.h"
#include "../global.h"
#include "../logger.h"
@@ -474,7 +474,7 @@ void AutoDownloader::processJob(const QSharedPointer<ProcessingJob> &job)
const auto torrentURL = job->articleData.value(Article::KeyTorrentURL).toString();
BitTorrent::Session::instance()->addTorrent(torrentURL, rule.addTorrentParams());
if (BitTorrent::MagnetUri(torrentURL).isValid())
if (BitTorrent::TorrentDescriptor::parse(torrentURL))
{
if (Feed *feed = Session::instance()->feedByURL(job->feedURL))
{