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
e4d496d2c0
@ -443,7 +443,7 @@ def do_convert(path_to_file, opts, notification=lambda m, p: p, output_format='l
|
||||
if output_format == 'pdf':
|
||||
create_pdf(pages, opts.profile, opts, thumbnail=thumbnail)
|
||||
shutil.rmtree(tdir)
|
||||
if not opts.no_process:
|
||||
if not getattr(opts, 'no_process', False):
|
||||
shutil.rmtree(tdir2)
|
||||
|
||||
|
||||
@ -457,7 +457,7 @@ def main(args=sys.argv, notification=None, output_format='lrf'):
|
||||
|
||||
if not callable(notification):
|
||||
pb = ProgressBar(terminal_controller, _('Rendering comic pages...'),
|
||||
no_progress_bar=opts.no_progress_bar)
|
||||
no_progress_bar=opts.no_progress_bar or getattr(opts, 'no_process', False))
|
||||
notification = pb.update
|
||||
|
||||
source = os.path.abspath(args[1])
|
||||
|
@ -406,6 +406,7 @@ class Document(QGraphicsScene):
|
||||
for font in lrf.font_map:
|
||||
fdata = QByteArray(lrf.font_map[font].data)
|
||||
id = QFontDatabase.addApplicationFontFromData(fdata)
|
||||
if id != -1:
|
||||
font_map[font] = [str(i) for i in QFontDatabase.applicationFontFamilies(id)][0]
|
||||
|
||||
if load_substitutions:
|
||||
|
@ -889,6 +889,9 @@ class Main(MainWindow, Ui_MainWindow):
|
||||
ids = [id for id in ids if self.library_view.model().db.has_id(id)]
|
||||
files = [self.library_view.model().db.format(id, prefs['output_format'], index_is_id=True, as_file=True) for id in ids]
|
||||
files = [f for f in files if f is not None]
|
||||
if not files:
|
||||
dynamic.set('news_to_be_synced', set([]))
|
||||
return
|
||||
metadata = self.library_view.model().get_metadata(ids, rows_are_ids=True)
|
||||
names = []
|
||||
for mi in metadata:
|
||||
|
@ -1551,9 +1551,6 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE;
|
||||
|
||||
|
||||
|
||||
def has_book(self, mi):
|
||||
return bool(self.conn.get('SELECT id FROM books where title=?', (mi.title,), all=False))
|
||||
|
||||
def has_id(self, id):
|
||||
return self.conn.get('SELECT id FROM books where id=?', (id,), all=False) is not None
|
||||
|
||||
|
@ -217,7 +217,11 @@ class ResultCache(SearchQueryParser):
|
||||
return self.index(id)
|
||||
|
||||
def has_id(self, id):
|
||||
try:
|
||||
return self._data[id] is not None
|
||||
except IndexError:
|
||||
pass
|
||||
return False
|
||||
|
||||
def refresh_ids(self, conn, ids):
|
||||
for id in ids:
|
||||
@ -558,6 +562,14 @@ class LibraryDatabase2(LibraryDatabase):
|
||||
return img
|
||||
return f if as_file else f.read()
|
||||
|
||||
def has_book(self, mi):
|
||||
title = mi.title
|
||||
if title:
|
||||
if not isinstance(title, unicode):
|
||||
title = title.decode(preferred_encoding, 'replace')
|
||||
return bool(self.conn.get('SELECT id FROM books where title=?', (title,), all=False))
|
||||
return False
|
||||
|
||||
def has_cover(self, index, index_is_id=False):
|
||||
id = index if index_is_id else self.id(index)
|
||||
path = os.path.join(self.library_path, self.path(id, index_is_id=True), 'cover.jpg')
|
||||
|
@ -21,7 +21,7 @@ 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',
|
||||
'joelonsoftware', 'telepolis', 'common_dreams', 'nin',
|
||||
)]
|
||||
|
||||
import re, imp, inspect, time, os
|
||||
|
55
src/calibre/web/feeds/recipes/recipe_nin.py
Normal file
55
src/calibre/web/feeds/recipes/recipe_nin.py
Normal file
@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
|
||||
'''
|
||||
nin.co.yu
|
||||
'''
|
||||
|
||||
import re, urllib
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
class Nin(BasicNewsRecipe):
|
||||
title = 'NIN online'
|
||||
__author__ = 'Darko Miletic'
|
||||
description = 'Nedeljne informativne novine'
|
||||
no_stylesheets = True
|
||||
oldest_article = 15
|
||||
simultaneous_downloads = 1
|
||||
delay = 1
|
||||
encoding = 'utf8'
|
||||
needs_subscription = True
|
||||
PREFIX = 'http://www.nin.co.yu'
|
||||
INDEX = PREFIX + '/?change_lang=ls'
|
||||
LOGIN = PREFIX + '/?logout=true'
|
||||
html2lrf_options = [
|
||||
'--comment' , description
|
||||
, '--category' , 'news, politics, Serbia'
|
||||
, '--publisher' , 'NIN'
|
||||
]
|
||||
|
||||
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
|
||||
|
||||
def get_browser(self):
|
||||
br = BasicNewsRecipe.get_browser()
|
||||
br.open(self.INDEX)
|
||||
if self.username is not None and self.password is not None:
|
||||
data = urllib.urlencode({ 'login_name':self.username
|
||||
,'login_password':self.password
|
||||
,'imageField.x':'32'
|
||||
,'imageField.y':'15'
|
||||
})
|
||||
br.open(self.LOGIN,data)
|
||||
return br
|
||||
|
||||
keep_only_tags =[dict(name='td', attrs={'width':'520'})]
|
||||
remove_tags_after =dict(name='html')
|
||||
feeds =[(u'NIN', u'http://www.nin.co.yu/misc/rss.php?feed=RSS2.0')]
|
||||
|
||||
def get_cover_url(self):
|
||||
cover_url = None
|
||||
soup = self.index_to_soup(self.INDEX)
|
||||
link_item = soup.find('img',attrs={'width':'100','height':'137','border':'0'})
|
||||
if link_item:
|
||||
cover_url = self.PREFIX + link_item['src']
|
||||
return cover_url
|
Loading…
x
Reference in New Issue
Block a user