from calibre.web.feeds.news import BasicNewsRecipe

class AdvancedUserRecipe1282101454(BasicNewsRecipe):
    title = 'Marietta Daily Journal'
    __author__ = 'Tony Stegall'
    language = 'en'
    description = 'Marietta Ga and Metro Atlanta News'
    publisher = 'MDJ'
    category = 'news,politics,Georgia,USA'
    oldest_article = 1
    max_articles_per_feed = 100
    no_stylesheets = True
    remove_javascript = True

    masthead_url = 'http://assets.matchbin.com/sites/624/assets/logo.gif'


    keep_only_tags    = [
                        dict(name='div', attrs={'id':['print_content_container']})

                        ]


    feeds          = [
                       ('Local News', 'http://mdjonline.com/rss/rss/Local+News?content_type=article&tags=news&page_name=rss&tag_inclusion=or&offset=0&limit=10&instance=Local+News'),
                       ('Sports',   'http://mdjonline.com/rss/rss/Sports?content_type=article&tags=sports&page_name=rss&tag_inclusion=or&offset=0&limit=10&instance=Sports'),
                       ('Obits',    'http://mdjonline.com/rss/rss/Obits?content_type=article&tags=obits&page_name=rss&tag_inclusion=or&offset=0&limit=20&instance=Obits'),
                       ('Editorial & oped',   'http://mdjonline.com/rss/rss/Editorial+and+OPED?content_type=article&tags=oped+editorial&page_name=rss&tag_inclusion=or&offset=0&limit=10&instance=Editorial+and+OPED'),
                       ('Lifestyle',   'http://mdjonline.com/rss/rss/Lifestyle?content_type=article&tags=lifestyle&page_name=rss&tag_inclusion=or&offset=0&limit=10&instance=Lifestyle'),
                       ('Blogs',   'http://mdjonline.com/rss/rss/Lifestyle?content_type=article&tags=lifestyle&page_name=rss&tag_inclusion=or&offset=0&limit=10&instance=Lifestyle')
                    ]

    def print_version(self, url):
        split1 = url.split("/")
        artid = split1[4]

        #example of link to convert
        #Original link: http://mdjonline.com/bookmark/9274197
        #print version: http://mdjonline.com/printer_friendly/9274197

        print_url = 'http://mdjonline.com/printer_friendly/' + artid
        return print_url

        #test with ebook-convert nejm.recipe output_dir --test -vv > myrecipe.txt






