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
37ac565f3e
@ -52,10 +52,12 @@ class Vreme(BasicNewsRecipe):
|
||||
def parse_index(self):
|
||||
articles = []
|
||||
soup = self.index_to_soup(self.INDEX)
|
||||
|
||||
cover_item = soup.find('div',attrs={'id':'najava'})
|
||||
if cover_item:
|
||||
self.cover_url = self.INDEX + cover_item.img['src']
|
||||
for item in soup.findAll(['h3','h4']):
|
||||
description = ''
|
||||
title_prefix = ''
|
||||
description = u''
|
||||
title_prefix = u''
|
||||
feed_link = item.find('a')
|
||||
if feed_link and feed_link.has_key('href') and feed_link['href'].startswith('/cms/view.php'):
|
||||
url = self.INDEX + feed_link['href']
|
||||
@ -67,7 +69,7 @@ class Vreme(BasicNewsRecipe):
|
||||
,'url' :url
|
||||
,'description':description
|
||||
})
|
||||
return [(soup.head.title.string, articles)]
|
||||
return [('Nedeljnik Vreme', articles)]
|
||||
|
||||
remove_tags = [
|
||||
dict(name=['object','link'])
|
||||
@ -76,11 +78,3 @@ class Vreme(BasicNewsRecipe):
|
||||
|
||||
def print_version(self, url):
|
||||
return url + '&print=yes'
|
||||
|
||||
def get_cover_url(self):
|
||||
cover_url = None
|
||||
soup = self.index_to_soup(self.INDEX)
|
||||
cover_item = soup.find('div',attrs={'id':'najava'})
|
||||
if cover_item:
|
||||
cover_url = self.INDEX + cover_item.img['src']
|
||||
return cover_url
|
||||
|
@ -22,7 +22,12 @@ from calibre.devices.errors import UserFeedback
|
||||
from PIL import Image as PILImage
|
||||
|
||||
if isosx:
|
||||
import appscript
|
||||
try:
|
||||
import appscript
|
||||
appscript
|
||||
except:
|
||||
# appscript fails to load on 10.4
|
||||
appscript = None
|
||||
|
||||
if iswindows:
|
||||
import pythoncom, win32com.client
|
||||
@ -268,6 +273,8 @@ class ITUNES(DevicePlugin):
|
||||
instantiate iTunes if necessary
|
||||
This gets called ~1x/second while device fingerprint is sensed
|
||||
'''
|
||||
if appscript is None:
|
||||
return False
|
||||
|
||||
if self.iTunes:
|
||||
# Check for connected book-capable device
|
||||
|
@ -415,10 +415,11 @@ class XMLCache(object):
|
||||
prints('\tmtime', strftime(os.path.getmtime(path)))
|
||||
record.set('date', date)
|
||||
record.set('size', str(os.stat(path).st_size))
|
||||
record.set('title', book.title)
|
||||
title = book.title if book.title else _('Unknown')
|
||||
record.set('title', title)
|
||||
ts = book.title_sort
|
||||
if not ts:
|
||||
ts = title_sort(book.title)
|
||||
ts = title_sort(title)
|
||||
record.set('titleSorter', ts)
|
||||
record.set('author', authors_to_string(book.authors))
|
||||
ext = os.path.splitext(path)[1]
|
||||
|
@ -44,7 +44,8 @@ def get_metadata_(src, encoding=None):
|
||||
author = match.group(2).replace(',', ';')
|
||||
|
||||
ent_pat = re.compile(r'&(\S+)?;')
|
||||
title = ent_pat.sub(entity_to_unicode, title)
|
||||
if title:
|
||||
title = ent_pat.sub(entity_to_unicode, title)
|
||||
if author:
|
||||
author = ent_pat.sub(entity_to_unicode, author)
|
||||
mi = MetaInformation(title, [author] if author else None)
|
||||
|
@ -201,7 +201,11 @@ class CSSFlattener(object):
|
||||
tag = barename(node.tag)
|
||||
style = stylizer.style(node)
|
||||
cssdict = style.cssdict()
|
||||
font_size = style['font-size']
|
||||
try:
|
||||
font_size = style['font-size']
|
||||
except:
|
||||
font_size = self.sbase if self.sbase is not None else \
|
||||
self.context.source.fbase
|
||||
if 'align' in node.attrib:
|
||||
cssdict['text-align'] = node.attrib['align']
|
||||
del node.attrib['align']
|
||||
|
@ -226,7 +226,7 @@ class GuiRunner(QObject):
|
||||
self.splash_pixmap = QPixmap()
|
||||
self.splash_pixmap.load(I('library.png'))
|
||||
self.splash_screen = QSplashScreen(self.splash_pixmap,
|
||||
Qt.SplashScreen|Qt.WindowStaysOnTopHint)
|
||||
Qt.SplashScreen)
|
||||
self.splash_screen.showMessage(_('Starting %s: Loading books...') %
|
||||
__appname__)
|
||||
self.splash_screen.show()
|
||||
|
@ -127,10 +127,7 @@ class ContentServer(object):
|
||||
cherrypy.log('User agent: '+ua)
|
||||
|
||||
if want_opds:
|
||||
return self.stanza(search=kwargs.get('search', None), sortby=kwargs.get('sortby',None), authorid=kwargs.get('authorid',None),
|
||||
tagid=kwargs.get('tagid',None),
|
||||
seriesid=kwargs.get('seriesid',None),
|
||||
offset=kwargs.get('offset', 0))
|
||||
return self.opds(version=0)
|
||||
|
||||
if want_mobile:
|
||||
return self.mobile()
|
||||
|
@ -157,7 +157,9 @@ If you get timeout errors while browsing the calibre catalog in Stanza, try incr
|
||||
Alternative for the iPad
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
As of |app| version 0.7.0, on windows and OS X you can plugin your iPad into the computer using its charging cable, and |app| will detect it and show you a list of books on the iPad. You can then use the Send to device button to send books directly to iBooks on the iPad.
|
||||
As of |app| version 0.7.0, you can plugin your iPad into the computer using its charging cable, and |app| will detect it and show you a list of books on the iPad. You can then use the Send to device button to send books directly to iBooks on the iPad.
|
||||
|
||||
This method only works on Windows XP and higher and OS X 10.5 and higher. Linux is not supported (iTunes is not available in linux) and OS X 10.4 is not supported.
|
||||
|
||||
How do I use |app| with my Android phone?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -161,6 +161,19 @@ def create_text_arc(text, font_size, font=None, bgcolor='white'):
|
||||
p.MagickTrimImage(canvas, 0)
|
||||
return canvas
|
||||
|
||||
def add_borders_to_image(path_to_image, left=0, top=0, right=0, bottom=0,
|
||||
border_color='white'):
|
||||
with p.ImageMagick():
|
||||
img = load_image(path_to_image)
|
||||
lwidth = p.MagickGetImageWidth(img)
|
||||
lheight = p.MagickGetImageHeight(img)
|
||||
canvas = create_canvas(lwidth+left+right, lheight+top+bottom,
|
||||
border_color)
|
||||
compose_image(canvas, img, left, top)
|
||||
p.DestroyMagickWand(img)
|
||||
with open(path_to_image, 'wb') as f:
|
||||
p.MagickWriteImage(canvas, f)
|
||||
p.DestroyMagickWand(canvas)
|
||||
|
||||
def create_cover_page(top_lines, logo_path, width=590, height=750,
|
||||
bgcolor='white', output_format='png'):
|
||||
|
@ -11,7 +11,7 @@ from lxml import html
|
||||
|
||||
from calibre.web.feeds.feedparser import parse
|
||||
from calibre.utils.logging import default_log
|
||||
from calibre import entity_to_unicode
|
||||
from calibre import entity_to_unicode, strftime
|
||||
from calibre.utils.date import dt_factory, utcnow, local_tz
|
||||
|
||||
class Article(object):
|
||||
@ -55,7 +55,8 @@ class Article(object):
|
||||
def formatted_date(self):
|
||||
def fget(self):
|
||||
if self._formatted_date is None:
|
||||
self._formatted_date = self.localtime.strftime(" [%a, %d %b %H:%M]")
|
||||
self._formatted_date = strftime(" [%a, %d %b %H:%M]",
|
||||
t=self.localtime.timetuple())
|
||||
return self._formatted_date
|
||||
def fset(self, val):
|
||||
self._formatted_date = val
|
||||
|
Loading…
x
Reference in New Issue
Block a user