From 6f1d668a66cd3c56a837752cf5642c4a595da3f2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 7 May 2011 12:45:18 -0600 Subject: [PATCH 1/3] Korea Herald by Seongkyoun Yoo. Fixes #779153 (add news recipe for korean) --- recipes/korea_herald.recipe | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 recipes/korea_herald.recipe diff --git a/recipes/korea_herald.recipe b/recipes/korea_herald.recipe new file mode 100644 index 0000000000..829906338c --- /dev/null +++ b/recipes/korea_herald.recipe @@ -0,0 +1,36 @@ +__license__ = 'GPL v3' +__copyright__ = '2011, Seongkyoun Yoo ' +''' +Profile to download KoreaHerald +''' +from calibre.web.feeds.news import BasicNewsRecipe + +class KoreaHerald(BasicNewsRecipe): + title = u'KoreaHerald' + language = 'en' + description = u'Korea Herald News articles' + __author__ = 'Seongkyoun Yoo' + oldest_article = 10 + recursions = 3 + max_articles_per_feed = 10 + no_stylesheets = True + keep_only_tags = [ + dict(id=['contentLeft', '_article']) + ] + + remove_tags = [ + dict(name='iframe'), + dict(name='div', attrs={'class':['left','htit2', 'navigation','banner_txt','banner_img']}), + dict(name='ul', attrs={'class':['link_icon', 'flow_icon','detailTextAD110113']}), + ] + + feeds = [ + ('All News','http://www.koreaherald.com/rss/020000000000.xml'), + ('National','http://www.koreaherald.com/rss/020100000000.xml'), + ('Business','http://www.koreaherald.com/rss/020200000000.xml'), + ('Life&Style','http://www.koreaherald.com/rss/020300000000.xml'), + ('Entertainment','http://www.koreaherald.com/rss/020400000000.xml'), + ('Sports','http://www.koreaherald.com/rss/020500000000.xml'), + ('Opinion','http://www.koreaherald.com/rss/020600000000.xml'), + ('English Cafe','http://www.koreaherald.com/rss/021000000000.xml'), + ] From a361a349ca91123e4fb592e823c4e2f5fc6e9495 Mon Sep 17 00:00:00 2001 From: GRiker Date: Sat, 7 May 2011 14:15:25 -0600 Subject: [PATCH 2/3] GwR revision to fetch title_sort from data_dict --- src/calibre/library/catalog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py index 05752f4a29..7a4ea1b0e1 100644 --- a/src/calibre/library/catalog.py +++ b/src/calibre/library/catalog.py @@ -128,7 +128,7 @@ class CSV_XML(CatalogPlugin): # {{{ if field.startswith('#'): item = db.get_field(entry['id'],field,index_is_id=True) elif field == 'title_sort': - item = _title_sort(unicode(entry['title'])) + item = entry['sort'] else: item = entry[field] @@ -183,7 +183,7 @@ class CSV_XML(CatalogPlugin): # {{{ record.append(item) if 'title' in fields: - title = E.title(r['title'], sort=_title_sort(unicode(r['title']))) + title = E.title(r['title'], sort=r['sort']) record.append(title) if 'authors' in fields: From 1dc466a15eafd21952a21bf0c30e0250a5d63713 Mon Sep 17 00:00:00 2001 From: GRiker Date: Sat, 7 May 2011 14:18:10 -0600 Subject: [PATCH 3/3] Removed unnecessary import of title_sort --- src/calibre/library/catalog.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py index 7a4ea1b0e1..a19534191b 100644 --- a/src/calibre/library/catalog.py +++ b/src/calibre/library/catalog.py @@ -16,7 +16,6 @@ from calibre.customize import CatalogPlugin from calibre.customize.conversion import OptionRecommendation, DummyReporter from calibre.ebooks.BeautifulSoup import BeautifulSoup, BeautifulStoneSoup, Tag, NavigableString from calibre.ebooks.chardet import substitute_entites -from calibre.ebooks.metadata import title_sort as _title_sort from calibre.library.save_to_disk import preprocess_template from calibre.ptempfile import PersistentTemporaryDirectory from calibre.utils.bibtex import BibTeX