mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Sync to trunk.
This commit is contained in:
commit
39c57bba49
@ -35,7 +35,7 @@ class IrishTimes(BasicNewsRecipe):
|
|||||||
def print_version(self, url):
|
def print_version(self, url):
|
||||||
if url.count('rss.feedsportal.com'):
|
if url.count('rss.feedsportal.com'):
|
||||||
u = 'http://www.irishtimes.com' + \
|
u = 'http://www.irishtimes.com' + \
|
||||||
(((url[69:].replace('0C','/')).replace('0A','0'))).replace('0Bhtml/story01.htm','_pf.html')
|
(((url[70:].replace('0C','/')).replace('0A','0'))).replace('0Bhtml/story01.htm','_pf.html')
|
||||||
else:
|
else:
|
||||||
u = url.replace('.html','_pf.html')
|
u = url.replace('.html','_pf.html')
|
||||||
return u
|
return u
|
||||||
|
@ -15,6 +15,7 @@ from calibre import guess_type, strftime
|
|||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||||
from calibre.ebooks.oeb.base import XPath, XHTML_NS, XHTML
|
from calibre.ebooks.oeb.base import XPath, XHTML_NS, XHTML
|
||||||
from calibre.library.comments import comments_to_html
|
from calibre.library.comments import comments_to_html
|
||||||
|
from calibre.utils.date import is_date_undefined
|
||||||
|
|
||||||
JACKET_XPATH = '//h:meta[@name="calibre-content" and @content="jacket"]'
|
JACKET_XPATH = '//h:meta[@name="calibre-content" and @content="jacket"]'
|
||||||
|
|
||||||
@ -130,7 +131,10 @@ def render_jacket(mi, output_profile,
|
|||||||
publisher = ''
|
publisher = ''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pubdate = strftime(u'%Y', mi.pubdate.timetuple())
|
if is_date_undefined(mi.pubdate):
|
||||||
|
pubdate = ''
|
||||||
|
else:
|
||||||
|
pubdate = strftime(u'%Y', mi.pubdate.timetuple())
|
||||||
except:
|
except:
|
||||||
pubdate = ''
|
pubdate = ''
|
||||||
|
|
||||||
@ -175,19 +179,24 @@ def render_jacket(mi, output_profile,
|
|||||||
soup = BeautifulSoup(generated_html)
|
soup = BeautifulSoup(generated_html)
|
||||||
if not series:
|
if not series:
|
||||||
series_tag = soup.find(attrs={'class':'cbj_series'})
|
series_tag = soup.find(attrs={'class':'cbj_series'})
|
||||||
series_tag.extract()
|
if series_tag is not None:
|
||||||
|
series_tag.extract()
|
||||||
if not rating:
|
if not rating:
|
||||||
rating_tag = soup.find(attrs={'class':'cbj_rating'})
|
rating_tag = soup.find(attrs={'class':'cbj_rating'})
|
||||||
rating_tag.extract()
|
if rating_tag is not None:
|
||||||
|
rating_tag.extract()
|
||||||
if not tags:
|
if not tags:
|
||||||
tags_tag = soup.find(attrs={'class':'cbj_tags'})
|
tags_tag = soup.find(attrs={'class':'cbj_tags'})
|
||||||
tags_tag.extract()
|
if tags_tag is not None:
|
||||||
|
tags_tag.extract()
|
||||||
if not pubdate:
|
if not pubdate:
|
||||||
pubdate_tag = soup.find(attrs={'class':'cbj_pubdate'})
|
pubdate_tag = soup.find(attrs={'class':'cbj_pubdata'})
|
||||||
pubdate_tag.extract()
|
if pubdate_tag is not None:
|
||||||
|
pubdate_tag.extract()
|
||||||
if output_profile.short_name != 'kindle':
|
if output_profile.short_name != 'kindle':
|
||||||
hr_tag = soup.find('hr', attrs={'class':'cbj_kindle_banner_hr'})
|
hr_tag = soup.find('hr', attrs={'class':'cbj_kindle_banner_hr'})
|
||||||
hr_tag.extract()
|
if hr_tag is not None:
|
||||||
|
hr_tag.extract()
|
||||||
|
|
||||||
return soup.renderContents(None)
|
return soup.renderContents(None)
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ class TXTInput(InputFormatPlugin):
|
|||||||
def convert(self, stream, options, file_ext, log,
|
def convert(self, stream, options, file_ext, log,
|
||||||
accelerators):
|
accelerators):
|
||||||
self.log = log
|
self.log = log
|
||||||
length = None
|
|
||||||
log.debug('Reading text from file...')
|
log.debug('Reading text from file...')
|
||||||
|
length = 0
|
||||||
|
|
||||||
txt = stream.read()
|
txt = stream.read()
|
||||||
|
|
||||||
|
@ -89,7 +89,8 @@ class MessageBox(QDialog, Ui_Dialog):
|
|||||||
(__version__, unicode(self.windowTitle()),
|
(__version__, unicode(self.windowTitle()),
|
||||||
unicode(self.msg.text()),
|
unicode(self.msg.text()),
|
||||||
unicode(self.det_msg.toPlainText())))
|
unicode(self.det_msg.toPlainText())))
|
||||||
self.ctc_button.setText(_('Copied'))
|
if hasattr(self, 'ctc_button'):
|
||||||
|
self.ctc_button.setText(_('Copied'))
|
||||||
|
|
||||||
def showEvent(self, ev):
|
def showEvent(self, ev):
|
||||||
ret = QDialog.showEvent(self, ev)
|
ret = QDialog.showEvent(self, ev)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user