Add recipe for Daily Telegraph and fixes for various minor regressions

This commit is contained in:
Kovid Goyal 2008-10-06 09:43:01 -07:00
parent 2a9ce30cc6
commit 5c73f9eb64
6 changed files with 51 additions and 4 deletions

View File

@ -17,7 +17,7 @@
<dc:publisher py:if="mi.publisher">${mi.publisher}</dc:publisher>
<dc:identifier opf:scheme="ISBN" py:if="mi.isbn">${mi.isbn}</dc:identifier>
<series py:if="mi.series">${mi.series}</series>
<series-index py:if="mi.series_index is not None">${mi.series_index}</series-index>
<series_index py:if="mi.series_index is not None">${mi.series_index}</series_index>
<rating py:if="mi.rating is not None">${mi.rating}</rating>
<py:for each="tag in mi.tags">
<dc:subject py:if="mi.tags is not None">${tag}</dc:subject>

View File

@ -411,7 +411,7 @@ class OPF(object):
metadata_path = XPath('descendant::*[re:match(name(), "metadata", "i")]')
metadata_elem_path = XPath('descendant::*[re:match(name(), $name, "i")]')
series_path = XPath('descendant::*[re:match(name(), "series(?!_)", "i")]')
series_path = XPath('descendant::*[re:match(name(), "series$", "i")]')
authors_path = XPath('descendant::*[re:match(name(), "creator", "i") and (@role="aut" or @opf:role="aut")]')
bkp_path = XPath('descendant::*[re:match(name(), "contributor", "i") and (@role="bkp" or @opf:role="bkp")]')
tags_path = XPath('descendant::*[re:match(name(), "subject", "i")]')

View File

@ -71,7 +71,7 @@ class ConfigDialog(QDialog, Ui_Dialog):
from calibre.translations import language_codes
from calibre.startup import get_lang
lang = get_lang()
if lang is not None:
if lang is not None and language_codes.has_key(lang):
self.language.addItem(language_codes[lang], QVariant(lang))
items = [(l, language_codes[l]) for l in translations.keys() if l != lang]
if lang != 'en':

View File

@ -90,7 +90,7 @@ class Config(QDialog, Ui_Dialog):
def select_cover(self):
files = choose_images(self, 'change cover dialog',
_('Choose cover for ') + unicode(self.gui_title.text()))
_('Choose cover for ') + unicode(self.title.text()))
if not files:
return
_file = files[0]

View File

@ -10,6 +10,7 @@ recipes = [
'wired', 'globe_and_mail', 'smh', 'espn', 'business_week',
'ars_technica', 'upi', 'new_yorker', 'irish_times', 'iht',
'discover_magazine', 'scientific_american', 'new_york_review_of_books',
'daily_telegraph',
]
import re, imp, inspect, time

View File

@ -0,0 +1,46 @@
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
'''
http://www.news.com.au/dailytelegraph/
'''
import re
from calibre.web.feeds.news import BasicNewsRecipe
class DailyTelegraph(BasicNewsRecipe):
title = u'Daily Telegraph'
__author__ = u'AprilHare'
description = u'News from down under'
oldest_article = 2
max_articles_per_feed = 10
remove_tags_before = dict(name='div', attrs={'class':'article-title'})
remove_tags = [dict(attrs={'class':['article-source', 'article-tools']})]
remove_tags_after = dict(attrs={'class':re.compile('share-article')})
feeds = [
(u'Top Stories', u'http://feeds.news.com.au/public/rss/2.0/dtele_top_stories_253.xml'),
(u'National News', u'http://feeds.news.com.au/public/rss/2.0/dtele_national_news_202.xml'),
(u'World News', u'http://feeds.news.com.au/public/rss/2.0/dtele_world_news_204.xml'),
(u'NSW and ACT', u'http://feeds.news.com.au/public/rss/2.0/dtele_nswact_225.xml'),
(u'Arts', u'http://feeds.news.com.au/public/rss/2.0/dtele_art_444.xml'),
(u'Business News', u'http://feeds.news.com.au/public/rss/2.0/dtele_business_226.xml'),
(u'Entertainment News', u'http://feeds.news.com.au/public/rss/2.0/dtele_entertainment_news_201.xml'),
(u'Lifestyle News', u'http://feeds.news.com.au/public/rss/2.0/dtele_lifestyle_227.xml'),
(u'Music', u'http://feeds.news.com.au/public/rss/2.0/dtele_music_441.xml'),
(u'Property Confidential', u'http://feeds.news.com.au/public/rss/2.0/dtele_property_confidential_463.xml'),
(u'Property - Your Space', u'http://feeds.news.com.au/public/rss/2.0/dtele_property_yourspace_462.xml'),
(u'Confidential News', u'http://feeds.news.com.au/public/rss/2.0/dtele_entertainment_confidential_252.xml'),
(u'Confidential Biographies', u'http://feeds.news.com.au/public/rss/2.0/dtele_confidential_biographies_491.xml'),
(u'Confidential Galleries', u'http://feeds.news.com.au/public/rss/2.0/dtele_confidential_galleries_483.xml'),
(u'Confidential In-depth', u'http://feeds.news.com.au/public/rss/2.0/dtele_confidential_indepth_490.xml'),
(u'Confidential ShowBuzz', u'http://feeds.news.com.au/public/rss/2.0/dtele_confidential_showbuzz_485.xml'),
(u'Sport', u'http://feeds.news.com.au/public/rss/2.0/dtele_sport_203.xml'),
(u'AFL', u'http://feeds.news.com.au/public/rss/2.0/dtele_sports_afl_341.xml'),
(u'Cricket', u'http://feeds.news.com.au/public/rss/2.0/dtele_sports_cricket_343.xml'),
(u'Horse Racing', u'http://feeds.news.com.au/public/rss/2.0/dtele_sports_horseracing_686.xml'),
(u'NRL', u'http://feeds.news.com.au/public/rss/2.0/dtele_sports_nrl_345.xml'),
(u'Rugby Union', u'http://feeds.news.com.au/public/rss/2.0/dtele_sports_rugby_union_342.xml'),
(u'Soccer', u'http://feeds.news.com.au/public/rss/2.0/dtele_sports_soccer_344.xml')
]