diff --git a/resources/recipes/winnipeg_sun.recipe b/resources/recipes/winnipeg_sun.recipe new file mode 100644 index 0000000000..fe611b8d5c --- /dev/null +++ b/resources/recipes/winnipeg_sun.recipe @@ -0,0 +1,35 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class AdvancedUserRecipe1277647803(BasicNewsRecipe): + title = u'Winnipeg Sun' + __author__ = 'rty' + __version__ = '1.0' + oldest_article = 2 + pubisher = 'www.winnipegsun.com' + description = 'Winnipeg Newspaper' + category = 'News, Winnipeg, Canada' + max_articles_per_feed = 100 + no_stylesheets = True + encoding = 'UTF-8' + remove_javascript = True + use_embedded_content = False + language = 'en_CA' + feeds = [ + (u'News', u'http://www.winnipegsun.com/news/rss.xml'), + (u'Columnists', u'http://www.winnipegsun.com/columnists/rss.xml'), + (u'Editorial', u'http://www.winnipegsun.com/comment/editorial/rss.xml'), + (u'Entertainments', u'http://www.winnipegsun.com/entertainment/rss.xml'), + (u'Life', u'http://www.winnipegsun.com/life/rss.xml'), + (u'Money', u'http://www.winnipegsun.com/money/rss.xml') + ] + keep_only_tags = [ + dict(name='div', attrs={'id':'article'}), + ] + remove_tags = [ + dict(name='div', attrs={'class':['leftBox','bottomBox clear']}), + dict(name='ul', attrs={'class':'tabs dl contentSwap'}), + dict(name='div', attrs={'id':'commentsBottom'}), + ] + remove_tags_after = [ + dict(name='div', attrs={'class':'bottomBox clear'}) + ] diff --git a/src/calibre/devices/kobo/books.py b/src/calibre/devices/kobo/books.py index 0389b266f2..781562d091 100644 --- a/src/calibre/devices/kobo/books.py +++ b/src/calibre/devices/kobo/books.py @@ -13,7 +13,7 @@ from calibre import isbytestring class Book(MetaInformation): - BOOK_ATTRS = ['lpath', 'size', 'mime', 'device_collections'] + BOOK_ATTRS = ['lpath', 'size', 'mime', 'device_collections', '_new_book'] JSON_ATTRS = [ 'lpath', 'title', 'authors', 'mime', 'size', 'tags', 'author_sort', @@ -27,6 +27,7 @@ class Book(MetaInformation): MetaInformation.__init__(self, '') self.device_collections = [] + self._new_book = False self.path = os.path.join(prefix, lpath) if os.sep == '\\': diff --git a/src/calibre/devices/usbms/books.py b/src/calibre/devices/usbms/books.py index 5c9a91fc18..0f5c848c1a 100644 --- a/src/calibre/devices/usbms/books.py +++ b/src/calibre/devices/usbms/books.py @@ -138,7 +138,7 @@ class CollectionsBookList(BookList): # The default: leave the book in all existing collections. Do not # add any new ones. attrs = ['device_collections'] - if book._new_book: + if getattr(book, '_new_book', False): if prefs['preserve_user_collections']: # Ensure that the book is in all the book's existing # collections plus all metadata collections diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index a08e06378c..9f9488a052 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -126,7 +126,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): self.dbpath = os.path.join(library_path, 'metadata.db') self.dbpath = os.environ.get('CALIBRE_OVERRIDE_DATABASE_PATH', self.dbpath) - if isinstance(self.dbpath, unicode): + if isinstance(self.dbpath, unicode) and not iswindows: self.dbpath = self.dbpath.encode(filesystem_encoding) self.connect() diff --git a/src/calibre/web/fetch/simple.py b/src/calibre/web/fetch/simple.py index b6186f785d..41d9c4ed59 100644 --- a/src/calibre/web/fetch/simple.py +++ b/src/calibre/web/fetch/simple.py @@ -156,7 +156,7 @@ class RecursiveFetcher(object): replace = self.prepreprocess_html_ext(soup) if replace is not None: - soup = BeautifulSoup(xml_to_unicode(src, self.verbose, strip_encoding_pats=True)[0], markupMassage=nmassage) + soup = BeautifulSoup(xml_to_unicode(replace, self.verbose, strip_encoding_pats=True)[0], markupMassage=nmassage) if self.keep_only_tags: body = Tag(soup, 'body')