diff --git a/resources/recipes/aftenposten.recipe b/resources/recipes/aftenposten.recipe index 304c7c0e02..fcc73658e9 100644 --- a/resources/recipes/aftenposten.recipe +++ b/resources/recipes/aftenposten.recipe @@ -7,6 +7,9 @@ class Aftenposten(BasicNewsRecipe): language = 'no' oldest_article = 5 max_articles_per_feed = 100 + recipe_disabled = ('The recipe to download Aftenposten has been ' + 'temporarily disabled at the publisher\'s request, while ' + 'they finalize their digital strategy.') no_stylesheets = True encoding = 'ISO-8859-1' diff --git a/resources/recipes/chowk.recipe b/resources/recipes/chowk.recipe new file mode 100644 index 0000000000..3c8ea48607 --- /dev/null +++ b/resources/recipes/chowk.recipe @@ -0,0 +1,46 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class ChowkRecipe(BasicNewsRecipe): + __license__ = 'GPL v3' + __author__ = 'kwetal' + language = 'en_IN' + version = 1 + + title = u'Chowk' + publisher = u'chowk.com' + category = u'Opinion, South Asia' + description = u'Ideas & Identities of South Asia' + + use_embedded_content = False + remove_empty_feeds = True + oldest_article = 30 + max_articles_per_feed = 100 + + #no_stylesheets = True + remove_javascript = True + encoding = 'utf-8' + + feeds = [] + feeds.append(('Chowk Articles', 'http://www.chowk.com/rss')) + + keep_only_tags = [] + keep_only_tags.append(dict(name = 'div', attrs = {'id': 'content'})) + + conversion_options = {'comments': description, 'tags': category, 'language': 'en', + 'publisher': publisher} + + extra_css = ''' + body{font-family:verdana,arial,helvetica,geneva,sans-serif;} + a {text-decoration: none; color: blue;} + div.pgtitle {font-size: x-large; font-weight: bold;} + div.wname, div.date {font-size: x-small; color: #696969;} + div.wname {margin-top: 1em;} + div.date {margin-bottom: 1em;} + div.title {font-weight: bold;} + ''' + + + def print_version(self, url): + main, sep, id = url.rpartition('/') + + return main + '/print/' + id diff --git a/resources/recipes/dawn.recipe b/resources/recipes/dawn.recipe new file mode 100644 index 0000000000..3d4ab42a07 --- /dev/null +++ b/resources/recipes/dawn.recipe @@ -0,0 +1,92 @@ +from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import Tag + +class DawnRecipe(BasicNewsRecipe): + __license__ = 'GPL v3' + __author__ = 'kwetal' + language = 'en_PK' + version = 1 + + title = u'Dawn' + publisher = u'Dawn Media Group' + category = u'News, Pakistan' + description = u'Leading English Newspaper of Pakistan covering national & international news' + + use_embedded_content = False + remove_empty_feeds = True + oldest_article = 2 + max_articles_per_feed = 100 + + no_stylesheets = True + remove_javascript = True + encoding = 'utf-8' + + # Feeds from http://www.dawn.com/wps/wcm/connect/dawn-content-library/dawn/services/rss + feeds = [] + feeds.append((u'Latest News', u'http://feedproxy.google.com/Dawn-All-News')) + feeds.append((u'Pakistan News', u'http://feeds2.feedburner.com/dawn/news/pakistan')) + feeds.append((u'World News', u'http://feeds2.feedburner.com/dawn/news/world')) + feeds.append((u'Business News', u'http://feeds2.feedburner.com/dawn/news/business')) + feeds.append((u'Sport News', u'http://feeds2.feedburner.com/dawn/news/sport')) + feeds.append((u'Cricket News', u'http://feeds2.feedburner.com/dawn/news/cricket')) + feeds.append((u'Sci-tech News', u'http://feeds2.feedburner.com/dawn/news/technology')) + feeds.append((u'Entertainment News', u'http://feeds2.feedburner.com/dawn/news/entertainment')) + feeds.append((u'Columnists', u'http://feeds2.feedburner.com/dawn/news/columnists')) + #feeds.append((u'', u'')) + + conversion_options = {'comments': description, 'tags': category, 'language': 'en', + 'publisher': publisher} + + extra_css = ''' + body{font-family:verdana,arial,helvetica,geneva,sans-serif;} + center {font-size: xx-small; color: #666666;} + strong {font-size: small; font-weight: bold;} + span.news_headline {font-size: xx-large; font-weight: bold; margin: 0em; padding: 0em} + span.news_byline {font-size: x-small; color: #696969; margin-top: 1em;} + ''' + + def print_version(self, url): + return url + '?pagedesign=Dawn_PrintlyFriendlyPage' + + def preprocess_html(self, soup): + newBody = Tag(soup, 'body') + + for cl in ['page_title', 'news_headline', 'news_byline']: + tag = soup.find('span', attrs = {'class': cl}) + if tag: + # They like their
tags; I don't: does not work well on small screens. + if tag['class'] == 'news_byline': + for br in tag.findAll('br'): + br.extract() + + newBody.append(tag) + + table = soup.find('table', attrs = {'id': 'body table'}) + if table: + for td in table.findAll('td', attrs = {'class': 'news_story'}): + for tag in td.findAll(True): + if tag.has_key('id') and tag['id'] == 'banner-img_slide': + tag.extract() + elif tag.has_key('style'): + del tag['style'] + elif tag.name == 'script': + tag.extract() + + # They like their
tags; I don't: does not work well on small screens. + center = td.find('center') + if center: + for br in center.findNextSiblings('br'): + br.extract() + for br in center.findPreviousSiblings('br'): + br.extract() + + for attr in ['align', 'valign']: + if td.has_key(attr): + del td[attr] + + td.name = 'div' + newBody.append(td) + + soup.body.replaceWith(newBody) + + return soup diff --git a/resources/recipes/independent.recipe b/resources/recipes/independent.recipe new file mode 100644 index 0000000000..4d677b58a6 --- /dev/null +++ b/resources/recipes/independent.recipe @@ -0,0 +1,26 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class Independent(BasicNewsRecipe): + title = u'The Independent' + oldest_article = 1 + language = 'en_GB' + __author__ = 'Jimmy Patrick' + max_articles_per_feed = 100 + + feeds = [(u'UK', u'http://www.independent.co.uk/news/uk/rss'), + (u'World', u'http://www.independent.co.uk/news/world/rss'), + (u'Sport', u'http://www.independent.co.uk/sport/rss'), + (u'Arts & Entertainment', u'http://www.independent.co.uk/arts-entertainment/rss'), + (u'Life & Style',u'http://www.independent.co.uk/life-style/fashion/news/rss'), + (u'Business',u'http://www.independent.co.uk/news/business/rss'), + (u'Science',u'http://www.independent.co.uk/news/science/rss'), + (u'Media',u'http://www.independent.co.uk/news/media/rss') + ] + + keep_only_tags = [dict(id=['article'])] + remove_tags = [dict(name='div', attrs={'class':'share-links'}), + dict(name='ul', attrs={'class':'article-tools'}), + dict(name='div', attrs={'class':'related-articles'}) + ] + + extra_css = "body{color:black;}" diff --git a/resources/recipes/nymag.recipe b/resources/recipes/nymag.recipe new file mode 100644 index 0000000000..134624bc67 --- /dev/null +++ b/resources/recipes/nymag.recipe @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2008, Kovid Goyal ' +''' +theatlantic.com +''' +from calibre.web.feeds.news import BasicNewsRecipe + +class NewYorkMagazine(BasicNewsRecipe): + + title = 'New York Magazine' + __author__ = 'Kovid Goyal' + description = 'Food, culture, arts and entertainment in New York' + language = 'en' + no_stylesheets = True + remove_javascript = True + encoding = 'iso-8859-1' + recursions = 1 + match_regexps = [r'http://nymag.com/.+/index[0-9]{1,2}.html$'] + keep_only_tags = [dict(id='main')] + remove_tags = [ + dict(attrs={'class':['start-discussion']}), + dict(id=['minibrowserbox', 'article-related', 'article-tools']) + ] + + PREFIX = 'http://nymag.com' + + def nymag_get_index(self): + return self.index_to_soup('http://nymag.com/includes/tableofcontents.htm') + + def parse_index(self): + soup = self.nymag_get_index() + self.cover_url = soup.find(attrs={'class':'cover'}).find('img', + src=True).get('src') + feeds = [] + current_section = 'Cover Story' + current_articles = [] + for h in soup.findAll(['h4', 'h5']): + if h.name == 'h4': + if current_section and current_articles: + feeds.append((current_section, current_articles)) + current_section = self.tag_to_string(h) + self.log('\tFound section:', current_section) + current_articles = [] + elif h.name == 'h5': + title = self.tag_to_string(h) + a = h.find('a', href=True) + if a is not None: + url = a.get('href') + if url.startswith('/'): + url = self.PREFIX + url + if title and url: + self.log('\t\tFound article:', title) + self.log('\t\t\t', url) + desc = '' + p = h.findNextSibling('p') + if p is not None: + desc = self.tag_to_string(p) + self.log('\t\t\t', desc) + current_articles.append({'title':title, 'url':url, + 'date':'', 'description':desc}) + return feeds + + def postprocess_html(self, soup, first): + for x in soup.findAll(attrs={'class':'page-navigation'}): + x.extract() + if not first: + for x in soup.findAll(attrs={'class':'header-spacing'}): + x.extract() + return soup + + + diff --git a/resources/recipes/nytimes_sub.recipe b/resources/recipes/nytimes_sub.recipe index bccfb11bbe..f636b1060f 100644 --- a/resources/recipes/nytimes_sub.recipe +++ b/resources/recipes/nytimes_sub.recipe @@ -17,7 +17,7 @@ class NYTimes(BasicNewsRecipe): language = 'en' description = 'Daily news from the New York Times (subscription version)' - timefmt = '' + timefmt = ' [%a, %b %d, %Y]' needs_subscription = True remove_tags_before = dict(id='article') remove_tags_after = dict(id='article') @@ -44,6 +44,9 @@ class NYTimes(BasicNewsRecipe): #open('/t/log.html', 'wb').write(raw) return br + def short_title(self): + return 'NY Times' + def parse_index(self): soup = self.index_to_soup('http://www.nytimes.com/pages/todayspaper/index.html') diff --git a/resources/recipes/thenews.recipe b/resources/recipes/thenews.recipe new file mode 100644 index 0000000000..7137b4538b --- /dev/null +++ b/resources/recipes/thenews.recipe @@ -0,0 +1,78 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class TheNewsRecipe(BasicNewsRecipe): + __license__ = 'GPL v3' + __author__ = 'kwetal' + language = 'en_PK' + version = 1 + + title = u'The News' + publisher = u'Jang Group' + category = u'News, Pakistan' + description = u'English Newspaper from Pakistan' + + use_embedded_content = False + remove_empty_feeds = True + oldest_article = 2 + max_articles_per_feed = 100 + + no_stylesheets = True + remove_javascript = True + encoding = 'iso-8859-1' + + remove_tags = [] + remove_tags.append(dict(name = 'img', attrs = {'src': 'images/thenews.gif'})) + remove_tags.append(dict(name = 'img', attrs = {'src': 'images/shim.gif'})) + + # Feeds from http://thenews.com.pk/rss.asp + feeds = [] + feeds.append((u'Latest Stories', u'http://www.thenews.com.pk/rss/thenews_updates.xml')) + feeds.append((u'Top Stories', u'http://www.thenews.com.pk/rss/thenews_topstories.xml')) + feeds.append((u'World News', u'http://www.thenews.com.pk/rss/thenews_world.xml')) + feeds.append((u'National News', u'http://www.thenews.com.pk/rss/thenews_national.xml')) + feeds.append((u'Business News', u'http://www.thenews.com.pk/rss/thenews_business.xml')) + feeds.append((u'Karachi News', u'http://www.thenews.com.pk/rss/thenews_karachi.xml')) + feeds.append((u'Lahore News', u'http://www.thenews.com.pk/rss/thenews_lahore.xml')) + feeds.append((u'Islamabad News', u'http://www.thenews.com.pk/rss/thenews_islamabad.xml')) + feeds.append((u'Peshawar News', u'http://www.thenews.com.pk/rss/thenews_peshawar.xml')) + feeds.append((u'Editorial', u'http://www.thenews.com.pk/rss/thenews_editorial.xml')) + feeds.append((u'Opinion', u'http://www.thenews.com.pk/rss/thenews_opinion.xml')) + feeds.append((u'Sports News', u'http://www.thenews.com.pk/rss/thenews_sports.xml')) + feeds.append((u'Newspost', u'http://www.thenews.com.pk/rss/thenews_newspost.xml')) + + conversion_options = {'comments': description, 'tags': category, 'language': 'en', + 'publisher': publisher, 'linearize_tables': True} + + extra_css = ''' + body{font-family:verdana,arial,helvetica,geneva,sans-serif;} + .heading_txt {font-size: x-large; font-weight: bold; text-align: left;} + .small_txt {text-align: left;} + .dateline {font-size: x-small; color: #696969; margin-top: 1em; margin-bottom: 1em} + ''' + + + def print_version(self, url): + ignore, sep, main = url.rpartition('/') + + if main.startswith('updates.asp'): + return url.replace('updates.asp', 'print.asp') + elif main.startswith('top_story_detail.asp'): + return url.replace('top_story_detail.asp', 'print3.asp') + elif main.startswith('daily_detail.asp'): + return url.replace('daily_detail.asp', 'print1.asp') + else: + return None + + def preprocess_html(self, soup): + for tr in soup.findAll('tr', attrs = {'bgcolor': True}): + del tr['bgcolor'] + + td = soup.find('td', attrs = {'class': 'small_txt', 'height': '20'}) + if td: + del td['height'] + td['class'] = 'dateline' + + return soup + + + diff --git a/setup/installer/linux/freeze.py b/setup/installer/linux/freeze.py index f5188bbbd0..59f4c2b39e 100644 --- a/setup/installer/linux/freeze.py +++ b/setup/installer/linux/freeze.py @@ -245,7 +245,7 @@ class LinuxFreeze(Command): export MAGICK_CONFIGURE_PATH=$base/ImageMagick/config export MAGICK_CODER_MODULE_PATH=$base/ImageMagick/modules-Q16/coders export MAGICK_CODER_FILTER_PATH=$base/ImageMagick/modules-Q16/filter - export QT_PLUGIN_PATH=$base/qtplugins + export QT_PLUGIN_PATH=$base/qtplugins:$QT_PLUGIN_PATH $loader "$@" ''')%exe) os.chmod(path, 0755) diff --git a/setup/installer/osx/app/main.py b/setup/installer/osx/app/main.py index 4cf995683f..85533717b4 100644 --- a/setup/installer/osx/app/main.py +++ b/setup/installer/osx/app/main.py @@ -309,7 +309,7 @@ class Py2App(object): @flush def add_qt_frameworks(self): info('\nAdding Qt Framework') - for f in ('QtCore', 'QtGui', 'QtXml', 'QtNetwork', 'QtSvg', 'QtWebkit', + for f in ('QtCore', 'QtGui', 'QtXml', 'QtNetwork', 'QtSvg', 'QtWebKit', 'QtXmlPatterns', 'phonon'): self.add_qt_framework(f) for d in glob.glob(join(SW, 'qt', 'plugins', '*')): diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index 36ffc19cbf..6e0c9321cd 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -462,6 +462,7 @@ plugins += [ ILIAD, IREXDR1000, JETBOOK, + SHINEBOOK, KINDLE, KINDLE2, KINDLE_DX, @@ -480,7 +481,6 @@ plugins += [ POCKETBOOK360, GER2, ITALICA, - SHINEBOOK, ECLICTO, DBOOK, BOOX, diff --git a/src/calibre/devices/eb600/driver.py b/src/calibre/devices/eb600/driver.py index 9be9e27864..fe89e57a94 100644 --- a/src/calibre/devices/eb600/driver.py +++ b/src/calibre/devices/eb600/driver.py @@ -16,6 +16,7 @@ Windows PNP strings: ''' from calibre.devices.usbms.driver import USBMS +from calibre.constants import iswindows class EB600(USBMS): @@ -81,6 +82,19 @@ class SHINEBOOK(EB600): VENDOR_NAME = 'LONGSHIN' WINDOWS_MAIN_MEM = 'ESHINEBOOK' + MAIN_MEMORY_VOLUME_LABEL = 'ShineBook Main Memory' + STORAGE_CARD_VOLUME_LABEL = 'ShineBook Storage Card' + + + @classmethod + def can_handle(cls, dev, debug=False): + try: + if not iswindows: + return dev[4] == 'ShineBook' + except: + return True + + class POCKETBOOK360(EB600): diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 4e30c0fab5..b847186c2a 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -1736,6 +1736,16 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI): d.show() self._modeless_dialogs.append(d) return + if 'calibre.web.feeds.input.RecipeDisabled' in job.details: + msg = job.details + msg = msg[msg.find('calibre.web.feeds.input.RecipeDisabled:'):] + msg = msg.partition(':')[-1] + d = error_dialog(self, _('Recipe Disabled'), + '

%s

'%msg) + d.setModal(False) + d.show() + self._modeless_dialogs.append(d) + return except: pass if job.killed: diff --git a/src/calibre/manual/faq.rst b/src/calibre/manual/faq.rst index 8a9eb6b23f..0319f5bb21 100644 --- a/src/calibre/manual/faq.rst +++ b/src/calibre/manual/faq.rst @@ -81,7 +81,7 @@ Device Integration What devices does |app| support? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -At the moment |app| has full support for the SONY PRS 300/500/505/600/700/900, Barnes & Noble Nook, Cybook Gen 3/Opus, Amazon Kindle 1/2/DX, Netronix EB600, Ectaco Jetbook, BeBook/BeBook Mini, Irex Illiad/DR1000, Foxit eSlick, PocketBook 360, Italica, eClicto, Iriver Story, Airis dBook, various Android phones and the iPhone. In addition, using the :guilabel:`Save to disk` function you can use it with any ebook reader that exports itself as a USB disk. +At the moment |app| has full support for the SONY PRS 300/500/505/600/700/900, Barnes & Noble Nook, Cybook Gen 3/Opus, Amazon Kindle 1/2/DX, Longshine ShineBook, Ectaco Jetbook, BeBook/BeBook Mini, Irex Illiad/DR1000, Foxit eSlick, PocketBook 360, Italica, eClicto, Iriver Story, Airis dBook, various Android phones and the iPhone. In addition, using the :guilabel:`Save to disk` function you can use it with any ebook reader that exports itself as a USB disk. How can I help get my device supported in |app|? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -301,7 +301,7 @@ Your antivirus program is wrong. |app| is a completely open source product. You How do I use purchased EPUB books with |app|? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Most purchased EPUB books have `DRM `_. This prevents |app| from opening them. You can still use |app| to store and transfer them to your SONY Reader. First, you must authorize your reader on a windows machine with Adobe Digital Editions. Once this is done, EPUB books transferred with |app| will work fine on your reader. Sometimes, the EPUB file itself is corrupted, in which case you should notify the e-book vendor. +Most purchased EPUB books have `DRM `_. This prevents |app| from opening them. You can still use |app| to store and transfer them to your SONY Reader. First, you must authorize your reader on a windows machine with Adobe Digital Editions. Once this is done, EPUB books transferred with |app| will work fine on your reader. When you purchase an epub book from a website, you will get an ".acsm" file. This file should be opened with Adobe Digital Editions, which will then download the actual ".epub" e-book. The e-book file will be stored in the folder "My Digital Editions", from where you can add it to |app|. I want some feature added to |app|. What can I do? diff --git a/src/calibre/utils/ipc/worker.py b/src/calibre/utils/ipc/worker.py index a53d1818ba..3d04298a65 100644 --- a/src/calibre/utils/ipc/worker.py +++ b/src/calibre/utils/ipc/worker.py @@ -73,6 +73,12 @@ def get_func(name): return func, notification def main(): + from calibre.constants import isosx + if isosx and 'CALIBRE_WORKER_ADDRESS' not in os.environ: + # On some OS X computers launchd apparently tries to + # launch the last run process from the bundle + from calibre.gui2.main import main as gui_main + return gui_main(['calibre']) address = cPickle.loads(unhexlify(os.environ['CALIBRE_WORKER_ADDRESS'])) key = unhexlify(os.environ['CALIBRE_WORKER_KEY']) resultf = unhexlify(os.environ['CALIBRE_WORKER_RESULT']) diff --git a/src/calibre/utils/localization.py b/src/calibre/utils/localization.py index 64dadb89e4..14b7b32c8c 100644 --- a/src/calibre/utils/localization.py +++ b/src/calibre/utils/localization.py @@ -101,6 +101,7 @@ _extra_lang_codes = { 'en_IN' : _('English (IND)'), 'en_TH' : _('English (TH)'), 'en_CY' : _('English (CY)'), + 'en_PK' : _('English (PK)'), 'de_AT' : _('German (AT)'), 'nl' : _('Dutch (NL)'), 'nl_BE' : _('Dutch (BE)'), diff --git a/src/calibre/web/feeds/input.py b/src/calibre/web/feeds/input.py index 5882dd8e7a..5015c1bef2 100644 --- a/src/calibre/web/feeds/input.py +++ b/src/calibre/web/feeds/input.py @@ -11,6 +11,9 @@ import os from calibre.customize.conversion import InputFormatPlugin, OptionRecommendation from calibre.constants import numeric_version +class RecipeDisabled(Exception): + pass + class RecipeInput(InputFormatPlugin): name = 'Recipe Input' @@ -40,7 +43,7 @@ class RecipeInput(InputFormatPlugin): 'content.')), OptionRecommendation(name='dont_download_recipe', recommended_value=False, - help=_('Download latest version of builtin recipes')), + help=_('Do not download latest version of builtin recipes from the calibre server')), OptionRecommendation(name='lrf', recommended_value=False, help='Optimize fetching for subsequent conversion to LRF.'), ]) @@ -83,6 +86,9 @@ class RecipeInput(InputFormatPlugin): recipe_or_file) ro = recipe(opts, log, self.report_progress) + disabled = getattr(ro, 'recipe_disabled', None) + if disabled is not None: + raise RecipeDisabled(disabled) ro.download() self.recipe_object = ro for key, val in recipe.conversion_options.items(): diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index bffe0b7f34..789710d764 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -270,11 +270,18 @@ class BasicNewsRecipe(Recipe): .navbar { font-family:monospace; } -''' + ''' + + #: Set to a non empty string to disable this recipe + #: The string will be used as the disabled message + recipe_disabled = None # See the built-in profiles for examples of these settings. + def short_title(self): + return self.title + def get_cover_url(self): ''' Return a :term:`URL` to the cover image for this issue or `None`. @@ -886,7 +893,7 @@ class BasicNewsRecipe(Recipe): def create_opf(self, feeds, dir=None): if dir is None: dir = self.output_dir - mi = MetaInformation(self.title + strftime(self.timefmt), [__appname__]) + mi = MetaInformation(self.short_title() + strftime(self.timefmt), [__appname__]) mi.publisher = __appname__ mi.author_sort = __appname__ mi.publication_type = 'periodical:'+self.publication_type