mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 23:17:21 -06:00
- Use torrent addition dialog for Magnet URIs too
This commit is contained in:
13
src/misc.h
13
src/misc.h
@@ -41,6 +41,7 @@
|
||||
#include <QList>
|
||||
#include <QPair>
|
||||
#include <QThread>
|
||||
#include <QUrl>
|
||||
#include <ctime>
|
||||
#include <QDateTime>
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
@@ -435,6 +436,18 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
static QString magnetUriToName(QString magnet_uri) {
|
||||
QString name = "";
|
||||
QRegExp regHex("dn=([^&]+)");
|
||||
int pos = regHex.indexIn(magnet_uri);
|
||||
if(pos > -1) {
|
||||
QString found = regHex.cap(1);
|
||||
// URL decode
|
||||
name = QUrl::fromPercentEncoding(found.toLocal8Bit()).replace("+", " ");
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
static QString magnetUriToHash(QString magnet_uri) {
|
||||
QString hash = "";
|
||||
QRegExp regHex("urn:btih:([0-9A-Za-z]+)");
|
||||
|
||||
Reference in New Issue
Block a user