mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Recipe for The London Review of Books (thanks to Darko Miletic)
This commit is contained in:
parent
657fa4d6c2
commit
263c6d7247
@ -231,6 +231,7 @@ class SchedulerDialog(QDialog, Ui_Dialog):
|
|||||||
self.connect(self.download, SIGNAL('clicked()'), self.download_now)
|
self.connect(self.download, SIGNAL('clicked()'), self.download_now)
|
||||||
self.search.setFocus(Qt.OtherFocusReason)
|
self.search.setFocus(Qt.OtherFocusReason)
|
||||||
self.old_news.setValue(gconf['oldest_news'])
|
self.old_news.setValue(gconf['oldest_news'])
|
||||||
|
self.rnumber.setText(_('%d recipes')%self._model.rowCount(None))
|
||||||
|
|
||||||
def download_now(self):
|
def download_now(self):
|
||||||
recipe = self._model.data(self.recipes.currentIndex(), Qt.UserRole)
|
recipe = self._model.data(self.recipes.currentIndex(), Qt.UserRole)
|
||||||
|
@ -30,6 +30,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="rnumber" >
|
||||||
|
<property name="text" >
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -473,8 +473,8 @@ class BooksModel(QAbstractTableModel):
|
|||||||
if role in (Qt.DisplayRole, Qt.EditRole):
|
if role in (Qt.DisplayRole, Qt.EditRole):
|
||||||
ans = self.dc[self.column_map[index.column()]](index.row())
|
ans = self.dc[self.column_map[index.column()]](index.row())
|
||||||
return NONE if ans is None else QVariant(ans)
|
return NONE if ans is None else QVariant(ans)
|
||||||
elif role == Qt.TextAlignmentRole and self.column_map[index.column()] in ('size', 'timestamp'):
|
#elif role == Qt.TextAlignmentRole and self.column_map[index.column()] in ('size', 'timestamp'):
|
||||||
return QVariant(Qt.AlignCenter | Qt.AlignVCenter)
|
# return QVariant(Qt.AlignVCenter | Qt.AlignCenter)
|
||||||
#elif role == Qt.ToolTipRole and index.isValid():
|
#elif role == Qt.ToolTipRole and index.isValid():
|
||||||
# if self.column_map[index.column()] in self.editable_cols:
|
# if self.column_map[index.column()] in self.editable_cols:
|
||||||
# return QVariant(_("Double click to <b>edit</b> me<br><br>"))
|
# return QVariant(_("Double click to <b>edit</b> me<br><br>"))
|
||||||
|
@ -99,12 +99,18 @@ class Main(MainWindow, Ui_MainWindow):
|
|||||||
self.donate_action = self.system_tray_menu.addAction(QIcon(':/images/donate.svg'), _('&Donate'))
|
self.donate_action = self.system_tray_menu.addAction(QIcon(':/images/donate.svg'), _('&Donate'))
|
||||||
self.quit_action = QAction(QIcon(':/images/window-close.svg'), _('&Quit'), self)
|
self.quit_action = QAction(QIcon(':/images/window-close.svg'), _('&Quit'), self)
|
||||||
self.addAction(self.quit_action)
|
self.addAction(self.quit_action)
|
||||||
|
self.action_restart = QAction(_('&Restart'), self)
|
||||||
|
self.addAction(self.action_restart)
|
||||||
self.system_tray_menu.addAction(self.quit_action)
|
self.system_tray_menu.addAction(self.quit_action)
|
||||||
self.quit_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_Q))
|
self.quit_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_Q))
|
||||||
|
self.action_restart.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_R))
|
||||||
self.system_tray_icon.setContextMenu(self.system_tray_menu)
|
self.system_tray_icon.setContextMenu(self.system_tray_menu)
|
||||||
self.connect(self.quit_action, SIGNAL('triggered(bool)'), self.quit)
|
self.connect(self.quit_action, SIGNAL('triggered(bool)'), self.quit)
|
||||||
self.connect(self.donate_action, SIGNAL('triggered(bool)'), self.donate)
|
self.connect(self.donate_action, SIGNAL('triggered(bool)'), self.donate)
|
||||||
self.connect(self.restore_action, SIGNAL('triggered(bool)'), lambda c : self.show())
|
self.connect(self.restore_action, SIGNAL('triggered(bool)'), lambda c : self.show())
|
||||||
|
def restart_app(c):
|
||||||
|
self.quit(None, restart=True)
|
||||||
|
self.connect(self.action_restart, SIGNAL('triggered(bool)'), restart_app)
|
||||||
def sta(r):
|
def sta(r):
|
||||||
if r == QSystemTrayIcon.Trigger:
|
if r == QSystemTrayIcon.Trigger:
|
||||||
self.hide() if self.isVisible() else self.show()
|
self.hide() if self.isVisible() else self.show()
|
||||||
@ -1275,8 +1281,9 @@ in which you want to store your books files. Any existing books will be automati
|
|||||||
if self.device_connected:
|
if self.device_connected:
|
||||||
self.memory_view.write_settings()
|
self.memory_view.write_settings()
|
||||||
|
|
||||||
def quit(self, checked):
|
def quit(self, checked, restart=False):
|
||||||
if self.shutdown():
|
if self.shutdown():
|
||||||
|
self.restart_after_quit = restart
|
||||||
QApplication.instance().quit()
|
QApplication.instance().quit()
|
||||||
|
|
||||||
def donate(self):
|
def donate(self):
|
||||||
@ -1411,7 +1418,13 @@ def main(args=sys.argv):
|
|||||||
sys.excepthook = main.unhandled_exception
|
sys.excepthook = main.unhandled_exception
|
||||||
if len(args) > 1:
|
if len(args) > 1:
|
||||||
main.add_filesystem_book(args[1])
|
main.add_filesystem_book(args[1])
|
||||||
return app.exec_()
|
ret = app.exec_()
|
||||||
|
if getattr(main, 'restart_after_quit', False):
|
||||||
|
e = sys.executable if getattr(sys, 'froze', False) else sys.argv[0]
|
||||||
|
print 'Restarting with:', e, sys.argv
|
||||||
|
os.execvp(e, sys.argv)
|
||||||
|
else:
|
||||||
|
return ret
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ msgid ""
|
|||||||
"threshold number of chapters were detected."
|
"threshold number of chapters were detected."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Максимальное количество ссылок вставленных в TOC. Для блокировки, выставите "
|
"Максимальное количество ссылок вставленных в TOC. Для блокировки, выставите "
|
||||||
"0 . По умолчанию : %default.
\n"
|
"0. По умолчанию: %default. "
|
||||||
"Если будет вставлено в TOC значение ссылок больше, чем --toc-threshold, то "
|
"Если будет вставлено в TOC значение ссылок больше, чем --toc-threshold, то "
|
||||||
"некоторое количество глав будет обнаруженно."
|
"некоторое количество глав будет обнаруженно."
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ recipe_modules = [
|
|||||||
'blic', 'novosti', 'danas', 'vreme', 'times_online', 'the_scotsman',
|
'blic', 'novosti', 'danas', 'vreme', 'times_online', 'the_scotsman',
|
||||||
'nytimes_sub', 'security_watch', 'cyberpresse', 'st_petersburg_times',
|
'nytimes_sub', 'security_watch', 'cyberpresse', 'st_petersburg_times',
|
||||||
'clarin', 'financial_times', 'heise', 'le_monde', 'harpers', 'science_aas',
|
'clarin', 'financial_times', 'heise', 'le_monde', 'harpers', 'science_aas',
|
||||||
'science_news', 'the_nation'
|
'science_news', 'the_nation', 'lrb'
|
||||||
]
|
]
|
||||||
|
|
||||||
import re, imp, inspect, time, os
|
import re, imp, inspect, time, os
|
||||||
|
34
src/calibre/web/feeds/recipes/lrb.py
Normal file
34
src/calibre/web/feeds/recipes/lrb.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
|
'''
|
||||||
|
lrb.co.uk
|
||||||
|
'''
|
||||||
|
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class LondonReviewOfBooks(BasicNewsRecipe):
|
||||||
|
title = u'London Review of Books'
|
||||||
|
__author__ = u'Darko Miletic'
|
||||||
|
description = u'Literary review publishing essay-length book reviews and topical articles on politics, literature, history, philosophy, science and the arts by leading writers and thinkers'
|
||||||
|
oldest_article = 7
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
no_stylesheets = True
|
||||||
|
use_embedded_content = False
|
||||||
|
encoding = 'cp1252'
|
||||||
|
|
||||||
|
remove_tags = [
|
||||||
|
dict(name='div' , attrs={'id' :'otherarticles'})
|
||||||
|
,dict(name='div' , attrs={'class':'pagetools' })
|
||||||
|
,dict(name='div' , attrs={'id' :'mainmenu' })
|
||||||
|
,dict(name='div' , attrs={'id' :'precontent' })
|
||||||
|
,dict(name='div' , attrs={'class':'nocss' })
|
||||||
|
,dict(name='span', attrs={'class':'inlineright' })
|
||||||
|
]
|
||||||
|
|
||||||
|
feeds = [(u'London Review of Books', u'http://www.lrb.co.uk/lrbrss.xml')]
|
||||||
|
|
||||||
|
def print_version(self, url):
|
||||||
|
main, split, rest = url.rpartition('/')
|
||||||
|
return main + '/print/' + rest
|
@ -68,9 +68,10 @@ def save_soup(soup, target):
|
|||||||
|
|
||||||
class response(str):
|
class response(str):
|
||||||
|
|
||||||
def __init__(self, *args):
|
def __new__(cls, *args):
|
||||||
str.__init__(self, *args)
|
obj = super(response, cls).__new__(cls, *args)
|
||||||
self.newurl = None
|
obj.newurl = None
|
||||||
|
return obj
|
||||||
|
|
||||||
class DummyLock(object):
|
class DummyLock(object):
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user