- 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
This commit is contained in:
Christophe Dumez 2007-09-02 07:58:25 +00:00
parent 7a16a1d8f1
commit 4a02d171b4
4 changed files with 20 additions and 7 deletions

3
TODO
View file

@ -78,3 +78,6 @@ beta6->beta7 changelog:
- FEATURE: Made search engine plugin install more reliable - FEATURE: Made search engine plugin install more reliable
- BUGFIX: Updated man page / README / INSTALL - BUGFIX: Updated man page / README / INSTALL
- BUGFIX: Paused torrents could be displayed as connected for a sec after checking - 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

View file

@ -152,6 +152,9 @@ void engineSelectDlg::on_actionUninstall_triggered() {
if(QFile::exists(misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+name+".png")) { 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"); 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 // Remove it from lists
installed_engines.removeAt(index); installed_engines.removeAt(index);
enginesEnabled.removeAt(index); enginesEnabled.removeAt(index);

View file

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

View file

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