mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix detection of UK firmware 505s on OS X and update USA Today recipe
This commit is contained in:
parent
f4841f4d9b
commit
a5c5880cb9
@ -33,9 +33,9 @@ class PRS505(CLI, Device):
|
||||
WINDOWS_CARD_A_MEM = ['PRS-505/UC:MS', 'PRS-505/CE:MS']
|
||||
WINDOWS_CARD_B_MEM = ['PRS-505/UC:SD', 'PRS-505/CE:SD']
|
||||
|
||||
OSX_MAIN_MEM = 'Sony PRS-505/UC Media'
|
||||
OSX_CARD_A_MEM = 'Sony PRS-505/UC:MS Media'
|
||||
OSX_CARD_B_MEM = 'Sony PRS-505/UC:SD'
|
||||
OSX_MAIN_MEM = ['Sony PRS-505/UC Media', 'Sony PRS-505/CE Media']
|
||||
OSX_CARD_A_MEM = ['Sony PRS-505/UC:MS Media', 'Sony PRS-505/CE:MS Media']
|
||||
OSX_CARD_B_MEM = ['Sony PRS-505/UC:SD', 'Sony PRS-505/CE:SD']
|
||||
|
||||
MAIN_MEMORY_VOLUME_LABEL = 'Sony Reader Main Memory'
|
||||
STORAGE_CARD_VOLUME_LABEL = 'Sony Reader Storage Card'
|
||||
@ -185,7 +185,7 @@ class PRS505(CLI, Device):
|
||||
def add_books_to_metadata(self, locations, metadata, booklists):
|
||||
if not locations or not metadata:
|
||||
return
|
||||
|
||||
|
||||
metadata = iter(metadata)
|
||||
for location in locations:
|
||||
info = metadata.next()
|
||||
|
@ -284,12 +284,24 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
names[loc] = match.group(1)
|
||||
break
|
||||
|
||||
def check_line(line, pat):
|
||||
if pat is None:
|
||||
return False
|
||||
if not line.strip().endswith('<class IOMedia>'):
|
||||
return False
|
||||
if isinstance(pat, basestring):
|
||||
pat = [pat]
|
||||
for x in pat:
|
||||
if x in line:
|
||||
return True
|
||||
return False
|
||||
|
||||
for i, line in enumerate(lines):
|
||||
if self.OSX_MAIN_MEM is not None and line.strip().endswith('<class IOMedia>') and self.OSX_MAIN_MEM in line:
|
||||
if check_line(line, self.OSX_MAIN_MEM):
|
||||
get_dev_node(lines[i+1:], 'main')
|
||||
if self.OSX_CARD_A_MEM is not None and line.strip().endswith('<class IOMedia>') and self.OSX_CARD_A_MEM in line:
|
||||
if check_line(line, self.OSX_CARD_A_MEM):
|
||||
get_dev_node(lines[i+1:], 'carda')
|
||||
if self.OSX_CARD_B_MEM is not None and line.strip().endswith('<class IOMedia>') and self.OSX_CARD_B_MEM in line:
|
||||
if check_line(line, self.OSX_CARD_B_MEM):
|
||||
get_dev_node(lines[i+1:], 'cardb')
|
||||
if len(names.keys()) == 3:
|
||||
break
|
||||
|
@ -14,21 +14,34 @@ class USAToday(BasicNewsRecipe):
|
||||
title = 'USA Today'
|
||||
timefmt = ' [%d %b %Y]'
|
||||
max_articles_per_feed = 20
|
||||
no_stylesheets = True
|
||||
language = _('English')
|
||||
__author__ = _('Kovid Goyal and Sujata Raman')
|
||||
|
||||
no_stylesheets = True
|
||||
extra_css = '''
|
||||
.inside-head { font: x-large bold }
|
||||
.inside-head2 { font: x-large bold }
|
||||
.inside-head3 { font: x-large bold }
|
||||
.byLine { font: large }
|
||||
'''
|
||||
.inside-head{font-family:Arial,Helvetica,sans-serif; font-size:large; font-weight:bold }
|
||||
.inside-head2{font-family:Arial,Helvetica,sans-serif; font-size:large; font-weight:bold }
|
||||
.inside-head3{font-family:Arial,Helvetica,sans-serif; font-size:large; font-weight:bold }
|
||||
h3{font-family:Arial,Helvetica,sans-serif; font-size:large; font-weight:bold }
|
||||
h4{font-family:Arial,Helvetica,sans-serif; font-size:x-small; font-weight:bold }
|
||||
.side-by-side{font-family:Arial,Helvetica,sans-serif; font-size:x-small;}
|
||||
#byLineTag{font-family:Arial,Helvetica,sans-serif; font-size:xx-small;}
|
||||
.inside-copy{font-family:Arial,Helvetica,sans-serif; font-size:x-small;text-align:left}
|
||||
.caption{font-family:Arial,Helvetica,sans-serif; font-size:x-small;}
|
||||
'''
|
||||
remove_tags = [
|
||||
dict(name='div', attrs={'class':'inside-copy'}),
|
||||
{'class':['tagListLabel','piped-taglist-string',]}
|
||||
]
|
||||
|
||||
html2lrf_options = ['--ignore-tables']
|
||||
|
||||
preprocess_regexps = [
|
||||
(re.compile(r'<BODY.*?<!--Article Goes Here-->', re.IGNORECASE | re.DOTALL), lambda match : '<BODY>'),
|
||||
(re.compile(r'<!--Article End-->.*?</BODY>', re.IGNORECASE | re.DOTALL), lambda match : '</BODY>'),
|
||||
]
|
||||
|
||||
|
||||
|
||||
feeds = [
|
||||
('Top Headlines', 'http://rssfeeds.usatoday.com/usatoday-NewsTopStories'),
|
||||
('Sport Headlines', 'http://rssfeeds.usatoday.com/UsatodaycomSports-TopStories'),
|
||||
@ -39,13 +52,13 @@ class USAToday(BasicNewsRecipe):
|
||||
('Weather Headlines', 'http://rssfeeds.usatoday.com/usatoday-WeatherTopStories'),
|
||||
('Most Popular', 'http://rssfeeds.usatoday.com/Usatoday-MostViewedArticles'),
|
||||
]
|
||||
|
||||
## Getting the print version
|
||||
|
||||
|
||||
## Getting the print version
|
||||
|
||||
def print_version(self, url):
|
||||
return 'http://www.printthis.clickability.com/pt/printThis?clickMap=printThis&fb=Y&url=' + url
|
||||
|
||||
|
||||
def postprocess_html(self, soup, first_fetch):
|
||||
for t in soup.findAll(['table', 'tr', 'td']):
|
||||
t.name = 'div'
|
||||
return soup
|
||||
return soup
|
||||
|
Loading…
x
Reference in New Issue
Block a user