diff --git a/recipes/mediapart.recipe b/recipes/mediapart.recipe index 0cf8f21032..4540879f72 100644 --- a/recipes/mediapart.recipe +++ b/recipes/mediapart.recipe @@ -71,7 +71,7 @@ class Mediapart(BasicNewsRecipe): br = BasicNewsRecipe.get_browser() if self.username is not None and self.password is not None: br.open('http://www.mediapart.fr/') - br.select_form(nr=1) + br.select_form(nr=0) br['name'] = self.username br['pass'] = self.password br.submit() diff --git a/recipes/metro_uk.recipe b/recipes/metro_uk.recipe index 26133edbd9..deced5976b 100644 --- a/recipes/metro_uk.recipe +++ b/recipes/metro_uk.recipe @@ -1,5 +1,4 @@ from calibre.web.feeds.news import BasicNewsRecipe - class AdvancedUserRecipe1306097511(BasicNewsRecipe): title = u'Metro UK' @@ -14,7 +13,9 @@ class AdvancedUserRecipe1306097511(BasicNewsRecipe): masthead_url = 'http://e-edition.metro.co.uk/images/metro_logo.gif' keep_only_tags = [ - dict(name='h1', attrs={'':''}), + dict(attrs={'class':['img-cnt figure']}), + dict(attrs={'class':['art-img']}), + dict(name='h1'), dict(name='h2', attrs={'class':'h2'}), dict(name='div', attrs={'class':'art-lft'}) ] @@ -24,3 +25,5 @@ class AdvancedUserRecipe1306097511(BasicNewsRecipe): feeds = [ (u'News', u'http://www.metro.co.uk/rss/news/'), (u'Money', u'http://www.metro.co.uk/rss/money/'), (u'Sport', u'http://www.metro.co.uk/rss/sport/'), (u'Film', u'http://www.metro.co.uk/rss/metrolife/film/'), (u'Music', u'http://www.metro.co.uk/rss/metrolife/music/'), (u'TV', u'http://www.metro.co.uk/rss/tv/'), (u'Showbiz', u'http://www.metro.co.uk/rss/showbiz/'), (u'Weird News', u'http://www.metro.co.uk/rss/weird/'), (u'Travel', u'http://www.metro.co.uk/rss/travel/'), (u'Lifestyle', u'http://www.metro.co.uk/rss/lifestyle/'), (u'Books', u'http://www.metro.co.uk/rss/lifestyle/books/'), (u'Food', u'http://www.metro.co.uk/rss/lifestyle/restaurants/')] + + diff --git a/src/calibre/ebooks/metadata/book/base.py b/src/calibre/ebooks/metadata/book/base.py index 3e2201f6a4..69407dcb2e 100644 --- a/src/calibre/ebooks/metadata/book/base.py +++ b/src/calibre/ebooks/metadata/book/base.py @@ -74,7 +74,7 @@ class Metadata(object): Metadata from custom columns should be accessed via the get() method, passing in the lookup name for the column, for example: "#mytags". - Use the :meth:`is_null` method to test if a filed is null. + Use the :meth:`is_null` method to test if a field is null. This object also has functions to format fields into strings. @@ -105,7 +105,7 @@ class Metadata(object): def is_null(self, field): ''' - Return True if the value of filed is null in this object. + Return True if the value of field is null in this object. 'null' means it is unknown or evaluates to False. So a title of _('Unknown') is null or a language of 'und' is null. diff --git a/src/calibre/manual/template_lang.rst b/src/calibre/manual/template_lang.rst index f1d2844d37..ef44b0a5c9 100644 --- a/src/calibre/manual/template_lang.rst +++ b/src/calibre/manual/template_lang.rst @@ -122,7 +122,7 @@ The functions available are: * ``uppercase()`` -- return the value of the field in upper case. * ``titlecase()`` -- return the value of the field in title case. * ``capitalize()`` -- return the value with the first letter upper case and the rest lower case. - * ``contains(pattern, text if match, text if not match`` -- checks if field contains matches for the regular expression `pattern`. Returns `text if match` if matches are found, otherwise it returns `text if no match`. + * ``contains(pattern, text if match, text if not match)`` -- checks if field contains matches for the regular expression `pattern`. Returns `text if match` if matches are found, otherwise it returns `text if no match`. * ``count(separator)`` -- interprets the value as a list of items separated by `separator`, returning the number of items in the list. Most lists use a comma as the separator, but authors uses an ampersand. Examples: `{tags:count(,)}`, `{authors:count(&)}` * ``ifempty(text)`` -- if the field is not empty, return the value of the field. Otherwise return `text`. * ``in_list(separator, pattern, found_val, not_found_val)`` -- interpret the field as a list of items separated by `separator`, comparing the `pattern` against each value in the list. If the pattern matches a value, return `found_val`, otherwise return `not_found_val`. diff --git a/src/calibre/utils/zipfile.py b/src/calibre/utils/zipfile.py index 33ee19bf4f..fa15bff4b4 100644 --- a/src/calibre/utils/zipfile.py +++ b/src/calibre/utils/zipfile.py @@ -1123,9 +1123,13 @@ class ZipFile: targetpath = os.sep.join(components) with open(targetpath, 'wb') as target: shutil.copyfileobj(source, target) - mtime = time.localtime() - mtime = time.mktime(member.date_time + (0, 0) + (mtime.tm_isdst,)) - os.utime(targetpath, (mtime, mtime)) + # Kovid: Try to preserve the timestamps in the ZIP file + try: + mtime = time.localtime() + mtime = time.mktime(member.date_time + (0, 0) + (mtime.tm_isdst,)) + os.utime(targetpath, (mtime, mtime)) + except: + pass self.extract_mapping[member.filename] = targetpath return targetpath