From 3839b99e9c5639e5c6a34b9e54531a4e664cf4d1 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Sat, 23 Oct 2010 15:11:06 +0100 Subject: [PATCH 1/3] Avoid creating metadata.opf files in the root of the library when adding books --- src/calibre/library/database2.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index b21299c335..4943dd9dd5 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -654,16 +654,20 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): def get_metadata_for_dump(self, idx, remove_from_dirtied=True): try: - path = os.path.join(self.abspath(idx, index_is_id=True), 'metadata.opf') - mi = self.get_metadata(idx, index_is_id=True) - # Always set cover to cover.jpg. Even if cover doesn't exist, - # no harm done. This way no need to call dirtied when - # cover is set/removed - mi.cover = 'cover.jpg' + path, mi = (None, None) + # 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') + mi = self.get_metadata(idx, index_is_id=True) + # Always set cover to cover.jpg. Even if cover doesn't exist, + # no harm done. This way no need to call dirtied when + # cover is set/removed + mi.cover = 'cover.jpg' except: # This almost certainly means that the book has been deleted while # the backup operation sat in the queue. - path, mi = (None, None) + pass try: # clear the dirtied indicator. The user must put it back if From c020a3d12797a57634a700addaaa0caa87bee150 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 23 Oct 2010 19:21:01 -0700 Subject: [PATCH 2/3] STNN by Larry Chan --- resources/recipes/stnn.recipe | 60 +++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 resources/recipes/stnn.recipe diff --git a/resources/recipes/stnn.recipe b/resources/recipes/stnn.recipe new file mode 100644 index 0000000000..7be357c921 --- /dev/null +++ b/resources/recipes/stnn.recipe @@ -0,0 +1,60 @@ + + +__license__ = 'GPL v3' +__copyright__ = '2010, Larry Chan ' +''' +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') + + ] + From 4110646e8a2f81d84b5c72a9347fb5661811137f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 24 Oct 2010 09:16:16 -0700 Subject: [PATCH 3/3] Fix #7287 (Building calibre fails on PyQt 4.8.0) --- src/calibre/gui2/lrf_renderer/main.ui | 189 +++++++++++--------------- src/calibre/gui2/viewer/main.ui | 4 +- 2 files changed, 81 insertions(+), 112 deletions(-) diff --git a/src/calibre/gui2/lrf_renderer/main.ui b/src/calibre/gui2/lrf_renderer/main.ui index 0e7b54edb8..4143b4f509 100644 --- a/src/calibre/gui2/lrf_renderer/main.ui +++ b/src/calibre/gui2/lrf_renderer/main.ui @@ -1,7 +1,8 @@ - + + MainWindow - - + + 0 0 @@ -9,75 +10,51 @@ 701 - - + + 0 0 - + LRF Viewer - - + + :/images/viewer.png:/images/viewer.png - - - - 0 - 39 - 601 - 662 - - - - + + + 0 - - + + 0 - - - - 0 - 0 - 601 - 662 - - - - + + + 0 - - - + + + true - - - - 0 - 0 - 601 - 701 - - - + + - + Qt::Vertical - + 20 40 @@ -86,34 +63,34 @@ - - + + QFrame::StyledPanel - + QFrame::Raised - + - - + + 0 - + -1 - - + + 11 75 true - + Parsing LRF file @@ -123,10 +100,10 @@ - + Qt::Vertical - + 20 40 @@ -140,93 +117,85 @@ - - - - 0 - 0 - 601 - 39 - - - + + LRF Viewer toolbar - + Qt::AllToolBarAreas - - TopToolBarArea + + Qt::TopToolBarArea - - true + + false - - - - - - - - - + + + + + + + + + - - - + + + :/images/next.png:/images/next.png - + Next Page - - - + + + :/images/previous.png:/images/previous.png - + Previous Page - - - + + + :/images/back.png:/images/back.png - + Back - - - + + + :/images/forward.png:/images/forward.png - + Forward - - + + Next match - - - + + + :/images/document_open.png:/images/document_open.png - + Open ebook - - - + + + :/images/config.png:/images/config.png - + Configure @@ -239,7 +208,7 @@ - + diff --git a/src/calibre/gui2/viewer/main.ui b/src/calibre/gui2/viewer/main.ui index e3b8fb8a61..4cfa1590da 100644 --- a/src/calibre/gui2/viewer/main.ui +++ b/src/calibre/gui2/viewer/main.ui @@ -108,7 +108,7 @@ - LeftToolBarArea + Qt::LeftToolBarArea false @@ -136,7 +136,7 @@ - TopToolBarArea + Qt::TopToolBarArea false