From 150487d0e1e65039f4000fe431363a5b97453f28 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 29 May 2010 19:33:26 -0600 Subject: [PATCH 1/2] Put back drive swapping for Hanlin and Binatone devices --- src/calibre/devices/binatone/driver.py | 10 ++++++++++ src/calibre/devices/hanlin/driver.py | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/calibre/devices/binatone/driver.py b/src/calibre/devices/binatone/driver.py index 8b3c803901..bf202be83c 100644 --- a/src/calibre/devices/binatone/driver.py +++ b/src/calibre/devices/binatone/driver.py @@ -42,3 +42,13 @@ class README(USBMS): drives[0] = drives[1] drives[1] = t return tuple(drives) + + def windows_sort_drives(self, drives): + if len(drives) < 2: return drives + main = drives.get('main', None) + carda = drives.get('carda', None) + if main and carda: + drives['main'] = carda + drives['carda'] = main + return drives + diff --git a/src/calibre/devices/hanlin/driver.py b/src/calibre/devices/hanlin/driver.py index 49f9dfab57..c6c9fb876a 100644 --- a/src/calibre/devices/hanlin/driver.py +++ b/src/calibre/devices/hanlin/driver.py @@ -71,6 +71,18 @@ class HANLINV3(USBMS): drives[1] = t return tuple(drives) + def windows_sort_drives(self, drives): + if len(drives) < 2: return drives + main = drives.get('main', None) + carda = drives.get('carda', None) + if main and carda: + drives['main'] = carda + drives['carda'] = main + return drives + + + + class HANLINV5(HANLINV3): name = 'Hanlin V5 driver' From 9cd0fc1a52425f15d4b17994cebdda7dc2197ee7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 29 May 2010 19:36:20 -0600 Subject: [PATCH 2/2] News download: Strip all comments before parsing article HTML. If your recipe depended ont eh presence of comemnts, it will have to be adapted. --- src/calibre/web/fetch/simple.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/web/fetch/simple.py b/src/calibre/web/fetch/simple.py index 24b7027420..93fb516f2d 100644 --- a/src/calibre/web/fetch/simple.py +++ b/src/calibre/web/fetch/simple.py @@ -148,6 +148,9 @@ class RecursiveFetcher(object): nmassage = copy.copy(BeautifulSoup.MARKUP_MASSAGE) nmassage.extend(self.preprocess_regexps) nmassage += [(re.compile(r'', re.DOTALL), lambda m: '')] # Some websites have buggy doctype declarations that mess up beautifulsoup + # Remove comments as they can leave detritus when extracting tags leaves + # multiple nested comments + nmassage.append((re.compile(r'', re.DOTALL), lambda m: '')) soup = BeautifulSoup(xml_to_unicode(src, self.verbose, strip_encoding_pats=True)[0], markupMassage=nmassage) if self.keep_only_tags: