Sync to trunk

This commit is contained in:
John Schember 2009-02-24 18:44:40 -05:00
commit d473fcf95e
8 changed files with 39 additions and 19 deletions

View File

@ -2,7 +2,7 @@ __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
__appname__ = 'calibre' __appname__ = 'calibre'
__version__ = '0.4.139' __version__ = '0.4.140'
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>" __author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
''' '''
Various run time constants. Various run time constants.

View File

@ -11,7 +11,8 @@ def devices():
from calibre.devices.prs700.driver import PRS700 from calibre.devices.prs700.driver import PRS700
from calibre.devices.cybookg3.driver import CYBOOKG3 from calibre.devices.cybookg3.driver import CYBOOKG3
from calibre.devices.kindle.driver import KINDLE from calibre.devices.kindle.driver import KINDLE
return (PRS500, PRS505, PRS700, CYBOOKG3, KINDLE) from calibre.devices.kindle.driver import KINDLE2
return (PRS500, PRS505, PRS700, CYBOOKG3, KINDLE, KINDLE2)
import time import time

View File

@ -4,7 +4,7 @@ __copyright__ = '2009, John Schember <john at nachtimwald.com>'
Device driver for Amazon's Kindle Device driver for Amazon's Kindle
''' '''
import os, fnmatch import os
from calibre.devices.usbms.driver import USBMS from calibre.devices.usbms.driver import USBMS
@ -35,10 +35,13 @@ class KINDLE(USBMS):
if os.path.exists(path): if os.path.exists(path):
os.unlink(path) os.unlink(path)
filepath, ext = os.path.splitext(path) filepath = os.path.splitext(path)[0]
basepath, filename = os.path.split(filepath)
# Delete the ebook auxiliary file # Delete the ebook auxiliary file
if os.path.exists(filepath + '.mbp'): if os.path.exists(filepath + '.mbp'):
os.unlink(filepath + '.mbp') os.unlink(filepath + '.mbp')
class KINDLE2(KINDLE):
PRODUCT_ID = [0x0002]
BCD = [0x0100]

View File

@ -9,7 +9,7 @@ from PyQt4.Qt import QMovie, QApplication, Qt, QIcon, QTimer, QWidget, SIGNAL, \
QDesktopServices, QDoubleSpinBox, QLabel, QTextBrowser, \ QDesktopServices, QDoubleSpinBox, QLabel, QTextBrowser, \
QPainter, QBrush, QColor, QStandardItemModel, QPalette, \ QPainter, QBrush, QColor, QStandardItemModel, QPalette, \
QStandardItem, QUrl, QRegExpValidator, QRegExp, QLineEdit, \ QStandardItem, QUrl, QRegExpValidator, QRegExp, QLineEdit, \
QToolButton, QMenu, QInputDialog QToolButton, QMenu, QInputDialog, QAction
from calibre.gui2.viewer.main_ui import Ui_EbookViewer from calibre.gui2.viewer.main_ui import Ui_EbookViewer
from calibre.gui2.viewer.printing import Printing from calibre.gui2.viewer.printing import Printing
@ -222,8 +222,14 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
self.view.set_manager(self) self.view.set_manager(self)
self.pi = ProgressIndicator(self) self.pi = ProgressIndicator(self)
self.toc.setVisible(False) self.toc.setVisible(False)
self.action_quit = QAction(self)
self.addAction(self.action_quit)
self.action_quit.setShortcut(Qt.CTRL+Qt.Key_Q)
self.connect(self.action_quit, SIGNAL('triggered(bool)'),
lambda x:QApplication.instance().quit())
self.action_copy.setDisabled(True) self.action_copy.setDisabled(True)
self.action_metadata.setCheckable(True) self.action_metadata.setCheckable(True)
self.action_metadata.setShortcut(Qt.CTRL+Qt.Key_I)
self.action_table_of_contents.setCheckable(True) self.action_table_of_contents.setCheckable(True)
self.action_reference_mode.setCheckable(True) self.action_reference_mode.setCheckable(True)
self.connect(self.action_reference_mode, SIGNAL('triggered(bool)'), self.connect(self.action_reference_mode, SIGNAL('triggered(bool)'),

View File

@ -916,12 +916,18 @@ class LibraryDatabase2(LibraryDatabase):
else: else:
aid = self.conn.execute('INSERT INTO authors(name) VALUES (?)', (a,)).lastrowid aid = self.conn.execute('INSERT INTO authors(name) VALUES (?)', (a,)).lastrowid
try: try:
self.conn.execute('INSERT INTO books_authors_link(book, author) VALUES (?,?)', (id, aid)) self.conn.execute('INSERT INTO books_authors_link(book, author) VALUES (?,?)',
(id, aid))
except IntegrityError: # Sometimes books specify the same author twice in their metadata except IntegrityError: # Sometimes books specify the same author twice in their metadata
pass pass
ss = authors_to_sort_string(authors)
self.conn.execute('UPDATE books SET author_sort=? WHERE id=?',
(ss, id))
self.conn.commit() self.conn.commit()
self.data.set(id, FIELD_MAP['authors'], ','.join([a.replace(',', '|') for a in authors]), row_is_id=True) self.data.set(id, FIELD_MAP['authors'],
self.data.set(id, FIELD_MAP['author_sort'], self.data[self.data.row(id)][FIELD_MAP['authors']], row_is_id=True) ','.join([a.replace(',', '|') for a in authors]),
row_is_id=True)
self.data.set(id, FIELD_MAP['author_sort'], ss, row_is_id=True)
self.set_path(id, True) self.set_path(id, True)
if notify: if notify:
self.notify('metadata', [id]) self.notify('metadata', [id])

View File

@ -103,7 +103,7 @@ Device Integration
What devices does |app| support? What devices does |app| support?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At the moment |app| has full support for the SONY PRS 500/505/700, Cybook Gen 3, Amazon Kindle as well as the iPhone. In addition, using the :guilabel:`Save to disk` function you can use it with any ebook reader that exports itself as a USB disk. At the moment |app| has full support for the SONY PRS 500/505/700, Cybook Gen 3, Amazon Kindle 1 and 2 as well as the iPhone. In addition, using the :guilabel:`Save to disk` function you can use it with any ebook reader that exports itself as a USB disk.
I used |app| to transfer some books to my reader, and now the SONY software hangs every time I connect the reader? I used |app| to transfer some books to my reader, and now the SONY software hangs every time I connect the reader?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -17,9 +17,19 @@ class NewYorkReviewOfBooks(BasicNewsRecipe):
description = u'Book reviews' description = u'Book reviews'
language = _('English') language = _('English')
__author__ = 'Kovid Goyal' __author__ = 'Kovid Goyal'
needs_subscription = True
remove_tags_before = {'id':'container'} remove_tags_before = {'id':'container'}
remove_tags = [{'class':['noprint', 'ad', 'footer']}, {'id':'right-content'}] remove_tags = [{'class':['noprint', 'ad', 'footer']}, {'id':'right-content'}]
def get_browser(self):
br = BasicNewsRecipe.get_browser()
if self.username is not None and self.password is not None:
br.open('http://www.nybooks.com/register/')
br.select_form(name='login')
br['email'] = self.username
br['password'] = self.password
br.submit()
return br
def parse_index(self): def parse_index(self):
root = html.fromstring(self.browser.open('http://www.nybooks.com/current-issue').read()) root = html.fromstring(self.browser.open('http://www.nybooks.com/current-issue').read())
@ -42,10 +52,4 @@ class NewYorkReviewOfBooks(BasicNewsRecipe):
articles.append(article) articles.append(article)
return [('Current Issue', articles)] return [('Current Issue', articles)]

View File

@ -11,7 +11,7 @@ from calibre.web.feeds.news import BasicNewsRecipe
class NewYorker(BasicNewsRecipe): class NewYorker(BasicNewsRecipe):
title = u'The New Yorker' title = u'The New Yorker'
__author__ = 'Darko Miletic' __author__ = 'Darko Miletic'
description = 'Best of the US journalism' description = 'The best of US journalism'
oldest_article = 7 oldest_article = 7
language = _('English') language = _('English')
max_articles_per_feed = 100 max_articles_per_feed = 100