mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
py2 compat in amazon metadata plugin for ancient calibre
This commit is contained in:
parent
d766adc463
commit
bc91a6bed6
@ -4,6 +4,7 @@
|
|||||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import string
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
from functools import partial
|
from functools import partial
|
||||||
@ -511,7 +512,10 @@ class Worker(Thread): # Get details {{{
|
|||||||
def totext(self, elem, only_printable=False):
|
def totext(self, elem, only_printable=False):
|
||||||
res = self.tostring(elem, encoding='unicode', method='text')
|
res = self.tostring(elem, encoding='unicode', method='text')
|
||||||
if only_printable:
|
if only_printable:
|
||||||
filtered_characters = list(s for s in res if s.isprintable())
|
try:
|
||||||
|
filtered_characters = list(s for s in res if s.isprintable())
|
||||||
|
except AttributeError:
|
||||||
|
filtered_characters = list(s for s in res if s in string.printable)
|
||||||
res = ''.join(filtered_characters).strip()
|
res = ''.join(filtered_characters).strip()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@ -971,7 +975,7 @@ class Worker(Thread): # Get details {{{
|
|||||||
class Amazon(Source):
|
class Amazon(Source):
|
||||||
|
|
||||||
name = 'Amazon.com'
|
name = 'Amazon.com'
|
||||||
version = (1, 2, 25)
|
version = (1, 2, 26)
|
||||||
minimum_calibre_version = (2, 82, 0)
|
minimum_calibre_version = (2, 82, 0)
|
||||||
description = _('Downloads metadata and covers from Amazon')
|
description = _('Downloads metadata and covers from Amazon')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user