From 944435fd2f7c7895ff4e82e3438f04f07f701111 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 2 Jan 2009 15:46:48 -0800 Subject: [PATCH 1/5] Fix bug affecting the Tableof COntents in EPUB files generated from PRC files. The generated TOC would cause the SONY reader to crash if the original PRC file contained links to the internet --- src/calibre/ebooks/mobi/reader.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/mobi/reader.py b/src/calibre/ebooks/mobi/reader.py index 779bdf8067..a5018a7ff2 100644 --- a/src/calibre/ebooks/mobi/reader.py +++ b/src/calibre/ebooks/mobi/reader.py @@ -309,7 +309,8 @@ class MobiReader(object): except: text = '' text = ent_pat.sub(entity_to_unicode, text) - tocobj.add_item(toc.partition('#')[0], a['href'][1:], text) + if a['href'].startswith('#'): + tocobj.add_item(toc.partition('#')[0], a['href'][1:], text) if tocobj is not None: opf.set_toc(tocobj) From e41f8b3a70bcdae8d83a14280faaeb643d8164b2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 2 Jan 2009 16:43:21 -0800 Subject: [PATCH 2/5] Add completion for author and publisher fields in edit metadata dialog. Fixes #1383 (useful feature ideas) and #1521 --- src/calibre/devices/cybookg3/books.py | 7 ++-- src/calibre/devices/cybookg3/driver.py | 2 +- src/calibre/gui2/dialogs/metadata_single.py | 40 ++++++++++++++++----- src/calibre/gui2/dialogs/metadata_single.ui | 34 ++++++++---------- src/calibre/library/database.py | 14 +++++++- 5 files changed, 64 insertions(+), 33 deletions(-) diff --git a/src/calibre/devices/cybookg3/books.py b/src/calibre/devices/cybookg3/books.py index 5c15919ea6..4e46faca42 100644 --- a/src/calibre/devices/cybookg3/books.py +++ b/src/calibre/devices/cybookg3/books.py @@ -1,5 +1,5 @@ __license__ = 'GPL v3' -__copyright__ = '2008, Kovid Goyal ' +__copyright__ = '2009, John Schember - - - - Change the author(s) of this book. Multiple authors should be separated by an &. If the author name contains an &, use && to represent it. - - - @@ -111,7 +104,7 @@ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - authors + author_sort @@ -185,13 +178,6 @@ - - - - Change the publisher of this book - - - @@ -330,6 +316,16 @@ + + + + true + + + + + + @@ -615,8 +611,8 @@ accept() - 257 - 646 + 261 + 710 157 @@ -631,8 +627,8 @@ reject() - 325 - 646 + 329 + 710 286 diff --git a/src/calibre/library/database.py b/src/calibre/library/database.py index 122bded333..f14a1174fc 100644 --- a/src/calibre/library/database.py +++ b/src/calibre/library/database.py @@ -943,7 +943,11 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE; if index_is_id: return self.conn.get('SELECT publisher FROM meta WHERE id=?', (index,), all=False) return self.data[index][3] - + + def publisher_id(self, index, index_is_id=False): + id = index if index_is_id else self.id(index) + return self.conn.get('SELECT publisher from books_publishers_link WHERE book=?', (id,), all=False) + def rating(self, index, index_is_id=False): if index_is_id: return self.conn.get('SELECT rating FROM meta WHERE id=?', (index,), all=False) @@ -1041,6 +1045,14 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE; def all_series(self): return [ (i[0], i[1]) for i in \ self.conn.get('SELECT id, name FROM series')] + + def all_authors(self): + return [ (i[0], i[1]) for i in \ + self.conn.get('SELECT id, name FROM authors')] + + def all_publishers(self): + return [ (i[0], i[1]) for i in \ + self.conn.get('SELECT id, name FROM publishers')] def all_tags(self): return [i[0].strip() for i in self.conn.get('SELECT name FROM tags') if i[0].strip()] From 66b81697063ad9b562ab64bbbc5712bf97f87203 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 2 Jan 2009 17:12:41 -0800 Subject: [PATCH 3/5] version 0.4.124 --- src/calibre/constants.py | 2 +- src/calibre/manual/faq.rst | 9 +++++++++ src/calibre/manual/news.rst | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 23e0ee439a..03307abcfe 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -2,7 +2,7 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' __docformat__ = 'restructuredtext en' __appname__ = 'calibre' -__version__ = '0.4.123' +__version__ = '0.4.124' __author__ = "Kovid Goyal " ''' Various run time constants. diff --git a/src/calibre/manual/faq.rst b/src/calibre/manual/faq.rst index 7276e177c9..4b3c217698 100644 --- a/src/calibre/manual/faq.rst +++ b/src/calibre/manual/faq.rst @@ -143,6 +143,15 @@ Where are the book files stored? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When you first run |app|, it will ask you for a folder in which to store your books. Whenever you add a book to |app|, it will copy the book into that folder. Books in the folder are nicely arranged into sub-folders by Author and Title. Metadata about the books is stored in the file ``metadata.db`` (which is a sqlite database). +Why doesn't |app| let me store books in my own directory structure? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The whole point if |app|'s library management features is that they provide an interface for locating books that is *much* more efficient than any possible directory scheme you could come up with for your collection. Indeed, once you become comfortable using |app|'s interface to find, sort and browse your collection, you wont ever feel the need to hunt through the files on your disk to find a book again. By managing books in its own directory struture of Author -> Title -> Book files, |app| is able to achieve a high level of reliability and standardization. + +Why doesn't |app| have a column for foo? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +|app| is designed to have columns for the most frequently and widely used fields. If it does not have a coulmn for your favorite field, you can always add a tag to the book for that piece of information. |app| also supports a general purpose "comments" fields for longer items. + Content From The Web --------------------- diff --git a/src/calibre/manual/news.rst b/src/calibre/manual/news.rst index 871b0beb09..025f38ec22 100644 --- a/src/calibre/manual/news.rst +++ b/src/calibre/manual/news.rst @@ -133,7 +133,7 @@ to the recipe. Finally, lets replace some of the :term:`CSS` that we disabled ea With these additions, our recipe has become "production quality", indeed it is very close to the actual recipe used by |app| for the *BBC*, shown below: -.. literalinclude:: ../web/feeds/recipes/bbc.py +.. literalinclude:: ../web/feeds/recipes/recipe_bbc.py This :term:`recipe` explores only the tip of the iceberg when it comes to the power of |app|. To explore more of the abilities of |app| we'll examine a more complex real life example in the next section. From 7dafbf686daeb30cdbe37841efecd110dce8c322 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 2 Jan 2009 17:19:36 -0800 Subject: [PATCH 4/5] IGN:Tag release From cabb09439071473acc42200e7c39c32ffe848903 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 3 Jan 2009 00:18:13 -0800 Subject: [PATCH 5/5] IGN:... --- src/calibre/trac/donations/server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/trac/donations/server.py b/src/calibre/trac/donations/server.py index 163851a4f1..cbb68d972e 100644 --- a/src/calibre/trac/donations/server.py +++ b/src/calibre/trac/donations/server.py @@ -102,6 +102,8 @@ class Stats: def get_deviation(self, amounts): l = float(len(amounts)) + if l == 0: + return 0 mean = sum(amounts)/l return sqrt( sum([i**2 for i in amounts])/l - mean**2 )