#!/usr/bin/env python
# -*- mode: python -*-
# -*- coding: utf-8 -*-

__license__ = 'GPL v3'
__copyright__ = '2012-2017, Darko Miletic <darko.miletic at gmail.com>'
'''
asianreviewofbooks.com
'''

from calibre.web.feeds.news import BasicNewsRecipe


class AsianReviewOfBooks(BasicNewsRecipe):
    title = 'The Asian Review of Books'
    __author__ = 'Darko Miletic'
    description = 'In addition to reviewing books about or of relevance to Asia, the Asian Review of Books also features long-format essays by leading Asian writers and thinkers, to providing an unparalleled forum for discussion of key contemporary issues by Asians for Asia and a vehicle of intellectual depth and breadth where leading thinkers can write on the books, arts and ideas of the day. Widely quoted and referenced, with an archive of more than one thousand book reviews, it is the only web resource dedicated to Asian books. And now, with the addition of the new premium content, the Asian Review of Books, is a must-read publication.'  # noqa
    publisher = 'The Asian Review of Books'
    category = 'literature, books, reviews, Asia'
    oldest_article = 30
    max_articles_per_feed = 100
    no_stylesheets = True
    use_embedded_content = False
    encoding = 'utf8'
    language = 'en_CN'
    publication_type = 'magazine'
    auto_cleanup = True
    masthead_url = 'https://i2.wp.com/asianreviewofbooks.com/content/wp-content/uploads/2016/09/ARBwidelogo.png'
    extra_css             = """
                               body{font-family: "Droid Serif", serif}
                               .entry-title {font-family: "Playfair Display", serif}
                               img {display: block}
                            """

    recipe_specific_options = {
        'days': {
            'short': 'Oldest article to download from this news source. In days ',
            'long': 'For example, 0.5, gives you articles from the past 12 hours',
            'default': str(oldest_article)
        }
    }

    def __init__(self, *args, **kwargs):
        BasicNewsRecipe.__init__(self, *args, **kwargs)
        d = self.recipe_specific_options.get('days')
        if d and isinstance(d, str):
            self.oldest_article = float(d)

    conversion_options = {
        'comment': description,
        'tags': category,
        'publisher': publisher,
        'language': language
    }

    feeds = [(u'Articles', u'http://asianreviewofbooks.com/content/feed/')]
