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):
|
def parse_index(self):
|
||||||
articles = []
|
articles = []
|
||||||
soup = self.index_to_soup(self.INDEX)
|
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']):
|
for item in soup.findAll(['h3','h4']):
|
||||||
description = ''
|
description = u''
|
||||||
title_prefix = ''
|
title_prefix = u''
|
||||||
feed_link = item.find('a')
|
feed_link = item.find('a')
|
||||||
if feed_link and feed_link.has_key('href') and feed_link['href'].startswith('/cms/view.php'):
|
if feed_link and feed_link.has_key('href') and feed_link['href'].startswith('/cms/view.php'):
|
||||||
url = self.INDEX + feed_link['href']
|
url = self.INDEX + feed_link['href']
|
||||||
@ -67,7 +69,7 @@ class Vreme(BasicNewsRecipe):
|
|||||||
,'url' :url
|
,'url' :url
|
||||||
,'description':description
|
,'description':description
|
||||||
})
|
})
|
||||||
return [(soup.head.title.string, articles)]
|
return [('Nedeljnik Vreme', articles)]
|
||||||
|
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name=['object','link'])
|
dict(name=['object','link'])
|
||||||
@ -76,11 +78,3 @@ class Vreme(BasicNewsRecipe):
|
|||||||
|
|
||||||
def print_version(self, url):
|
def print_version(self, url):
|
||||||
return url + '&print=yes'
|
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
|
from PIL import Image as PILImage
|
||||||
|
|
||||||
if isosx:
|
if isosx:
|
||||||
|
try:
|
||||||
import appscript
|
import appscript
|
||||||
|
appscript
|
||||||
|
except:
|
||||||
|
# appscript fails to load on 10.4
|
||||||
|
appscript = None
|
||||||
|
|
||||||
if iswindows:
|
if iswindows:
|
||||||
import pythoncom, win32com.client
|
import pythoncom, win32com.client
|
||||||
@ -268,6 +273,8 @@ class ITUNES(DevicePlugin):
|
|||||||
instantiate iTunes if necessary
|
instantiate iTunes if necessary
|
||||||
This gets called ~1x/second while device fingerprint is sensed
|
This gets called ~1x/second while device fingerprint is sensed
|
||||||
'''
|
'''
|
||||||
|
if appscript is None:
|
||||||
|
return False
|
||||||
|
|
||||||
if self.iTunes:
|
if self.iTunes:
|
||||||
# Check for connected book-capable device
|
# Check for connected book-capable device
|
||||||
|
@ -415,10 +415,11 @@ class XMLCache(object):
|
|||||||
prints('\tmtime', strftime(os.path.getmtime(path)))
|
prints('\tmtime', strftime(os.path.getmtime(path)))
|
||||||
record.set('date', date)
|
record.set('date', date)
|
||||||
record.set('size', str(os.stat(path).st_size))
|
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
|
ts = book.title_sort
|
||||||
if not ts:
|
if not ts:
|
||||||
ts = title_sort(book.title)
|
ts = title_sort(title)
|
||||||
record.set('titleSorter', ts)
|
record.set('titleSorter', ts)
|
||||||
record.set('author', authors_to_string(book.authors))
|
record.set('author', authors_to_string(book.authors))
|
||||||
ext = os.path.splitext(path)[1]
|
ext = os.path.splitext(path)[1]
|
||||||
|
@ -44,6 +44,7 @@ def get_metadata_(src, encoding=None):
|
|||||||
author = match.group(2).replace(',', ';')
|
author = match.group(2).replace(',', ';')
|
||||||
|
|
||||||
ent_pat = re.compile(r'&(\S+)?;')
|
ent_pat = re.compile(r'&(\S+)?;')
|
||||||
|
if title:
|
||||||
title = ent_pat.sub(entity_to_unicode, title)
|
title = ent_pat.sub(entity_to_unicode, title)
|
||||||
if author:
|
if author:
|
||||||
author = ent_pat.sub(entity_to_unicode, author)
|
author = ent_pat.sub(entity_to_unicode, author)
|
||||||
|
@ -201,7 +201,11 @@ class CSSFlattener(object):
|
|||||||
tag = barename(node.tag)
|
tag = barename(node.tag)
|
||||||
style = stylizer.style(node)
|
style = stylizer.style(node)
|
||||||
cssdict = style.cssdict()
|
cssdict = style.cssdict()
|
||||||
|
try:
|
||||||
font_size = style['font-size']
|
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:
|
if 'align' in node.attrib:
|
||||||
cssdict['text-align'] = node.attrib['align']
|
cssdict['text-align'] = node.attrib['align']
|
||||||
del node.attrib['align']
|
del node.attrib['align']
|
||||||
|
@ -226,7 +226,7 @@ class GuiRunner(QObject):
|
|||||||
self.splash_pixmap = QPixmap()
|
self.splash_pixmap = QPixmap()
|
||||||
self.splash_pixmap.load(I('library.png'))
|
self.splash_pixmap.load(I('library.png'))
|
||||||
self.splash_screen = QSplashScreen(self.splash_pixmap,
|
self.splash_screen = QSplashScreen(self.splash_pixmap,
|
||||||
Qt.SplashScreen|Qt.WindowStaysOnTopHint)
|
Qt.SplashScreen)
|
||||||
self.splash_screen.showMessage(_('Starting %s: Loading books...') %
|
self.splash_screen.showMessage(_('Starting %s: Loading books...') %
|
||||||
__appname__)
|
__appname__)
|
||||||
self.splash_screen.show()
|
self.splash_screen.show()
|
||||||
|
@ -127,10 +127,7 @@ class ContentServer(object):
|
|||||||
cherrypy.log('User agent: '+ua)
|
cherrypy.log('User agent: '+ua)
|
||||||
|
|
||||||
if want_opds:
|
if want_opds:
|
||||||
return self.stanza(search=kwargs.get('search', None), sortby=kwargs.get('sortby',None), authorid=kwargs.get('authorid',None),
|
return self.opds(version=0)
|
||||||
tagid=kwargs.get('tagid',None),
|
|
||||||
seriesid=kwargs.get('seriesid',None),
|
|
||||||
offset=kwargs.get('offset', 0))
|
|
||||||
|
|
||||||
if want_mobile:
|
if want_mobile:
|
||||||
return self.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
|
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?
|
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)
|
p.MagickTrimImage(canvas, 0)
|
||||||
return canvas
|
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,
|
def create_cover_page(top_lines, logo_path, width=590, height=750,
|
||||||
bgcolor='white', output_format='png'):
|
bgcolor='white', output_format='png'):
|
||||||
|
@ -11,7 +11,7 @@ from lxml import html
|
|||||||
|
|
||||||
from calibre.web.feeds.feedparser import parse
|
from calibre.web.feeds.feedparser import parse
|
||||||
from calibre.utils.logging import default_log
|
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
|
from calibre.utils.date import dt_factory, utcnow, local_tz
|
||||||
|
|
||||||
class Article(object):
|
class Article(object):
|
||||||
@ -55,7 +55,8 @@ class Article(object):
|
|||||||
def formatted_date(self):
|
def formatted_date(self):
|
||||||
def fget(self):
|
def fget(self):
|
||||||
if self._formatted_date is None:
|
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
|
return self._formatted_date
|
||||||
def fset(self, val):
|
def fset(self, val):
|
||||||
self._formatted_date = val
|
self._formatted_date = val
|
||||||
|
Loading…
x
Reference in New Issue
Block a user