Browse Source

Fix possible search plugin update issue

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
af61ed7c72
  1. 1
      src/engineselectdlg.cpp
  2. 2
      src/search_engine/engines/torrentdownloads.py
  3. 2
      src/search_engine/engines/versions.txt
  4. 8
      src/searchengine.cpp

1
src/engineselectdlg.cpp

@ -270,6 +270,7 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) {
// Backup in case install fails // Backup in case install fails
QFile::copy(dest_path, dest_path+".bak"); QFile::copy(dest_path, dest_path+".bak");
misc::safeRemove(dest_path); misc::safeRemove(dest_path);
misc::safeRemove(dest_path+"c");
update = true; update = true;
} }
// Copy the plugin // Copy the plugin

2
src/search_engine/engines/torrentdownloads.py

@ -1,4 +1,4 @@
#VERSION: 1.05 #VERSION: 1.06
#AUTHORS: Christophe Dumez (chris@qbittorrent.org) #AUTHORS: Christophe Dumez (chris@qbittorrent.org)
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

2
src/search_engine/engines/versions.txt

@ -4,4 +4,4 @@ btjunkie: 2.21
mininova: 1.40 mininova: 1.40
piratebay: 1.30 piratebay: 1.30
vertor: 1.0 vertor: 1.0
torrentdownloads: 1.05 torrentdownloads: 1.06

8
src/searchengine.cpp

@ -484,8 +484,10 @@ void SearchEngine::updateNova() {
// Copy search plugin files (if necessary) // Copy search plugin files (if necessary)
QString filePath = search_dir.absoluteFilePath("nova2.py"); QString filePath = search_dir.absoluteFilePath("nova2.py");
if(getPluginVersion(":/search_engine/nova2.py") > getPluginVersion(filePath)) { if(getPluginVersion(":/search_engine/nova2.py") > getPluginVersion(filePath)) {
if(QFile::exists(filePath)) if(QFile::exists(filePath)) {
misc::safeRemove(filePath); misc::safeRemove(filePath);
misc::safeRemove(filePath+"c");
}
QFile::copy(":/search_engine/nova2.py", filePath); QFile::copy(":/search_engine/nova2.py", filePath);
} }
@ -493,6 +495,7 @@ void SearchEngine::updateNova() {
if(getPluginVersion(":/search_engine/nova2dl.py") > getPluginVersion(filePath)) { if(getPluginVersion(":/search_engine/nova2dl.py") > getPluginVersion(filePath)) {
if(QFile::exists(filePath)){ if(QFile::exists(filePath)){
misc::safeRemove(filePath); misc::safeRemove(filePath);
misc::safeRemove(filePath+"c");
} }
QFile::copy(":/search_engine/nova2dl.py", filePath); QFile::copy(":/search_engine/nova2dl.py", filePath);
} }
@ -501,6 +504,7 @@ void SearchEngine::updateNova() {
if(getPluginVersion(":/search_engine/novaprinter.py") > getPluginVersion(filePath)) { if(getPluginVersion(":/search_engine/novaprinter.py") > getPluginVersion(filePath)) {
if(QFile::exists(filePath)){ if(QFile::exists(filePath)){
misc::safeRemove(filePath); misc::safeRemove(filePath);
misc::safeRemove(filePath+"c");
} }
QFile::copy(":/search_engine/novaprinter.py", filePath); QFile::copy(":/search_engine/novaprinter.py", filePath);
} }
@ -509,6 +513,7 @@ void SearchEngine::updateNova() {
if(getPluginVersion(":/search_engine/helpers.py") > getPluginVersion(filePath)) { if(getPluginVersion(":/search_engine/helpers.py") > getPluginVersion(filePath)) {
if(QFile::exists(filePath)){ if(QFile::exists(filePath)){
misc::safeRemove(filePath); misc::safeRemove(filePath);
misc::safeRemove(filePath+"c");
} }
QFile::copy(":/search_engine/helpers.py", filePath); QFile::copy(":/search_engine/helpers.py", filePath);
} }
@ -530,6 +535,7 @@ void SearchEngine::updateNova() {
if(QFile::exists(dest_file)) { if(QFile::exists(dest_file)) {
qDebug("Removing old %s", qPrintable(dest_file)); qDebug("Removing old %s", qPrintable(dest_file));
misc::safeRemove(dest_file); misc::safeRemove(dest_file);
misc::safeRemove(dest_file+"c");
} }
qDebug("%s copied to %s", qPrintable(shipped_file), qPrintable(dest_file)); qDebug("%s copied to %s", qPrintable(shipped_file), qPrintable(dest_file));
QFile::copy(shipped_file, dest_file); QFile::copy(shipped_file, dest_file);

Loading…
Cancel
Save