Merge from trunk

This commit is contained in:
Charles Haley 2012-01-14 09:22:47 +01:00
commit 87831b8e9e
14 changed files with 224 additions and 36 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

View File

@ -1,14 +1,25 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__license__ = 'GPL v3'
##
## Title: New Journal of Physics
## License: GNU General Public License v3 - http://www.gnu.org/copyleft/gpl.html
## Copyright: Chema Cort\xe9s
##
## Written: Jan 2011
## Last Edited: Jan 2012 - by Kiavash
##
__license__ = 'GNU General Public License v3 - http://www.gnu.org/copyleft/gpl.html'
__copyright__ = u'Chema Cort\xe9s - 2011-01-05'
__version__ = 'v0.01'
__date__ = '2011-01-05'
__version__ = 'v0.5.0'
__date__ = '2012-01-13'
'''
njp.org
'''
import re # Import the regular expressions module.
from calibre.web.feeds.news import BasicNewsRecipe
class NewJournalOfPhysics(BasicNewsRecipe):
@ -19,14 +30,60 @@ class NewJournalOfPhysics(BasicNewsRecipe):
category = 'physics, journal, science'
language = 'en'
oldest_article = 30
max_articles_per_feed = 100
keep_only_tags = [dict(id=['fulltextContainer'])]
no_stylesheets=True
use_embedded_content=False
feeds = [(u'Latest Papers', u'http://iopscience.iop.org/1367-2630/?rss=1')]
cover_url = 'http://images.iop.org/journals_icons/Info/1367-2630/cover.gif'
oldest_article = 7
max_articles_per_feed = 30
timeout = 30
no_stylesheets = True
use_embedded_content = False
remove_javascript = True
remove_empty_feeds = True
asciiize = True # Converts all none ascii characters to their ascii equivalents
keep_only_tags = [
dict(id=['articleEvoContainer']),
]
remove_tags = [
dict(name='div', attrs={'class':'affiliations'}), # Removes Shoow Affiliations
dict(name='div', attrs={'class':'abst-icon-links'}), # Removes Tags and PDF export
dict(name='p', attrs={'class':'studyimage'}), # remove Studay image
dict(name='a', attrs={'class':'icon powerpoint'}), # remove Export to PowerPoint Slide
dict(name='a', attrs={'title':'CrossRef'}), # remove CrossRef icon
dict(name='a', attrs={'title':'PubMed'}), # remove PubMed icon
dict(name='a', attrs={'e4f5426941':'true'}), # remove cross ref image
dict(name='img', attrs={'src':''}), # remove empty image
dict(name='a', attrs={'class':'closeChap'}), # remove 'Close'
dict(name='ul', attrs={'class':'breadcrumbs'}), # remove Top breadcrumbs
]
extra_css = 'body { font-family: verdana, helvetica, sans-serif; } \
.introduction, .first { font-weight: bold; } \
.cross-head { font-weight: bold; font-size: 125%; } \
.cap, .caption { display: block; font-size: 80%; font-style: italic; } \
.cap, .caption, .caption img, .caption span { display: block; margin: 5px auto; } \
.byl, .byd, .byline img, .byline-name, .byline-title, .author-name, .author-position, \
.correspondent-portrait img, .byline-lead-in, .name, .bbc-role { display: block; \
font-size: 80%; font-style: italic; margin: 1px auto; } \
.story-date, .published { font-size: 80%; } \
table { width: 100%; } \
td img { display: block; margin: 5px auto; } \
ul { padding-top: 10px; } \
ol { padding-top: 10px; } \
li { padding-top: 5px; padding-bottom: 5px; } \
h1 { font-size: 175%; font-weight: bold; } \
h2 { font-size: 150%; font-weight: bold; } \
h3 { font-size: 125%; font-weight: bold; } \
h4, h5, h6 { font-size: 100%; font-weight: bold; }'
# Remove the line breaks.
preprocess_regexps = [(re.compile(r'<br[ ]*/>', re.IGNORECASE), lambda m: ''),
(re.compile(r'<br[ ]*clear.*/>', re.IGNORECASE), lambda m: ''),
]
def print_version(self, url):
return url+"/fulltext"
return url+"/article"

View File

@ -0,0 +1,101 @@
__license__ = 'GPL v3'
__copyright__ = '2012, Darko Miletic <darko.miletic at gmail.com>'
'''
novine.novilist.hr
'''
import re
from calibre import strftime
from calibre.web.feeds.news import BasicNewsRecipe
class NoviList_hr(BasicNewsRecipe):
title = 'Novi List'
__author__ = 'Darko Miletic'
description = 'Vijesti iz Hrvatske'
publisher = 'NOVI LIST d.d.'
category = 'Novi list, politika, hrvatski dnevnik, Novine, Hrvatska, Croatia, News, newspaper, Hrvatski,Primorje, dnevni list, Rijeka'
oldest_article = 2
max_articles_per_feed = 200
no_stylesheets = True
encoding = 'cp1250'
use_embedded_content = False
language = 'hr'
remove_empty_feeds = True
publication_type = 'newspaper'
needs_subscription = 'required'
masthead_url = 'http://novine.novilist.hr/images/system/novilist-logo.jpg'
extra_css = """
body{font-family: Geneva,Arial,Helvetica,Swiss,sans-serif }
img{display:block; margin-bottom: 0.4em; margin-top: 0.4em}
.nadnaslov,.podnaslov{font-size: small; text-align: center}
.naslov{font-size: x-large; color: maroon; font-weight: bold}
"""
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
conversion_options = {
'comment' : description
, 'tags' : category
, 'publisher' : publisher
, 'language' : language
, 'linearize_tables' : True
}
keep_only_tags = [
dict(name='td', attrs={'class':['nadnaslov', 'naslov', 'podnaslov']}),
dict(name='font', attrs={'face':'Geneva,Arial,Helvetica,Swiss'})
]
remove_tags = [dict(name=['meta', 'link', 'iframe', 'embed', 'object'])]
remove_attributes=['border', 'lang']
def get_browser(self):
br = BasicNewsRecipe.get_browser()
if self.username is not None and self.password is not None:
br.open('http://novine.novilist.hr/loginnow.asp')
br.select_form(nr=0)
br['username'] = self.username
br['password'] = self.password
br.submit()
return br
def parse_index(self):
articles = []
count = 0
soup = self.index_to_soup('http://novine.novilist.hr/')
#cover url
for alink in soup.findAll('a'):
if alink['href'].startswith('images/clanci/DOC_'):
self.cover_url = 'http://novine.novilist.hr/' + alink['href']
#feeds
for item in soup.findAll('td',attrs={'class':'tocrubrika'}):
count = count +1
if self.test and count > 2:
return articles
aitem = item.a
section = self.tag_to_string(aitem)
feedlink = 'http://novine.novilist.hr/' + aitem['href']
feedpage = self.index_to_soup(feedlink)
self.report_progress(0, _('Fetching feed')+' %s...'%(section))
inarts = []
for alink in feedpage.findAll('a',attrs={'class':'naslovlinkdesno'}):
url = 'http://novine.novilist.hr/' + alink['href']
title = self.tag_to_string(alink)
date = strftime(self.timefmt)
description = ''
inarts.append({
'title' :title
,'date' :date
,'url' :url
,'description':description
})
articles.append((section,inarts))
return articles
def print_version(self, url):
return url.replace('?WCI=Rubrike&','?WCI=Pretrazivac&')
def preprocess_html(self, soup):
for item in soup.findAll(style=True):
del item['style']
return soup

View File

@ -14,6 +14,7 @@ class TagesspiegelRSS(BasicNewsRecipe):
language = 'de'
oldest_article = 7
max_articles_per_feed = 100
publication_type = 'newspaper'
extra_css = '''
.hcf-overline{color:#990000; font-family:Arial,Helvetica,sans-serif;font-size:xx-small;display:block}
@ -33,13 +34,16 @@ class TagesspiegelRSS(BasicNewsRecipe):
no_javascript = True
remove_empty_feeds = True
encoding = 'utf-8'
remove_tags = [{'class':'hcf-header'}]
remove_tags = [{'class':'hcf-header'}, {'class':'hcf-atlas'}, {'class':'hcf-date hcf-separate'}]
def print_version(self, url):
url = url.split('/')
url[-1] = 'v_print,%s?p='%url[-1]
return '/'.join(url)
def get_masthead_url(self):
return 'http://www.tagesspiegel.de/images/tsp_logo/3114/6.png'
def parse_index(self):
soup = self.index_to_soup('http://www.tagesspiegel.de/zeitung/')
@ -51,7 +55,7 @@ class TagesspiegelRSS(BasicNewsRecipe):
ans = []
maincol = soup.find('div', attrs={'class':re.compile('hcf-main-col')})
for div in maincol.findAll(True, attrs={'class':['hcf-teaser', 'hcf-header', 'story headline']}):
for div in maincol.findAll(True, attrs={'class':['hcf-teaser', 'hcf-header', 'story headline', 'hcf-teaser hcf-last']}):
if div['class'] == 'hcf-header':
try:
@ -61,7 +65,7 @@ class TagesspiegelRSS(BasicNewsRecipe):
except:
continue
elif div['class'] == 'hcf-teaser' and getattr(div.contents[0],'name','') == 'h2':
elif div['class'] in ['hcf-teaser', 'hcf-teaser hcf-last'] and getattr(div.contents[0],'name','') == 'h2':
a = div.find('a', href=True)
if not a:
continue

View File

@ -6167,7 +6167,7 @@ msgstr ""
#. name for deu
msgid "German"
msgstr ""
msgstr "Deutsch"
#. name for dev
msgid "Domung"

View File

@ -550,7 +550,7 @@ from calibre.devices.cybook.driver import CYBOOK, ORIZON
from calibre.devices.eb600.driver import (EB600, COOL_ER, SHINEBOOK,
POCKETBOOK360, GER2, ITALICA, ECLICTO, DBOOK, INVESBOOK,
BOOQ, ELONEX, POCKETBOOK301, MENTOR, POCKETBOOK602,
POCKETBOOK701, POCKETBOOK360P)
POCKETBOOK701, POCKETBOOK360P, PI2)
from calibre.devices.iliad.driver import ILIAD
from calibre.devices.irexdr.driver import IREXDR1000, IREXDR800
from calibre.devices.jetbook.driver import JETBOOK, MIBUK, JETBOOK_MINI
@ -657,6 +657,7 @@ plugins += [
MIBUK,
SHINEBOOK,
POCKETBOOK360, POCKETBOOK301, POCKETBOOK602, POCKETBOOK701, POCKETBOOK360P,
PI2,
KINDLE, KINDLE2, KINDLE_DX, KINDLE_FIRE,
NOOK, NOOK_COLOR,
PRS505, PRST1,

View File

@ -286,3 +286,21 @@ class POCKETBOOK701(USBMS):
drives['carda'] = main
return drives
class PI2(EB600):
name = 'Infibeam Pi2 Device Interface'
gui_name = 'Infibeam Pi2'
author = 'Michael Scalet'
description = _('Communicate with the Infibeam Pi2 reader.')
version = (1,0,1)
# Ordered list of supported formats
FORMATS = ['epub', 'mobi', 'prc', 'html', 'htm', 'doc', 'pdf', 'rtf',
'txt']
VENDOR_NAME = 'INFIBEAM'
WINDOWS_MAIN_MEM = 'INFIBEAM_PI'
WINDOWS_CARD_A_MEM = 'INFIBEAM_PI'
DELETE_EXTS = ['.rec']

View File

@ -61,7 +61,7 @@ class LIBREAIR(N516):
FORMATS = ['epub', 'mobi', 'prc', 'fb2', 'rtf', 'txt', 'pdf']
BCD = [0x399]
VENDOR_NAME = 'ALURATEK'
VENDOR_NAME = ['ALURATEK', 'LINUX']
WINDOWS_MAIN_MEM = WINDOWS_CARD_A_MEM = 'FILE-STOR_GADGET'
EBOOK_DIR_MAIN = 'Books'

View File

@ -67,10 +67,10 @@ def get_metadata(stream):
_parse_pubdate(root, mi)
except:
pass
try:
_parse_timestamp(root, mi)
except:
pass
#try:
# _parse_timestamp(root, mi)
#except:
# pass
try:
_parse_language(root, mi)

View File

@ -557,6 +557,13 @@ class CanonicalFragmentIdentifier
null
# }}}
current_cfi: () -> # {{{
[winx, winy] = window_scroll_pos()
[winw, winh] = [window.innerWidth, window.innerHeight]
winw = max(winw, 400)
winh = max(winh, 600)
# }}}
if window?
window.cfi = new CanonicalFragmentIdentifier()
else if process?

View File

@ -375,7 +375,7 @@ class SchedulerDialog(QDialog, Ui_Dialog):
author=recipe.get('author', _('Unknown')),
description=recipe.get('description', '')))
self.download_button.setToolTip(
_('Downlod %s now')%recipe.get('title'))
_('Download %s now')%recipe.get('title'))
scheduled = schedule_info is not None
self.schedule.setChecked(scheduled)
self.toggle_schedule_info()

View File

@ -279,12 +279,7 @@ class CustomColumns(object):
def is_item_used_in_multiple(self, item, label=None, num=None):
existing_tags = self.all_custom(label=label, num=num)
lt = [t.lower() for t in existing_tags]
try:
lt.index(item.lower())
return True
except ValueError:
return False
return item.lower() in {t.lower() for t in existing_tags}
def delete_item_from_multiple(self, item, label=None, num=None):
if label is not None:
@ -302,10 +297,10 @@ class CustomColumns(object):
books_affected = []
if idx > -1:
table, lt = self.custom_table_names(data['num'])
id_ = self.conn.get('SELECT id FROM %s where value = ?'%table,
id_ = self.conn.get('SELECT id FROM %s WHERE value = ?'%table,
(existing_tags[idx],), all=False)
if id_:
books = self.conn.get('SELECT book FROM %s where value = ?'%lt, (id_,))
books = self.conn.get('SELECT book FROM %s WHERE value = ?'%lt, (id_,))
if books:
books_affected = [b[0] for b in books]
self.conn.execute('DELETE FROM %s WHERE value=?'%lt, (id_,))

View File

@ -669,10 +669,15 @@ class BrowseServer(object):
args = {'id':id_, 'mi':mi,
}
ccache = self.categories_cache() if add_category_links else {}
ftitle = fauthors = ''
for key in mi.all_field_keys():
val = mi.format_field(key)[1]
if not val:
val = ''
if key == 'title':
ftitle = xml(val, True)
elif key == 'authors':
fauthors = xml(val, True)
if add_category_links:
added_key = False
fm = mi.metadata_for_field(key)
@ -710,8 +715,8 @@ class BrowseServer(object):
args[key] = xml(val, True)
else:
args[key] = xml(val, True)
fname = quote(ascii_filename(args['title']) + ' - ' +
ascii_filename(args['authors']))
fname = quote(ascii_filename(ftitle) + ' - ' +
ascii_filename(fauthors))
return args, fmt, fmts, fname
@Endpoint(mimetype='application/json; charset=utf-8')

View File

@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: calibre 0.8.35\n"
"POT-Creation-Date: 2012-01-13 09:36+IST\n"
"PO-Revision-Date: 2012-01-13 09:36+IST\n"
"POT-Creation-Date: 2012-01-13 17:39+IST\n"
"PO-Revision-Date: 2012-01-13 17:39+IST\n"
"Last-Translator: Automatically generated\n"
"Language-Team: LANGUAGE\n"
"MIME-Version: 1.0\n"
@ -9012,7 +9012,7 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/scheduler.py:378
#, python-format
msgid "Downlod %s now"
msgid "Download %s now"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/scheduler.py:382