remove parameter max_results from all capabilities
This commit is contained in:
parent
c108ca3fc5
commit
b99d599aa9
30 changed files with 84 additions and 80 deletions
|
|
@ -72,8 +72,7 @@ class Galleroob(ReplApplication):
|
|||
return 2
|
||||
|
||||
self.start_format(pattern=pattern)
|
||||
for backend, gallery in self.do('search_gallery', pattern=pattern,
|
||||
max_results=self.options.count):
|
||||
for backend, gallery in self.do('search_gallery', pattern=pattern):
|
||||
self.cached_format(gallery)
|
||||
|
||||
def do_download(self, line):
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ from .minivideo import MiniVideo
|
|||
|
||||
|
||||
class MainWindow(QtMainWindow):
|
||||
def __init__(self, config, weboob, parent=None):
|
||||
def __init__(self, config, weboob, app, parent=None):
|
||||
QtMainWindow.__init__(self, parent)
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
|
|
@ -39,6 +39,7 @@ class MainWindow(QtMainWindow):
|
|||
self.config = config
|
||||
self.weboob = weboob
|
||||
self.minivideos = []
|
||||
self.app = app
|
||||
|
||||
self.ui.sortbyEdit.setCurrentIndex(int(self.config.get('settings', 'sortby')))
|
||||
self.ui.nsfwCheckBox.setChecked(int(self.config.get('settings', 'nsfw')))
|
||||
|
|
@ -109,7 +110,7 @@ class MainWindow(QtMainWindow):
|
|||
backend_name = str(self.ui.backendEdit.itemData(self.ui.backendEdit.currentIndex()).toString())
|
||||
|
||||
self.process = QtDo(self.weboob, self.addVideo)
|
||||
self.process.do('search_videos', pattern, self.ui.sortbyEdit.currentIndex(), nsfw=True, max_results=20, backends=backend_name)
|
||||
self.process.do(self.app._do_complete, 20, (), 'search_videos', pattern, self.ui.sortbyEdit.currentIndex(), nsfw=True, backends=backend_name)
|
||||
|
||||
def addVideo(self, backend, video):
|
||||
if not backend:
|
||||
|
|
|
|||
|
|
@ -42,6 +42,6 @@ class QVideoob(QtApplication):
|
|||
self.load_backends(ICapVideo)
|
||||
self.load_config()
|
||||
|
||||
self.main_window = MainWindow(self.config, self.weboob)
|
||||
self.main_window = MainWindow(self.config, self.weboob, self)
|
||||
self.main_window.show()
|
||||
return self.weboob.loop()
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ from PyQt4.QtCore import SIGNAL
|
|||
from PyQt4.QtGui import QMessageBox, QTableWidgetItem
|
||||
from PyQt4.QtCore import Qt
|
||||
|
||||
from weboob.tools.application.base import MoreResultsAvailable
|
||||
from weboob.tools.application.qt import QtMainWindow, QtDo
|
||||
from weboob.tools.application.qt.backendcfg import BackendCfg
|
||||
from weboob.capabilities.content import ICapContent
|
||||
|
|
@ -32,7 +33,7 @@ from .ui.main_window_ui import Ui_MainWindow
|
|||
|
||||
|
||||
class MainWindow(QtMainWindow):
|
||||
def __init__(self, config, weboob, parent=None):
|
||||
def __init__(self, config, weboob, app, parent=None):
|
||||
QtMainWindow.__init__(self, parent)
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
|
|
@ -40,6 +41,7 @@ class MainWindow(QtMainWindow):
|
|||
self.config = config
|
||||
self.weboob = weboob
|
||||
self.backend = None
|
||||
self.app = app
|
||||
|
||||
self.connect(self.ui.idEdit,
|
||||
SIGNAL("returnPressed()"),
|
||||
|
|
@ -217,9 +219,11 @@ class MainWindow(QtMainWindow):
|
|||
self.process = QtDo(self.weboob,
|
||||
self._gotRevision,
|
||||
self._errorHistory)
|
||||
self.process.do('iter_revisions',
|
||||
self.process.do(self.app._do_complete,
|
||||
self.ui.nbRevBox.value(),
|
||||
(),
|
||||
'iter_revisions',
|
||||
self.content.id,
|
||||
max_results=self.ui.nbRevBox.value(),
|
||||
backends=(self.backend,))
|
||||
|
||||
def _gotRevision(self, backend, revision):
|
||||
|
|
@ -256,6 +260,9 @@ class MainWindow(QtMainWindow):
|
|||
|
||||
def _errorHistory(self, backend, error, backtrace):
|
||||
""" Loading the history has failed """
|
||||
if isinstance(error, MoreResultsAvailable):
|
||||
return
|
||||
|
||||
content = unicode(self.tr('Unable to load history:\n%s\n')) % to_unicode(error)
|
||||
if logging.root.level == logging.DEBUG:
|
||||
content += '\n%s\n' % to_unicode(backtrace)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,6 @@ class QWebContentEdit(QtApplication):
|
|||
|
||||
def main(self, argv):
|
||||
self.load_backends(ICapContent, storage=self.create_storage())
|
||||
self.main_window = MainWindow(self.config, self.weboob)
|
||||
self.main_window = MainWindow(self.config, self.weboob, self)
|
||||
self.main_window.show()
|
||||
return self.weboob.loop()
|
||||
|
|
|
|||
|
|
@ -216,6 +216,5 @@ class Videoob(ReplApplication):
|
|||
|
||||
self.change_path([u'search'])
|
||||
self.start_format(pattern=pattern)
|
||||
for backend, video in self.do('search_videos', pattern=pattern, nsfw=self.nsfw,
|
||||
max_results=self.options.count):
|
||||
for backend, video in self.do('search_videos', pattern=pattern, nsfw=self.nsfw):
|
||||
self.cached_format(video)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import codecs
|
|||
|
||||
from weboob.core.bcall import CallErrors
|
||||
from weboob.capabilities.content import ICapContent, Revision
|
||||
from weboob.tools.application.repl import ReplApplication
|
||||
from weboob.tools.application.repl import ReplApplication, defaultcount
|
||||
|
||||
|
||||
__all__ = ['WebContentEdit']
|
||||
|
|
@ -144,6 +144,7 @@ class WebContentEdit(ReplApplication):
|
|||
if len(errors.errors) > 0:
|
||||
raise errors
|
||||
|
||||
@defaultcount(10)
|
||||
def do_log(self, line):
|
||||
"""
|
||||
log ID
|
||||
|
|
@ -160,7 +161,7 @@ class WebContentEdit(ReplApplication):
|
|||
_id = _id.encode('utf-8')
|
||||
|
||||
self.start_format()
|
||||
for backend, revision in self.do('iter_revisions', _id, max_results=self.options.count, backends=backend_names):
|
||||
for backend, revision in self.do('iter_revisions', _id, backends=backend_names):
|
||||
self.format(revision)
|
||||
|
||||
def do_get(self, line):
|
||||
|
|
|
|||
|
|
@ -57,14 +57,12 @@ class ICapContent(IBaseCap):
|
|||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def iter_revisions(self, id, max_results=10):
|
||||
def iter_revisions(self, id):
|
||||
"""
|
||||
Iter revisions of a content.
|
||||
|
||||
:param id: id of content
|
||||
:type id: str
|
||||
:param max_results: maximum results
|
||||
:type max_results: int
|
||||
:rtype: iter[:class:`Revision`]
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ class ICapGallery(IBaseCap):
|
|||
SEARCH_VIEWS,
|
||||
SEARCH_DATE) = range(4)
|
||||
|
||||
def search_gallery(self, pattern, sortby=SEARCH_RELEVANCE, max_results=None):
|
||||
def search_gallery(self, pattern, sortby=SEARCH_RELEVANCE):
|
||||
"""
|
||||
Iter results of a search on a pattern.
|
||||
|
||||
|
|
@ -119,10 +119,6 @@ class ICapGallery(IBaseCap):
|
|||
:type pattern: str
|
||||
:param sortby: sort by...
|
||||
:type sortby: SEARCH_*
|
||||
:param nsfw: include non-suitable for work videos if True
|
||||
:type nsfw: bool
|
||||
:param max_results: maximum number of results to return
|
||||
:type max_results: int
|
||||
:rtype: :class:`BaseGallery`
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class ICapVideo(IBaseCap):
|
|||
SEARCH_VIEWS,
|
||||
SEARCH_DATE) = range(4)
|
||||
|
||||
def search_videos(self, pattern, sortby=SEARCH_RELEVANCE, nsfw=False, max_results=None):
|
||||
def search_videos(self, pattern, sortby=SEARCH_RELEVANCE, nsfw=False):
|
||||
"""
|
||||
Iter results of a search on a pattern.
|
||||
|
||||
|
|
@ -77,8 +77,6 @@ class ICapVideo(IBaseCap):
|
|||
:param sortby: sort by... (use SEARCH_* constants)
|
||||
:param nsfw: include non-suitable for work videos if True
|
||||
:type nsfw: bool
|
||||
:param max_results: maximum number of results to return
|
||||
:type max_results: int
|
||||
:rtype: iter[:class:`BaseVideo`]
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue