Browse Source

- BUGFIX: 'Unknown' is now displayed in search results columns where value is -1

- BUGFIX: Improved search engine core a little
- BUGFIX: Forgot to remove *.pyc files when uninstalling a search plugin
adaptive-webui-19844
Christophe Dumez 17 years ago
parent
commit
4a02d171b4
  1. 3
      TODO
  2. 3
      src/engineSelectDlg.cpp
  3. 12
      src/searchEngine.cpp
  4. 9
      src/search_engine/novaprinter.py

3
TODO

@ -78,3 +78,6 @@ beta6->beta7 changelog: @@ -78,3 +78,6 @@ beta6->beta7 changelog:
- FEATURE: Made search engine plugin install more reliable
- BUGFIX: Updated man page / README / INSTALL
- BUGFIX: Paused torrents could be displayed as connected for a sec after checking
- BUGFIX: 'Unknown' is now displayed in search results columns where value is -1
- BUGFIX: Improved search engine core a little
- BUGFIX: Forgot to remove *.pyc files when uninstalling a search plugin

3
src/engineSelectDlg.cpp

@ -152,6 +152,9 @@ void engineSelectDlg::on_actionUninstall_triggered() { @@ -152,6 +152,9 @@ void engineSelectDlg::on_actionUninstall_triggered() {
if(QFile::exists(misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+name+".png")) {
QFile::remove(misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+name+".png");
}
if(QFile::exists(misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+name+".pyc")) {
QFile::remove(misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+name+".pyc");
}
// Remove it from lists
installed_engines.removeAt(index);
enginesEnabled.removeAt(index);

12
src/searchEngine.cpp

@ -344,13 +344,17 @@ void SearchEngine::updateNova() { @@ -344,13 +344,17 @@ void SearchEngine::updateNova() {
if(misc::getPluginVersion(":/search_engine/nova2.py") > misc::getPluginVersion(filePath)) {
if(QFile::exists(filePath))
QFile::remove(filePath);
QFile::copy(":/search_engine/nova2.py", misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py");
QFile::copy(":/search_engine/nova2.py", filePath);
}
// Set permissions
QFile::Permissions perm=QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner | QFile::ReadUser | QFile::WriteUser | QFile::ExeUser | QFile::ReadGroup | QFile::ReadGroup;
QFile(misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py").setPermissions(perm);
if(!QFile::exists(misc::qBittorrentPath()+"search_engine"+QDir::separator()+"novaprinter.py")){
QFile::copy(":/search_engine/novaprinter.py", misc::qBittorrentPath()+"search_engine"+QDir::separator()+"novaprinter.py");
filePath = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"novaprinter.py";
if(misc::getPluginVersion(":/search_engine/novaprinter.py") > misc::getPluginVersion(filePath)) {
if(QFile::exists(filePath)){
QFile::remove(filePath);
}
QFile::copy(":/search_engine/novaprinter.py", filePath);
}
QString destDir = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator();
QDir shipped_subDir(":/search_engine/engines/");
@ -425,7 +429,7 @@ void SearchEngine::appendSearchResult(QString line){ @@ -425,7 +429,7 @@ void SearchEngine::appendSearchResult(QString line){
int row = SearchListModel->rowCount();
SearchListModel->insertRow(row);
for(int i=0; i<5; ++i){
if(parts.at(i).toFloat() == -1)
if(parts.at(i).toFloat() == -1 && i != SIZE)
SearchListModel->setData(SearchListModel->index(row, i), tr("Unknown"));
else
SearchListModel->setData(SearchListModel->index(row, i), QVariant(parts.at(i)));

9
src/search_engine/novaprinter.py

@ -1,3 +1,5 @@ @@ -1,3 +1,5 @@
#VERSION: 1.11
def prettyPrinter(dictionnary):
dictionnary['size'] = anySizeToBytes(dictionnary['size'])
print "%(link)s|%(name)s|%(size)s|%(seeds)s|%(leech)s|%(engine_url)s" % dictionnary
@ -9,14 +11,15 @@ def anySizeToBytes(size_string): @@ -9,14 +11,15 @@ def anySizeToBytes(size_string):
# separate integer from unit
try:
size, unit = size_string.split()
except (ValueError, TypeError):
except:
try:
size = size_string.strip()
unit = ''.join([c for c in size if c.isalpha()])
size = size[:-len(unit)]
except(ValueError, TypeError):
except:
return -1
if len(size) == 0:
return -1
size = float(size)
short_unit = unit.upper()[0]

Loading…
Cancel
Save