More intelligent error message when user selects wrong card for send to device operation on SONYs and improved nyimes

This commit is contained in:
Kovid Goyal 2010-03-22 06:43:16 +05:30
parent 70d9a6d3d6
commit 91f3f2d8b8
2 changed files with 10 additions and 4 deletions

View File

@ -57,9 +57,9 @@ class NYTimes(BasicNewsRecipe):
remove_tags_after = dict(id='article') remove_tags_after = dict(id='article')
remove_tags = [dict(attrs={'class':[ remove_tags = [dict(attrs={'class':[
'articleFooter', 'articleFooter',
'articleInline runaroundLeft',
'articleTools', 'articleTools',
'columnGroup doubleRule', 'columnGroup doubleRule',
'columnGroup singleRule',
'columnGroup last', 'columnGroup last',
'columnGroup last', 'columnGroup last',
'doubleRule', 'doubleRule',
@ -68,6 +68,7 @@ class NYTimes(BasicNewsRecipe):
'icon enlargeThis', 'icon enlargeThis',
'leftNavTabs', 'leftNavTabs',
'module box nav', 'module box nav',
'nextArticleLink',
'nextArticleLink clearfix', 'nextArticleLink clearfix',
'post-tools', 'post-tools',
'relatedSearchesModule', 'relatedSearchesModule',
@ -226,7 +227,7 @@ class NYTimes(BasicNewsRecipe):
if div['class'] == 'section-headline': if div['class'] == 'section-headline':
key = string.capwords(feed_title(div)) key = string.capwords(feed_title(div))
if len(self.excludeSectionKeywords): if self.excludeSectionKeywords:
excluded = re.compile('|'.join(self.excludeSectionKeywords)) excluded = re.compile('|'.join(self.excludeSectionKeywords))
if excluded.search(key): if excluded.search(key):
self.log("Skipping section %s" % key) self.log("Skipping section %s" % key)

View File

@ -150,7 +150,8 @@ class PRS505(CLI, Device):
for location in locations: for location in locations:
info = metadata.next() info = metadata.next()
path = location[0] path = location[0]
blist = 2 if location[3] == 'cardb' else 1 if location[3] == 'carda' else 0 oncard = location[3]
blist = 2 if oncard == 'cardb' else 1 if oncard == 'carda' else 0
if self._main_prefix and path.startswith(self._main_prefix): if self._main_prefix and path.startswith(self._main_prefix):
name = path.replace(self._main_prefix, '') name = path.replace(self._main_prefix, '')
@ -166,7 +167,11 @@ class PRS505(CLI, Device):
opts = self.settings() opts = self.settings()
collections = opts.extra_customization.split(',') if opts.extra_customization else [] collections = opts.extra_customization.split(',') if opts.extra_customization else []
booklists[blist].add_book(info, name, collections, *location[1:-1]) booklist = booklists[blist]
if not hasattr(booklist, 'add_book'):
raise ValueError(('Incorrect upload location %s. Did you choose the'
' correct card A or B, to send books to?')%oncard)
booklist.add_book(info, name, collections, *location[1:-1])
fix_ids(*booklists) fix_ids(*booklists)
def delete_books(self, paths, end_session=True): def delete_books(self, paths, end_session=True):