mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Pull from trunk
This commit is contained in:
commit
29e6630419
72
resources/recipes/Ansa.recipe
Normal file
72
resources/recipes/Ansa.recipe
Normal file
@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env python
|
||||
__license__ = 'GPL v3'
|
||||
__author__ = 'Gabriele Marini, based on Darko Miletic'
|
||||
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
|
||||
description = 'Italian daily newspaper - 01-05-2010'
|
||||
'''
|
||||
http://www.ansa.it/
|
||||
'''
|
||||
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
class Ansa(BasicNewsRecipe):
|
||||
__author__ = 'Gabriele Marini'
|
||||
description = 'Italian News Agency'
|
||||
|
||||
cover_url = 'http://www.ansa.it/web/images/logo_ansa_interna.gif'
|
||||
title = u'Ansa'
|
||||
publisher = 'Ansa'
|
||||
category = 'News, politics, culture, economy, general interest'
|
||||
|
||||
language = 'it'
|
||||
timefmt = '[%a, %d %b, %Y]'
|
||||
|
||||
oldest_article = 1
|
||||
max_articles_per_feed = 10
|
||||
use_embedded_content = False
|
||||
recursion = 10
|
||||
|
||||
remove_javascript = True
|
||||
no_stylesheets = True
|
||||
conversion_options = {'linearize_tables':True}
|
||||
remove_attributes = ['colspan']
|
||||
|
||||
keep_only_tags = [dict(name='div', attrs={'class':['path','header-content','corpo']}),
|
||||
]
|
||||
|
||||
|
||||
remove_tags = [
|
||||
dict(name='div', attrs={'class':'tools-bar'}),
|
||||
dict(name='div', attrs={'id':['rssdiv','blocco']})
|
||||
]
|
||||
|
||||
|
||||
feeds = [
|
||||
(u'HomePage', u'http://www.ansa.it/web/ansait_web_rss_homepage.xml'),
|
||||
(u'Top New', u'http://www.ansa.it/web/notizie/rubriche/topnews/topnews_rss.xml'),
|
||||
(u'Cronaca', u'http://www.ansa.it/web/notizie/rubriche/cronaca/cronaca_rss.xml'),
|
||||
(u'Mondo', u'http://www.ansa.it/web/notizie/rubriche/mondo/mondo_rss.xml'),
|
||||
(u'Economia', u'http://www.ansa.it/web/notizie/rubriche/economia/economia_rss.xml'),
|
||||
(u'Politica', u'http://www.ansa.it/web/notizie/rubriche/politica/politica_rss.xml'),
|
||||
(u'Scienze', u'http://www.ansa.it/web/notizie/rubriche/scienza/scienza_rss.xml'),
|
||||
(u'Cinema', u'http://www.ansa.it/web/notizie/rubriche/cinema/cinema_rss.xml'),
|
||||
(u'Tecnologia e Internet', u'http://www.ansa.it/web/notizie/rubriche/tecnologia/tecnologia_rss.xml'),
|
||||
(u'Spettacolo', u'http://www.ansa.it/web/notizie/rubriche/spettacolo/spettacolo_rss.xml'),
|
||||
(u'Cultura e Tendenze', u'http://www.ansa.it/web/notizie/rubriche/cultura/cultura_rss.xml'),
|
||||
(u'Sport', u'http://www.ansa.it/web/notizie/rubriche/altrisport/altrisport_rss.xml'),
|
||||
(u'Calcio', u'http://www.ansa.it/web/notizie/rubriche/calcio/calcio_rss.xml'),
|
||||
(u'Lazio', u'http://www.ansa.it/web/notizie/regioni/lazio/lazio_rss.xml'),
|
||||
(u'Lombardia', u'http://www.ansa.it/web/notizie/regioni/lombardia/lombardia.shtml'),
|
||||
(u'Veneto', u'http://www.ansa.it/web/notizie/regioni/veneto/veneto.shtml'),
|
||||
(u'Campanioa', u'http://www.ansa.it/web/notizie/regioni/campania/campania.shtml'),
|
||||
(u'Sicilia', u'http://www.ansa.it/web/notizie/regioni/sicilia/sicilia.shtml'),
|
||||
(u'Toscana', u'http://www.ansa.it/web/notizie/regioni/toscana/toscana.shtml'),
|
||||
(u'Trentino', u'http://www.ansa.it/web/notizie/regioni/trentino/trentino.shtml')
|
||||
]
|
||||
|
||||
extra_css = '''
|
||||
.path{font-style: italic; font-size: small}
|
||||
.header-content h1{font-weight: bold; font-size: xx-large}
|
||||
.header-content h2{font-weight: bold; font-size: x-large; font-syle: italic}
|
||||
.content-corpo{font-size: 14px;font-family: Times New Roman;}
|
||||
'''
|
48
resources/recipes/apcom.recipe
Normal file
48
resources/recipes/apcom.recipe
Normal file
@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python
|
||||
__license__ = 'GPL v3'
|
||||
__author__ = 'Gabriele Marini, based on Darko Miletic'
|
||||
__copyright__ = '2009-2010, Darko Miletic <darko.miletic at gmail.com>'
|
||||
description = 'Italian daily newspaper - 14-05-2010'
|
||||
|
||||
'''
|
||||
http://www.apcom.NET/
|
||||
'''
|
||||
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
class Apcom(BasicNewsRecipe):
|
||||
__author__ = 'Marini Gabriele'
|
||||
description = 'Italian daily newspaper'
|
||||
|
||||
cover_url = 'http://www.apcom.net/img/logoAP.gif'
|
||||
title = u'Apcom'
|
||||
publisher = 'TM News S.p.A.'
|
||||
category = 'News, politics, culture, economy, general interest'
|
||||
|
||||
language = 'it'
|
||||
timefmt = '[%a, %d %b, %Y]'
|
||||
|
||||
oldest_article = 7
|
||||
max_articles_per_feed = 50
|
||||
use_embedded_content = False
|
||||
recursion = 100
|
||||
|
||||
no_stylesheets = True
|
||||
conversion_options = {'linearize_tables':True}
|
||||
remove_javascript = True
|
||||
|
||||
keep_only_tags = [
|
||||
dict(name='div', attrs={'id':'ag_center'})
|
||||
]
|
||||
|
||||
|
||||
|
||||
feeds = [
|
||||
(u'Globale', u'http://www.apcom.net/rss/globale.xml '),
|
||||
(u'Politica', u'http://www.apcom.net/rss/politica.xml'),
|
||||
(u'Cronaca', u'http://www.apcom.net/rss/cronaca.xml'),
|
||||
(u'Econimia', u'http://www.apcom.net/rss/economia.xml'),
|
||||
(u'Esteri', u'http://www.apcom.net/rss/esteri.xml'),
|
||||
(u'Cultura', u'http://www.apcom.net/rss/cultura.xml'),
|
||||
(u'Sport', u'http://www.apcom.net/rss/sport.xml')
|
||||
]
|
49
resources/recipes/leggo_it.recipe
Normal file
49
resources/recipes/leggo_it.recipe
Normal file
@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python
|
||||
__license__ = 'GPL v3'
|
||||
__author__ = 'Gabriele Marini, based on Darko Miletic'
|
||||
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||
description = 'Italian daily newspaper - v1.00 05-05-2010'
|
||||
|
||||
'''
|
||||
http://www.leggo.it
|
||||
'''
|
||||
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
class LeggoIT(BasicNewsRecipe):
|
||||
__author__ = 'Gabriele Marini'
|
||||
description = 'Italian Free daily newspaper'
|
||||
|
||||
cover_url = 'http://www.leggo.it/img/logo-leggo2.gif'
|
||||
title = u'Leggo.it'
|
||||
publisher = 'Ced Caltagirone Editore S.p.A.'
|
||||
category = 'News, politics, culture, economy, general interest'
|
||||
|
||||
language = 'it'
|
||||
timefmt = '[%a, %d %b, %Y]'
|
||||
|
||||
oldest_article = 5
|
||||
max_articles_per_feed = 100
|
||||
use_embedded_content = False
|
||||
recursion = 100
|
||||
|
||||
no_stylesheets = True
|
||||
remove_javascript = True
|
||||
conversion_options = {'linearize_tables':True}
|
||||
|
||||
keep_only_tags = [
|
||||
dict(name='h1',attrs={'class':'nero22'}),
|
||||
dict(name='div',attrs={'id':'testodim'})
|
||||
]
|
||||
feeds = [
|
||||
(u'Home Page', u'http://www.leggo.it/rss/home.xml'),
|
||||
(u'Italia', u'http://www.leggo.it/rss/italia.xml'),
|
||||
(u'Esteri', u'http://www.leggo.it/rss/esteri.xml'),
|
||||
(u'Economia', u'http://www.leggo.it/rss/economia.xml'),
|
||||
(u'Sport', u'http://www.leggo.it/rss/sport.xml'),
|
||||
(u'Gossip', u'http://www.leggo.it/rss/gossip.xml'),
|
||||
(u'Spettacoli', u'http://www.leggo.it/rss/spettacoli.xml'),
|
||||
(u'Salute', u'http://www.leggo.it/rss/salute.xml'),
|
||||
(u'Scienza', u'http://www.leggo.it/rss/scienza.xml')
|
||||
]
|
||||
|
@ -10,6 +10,7 @@ class PhysicsWorld(BasicNewsRecipe):
|
||||
oldest_article = 7
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
cover_url = 'http://images.iop.org/cws/icons/themes/phw/header-logo.png'
|
||||
use_embedded_content = False
|
||||
remove_javascript = True
|
||||
needs_subscription = True
|
||||
@ -27,7 +28,7 @@ class PhysicsWorld(BasicNewsRecipe):
|
||||
br = BasicNewsRecipe.get_browser(self)
|
||||
if self.username is not None and self.password is not None:
|
||||
br.open('http://physicsworld.com/cws/sign-in')
|
||||
br.select_form(nr=1)
|
||||
br.select_form(nr=2)
|
||||
br['username'] = self.username
|
||||
br['password'] = self.password
|
||||
br.submit()
|
||||
|
38
resources/recipes/punto_informatico.recipe
Normal file
38
resources/recipes/punto_informatico.recipe
Normal file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python
|
||||
__license__ = 'GPL v3'
|
||||
__author__ = 'Gabriele Marini'
|
||||
__copyright__ = 'Gabriele Marini'
|
||||
__description__ = 'Punto Informatico'
|
||||
|
||||
'''
|
||||
http://www.punto-informatico.it/
|
||||
'''
|
||||
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
|
||||
class PuntoInformatico(BasicNewsRecipe):
|
||||
__author__ = 'Gabriele Marini'
|
||||
description = 'Punto Informatico: Internet dal 1996'
|
||||
|
||||
cover_url = 'http://punto-informatico.it/images/logo_8bit.png'
|
||||
title = u'Punto Informatico '
|
||||
publisher = 'italiaNews High Tech'
|
||||
category = 'News, Information Tecnology'
|
||||
|
||||
language = 'it'
|
||||
timefmt = '[%a, %d %b, %Y]'
|
||||
|
||||
oldest_article = 15
|
||||
max_articles_per_feed = 50
|
||||
use_embedded_content = False
|
||||
|
||||
remove_javascript = True
|
||||
no_stylesheets = True
|
||||
keep_only_tags = [dict(name='div', attrs={'class':'box'})]
|
||||
remove_tags = [dict(name='div',attrs={'class':'boxadv'})]
|
||||
def get_article_url(self, article):
|
||||
return article.get('id', article.get('guid', None))
|
||||
|
||||
feeds = [(u'Punto Informatico',u'http://feeds.punto-informatico.it/c/32288/f/438866/index.rss')]
|
||||
|
@ -66,5 +66,6 @@ class AVANT(USBMS):
|
||||
VENDOR_NAME = 'E-BOOK'
|
||||
WINDOWS_MAIN_MEM = 'READER'
|
||||
|
||||
EBOOK_DIR_MAIN = 'E-books'
|
||||
EBOOK_DIR_MAIN = ''
|
||||
SUPPORTS_SUB_DIRS = True
|
||||
|
||||
|
@ -92,10 +92,10 @@ class EbookIterator(object):
|
||||
ext = re.sub(r'(x{0,1})htm(l{0,1})', 'html', ext)
|
||||
self.ebook_ext = ext
|
||||
|
||||
def search(self, text, index):
|
||||
def search(self, text, index, backwards=False):
|
||||
text = text.lower()
|
||||
for i, path in enumerate(self.spine):
|
||||
if i > index:
|
||||
if (backwards and i < index) or (not backwards and i > index):
|
||||
if text in open(path, 'rb').read().decode(path.encoding).lower():
|
||||
return i
|
||||
|
||||
|
@ -141,6 +141,13 @@ class SearchBox2(QComboBox):
|
||||
if event.timerId() == self.timer:
|
||||
self.do_search()
|
||||
|
||||
@property
|
||||
def smart_text(self):
|
||||
text = unicode(self.currentText()).strip()
|
||||
if not text or text == self.help_text:
|
||||
return ''
|
||||
return text
|
||||
|
||||
def do_search(self):
|
||||
text = unicode(self.currentText()).strip()
|
||||
if not text or text == self.help_text:
|
||||
|
@ -585,7 +585,9 @@ class DocumentView(QWebView):
|
||||
def fset(self, val): self.document.current_language = val
|
||||
return property(fget=fget, fset=fset)
|
||||
|
||||
def search(self, text):
|
||||
def search(self, text, backwards=False):
|
||||
if backwards:
|
||||
return self.findText(text, self.document.FindBackwards)
|
||||
return self.findText(text)
|
||||
|
||||
def path(self):
|
||||
|
@ -229,7 +229,11 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
||||
self.connect(self.action_previous_page, SIGNAL('triggered(bool)'),
|
||||
lambda x:self.view.previous_page())
|
||||
self.connect(self.action_find_next, SIGNAL('triggered(bool)'),
|
||||
lambda x:self.find(unicode(self.search.text()), True, repeat=True))
|
||||
lambda x:self.find(self.search.smart_text, True, repeat=True))
|
||||
self.connect(self.action_find_previous, SIGNAL('triggered(bool)'),
|
||||
lambda x:self.find(self.search.smart_text, True,
|
||||
repeat=True, backwards=True))
|
||||
|
||||
self.connect(self.action_full_screen, SIGNAL('triggered(bool)'),
|
||||
self.toggle_fullscreen)
|
||||
self.action_full_screen.setShortcuts([Qt.Key_F11, Qt.CTRL+Qt.SHIFT+Qt.Key_F])
|
||||
@ -420,13 +424,15 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
||||
self.set_bookmarks(self.iterator.bookmarks)
|
||||
|
||||
|
||||
def find(self, text, refinement, repeat=False):
|
||||
def find(self, text, refinement, repeat=False, backwards=False):
|
||||
if not text:
|
||||
self.view.search('')
|
||||
return self.search.search_done(False)
|
||||
if self.view.search(text):
|
||||
self.scrolled(self.view.scroll_fraction)
|
||||
return self.search.search_done(True)
|
||||
index = self.iterator.search(text, self.current_index)
|
||||
index = self.iterator.search(text, self.current_index,
|
||||
backwards=backwards)
|
||||
if index is None:
|
||||
if self.current_index > 0:
|
||||
index = self.iterator.search(text, 0)
|
||||
@ -444,10 +450,7 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
||||
self.scrolled(self.view.scroll_fraction)
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
if event.key() == Qt.Key_F3:
|
||||
text = unicode(self.search.text())
|
||||
self.find(text, True, repeat=True)
|
||||
elif event.key() == Qt.Key_Slash:
|
||||
if event.key() == Qt.Key_Slash:
|
||||
self.search.setFocus(Qt.OtherFocusReason)
|
||||
else:
|
||||
return MainWindow.keyPressEvent(self, event)
|
||||
|
@ -142,6 +142,7 @@
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="action_find_next"/>
|
||||
<addaction name="action_find_previous"/>
|
||||
</widget>
|
||||
<action name="action_back">
|
||||
<property name="icon">
|
||||
@ -232,6 +233,12 @@
|
||||
<property name="text">
|
||||
<string>Find next</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Find next occurrence</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F3</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_copy">
|
||||
<property name="icon">
|
||||
@ -287,6 +294,21 @@
|
||||
<string>Print</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_find_previous">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<normaloff>:/images/arrow-up.svg</normaloff>:/images/arrow-up.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Find previous</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Find previous occurrence</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Shift+F3</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
@ -97,9 +97,18 @@ class Kobo(Device):
|
||||
manufacturer = 'Kobo'
|
||||
output_profile = 'kobo'
|
||||
output_format = 'EPUB'
|
||||
name = 'Kobo Reader'
|
||||
id = 'kobo'
|
||||
|
||||
class Booq(Device):
|
||||
name = 'Booq Reader'
|
||||
manufacturer = 'Booq'
|
||||
output_profile = 'prs505'
|
||||
output_format = 'EPUB'
|
||||
id = 'booq'
|
||||
|
||||
class Avant(Booq):
|
||||
name = 'Booq Avant'
|
||||
|
||||
class Sony300(Sony505):
|
||||
|
||||
name = 'SONY Reader Pocket Edition'
|
||||
|
Loading…
x
Reference in New Issue
Block a user