mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 16:58:06 -06:00
@@ -81,7 +81,7 @@ namespace
|
||||
QPointer<SearchPluginManager> SearchPluginManager::m_instance = nullptr;
|
||||
|
||||
SearchPluginManager::SearchPluginManager()
|
||||
: m_updateUrl(QString("http://searchplugins.qbittorrent.org/%1/engines/").arg(Utils::ForeignApps::pythonInfo().version.majorNumber() >= 3 ? "nova3" : "nova"))
|
||||
: m_updateUrl(QLatin1String("http://searchplugins.qbittorrent.org/nova3/engines/"))
|
||||
{
|
||||
Q_ASSERT(!m_instance); // only one instance is allowed
|
||||
m_instance = this;
|
||||
@@ -345,9 +345,7 @@ QString SearchPluginManager::engineLocation()
|
||||
{
|
||||
static QString location;
|
||||
if (location.isEmpty()) {
|
||||
const QString folder = (Utils::ForeignApps::pythonInfo().version.majorNumber() >= 3)
|
||||
? "nova3" : "nova";
|
||||
location = Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Data) + folder);
|
||||
location = Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Data) + "nova3");
|
||||
|
||||
const QDir locationDir(location);
|
||||
locationDir.mkpath(locationDir.absolutePath());
|
||||
@@ -391,8 +389,6 @@ void SearchPluginManager::updateNova()
|
||||
{
|
||||
// create nova directory if necessary
|
||||
const QDir searchDir(engineLocation());
|
||||
const QString novaFolder = Utils::ForeignApps::pythonInfo().version.majorNumber() >= 3
|
||||
? "searchengine/nova3" : "searchengine/nova";
|
||||
|
||||
QFile packageFile(searchDir.absoluteFilePath("__init__.py"));
|
||||
packageFile.open(QIODevice::WriteOnly);
|
||||
@@ -405,9 +401,9 @@ void SearchPluginManager::updateNova()
|
||||
packageFile2.close();
|
||||
|
||||
// Copy search plugin files (if necessary)
|
||||
const auto updateFile = [&novaFolder](const QString &filename, const bool compareVersion)
|
||||
const auto updateFile = [](const QString &filename, const bool compareVersion)
|
||||
{
|
||||
const QString filePathBundled = ":/" + novaFolder + '/' + filename;
|
||||
const QString filePathBundled = ":/searchengine/nova3/" + filename;
|
||||
const QString filePathDisk = QDir(engineLocation()).absoluteFilePath(filename);
|
||||
|
||||
if (compareVersion && (getPluginVersion(filePathBundled) <= getPluginVersion(filePathDisk)))
|
||||
@@ -421,12 +417,8 @@ void SearchPluginManager::updateNova()
|
||||
updateFile("nova2.py", true);
|
||||
updateFile("nova2dl.py", true);
|
||||
updateFile("novaprinter.py", true);
|
||||
updateFile("sgmllib3.py", false);
|
||||
updateFile("socks.py", false);
|
||||
|
||||
if (Utils::ForeignApps::pythonInfo().version.majorNumber() >= 3)
|
||||
updateFile("sgmllib3.py", false);
|
||||
else
|
||||
updateFile("fix_encoding.py", false);
|
||||
}
|
||||
|
||||
void SearchPluginManager::update()
|
||||
|
||||
Reference in New Issue
Block a user