From 3525827192283f180f94b2140609792a0c0de5a0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 15 Jan 2009 09:44:34 -0800 Subject: [PATCH 1/4] Recipe for German Tom's Hardware by Oliver Niesner --- .../gui2/images/news/tomshardware_de.png | Bin 0 -> 992 bytes src/calibre/web/feeds/recipes/__init__.py | 3 +- .../web/feeds/recipes/recipe_tomshardware.py | 3 +- .../feeds/recipes/recipe_tomshardware_de.py | 54 ++++++++++++++++++ 4 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 src/calibre/gui2/images/news/tomshardware_de.png create mode 100644 src/calibre/web/feeds/recipes/recipe_tomshardware_de.py diff --git a/src/calibre/gui2/images/news/tomshardware_de.png b/src/calibre/gui2/images/news/tomshardware_de.png new file mode 100644 index 0000000000000000000000000000000000000000..c31412474caf6291120957e4228b463ecf420bf7 GIT binary patch literal 992 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%b@U_I1CZGssfk$L9 zkoEv$x0Bg+Ai=T%$8;bK*3S@gZ0%tN24+rA7sn8b)2)+pJ?^l|9JjCke@S<4-mba+ zCZe?)?{XD7Dg_;zvsX|ian02@-{yiQ#S;ojI#Vj0<8`Wq&K(fA*8Fx`>X8NaOpB7u zK0n+Qw!>F{%I7=J&J~yc+Q0k%cJbN9H@ofL*Zp~L`1{fC*&aguf`<+~_&>2FQ9>e` zl|M3$XOoHP$>so#o1QX~GgEfYQ_X*WPyIwaV6?A@9ha--W41^iVc-v1X#_v2G_?`JeHx9>myJo#?d=IrNupTfdB z{{CcN_t@8BQ#td5ESpm$kDJ8P^Y~QP%O|S}J^YeszVN8P(W6IG($hcx-l`D3{(oDt z>Y48H>6M?~3X6z}HmS5upJsCJ^|Uuj*6dh%?3miuuU|E#dQWZ3Z9SYQo1Zh~^3Lc~ z_ES^0**dqjwicC_Yl}X3cjms$i94NBJuZE}DCy9Vr6ADG2QE`v#l*P^2p=D8aw&Ca`Vhg ze`7PVW5ImvsqFKP-@V#7bN>AQ5BsOjKmXa8FQ_8HBpML+Hw4|?(kMY#$)8UnsJFBXy zR6MuqSDDs+{NvoH^4H30RaY0+)VKH7f4<+J(d?nJ=-02R(9qD8d-ul1*IKXH+FIFL zR=eP8K}E2FXYuCEyFT4i@AB(;yMgKI%Czc6;>BhhuqFUk_QIcGgnpl#mn*t;lj0_AcbPbJkjSWK# v%&km~txODc4J@n-3>YUYxCzsco1c=IR!KlZoZ_{&Kn)C@u6{1-oD!M<@SeXR literal 0 HcmV?d00001 diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index 0c6e48131e..faeb65c193 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -21,7 +21,8 @@ recipe_modules = ['recipe_' + r for r in ( 'linux_magazine', 'telegraph_uk', 'utne', 'sciencedaily', 'forbes', 'time_magazine', 'endgadget', 'fudzilla', 'nspm_int', 'nspm', 'pescanik', 'spiegel_int', 'themarketticker', 'tomshardware', 'xkcd', 'ftd', 'zdnet', - 'joelonsoftware', 'telepolis', 'common_dreams', 'nin', + 'joelonsoftware', 'telepolis', 'common_dreams', 'nin', 'tomshardware_de', + )] import re, imp, inspect, time, os diff --git a/src/calibre/web/feeds/recipes/recipe_tomshardware.py b/src/calibre/web/feeds/recipes/recipe_tomshardware.py index 657a6911f7..b0b155666f 100644 --- a/src/calibre/web/feeds/recipes/recipe_tomshardware.py +++ b/src/calibre/web/feeds/recipes/recipe_tomshardware.py @@ -6,7 +6,6 @@ __copyright__ = '2008, Darko Miletic ' tomshardware.com ''' -from calibre.ebooks.BeautifulSoup import BeautifulSoup from calibre.web.feeds.recipes import BasicNewsRecipe class Tomshardware(BasicNewsRecipe): @@ -50,7 +49,7 @@ class Tomshardware(BasicNewsRecipe): rmain, rsep, article_id = main.rpartition(',') tmain, tsep, trest = rmain.rpartition('/reviews/') if tsep: - return 'http://www.tomshardware.com/review_print.php?p1=' + article_id + return 'http://www.tomshardware.com/review_print.php?p1=' + article_id return 'http://www.tomshardware.com/news_print.php?p1=' + article_id def preprocess_html(self, soup): diff --git a/src/calibre/web/feeds/recipes/recipe_tomshardware_de.py b/src/calibre/web/feeds/recipes/recipe_tomshardware_de.py new file mode 100644 index 0000000000..78d820e246 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_tomshardware_de.py @@ -0,0 +1,54 @@ +__license__ = 'GPL v3' +__copyright__ = '2008, Kovid Goyal ' + +''' +Fetch tomshardware. +''' + +from calibre.web.feeds.news import BasicNewsRecipe +import re + + +class TomsHardwareDe(BasicNewsRecipe): + + title = 'Tom\'s Hardware German' + description = 'Computer news in german' + __author__ = 'Oliver Niesner' + use_embedded_content = False + timefmt = ' [%d %b %Y]' + max_articles_per_feed = 50 + no_stylesheets = True + encoding = 'utf-8' + + #preprocess_regexps = \ +# [(re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in +# [ +# (r'<84>', lambda match: ''), +# (r'<93>', lambda match: ''), +# ] +# ] + + remove_tags = [dict(id='outside-advert'), + dict(id='advertRightWhite'), + dict(id='header-advert'), + dict(id='header-banner'), + dict(id='header-menu'), + dict(id='header-top'), + dict(id='header-tools'), + dict(id='nbComment'), + dict(id='internalSidebar'), + dict(id='header-news-infos'), + dict(id='breadcrumbs'), + dict(id=''), + dict(name='div', attrs={'class':'pyjama'}), + dict(name='href', attrs={'class':'comment'}), + dict(name='div', attrs={'class':'greyBoxR clearfix'}), + dict(name='div', attrs={'class':'greyBoxL clearfix'}), + dict(name='div', attrs={'class':'greyBox clearfix'}), + dict(id='')] + #remove_tags_before = [dict(id='header-news-title')] + remove_tags_after = [dict(name='div', attrs={'class':'news-elm'})] + #remove_tags_after = [dict(name='div', attrs={'class':'intelliTXT'})] + + feeds = [ ('tomshardware', 'http://www.tomshardware.com/de/feeds/rss2/tom-s-hardware-de,12-1.xml') ] + From 85b25af6b125f63025e80b5da5c7e3ba4623147d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 15 Jan 2009 11:13:40 -0800 Subject: [PATCH 2/4] Content server now works partially with IE6,7 and fully with IE 8 --- src/calibre/library/static/gui.js | 60 +++++++++++++++---------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/calibre/library/static/gui.js b/src/calibre/library/static/gui.js index b0a88db7f9..17f6f7f8fd 100644 --- a/src/calibre/library/static/gui.js +++ b/src/calibre/library/static/gui.js @@ -7,8 +7,8 @@ var column_titles = { 'rating' : 'Rating', 'date' : 'Date', 'tags' : 'Tags', - 'series' : 'Series', -} + 'series' : 'Series' +}; String.prototype.format = function() { var pattern = /\{\d+\}/g; @@ -47,7 +47,7 @@ function render_book(book) { // Render title cell var title = '{0}'.format(book.attr("title")) + '
'; var id = book.attr("id"); - var comments = $.trim(book.text()).replace(/\n\n/, '
'); + var comments = $.trim(book.text()).replace(/\n\n/, '
'); var formats = new Array(); var size = (parseFloat(book.attr('size'))/(1024*1024)).toFixed(1); var tags = book.attr('tags').replace(/,/g, ', '); @@ -70,22 +70,22 @@ function render_book(book) { authors += jQuery.trim(_authors[i]).replace(/ /g, ' ')+'
'; } if (authors) { authors = authors.slice(0, authors.length-6); } - + // Render rating cell var _rating = parseFloat(book.attr('rating'))/2.; var rating = ''; for (i = 0; i < _rating; i++) { rating += '★'} - + // Render date cell var _date = Date.parseExact(book.attr('timestamp'), 'yyyy/MM/dd HH:mm:ss'); var date = _date.toString('d MMM yyyy').replace(/ /g, ' '); - + // Render series cell var series = book.attr("series") if (series) { series += ' [{0}]'.format(book.attr('series_index')); } - + var cells = { 'title' : title, 'authors' : authors, @@ -93,12 +93,12 @@ function render_book(book) { 'date' : date, 'series' : series }; - + var row = ''; for (i = 0; i < cmap.length; i++) { row += '{1}'.format(cmap[i], cells[cmap[i]]); } - return '{1}'.format(id, row); + return '{1}'.format(id, row); } function fetch_library_books(start, num, timeout, sort, order, search) { @@ -112,15 +112,15 @@ function fetch_library_books(start, num, timeout, sort, order, search) { last_search = search; last_sort = sort; last_sort_order = order; - + if (current_library_request != null) { current_library_request.abort(); current_library_request = null; } - + $('#cover_pane').css('visibility', 'hidden'); $('#loading').css('visibility', 'visible'); - + current_library_request = $.ajax({ type: "GET", url: "library", @@ -128,18 +128,18 @@ function fetch_library_books(start, num, timeout, sort, order, search) { cache: false, timeout: timeout, //milliseconds dataType: "xml", - + error : function(XMLHttpRequest, textStatus, errorThrown) { - alert('Error: '+textStatus+'\n\n'+errorThrown); + alert('Error: '+textStatus+'\n\n'+errorThrown); }, - + success : function(xml, textStatus) { var library = $(xml).find('library'); total = parseInt(library.attr('total')); var num = parseInt(library.attr('num')); var start = parseInt(library.attr('start')); update_count_bar(start, num, total); - var display = ''; + var display = ''; library.find('book').each( function() { var book = $(this); var row = render_book(book); @@ -170,18 +170,18 @@ function fetch_library_books(start, num, timeout, sort, order, search) { $('#cover_pane').css('visibility', 'visible'); } }); - - + + layout(); $('#book_list tbody tr:even()').css('background-color', '#eeeeee'); }, - + complete : function(XMLHttpRequest, textStatus) { current_library_request = null; document.getElementById('main').scrollTop = 0; $('#loading').css('visibility', 'hidden'); } - + }); } @@ -196,7 +196,7 @@ function update_count_bar(start, num, total) { left.css('opacity', (start <= 0) ? 0.3 : 1); var right = cb.find('#right'); right.css('opacity', (start + num >= total) ? 0.3 : 1); - + } function setup_count_bar() { @@ -205,7 +205,7 @@ function setup_count_bar() { fetch_library_books(0, last_num, LIBRARY_FETCH_TIMEOUT, last_sort, last_sort_order, last_search); } }); - + $('#count_bar * img:eq(1)').click(function(){ if (last_start > 0) { var new_start = last_start - last_num; @@ -215,14 +215,14 @@ function setup_count_bar() { fetch_library_books(new_start, last_num, LIBRARY_FETCH_TIMEOUT, last_sort, last_sort_order, last_search); } }); - + $('#count_bar * img:eq(2)').click(function(){ if (last_start + last_num < total) { var new_start = last_start + last_num; fetch_library_books(new_start, last_num, LIBRARY_FETCH_TIMEOUT, last_sort, last_sort_order, last_search); } }); - + $('#count_bar * img:eq(3)').click(function(){ if (total - last_num > 0) { fetch_library_books(total - last_num, last_num, LIBRARY_FETCH_TIMEOUT, last_sort, last_sort_order, last_search); @@ -234,7 +234,7 @@ function setup_count_bar() { function search() { var search = $.trim($('#search_box * #s').val()); - fetch_library_books(0, last_num, LIBRARY_FETCH_TIMEOUT, + fetch_library_books(0, last_num, LIBRARY_FETCH_TIMEOUT, last_sort, last_sort_order, search); } @@ -245,11 +245,11 @@ function setup_sorting() { $('table#book_list thead tr td').mouseover(function() { this.style.backgroundColor = "#fff2a8"; }); - + $('table#book_list thead tr td').mouseout(function() { this.style.backgroundColor = "inherit"; }); - + for (i = 0; i < cmap.length; i++) { $('table#book_list span#{0}_sort'.format(cmap[i])).parent().click(function() { var sort_indicator = $($(this).find('span')); @@ -258,7 +258,7 @@ function setup_sorting() { var col = id.slice(0, id.indexOf("_")); var order = 'ascending'; var html = '↑'; - + if (sort_indicator.html() == '↑') { order = 'descending'; html = '↓'; } @@ -291,13 +291,13 @@ function layout() { $(function() { // document is ready create_table_headers(); - + // Setup widgets setup_sorting(); setup_count_bar(); $('#search_box * #s').val(''); $(window).resize(layout); - + $($('#book_list * span#date_sort').parent()).click(); }); From 4bf3a62075f1e3575afa7997153ba7cb5729bd3f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 15 Jan 2009 11:16:12 -0800 Subject: [PATCH 3/4] version 0.4.128 --- src/calibre/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 12b17b7f0a..180433532d 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -2,7 +2,7 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' __docformat__ = 'restructuredtext en' __appname__ = 'calibre' -__version__ = '0.4.127' +__version__ = '0.4.128' __author__ = "Kovid Goyal " ''' Various run time constants. From bdc21e2025c66bebb310b292f2919c83268f2c57 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 15 Jan 2009 11:19:58 -0800 Subject: [PATCH 4/4] IGN:Tag release