Browse Source

FEATURE: Replaced Meganova search engine by TorrentReactor

adaptive-webui-19844
Christophe Dumez 17 years ago
parent
commit
4a2c7efb27
  1. 3
      TODO
  2. 2
      src/search.ui
  3. 14
      src/searchEngine.cpp
  4. 25
      src/search_engine/nova.py

3
TODO

@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
- valgrind --tool=memcheck --leak-check=full src/qbittorrent (Looks ok)
- 128m 29m 16m S 4.8 2.9 0:02.28 qbittorrent
* beta 6
- Fix Qt4.2 compatibility (download.ui)
- Fix Qt4.2 compatibility (toolbar)
- Fix meganova search engine
- Translations update (IN PROGRESS)
- Wait for some bug fixes in libtorrent :
@ -79,6 +79,7 @@ beta5->beta6 changelog: @@ -79,6 +79,7 @@ beta5->beta6 changelog:
- FEATURE: Split download tab from GUI class and cleaned up code
- FEATURE: A lot of code optimization (CPU & memory usage)
- FEATURE: Added support for .ico format (useful for RSS favicons)
- FEATURE: Replaced Meganova search engine by TorrentReactor
- I18N: Updated Greek translation
- BUGFIX: Made torrent deletion from hard-drive safer
- BUGFIX: Fixed a bug when switching from finished to downloading list

2
src/search.ui

@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="meganova" >
<widget class="QCheckBox" name="reactor" >
<property name="text" >
<string/>
</property>

14
src/searchEngine.cpp

@ -87,7 +87,7 @@ SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, b @@ -87,7 +87,7 @@ SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, b
// reactor->setText("TorrentReactor");
isohunt->setText("Isohunt");
// btjunkie->setText("BTJunkie");
meganova->setText("Meganova");
reactor->setText("TorrentReactor");
// Check last checked search engines
loadCheckedSearchEngines();
connect(mininova, SIGNAL(stateChanged(int)), this, SLOT(saveCheckedSearchEngines(int)));
@ -95,7 +95,7 @@ SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, b @@ -95,7 +95,7 @@ SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, b
// connect(reactor, SIGNAL(stateChanged(int)), this, SLOT(saveCheckedSearchEngines(int)));
connect(isohunt, SIGNAL(stateChanged(int)), this, SLOT(saveCheckedSearchEngines(int)));
// connect(btjunkie, SIGNAL(stateChanged(int)), this, SLOT(saveCheckedSearchEngines(int)));
connect(meganova, SIGNAL(stateChanged(int)), this, SLOT(saveCheckedSearchEngines(int)));
connect(reactor, SIGNAL(stateChanged(int)), this, SLOT(saveCheckedSearchEngines(int)));
// Update nova.py search plugin if necessary
updateNova();
}
@ -190,7 +190,7 @@ void SearchEngine::saveCheckedSearchEngines(int) const{ @@ -190,7 +190,7 @@ void SearchEngine::saveCheckedSearchEngines(int) const{
settings.setValue("mininova", mininova->isChecked());
settings.setValue("piratebay", piratebay->isChecked());
settings.setValue("isohunt", isohunt->isChecked());
settings.setValue("meganova", meganova->isChecked());
settings.setValue("reactor", reactor->isChecked());
settings.endGroup();
qDebug("Saved checked search engines");
}
@ -234,7 +234,7 @@ void SearchEngine::loadCheckedSearchEngines(){ @@ -234,7 +234,7 @@ void SearchEngine::loadCheckedSearchEngines(){
mininova->setChecked(settings.value("mininova", true).toBool());
piratebay->setChecked(settings.value("piratebay", false).toBool());
isohunt->setChecked(settings.value("isohunt", false).toBool());
meganova->setChecked(settings.value("meganova", false).toBool());
reactor->setChecked(settings.value("reactor", false).toBool());
settings.endGroup();
qDebug("Loaded checked search engines");
}
@ -282,7 +282,7 @@ void SearchEngine::on_search_button_clicked(){ @@ -282,7 +282,7 @@ void SearchEngine::on_search_button_clicked(){
// Getting checked search engines
if(!mininova->isChecked() && ! piratebay->isChecked()/* && !reactor->isChecked()*/ && !isohunt->isChecked()/* && !btjunkie->isChecked()*/ && !meganova->isChecked()){
if(!mininova->isChecked() && ! piratebay->isChecked() && !reactor->isChecked() && !isohunt->isChecked()/* && !btjunkie->isChecked()*/ /*&& !meganova->isChecked()*/){
QMessageBox::critical(0, tr("No search engine selected"), tr("You must select at least one search engine."));
return;
}
@ -305,8 +305,8 @@ void SearchEngine::on_search_button_clicked(){ @@ -305,8 +305,8 @@ void SearchEngine::on_search_button_clicked(){
// if(btjunkie->isChecked()){
// engineNames << "btjunkie";
// }
if(meganova->isChecked()){
engineNames << "meganova";
if(reactor->isChecked()){
engineNames << "reactor";
}
params << engineNames.join(",");
params << pattern.split(" ");

25
src/search_engine/nova.py

@ -1,5 +1,9 @@ @@ -1,5 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Version: 2.04
# Changelog:
# - Fixed TorrentReactor search engine
# Version: 2.03
# Changelog:
# - Little fix for mininova search engine when file name contain '<='
@ -55,7 +59,7 @@ import cgi @@ -55,7 +59,7 @@ import cgi
import traceback
import threading
STANDALONE = True
STANDALONE = False
THREADED = True
if os.environ.has_key('QBITTORRENT'):
@ -274,11 +278,11 @@ class MegaNova(object): @@ -274,11 +278,11 @@ class MegaNova(object):
url = 'http://www.meganova.org'
def search(self, what):
dat = urllib.urlopen(self.url+'/find-seeds/%s.html'%what).read().decode('utf8', 'replace')
print 'url is ' + self.url+'/find-seeds/%s.html'%what
dat = urllib.urlopen(self.url+'/find/%s/4/1.html'%what).read().decode('utf8', 'replace')
print 'url is ' + self.url+'/find/%s/4/1.html'%what
# I know it's not very readable, but the SGML parser feels in pain
section_re = re.compile('(?s)<td width="6%">.*?</tr')
section_re = re.compile('(?s)<td><a class="name".*?</tr')
torrent_re = re.compile('(?s)href="(?P<link>/torrent/.*?)".*?'
'<span.*?>(?P<name>.*?)</span>.*?'
'>(?P<size>[0-9.]+\s+.B).*?'
@ -296,7 +300,7 @@ class MegaNova(object): @@ -296,7 +300,7 @@ class MegaNova(object):
prettyPrinter(torrent_infos)
class Reactor(object):
url = 'http://tr.searching.com'
url = 'http://www.torrentreactor.net'
class SimpleSGMLParser(sgmllib.SGMLParser):
def __init__(self, results, url, *args):
@ -309,13 +313,12 @@ class Reactor(object): @@ -309,13 +313,12 @@ class Reactor(object):
def start_a(self, attr):
params = dict(attr)
if params['href'].startswith('view.php'):
if params['href'].startswith('http://dl.torrentreactor.net/download.php'):
self.current_item = {}
self.td_counter = 0
# extract the torrent id
#I save it in a global variable for after create the link string
equal = params['href'].find("=")
self.id = str(int(params['href'][equal+1:]))
amp = params['href'].find("&", equal+1)
self.id = str(int(params['href'][equal+1:amp]))
def handle_data(self, data):
if self.td_counter == 0:
@ -342,7 +345,7 @@ class Reactor(object): @@ -342,7 +345,7 @@ class Reactor(object):
self.td_counter = None
# add item to results
if self.current_item:
self.current_item['link']='http://download.torrentreactor.net/download.php?name=%s&id=%s'%(cgi.escape(self.current_item['name']),self.id)
self.current_item['link']='http://download.torrentreactor.net/download.php?id=%s&name=%s'%(self.id, urllib.quote(self.current_item['name']))
self.current_item['engine_url'] = self.url
self.current_item['size']= anySizeToBytes(self.current_item['size'])
if not self.current_item['seeds'].isdigit():
@ -362,7 +365,7 @@ class Reactor(object): @@ -362,7 +365,7 @@ class Reactor(object):
while True:
results = []
parser = self.SimpleSGMLParser(results, self.url)
dat = urllib.urlopen(self.url+'/search.php?search=&words=%s&skip=%s'%(what,(i*50))).read().decode('utf-8', 'replace')
dat = urllib.urlopen(self.url+'/search.php?search=&words=%s&cid=&sid=&type=2&orderby=a.seeds&asc=0&skip=%s'%(what,(i*35))).read().decode('utf-8', 'replace')
parser.feed(dat)
parser.close()
if len(results) <= 0:

Loading…
Cancel
Save