mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Pull from trunk
This commit is contained in:
commit
28ef1eaab1
@ -14,7 +14,7 @@ class BEBOOK(USBMS):
|
|||||||
|
|
||||||
|
|
||||||
# Ordered list of supported formats
|
# Ordered list of supported formats
|
||||||
FORMATS = ['mobi', 'epub', 'pdf', 'mobi', 'txt']
|
FORMATS = ['mobi', 'epub', 'pdf', 'txt']
|
||||||
|
|
||||||
VENDOR_ID = [0x0525]
|
VENDOR_ID = [0x0525]
|
||||||
PRODUCT_ID = [0x8803, 0x6803]
|
PRODUCT_ID = [0x8803, 0x6803]
|
||||||
|
@ -71,12 +71,16 @@ usbobserver_get_usb_devices(PyObject *self, PyObject *args) {
|
|||||||
plugInInterface = NULL; dev = NULL;
|
plugInInterface = NULL; dev = NULL;
|
||||||
//Create an intermediate plugin
|
//Create an intermediate plugin
|
||||||
kr = IOCreatePlugInInterfaceForService(usbDevice, kIOUSBDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &plugInInterface, &score);
|
kr = IOCreatePlugInInterfaceForService(usbDevice, kIOUSBDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &plugInInterface, &score);
|
||||||
if ((kIOReturnSuccess != kr) || !plugInInterface)
|
if ((kIOReturnSuccess != kr) || !plugInInterface) {
|
||||||
printf("Unable to create a plug-in (%08x)\n", kr);
|
printf("Unable to create a plug-in (%08x)\n", kr); continue;
|
||||||
|
}
|
||||||
//Now create the device interface
|
//Now create the device interface
|
||||||
HRESULT result = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID), (LPVOID)&dev);
|
HRESULT result = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID), (LPVOID)&dev);
|
||||||
|
|
||||||
if (result || !dev) printf("Couldn't create a device interface (%08x)\n", (int) result);
|
if (result || !dev) {
|
||||||
|
printf("Couldn't create a device interface (%08x)\n", (int) result);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
kr = (*dev)->GetDeviceVendor(dev, &vendor);
|
kr = (*dev)->GetDeviceVendor(dev, &vendor);
|
||||||
kr = (*dev)->GetDeviceProduct(dev, &product);
|
kr = (*dev)->GetDeviceProduct(dev, &product);
|
||||||
|
@ -683,12 +683,13 @@ class MobiReader(object):
|
|||||||
image_index += 1
|
image_index += 1
|
||||||
try:
|
try:
|
||||||
im = PILImage.open(buf)
|
im = PILImage.open(buf)
|
||||||
|
im = im.convert('RGB')
|
||||||
except IOError:
|
except IOError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
path = os.path.join(output_dir, '%05d.jpg'%image_index)
|
path = os.path.join(output_dir, '%05d.jpg'%image_index)
|
||||||
self.image_names.append(os.path.basename(path))
|
self.image_names.append(os.path.basename(path))
|
||||||
im.convert('RGB').save(open(path, 'wb'), format='JPEG')
|
im.save(open(path, 'wb'), format='JPEG')
|
||||||
|
|
||||||
def get_metadata(stream):
|
def get_metadata(stream):
|
||||||
from calibre.utils.logging import Log
|
from calibre.utils.logging import Log
|
||||||
|
@ -187,6 +187,8 @@ class FetchMetadata(QDialog, Ui_FetchMetadata):
|
|||||||
def terminate(self):
|
def terminate(self):
|
||||||
if hasattr(self, 'fetcher') and self.fetcher.isRunning():
|
if hasattr(self, 'fetcher') and self.fetcher.isRunning():
|
||||||
self.fetcher.terminate()
|
self.fetcher.terminate()
|
||||||
|
if hasattr(self, '_hangcheck') and self._hangcheck.isActive():
|
||||||
|
self._hangcheck.stop()
|
||||||
|
|
||||||
|
|
||||||
def __enter__(self, *args):
|
def __enter__(self, *args):
|
||||||
|
@ -422,22 +422,22 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
|||||||
publisher = qstring_to_unicode(self.publisher.currentText())
|
publisher = qstring_to_unicode(self.publisher.currentText())
|
||||||
if isbn or title or author or publisher:
|
if isbn or title or author or publisher:
|
||||||
d = FetchMetadata(self, isbn, title, author, publisher, self.timeout)
|
d = FetchMetadata(self, isbn, title, author, publisher, self.timeout)
|
||||||
|
self._fetch_metadata_scope = d
|
||||||
with d:
|
with d:
|
||||||
d.exec_()
|
if d.exec_() == QDialog.Accepted:
|
||||||
if d.result() == QDialog.Accepted:
|
book = d.selected_book()
|
||||||
book = d.selected_book()
|
if book:
|
||||||
if book:
|
self.title.setText(book.title)
|
||||||
self.title.setText(book.title)
|
self.authors.setText(authors_to_string(book.authors))
|
||||||
self.authors.setText(authors_to_string(book.authors))
|
if book.author_sort: self.author_sort.setText(book.author_sort)
|
||||||
if book.author_sort: self.author_sort.setText(book.author_sort)
|
if book.publisher: self.publisher.setEditText(book.publisher)
|
||||||
if book.publisher: self.publisher.setEditText(book.publisher)
|
if book.isbn: self.isbn.setText(book.isbn)
|
||||||
if book.isbn: self.isbn.setText(book.isbn)
|
summ = book.comments
|
||||||
summ = book.comments
|
if summ:
|
||||||
if summ:
|
prefix = qstring_to_unicode(self.comments.toPlainText())
|
||||||
prefix = qstring_to_unicode(self.comments.toPlainText())
|
if prefix:
|
||||||
if prefix:
|
prefix += '\n'
|
||||||
prefix += '\n'
|
self.comments.setText(prefix + summ)
|
||||||
self.comments.setText(prefix + summ)
|
|
||||||
else:
|
else:
|
||||||
error_dialog(self, _('Cannot fetch metadata'),
|
error_dialog(self, _('Cannot fetch metadata'),
|
||||||
_('You must specify at least one of ISBN, Title, '
|
_('You must specify at least one of ISBN, Title, '
|
||||||
|
BIN
src/calibre/gui2/images/news/times_online.png
Normal file
BIN
src/calibre/gui2/images/news/times_online.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 328 B |
@ -193,6 +193,8 @@ class ResultCache(SearchQueryParser):
|
|||||||
if query and query.strip():
|
if query and query.strip():
|
||||||
location = location.lower().strip()
|
location = location.lower().strip()
|
||||||
query = query.lower()
|
query = query.lower()
|
||||||
|
if not isinstance(query, unicode):
|
||||||
|
query = query.decode('utf-8')
|
||||||
if location in ('tag', 'author', 'format'):
|
if location in ('tag', 'author', 'format'):
|
||||||
location += 's'
|
location += 's'
|
||||||
all = ('title', 'authors', 'publisher', 'tags', 'comments', 'series', 'formats')
|
all = ('title', 'authors', 'publisher', 'tags', 'comments', 'series', 'formats')
|
||||||
|
28
src/calibre/utils/genshi/LICENSE
Normal file
28
src/calibre/utils/genshi/LICENSE
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
Copyright © 2006-2007 Edgewall Software[[BR]]
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in
|
||||||
|
the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
3. The name of the author may not be used to endorse or promote
|
||||||
|
products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR “AS IS” AND ANY EXPRESS
|
||||||
|
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||||
|
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
|
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@ -43,6 +43,7 @@ recipe_modules = ['recipe_' + r for r in (
|
|||||||
'seattle_times', 'scott_hanselman', 'coding_horror', 'twitchfilms',
|
'seattle_times', 'scott_hanselman', 'coding_horror', 'twitchfilms',
|
||||||
'stackoverflow', 'telepolis_artikel', 'zaobao', 'usnews',
|
'stackoverflow', 'telepolis_artikel', 'zaobao', 'usnews',
|
||||||
'straitstimes', 'index_hu', 'pcworld_hu', 'hrt', 'rts',
|
'straitstimes', 'index_hu', 'pcworld_hu', 'hrt', 'rts',
|
||||||
|
'h1', 'h2', 'h3',
|
||||||
)]
|
)]
|
||||||
|
|
||||||
import re, imp, inspect, time, os
|
import re, imp, inspect, time, os
|
||||||
|
32
src/calibre/web/feeds/recipes/recipe_h1.py
Normal file
32
src/calibre/web/feeds/recipes/recipe_h1.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||||
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class H168(BasicNewsRecipe):
|
||||||
|
title = u'168\xf3ra'
|
||||||
|
oldest_article = 4
|
||||||
|
max_articles_per_feed = 50
|
||||||
|
language = _('Hungarian')
|
||||||
|
__author__ = 'Ezmegaz'
|
||||||
|
|
||||||
|
feeds = [(u'Itthon',
|
||||||
|
u'http://www.168ora.hu/static/rss/cikkek_itthon.xml'), (u'Gl\xf3busz',
|
||||||
|
u'http://www.168ora.hu/static/rss/cikkek_globusz.xml'), (u'Punch',
|
||||||
|
u'http://www.168ora.hu/static/rss/cikkek_punch.xml'), (u'Arte',
|
||||||
|
u'http://www.168ora.hu/static/rss/cikkek_arte.xml'), (u'Buxa',
|
||||||
|
u'http://www.168ora.hu/static/rss/cikkek_buxa.xml'), (u'Sebess\xe9g',
|
||||||
|
u'http://www.168ora.hu/static/rss/cikkek_sebesseg.xml'), (u'Tud\xe1s',
|
||||||
|
u'http://www.168ora.hu/static/rss/cikkek_tudas.xml'), (u'Sport',
|
||||||
|
u'http://www.168ora.hu/static/rss/cikkek_sport.xml'), (u'V\xe9lem\xe9ny',
|
||||||
|
u'http://www.168ora.hu/static/rss/cikkek_velemeny.xml'), (u'Dolce Vita',
|
||||||
|
u'http://www.168ora.hu/static/rss/cikkek_dolcevita.xml'), (u'R\xe1di\xf3',
|
||||||
|
u'http://www.168ora.hu/static/rss/radio.xml')]
|
||||||
|
|
||||||
|
|
||||||
|
|
21
src/calibre/web/feeds/recipes/recipe_h2.py
Normal file
21
src/calibre/web/feeds/recipes/recipe_h2.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||||
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class ATV(BasicNewsRecipe):
|
||||||
|
title = u'ATV'
|
||||||
|
oldest_article = 5
|
||||||
|
max_articles_per_feed = 50
|
||||||
|
language = _('Hungarian')
|
||||||
|
__author__ = 'Ezmegaz'
|
||||||
|
|
||||||
|
|
||||||
|
feeds = [(u'H\xedrek', u'http://atv.hu/rss/1'), (u'Cikkek',
|
||||||
|
u'http://atv.hu/rss/2')]
|
||||||
|
|
29
src/calibre/web/feeds/recipes/recipe_h3.py
Normal file
29
src/calibre/web/feeds/recipes/recipe_h3.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||||
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class H3(BasicNewsRecipe):
|
||||||
|
title = u'H\xedrszerz\u0151'
|
||||||
|
oldest_article = 5
|
||||||
|
max_articles_per_feed = 50
|
||||||
|
language = _('Hungarian')
|
||||||
|
__author__ = 'Ezmegaz'
|
||||||
|
|
||||||
|
|
||||||
|
feeds = [(u'Belf\xf6ld',
|
||||||
|
u'http://www.hirszerzo.hu/rss.belfold.xml'), (u'K\xfclf\xf6ld',
|
||||||
|
u'http://www.hirszerzo.hu/rss.kulfold.xml'), (u'Profit',
|
||||||
|
u'http://www.hirszerzo.hu/rss.profit.xml'), (u'Shake',
|
||||||
|
u'http://www.hirszerzo.hu/rss.shake.xml'), (u'Publicisztika',
|
||||||
|
u'http://www.hirszerzo.hu/rss.publicisztika.xml'), (u'Elemz\xe9s',
|
||||||
|
u'http://www.hirszerzo.hu/rss.elemzes.xml'), (u'Sorok k\xf6z\xf6tt',
|
||||||
|
u'http://www.hirszerzo.hu/rss.sorok_kozott.xml'), (u'Gal\xe9ria',
|
||||||
|
u'http://www.hirszerzo.hu/rss.galeria.xml'), (u'Patro',
|
||||||
|
u'http://www.hirszerzo.hu/rss.patro.xml')]
|
||||||
|
|
@ -12,6 +12,7 @@ class Newsweek(BasicNewsRecipe):
|
|||||||
__author__ = 'Kovid Goyal'
|
__author__ = 'Kovid Goyal'
|
||||||
description = 'Weekly news and current affairs in the US'
|
description = 'Weekly news and current affairs in the US'
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
|
encoding = 'utf-8'
|
||||||
language = _('English')
|
language = _('English')
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
{'class':['navbar', 'ad', 'sponsorLinksArticle', 'mm-content',
|
{'class':['navbar', 'ad', 'sponsorLinksArticle', 'mm-content',
|
||||||
@ -106,3 +107,12 @@ class Newsweek(BasicNewsRecipe):
|
|||||||
href = a['href'].split('#')[0]
|
href = a['href'].split('#')[0]
|
||||||
return self.index_to_soup(href)
|
return self.index_to_soup(href)
|
||||||
|
|
||||||
|
def get_cover_url(self):
|
||||||
|
cover_url = None
|
||||||
|
soup = self.index_to_soup(self.INDEX)
|
||||||
|
link_item = soup.find('div',attrs={'class':'cover-image'})
|
||||||
|
if link_item and link_item.a and link_item.a.img:
|
||||||
|
cover_url = link_item.a.img['src']
|
||||||
|
return cover_url
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,28 +1,39 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2008-2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
timesonline.co.uk
|
timesonline.co.uk
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag
|
||||||
|
|
||||||
class TimesOnline(BasicNewsRecipe):
|
class Timesonline(BasicNewsRecipe):
|
||||||
title = u'The Times Online'
|
title = 'The Times Online'
|
||||||
__author__ = 'Darko Miletic'
|
__author__ = 'Darko Miletic'
|
||||||
description = 'UK news'
|
description = 'UK news'
|
||||||
oldest_article = 7
|
publisher = 'timesonline.co.uk'
|
||||||
max_articles_per_feed = 100
|
category = 'news, politics, UK'
|
||||||
no_stylesheets = True
|
oldest_article = 2
|
||||||
use_embedded_content = False
|
max_articles_per_feed = 100
|
||||||
language = _('English')
|
no_stylesheets = True
|
||||||
|
use_embedded_content = False
|
||||||
simultaneous_downloads = 1
|
simultaneous_downloads = 1
|
||||||
|
encoding = 'cp1252'
|
||||||
|
lang = 'en-UK'
|
||||||
|
language = _('English')
|
||||||
|
|
||||||
|
html2lrf_options = [
|
||||||
|
'--comment', description
|
||||||
|
, '--category', category
|
||||||
|
, '--publisher', publisher
|
||||||
|
]
|
||||||
|
|
||||||
|
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
|
||||||
|
|
||||||
|
remove_tags = [dict(name=['embed','object'])]
|
||||||
remove_tags_after = dict(name='div', attrs={'class':'bg-666'})
|
remove_tags_after = dict(name='div', attrs={'class':'bg-666'})
|
||||||
remove_tags = [
|
|
||||||
dict(name='div' , attrs={'class':'hide-from-print padding-bottom-7' })
|
|
||||||
]
|
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
(u'Top stories from Times Online', u'http://www.timesonline.co.uk/tol/feeds/rss/topstories.xml' ),
|
(u'Top stories from Times Online', u'http://www.timesonline.co.uk/tol/feeds/rss/topstories.xml' ),
|
||||||
@ -38,5 +49,17 @@ class TimesOnline(BasicNewsRecipe):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def print_version(self, url):
|
def print_version(self, url):
|
||||||
main = url.partition('#')[0]
|
return url + '?print=yes'
|
||||||
return main + '?print=yes'
|
|
||||||
|
def get_article_url(self, article):
|
||||||
|
return article.get('guid', None)
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
soup.html['xml:lang'] = self.lang
|
||||||
|
soup.html['lang'] = self.lang
|
||||||
|
mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
|
||||||
|
mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=UTF-8")])
|
||||||
|
soup.head.insert(0,mlang)
|
||||||
|
soup.head.insert(1,mcharset)
|
||||||
|
return self.adeify_images(soup)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user