Merge from custcol trunk

This commit is contained in:
Charles Haley 2010-05-05 16:20:11 +01:00
commit e5687d6763
8 changed files with 157 additions and 4 deletions

View File

@ -0,0 +1,34 @@
from calibre.web.feeds.news import BasicNewsRecipe
class Arbetaren_SE(BasicNewsRecipe):
title = u'Arbetaren'
__author__ = 'Joakim Lindskog'
description = 'Nyheter fr\xc3\xa5n Arbetaren'
publisher = 'Arbetaren'
category = 'news, politics, socialism, Sweden'
oldest_article = 7
delay = 1
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
encoding = 'utf-8'
language = 'sv'
conversion_options = {
'comment' : description
, 'tags' : category
, 'publisher' : publisher
, 'language' : language
}
keep_only_tags = [dict(name='div', attrs={'id':'article'})]
remove_tags_before = dict(name='div', attrs={'id':'article'})
remove_tags_after = dict(name='p',attrs={'id':'byline'})
remove_tags = [
dict(name=['object','link','base']),
dict(name='p', attrs={'class':'print'}),
dict(name='a', attrs={'class':'addthis_button_compact'}),
dict(name='script')
]
feeds = [(u'Nyheter', u'http://www.arbetaren.se/rss/arbetaren.rss?rev=123')]

View File

@ -0,0 +1,39 @@
from calibre.web.feeds.news import BasicNewsRecipe
class Ekot_SE(BasicNewsRecipe):
title = 'Ekot'
__author__ = 'Joakim Lindskog'
description = 'Nyheter fr\xc3\xa5n Ekot'
publisher = 'Ekot'
category = 'news, politics, Sweden'
oldest_article = 7
delay = 1
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
encoding = 'utf-8'
language = 'sv'
conversion_options = {
'comment' : description
, 'tags' : category
, 'publisher' : publisher
, 'language' : language
}
keep_only_tags = [dict(name='h1', attrs={'class':'newsH2'}),
dict(name='div', attrs={'class':'articleTop'}),
dict(name='div', attrs={'class':'newsIntro'}),
dict(name='div', attrs={'class':'newsText'})]
remove_tags = [
dict(name=['object','link','base'])
,dict(name='span',attrs={'class':'relLink'})
]
feeds = [(u'Ekot', u'http://api.sr.se/api/rssfeed/rssfeed.aspx?rssfeed=83'),
(u'Utrikes', u'http://api.sr.se/api/rssfeed/rssfeed.aspx?rssfeed=3304'),
(u'Radiosporten', u'http://api.sr.se/api/rssfeed/rssfeed.aspx?rssfeed=179')]
def print_version(self, url):
return url.replace('http://sverigesradio.se/cgi-bin/ekot/artikel.asp',
'http://sverigesradio.se/cgi-bin/isidorpub/PrinterFriendlyArticle.asp')+'&ProgramID=83'

View File

@ -0,0 +1,66 @@
from calibre.web.feeds.news import BasicNewsRecipe
class FriaTidningen_SE(BasicNewsRecipe):
title = u'Fria Tidningen'
__author__ = 'Joakim Lindskog'
description = 'Nyheter fr\xc3\xa5n Fria Tidningen'
publisher = 'Fria Tidningen'
category = 'news, politics, Sweden'
oldest_article = 7
delay = 1
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
encoding = 'utf-8'
language = 'sv'
conversion_options = {
'comment' : description
, 'tags' : category
, 'publisher' : publisher
, 'language' : language
}
keep_only_tags = [dict(name='div', attrs={'id':'content-area'})]
remove_tags_before = dict(name='div', attrs={'id':'content-area'})
remove_tags_after = dict(name='div',attrs={'id':'byline'})
remove_tags = [
dict(name=['object','link','base']),
dict(name='div', attrs={'id':'comments'}),
dict(name='div', attrs={'id':'block-block-21'}),
dict(name='div', attrs={'id':'block-block-22'}),
dict(name='div', attrs={'id':'block-block-23'}),
dict(name='div', attrs={'id':'block-block-24'}),
dict(name='div', attrs={'id':'block-block-25'}),
dict(name='div', attrs={'id':'block-block-26'}),
dict(name='div', attrs={'id':'block-block-27'}),
dict(name='div', attrs={'id':'block-block-28'}),
dict(name='div', attrs={'id':'block-block-29'}),
dict(name='div', attrs={'id':'block-block-30'}),
dict(name='div', attrs={'id':'block-block-40'})
]
feeds = [(u'Allt', u'http://www.fria.nu/feed'),
(u'Nyheter', u'http://www.fria.nu/taxonomy/term/13/feed/feed'),
(u'Inrikes', u'http://www.fria.nu/taxonomy/term/14/0/feed'),
(u'Utrikes', u'http://www.fria.nu/taxonomy/term/15/0/feed'),
(u'Ekonomi', u'http://www.fria.nu/taxonomy/term/27047/0/feed'),
(u'Opinion', u'http://www.fria.nu/taxonomy/term/22/0/feed'),
(u'Inledaren', u'http://www.fria.nu/taxonomy/term/24/0/feed'),
(u'Argument', u'http://www.fria.nu/taxonomy/term/23/0/feed'),
(u'Synpunkten', u'http://www.fria.nu/taxonomy/term/26/0/feed'),
(u'Debatt', u'http://www.fria.nu/taxonomy/term/25/0/feed'),
(u'Kultur', u'http://www.fria.nu/taxonomy/term/19/0/feed'),
(u'Kulturnyheter', u'http://www.fria.nu/taxonomy/term/24534/0/feed'),
(u'Recensioner', u'http://www.fria.nu/taxonomy/term/24535/0/feed'),
(u'BAK', u'http://www.fria.nu/taxonomy/term/27/0/feed'),
(u'Sport & H\xc3\xa4lsa' u'http://www.fria.nu/taxonomy/term/27215/0/feed'),
(u'Sport', u'http://www.fria.nu/taxonomy/term/20/0/feed'),
(u'H\xc3\xa4lsa', u'http://www.fria.nu/taxonomy/term/21/0/feed'),
(u'F\xc3\xb6rdjupning', u'http://www.fria.nu/taxonomy/term/24994/0/feed'),
(u'Fokus', u'http://www.fria.nu/taxonomy/term/24864/0/feed'),
(u'Samtal', u'http://www.fria.nu/taxonomy/term/28/0/feed'),
(u'Stockholm', u'http://www.fria.nu/taxonomy/term/122/0/feed'),
(u'G\xc3\xb6teborg', u'http://www.fria.nu/taxonomy/term/73/0/feed'),
(u'Uppsala', u'http://www.fria.nu/taxonomy/term/27324/0/feed'),
(u'Malm\xc3\xb6', u'http://www.fria.nu/taxonomy/term/28031/0/feed')]

View File

@ -49,7 +49,7 @@ class Reader(FormatReader):
def decompress_text(self, number):
if self.header_record.compression == 1:
return self.section_data(number).decode('cp1252' if self.encoding is None else self.encoding)
if self.header_record.compression == 2:
if self.header_record.compression == 2 or self.header_record.compression == 258:
from calibre.ebooks.compression.palmdoc import decompress_doc
return decompress_doc(self.section_data(number)).decode('cp1252' if self.encoding is None else self.encoding, 'replace')
return ''

View File

@ -98,7 +98,7 @@ class Float(Int):
self.widgets = [QLabel('&'+self.col_metadata['name']+':', parent),
QDoubleSpinBox(parent)]
w = self.widgets[1]
self.setRange(-100., float(sys.maxint))
w.setRange(-100., float(sys.maxint))
w.setDecimals(2)
class Rating(Int):
@ -160,6 +160,7 @@ class Comments(Base):
self._layout = QVBoxLayout()
self._tb = QPlainTextEdit(self._box)
self._tb.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
self._tb.setTabChangesFocus()
self._layout.addWidget(self._tb)
self._box.setLayout(self._layout)
self.widgets = [self._box]
@ -240,7 +241,13 @@ widgets = {
def populate_single_metadata_page(left, right, db, book_id, parent=None):
x = db.custom_column_num_map
cols = list(x)
cols.sort(cmp=lambda z,y: cmp(x[z]['name'].lower(), x[y]['name'].lower()))
def field_sort(y, z):
m1, m2 = x[y], x[z]
n1 = 'zzzzz' if m1['datatype'] == 'comments' else m1['name']
n2 = 'zzzzz' if m2['datatype'] == 'comments' else m2['name']
return cmp(n1.lower(), n2.lower())
cols.sort(cmp=field_sort)
ans = []
for i, col in enumerate(cols):
w = widgets[x[col]['datatype']](db, col, parent)

View File

@ -426,6 +426,10 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
sip.delete(w.layout())
w.setLayout(top_layout)
self.__custom_col_layouts = [top_layout, left_layout, right_layout]
ans = self.custom_column_widgets
for i in range(len(ans)-1):
w.setTabOrder(ans[i].widgets[-1], ans[i+1].widgets[-1])
def validate_isbn(self, isbn):

View File

@ -416,6 +416,9 @@
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QTextEdit" name="comments">
<property name="tabChangesFocus">
<bool>true</bool>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>

View File

@ -81,7 +81,7 @@ Device Integration
What devices does |app| support?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At the moment |app| has full support for the SONY PRS 300/500/505/600/700/900, Barnes & Noble Nook, Cybook Gen 3/Opus, Amazon Kindle 1/2/DX, Entourage Edge, Longshine ShineBook, Ectaco Jetbook, BeBook/BeBook Mini, Irex Illiad/DR1000, Foxit eSlick, PocketBook 360, Italica, eClicto, Iriver Story, Airis dBook, Hanvon N515, Binatone Readme, Teclast K3, SpringDesign Alex, various Android phones and the iPhone. In addition, using the :guilabel:`Save to disk` function you can use it with any ebook reader that exports itself as a USB disk.
At the moment |app| has full support for the SONY PRS 300/500/505/600/700/900, Barnes & Noble Nook, Cybook Gen 3/Opus, Amazon Kindle 1/2/DX, Entourage Edge, Longshine ShineBook, Ectaco Jetbook, BeBook/BeBook Mini, Irex Illiad/DR1000, Foxit eSlick, PocketBook 360, Italica, eClicto, Iriver Story, Airis dBook, Hanvon N515, Binatone Readme, Teclast K3, SpringDesign Alex, various Android phones and the iPhone/iPad. In addition, using the :guilabel:`Save to disk` function you can use it with any ebook reader that exports itself as a USB disk.
How can I help get my device supported in |app|?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~