diff --git a/resources/recipes/aprospect.recipe b/resources/recipes/aprospect.recipe new file mode 100755 index 0000000000..ce230c624a --- /dev/null +++ b/resources/recipes/aprospect.recipe @@ -0,0 +1,26 @@ +import re +from calibre.web.feeds.news import BasicNewsRecipe + +class AmericanProspect(BasicNewsRecipe): + title = u'American Prospect' + __author__ = u'Michael Heinz' + oldest_article = 30 + language = 'en' + max_articles_per_feed = 100 + recursions = 0 + no_stylesheets = True + remove_javascript = True + + preprocess_regexps = [ + (re.compile(r'', re.DOTALL|re.IGNORECASE), lambda match: '
'), + (re.compile(r'
.*', re.DOTALL|re.IGNORECASE), lambda match: ''), + (re.compile('\r'),lambda match: ''), + (re.compile(r'', re.DOTALL|re.IGNORECASE), lambda match: ''), + (re.compile(r'', re.DOTALL|re.IGNORECASE), lambda match: ''), + (re.compile(r'', re.DOTALL|re.IGNORECASE), lambda match: ''), + (re.compile(r'', re.DOTALL|re.IGNORECASE), lambda match: ''), + (re.compile(r'', re.DOTALL|re.IGNORECASE), lambda match: ''), + ] + + feeds = [(u'Articles', u'feed://www.prospect.org/articles_rss.jsp')] + diff --git a/resources/recipes/factcheck.recipe b/resources/recipes/factcheck.recipe new file mode 100644 index 0000000000..b25b9c245b --- /dev/null +++ b/resources/recipes/factcheck.recipe @@ -0,0 +1,19 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class FactCheckOrg(BasicNewsRecipe): + title = u'Factcheck' + __author__ = u'Michael Heinz' + language = 'en' + oldest_article = 7 + max_articles_per_feed = 100 + recursion = 0 + + publication_type = 'magazine' + masthead_url = 'http://factcheck.org/wp-content/themes/Streamline/images/headernew.jpg' + cover_url = 'http://factcheck.org/wp-content/themes/Streamline/images/headernew.jpg' + + remove_tags = [ dict({'id':['footer','footerabout','sidebar']}) ] + + + feeds = [(u'Factcheck', u'feed://www.factcheck.org/feed/')] + diff --git a/resources/recipes/politifact.recipe b/resources/recipes/politifact.recipe new file mode 100644 index 0000000000..d06f3a51e0 --- /dev/null +++ b/resources/recipes/politifact.recipe @@ -0,0 +1,30 @@ +from calibre.wb.feeds.news import BasicNewsRecipe + +class PolitiFactCom(BasicNewsRecipe): + title = u'Politifact' + __author__ = u'Michael Heinz' + oldest_article = 21 + max_articles_per_feed = 100 + recursion = 0 + language = 'en' + + no_stylesheets = True + + publication_type = 'magazine' + masthead_url = 'http://static.politifact.com.s3.amazonaws.com/images/politifactdotcom-flag-fff_01.png' + cover_url = 'http://static.politifact.com.s3.amazonaws.com/images/politifactdotcom-flag-fff_01.png' + + remove_tags = [ + dict(name='div', attrs={'class':'pfstoryarchive'}), + dict(name='div', attrs={'class':'pfhead'}), + dict(name='div', attrs={'class':'boxmid'}), + ] + + keep_only_tags = [dict(name='div', attrs={'class':'pfcontentleft'})] + feeds = [ + (u'Articles', u'http://www.politifact.com/feeds/articles/truth-o-meter/'), + (u'Obamameter', u'http://politifact.com/feeds/updates/'), + (u'Statements', u'http://www.politifact.com/feeds/statements/truth-o-meter/') + ] + + diff --git a/src/calibre/devices/manager.py b/src/calibre/devices/manager.py index bc493d9f1a..b00e944d05 100644 --- a/src/calibre/devices/manager.py +++ b/src/calibre/devices/manager.py @@ -10,7 +10,7 @@ import threading, Queue class DeviceManager(object): - + def __init__(self): self.devices = [] self.device_jobs = Queue(0) @@ -21,19 +21,19 @@ class Job(object): def __init__(self, func, args): self.completed = False self.exception = None - + class Worker(threading.Thread): - - def __init__(self, jobs): + + def __init__(self, jobs): self.jobs = jobs self.results = [] threading.Thread.__init__(self) self.setDaemon(True) - + def run(self): '''Thread loops taking jobs from the queue as they become available''' while True: - job = self.jobs.get(True, None) + self.jobs.get(True, None) # Do job - self.jobs.task_done() \ No newline at end of file + self.jobs.task_done() diff --git a/src/calibre/ebooks/rtf2xml/paragraph_def.py b/src/calibre/ebooks/rtf2xml/paragraph_def.py index 6635024273..aa13f9e4e2 100755 --- a/src/calibre/ebooks/rtf2xml/paragraph_def.py +++ b/src/calibre/ebooks/rtf2xml/paragraph_def.py @@ -354,7 +354,6 @@ if another paragraph_def is found, the state changes to collect_tokens. def __tab_stop_func(self, line): """ """ - type = 'tabs-%s' % self.__tab_type self.__att_val_dict['tabs'] += '%s:' % self.__tab_type self.__att_val_dict['tabs'] += '%s;' % line[20:-1] self.__tab_type = 'left' @@ -373,7 +372,6 @@ if another paragraph_def is found, the state changes to collect_tokens. """ leader = self.__tab_type_dict.get(self.__token_info) if leader != None: - type = 'tabs-%s' % self.__tab_type self.__att_val_dict['tabs'] += '%s^' % leader else: if self.__run_level > 3: diff --git a/src/calibre/ebooks/rtf2xml/styles.py b/src/calibre/ebooks/rtf2xml/styles.py index c551b7ad3c..815a64e4f4 100755 --- a/src/calibre/ebooks/rtf2xml/styles.py +++ b/src/calibre/ebooks/rtf2xml/styles.py @@ -318,7 +318,6 @@ class Styles: Try to add the number to dictionary entry tabs-left, or tabs-right, etc. If the dictionary entry doesn't exist, create one. """ - type = 'tabs-%s' % self.__tab_type try: if self.__leader_found: self.__styles_dict['par'][self.__styles_num]['tabs']\ @@ -362,7 +361,6 @@ class Styles: leader = self.__tab_type_dict.get(self.__token_info) if leader != None: leader += '^' - type = 'tabs-%s' % self.__tab_type try: self.__styles_dict['par'][self.__styles_num]['tabs'] += ':%s;' % leader except KeyError: