Merge from trunk

This commit is contained in:
Sengian 2010-10-24 23:29:33 +02:00
commit ab7de6bbe1
4 changed files with 152 additions and 119 deletions

View File

@ -0,0 +1,60 @@
__license__ = 'GPL v3'
__copyright__ = '2010, Larry Chan <larry1chan at gmail.com>'
'''
Singtao STNN
'''
from calibre.web.feeds.recipes import BasicNewsRecipe
class SingtaoSTNN(BasicNewsRecipe):
title = 'Singtao STNN'
__author__ = 'Larry Chan, larry1chan'
description = 'Chinese News'
oldest_article = 2
max_articles_per_feed = 100
simultaneous_downloads = 5
no_stylesheets = True
#delay = 1
use_embedded_content = False
encoding = 'gb2312'
publisher = 'Singtao STNN'
category = 'news, China, world'
language = 'zh'
publication_type = 'newsportal'
extra_css = ' body{ font-family: Verdana,Helvetica,Arial,sans-serif } .introduction{font-weight: bold} .story-feature{display: block; padding: 0; border: 1px solid; width: 40%; font-size: small} .story-feature h2{text-align: center; text-transform: uppercase} '
masthead_url = 'http://www.stnn.cc/images/0806/logo_080728.gif'
conversion_options = {
'comments' : description
,'tags' : category
,'language' : language
,'publisher' : publisher
,'linearize_tables': True
}
remove_tags_before = dict(name='div', attrs={'class':['page_box']})
remove_tags_after = dict(name='div', attrs={'class':['pagelist']})
keep_only_tags = [
dict(name='div', attrs={'class':['font_title clearfix']}),
dict(name='div', attrs={'id':['content_zoom']})
]
remove_attributes = ['width','height','href']
# for a full list of rss check out [url]http://www.stnn.cc/rss/[/url]
feeds = [ (u'Headline News', u'http://www.stnn.cc/rss/news/index.xml'),
(u'Breaking News', u'http://www.stnn.cc/rss/tufa/index.xml'),
(u'Finance', u'http://www.stnn.cc/rss/fin/index.xml'),
(u'Entertainment', u'http://www.stnn.cc/rss/ent/index.xml'),
(u'International', u'http://www.stnn.cc/rss/guoji/index.xml'),
(u'China', u'http://www.stnn.cc/rss/china/index.xml'),
(u'Opnion', u'http://www.stnn.cc/rss/fin_op/index.xml'),
(u'Blog', u'http://blog.stnn.cc/uploadfile/rssblogtypehotlog.xml'),
(u'Hong Kong', u'http://www.stnn.cc/rss/hongkong/index.xml')
]

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>MainWindow</class> <class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow"> <widget class="QMainWindow" name="MainWindow">
@ -10,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" > <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -19,18 +20,10 @@
<string>LRF Viewer</string> <string>LRF Viewer</string>
</property> </property>
<property name="windowIcon"> <property name="windowIcon">
<iconset resource="../../../../resources/images.qrc" > <iconset>
<normaloff>:/images/viewer.png</normaloff>:/images/viewer.png</iconset> <normaloff>:/images/viewer.png</normaloff>:/images/viewer.png</iconset>
</property> </property>
<widget class="QWidget" name="central_widget"> <widget class="QWidget" name="central_widget">
<property name="geometry" >
<rect>
<x>0</x>
<y>39</y>
<width>601</width>
<height>662</height>
</rect>
</property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
@ -41,14 +34,6 @@
<number>0</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="viewer_page"> <widget class="QWidget" name="viewer_page">
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>601</width>
<height>662</height>
</rect>
</property>
<layout class="QGridLayout"> <layout class="QGridLayout">
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
@ -63,14 +48,6 @@
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="bar_page"> <widget class="QWidget" name="bar_page">
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>601</width>
<height>701</height>
</rect>
</property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<item> <item>
<spacer> <spacer>
@ -141,14 +118,6 @@
</layout> </layout>
</widget> </widget>
<widget class="QToolBar" name="tool_bar"> <widget class="QToolBar" name="tool_bar">
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>601</width>
<height>39</height>
</rect>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>LRF Viewer toolbar</string> <string>LRF Viewer toolbar</string>
</property> </property>
@ -156,10 +125,10 @@
<set>Qt::AllToolBarAreas</set> <set>Qt::AllToolBarAreas</set>
</property> </property>
<attribute name="toolBarArea"> <attribute name="toolBarArea">
<enum>TopToolBarArea</enum> <enum>Qt::TopToolBarArea</enum>
</attribute> </attribute>
<attribute name="toolBarBreak"> <attribute name="toolBarBreak">
<bool>true</bool> <bool>false</bool>
</attribute> </attribute>
<addaction name="action_back"/> <addaction name="action_back"/>
<addaction name="action_forward"/> <addaction name="action_forward"/>
@ -173,7 +142,7 @@
</widget> </widget>
<action name="action_next_page"> <action name="action_next_page">
<property name="icon"> <property name="icon">
<iconset resource="../../../../resources/images.qrc" > <iconset>
<normaloff>:/images/next.png</normaloff>:/images/next.png</iconset> <normaloff>:/images/next.png</normaloff>:/images/next.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -182,7 +151,7 @@
</action> </action>
<action name="action_previous_page"> <action name="action_previous_page">
<property name="icon"> <property name="icon">
<iconset resource="../../../../resources/images.qrc" > <iconset>
<normaloff>:/images/previous.png</normaloff>:/images/previous.png</iconset> <normaloff>:/images/previous.png</normaloff>:/images/previous.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -191,7 +160,7 @@
</action> </action>
<action name="action_back"> <action name="action_back">
<property name="icon"> <property name="icon">
<iconset resource="../../../../resources/images.qrc" > <iconset>
<normaloff>:/images/back.png</normaloff>:/images/back.png</iconset> <normaloff>:/images/back.png</normaloff>:/images/back.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -200,7 +169,7 @@
</action> </action>
<action name="action_forward"> <action name="action_forward">
<property name="icon"> <property name="icon">
<iconset resource="../../../../resources/images.qrc" > <iconset>
<normaloff>:/images/forward.png</normaloff>:/images/forward.png</iconset> <normaloff>:/images/forward.png</normaloff>:/images/forward.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -214,7 +183,7 @@
</action> </action>
<action name="action_open_ebook"> <action name="action_open_ebook">
<property name="icon"> <property name="icon">
<iconset resource="../../../../resources/images.qrc" > <iconset>
<normaloff>:/images/document_open.png</normaloff>:/images/document_open.png</iconset> <normaloff>:/images/document_open.png</normaloff>:/images/document_open.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -223,7 +192,7 @@
</action> </action>
<action name="action_configure"> <action name="action_configure">
<property name="icon"> <property name="icon">
<iconset resource="../../../../resources/images.qrc" > <iconset>
<normaloff>:/images/config.png</normaloff>:/images/config.png</iconset> <normaloff>:/images/config.png</normaloff>:/images/config.png</iconset>
</property> </property>
<property name="text"> <property name="text">

View File

@ -108,7 +108,7 @@
</size> </size>
</property> </property>
<attribute name="toolBarArea"> <attribute name="toolBarArea">
<enum>LeftToolBarArea</enum> <enum>Qt::LeftToolBarArea</enum>
</attribute> </attribute>
<attribute name="toolBarBreak"> <attribute name="toolBarBreak">
<bool>false</bool> <bool>false</bool>
@ -136,7 +136,7 @@
</widget> </widget>
<widget class="QToolBar" name="tool_bar2"> <widget class="QToolBar" name="tool_bar2">
<attribute name="toolBarArea"> <attribute name="toolBarArea">
<enum>TopToolBarArea</enum> <enum>Qt::TopToolBarArea</enum>
</attribute> </attribute>
<attribute name="toolBarBreak"> <attribute name="toolBarBreak">
<bool>false</bool> <bool>false</bool>

View File

@ -653,7 +653,11 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
self.dirtied(book_ids) self.dirtied(book_ids)
def get_metadata_for_dump(self, idx, remove_from_dirtied=True): def get_metadata_for_dump(self, idx, remove_from_dirtied=True):
path, mi = (None, None)
try: try:
# While a book is being created, the path is empty. Don't bother to
# try to write the opf, because it will go to the wrong folder.
if self.path(idx, index_is_id=True):
path = os.path.join(self.abspath(idx, index_is_id=True), 'metadata.opf') path = os.path.join(self.abspath(idx, index_is_id=True), 'metadata.opf')
mi = self.get_metadata(idx, index_is_id=True) mi = self.get_metadata(idx, index_is_id=True)
# Always set cover to cover.jpg. Even if cover doesn't exist, # Always set cover to cover.jpg. Even if cover doesn't exist,
@ -663,7 +667,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
except: except:
# This almost certainly means that the book has been deleted while # This almost certainly means that the book has been deleted while
# the backup operation sat in the queue. # the backup operation sat in the queue.
path, mi = (None, None) pass
try: try:
# clear the dirtied indicator. The user must put it back if # clear the dirtied indicator. The user must put it back if