mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
ba16dcb128
commit
fb0210dff8
@ -35,8 +35,8 @@ class Table(object):
|
|||||||
def __init__(self, name, metadata, link_table=None):
|
def __init__(self, name, metadata, link_table=None):
|
||||||
self.name, self.metadata = name, metadata
|
self.name, self.metadata = name, metadata
|
||||||
|
|
||||||
# self.adapt() maps values from the db to python objects
|
# self.unserialize() maps values from the db to python objects
|
||||||
self.adapt = \
|
self.unserialize = \
|
||||||
{
|
{
|
||||||
'datetime': _c_convert_timestamp,
|
'datetime': _c_convert_timestamp,
|
||||||
'bool': bool
|
'bool': bool
|
||||||
@ -44,7 +44,7 @@ class Table(object):
|
|||||||
metadata['datatype'], lambda x: x)
|
metadata['datatype'], lambda x: x)
|
||||||
if name == 'authors':
|
if name == 'authors':
|
||||||
# Legacy
|
# Legacy
|
||||||
self.adapt = lambda x: x.replace('|', ',') if x else None
|
self.unserialize = lambda x: x.replace('|', ',') if x else None
|
||||||
|
|
||||||
self.link_table = (link_table if link_table else
|
self.link_table = (link_table if link_table else
|
||||||
'books_%s_link'%self.metadata['table'])
|
'books_%s_link'%self.metadata['table'])
|
||||||
@ -62,7 +62,7 @@ class OneToOneTable(Table):
|
|||||||
idcol = 'id' if self.metadata['table'] == 'books' else 'book'
|
idcol = 'id' if self.metadata['table'] == 'books' else 'book'
|
||||||
for row in db.conn.execute('SELECT {0}, {1} FROM {2}'.format(idcol,
|
for row in db.conn.execute('SELECT {0}, {1} FROM {2}'.format(idcol,
|
||||||
self.metadata['column'], self.metadata['table'])):
|
self.metadata['column'], self.metadata['table'])):
|
||||||
self.book_col_map[row[0]] = self.adapt(row[1])
|
self.book_col_map[row[0]] = self.unserialize(row[1])
|
||||||
|
|
||||||
class SizeTable(OneToOneTable):
|
class SizeTable(OneToOneTable):
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ class SizeTable(OneToOneTable):
|
|||||||
for row in db.conn.execute(
|
for row in db.conn.execute(
|
||||||
'SELECT books.id, (SELECT MAX(uncompressed_size) FROM data '
|
'SELECT books.id, (SELECT MAX(uncompressed_size) FROM data '
|
||||||
'WHERE data.book=books.id) FROM books'):
|
'WHERE data.book=books.id) FROM books'):
|
||||||
self.book_col_map[row[0]] = self.adapt(row[1])
|
self.book_col_map[row[0]] = self.unserialize(row[1])
|
||||||
|
|
||||||
class ManyToOneTable(Table):
|
class ManyToOneTable(Table):
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ class ManyToOneTable(Table):
|
|||||||
for row in db.conn.execute('SELECT id, {0} FROM {1}'.format(
|
for row in db.conn.execute('SELECT id, {0} FROM {1}'.format(
|
||||||
self.metadata['name'], self.metadata['table'])):
|
self.metadata['name'], self.metadata['table'])):
|
||||||
if row[1]:
|
if row[1]:
|
||||||
self.id_map[row[0]] = self.adapt(row[1])
|
self.id_map[row[0]] = self.unserialize(row[1])
|
||||||
|
|
||||||
def read_maps(self, db):
|
def read_maps(self, db):
|
||||||
for row in db.conn.execute(
|
for row in db.conn.execute(
|
||||||
|
@ -340,6 +340,10 @@ When you first run |app|, it will ask you for a folder in which to store your bo
|
|||||||
|
|
||||||
Metadata about the books is stored in the file ``metadata.db`` at the top level of the library folder This file is is a sqlite database. When backing up your library make sure you copy the entire folder and all its sub-folders.
|
Metadata about the books is stored in the file ``metadata.db`` at the top level of the library folder This file is is a sqlite database. When backing up your library make sure you copy the entire folder and all its sub-folders.
|
||||||
|
|
||||||
|
The library folder and all it's contents make up what is called a *|app| library*. You can have multiple such libraries. To manage the libraries, click the |app| icon on the toolbar. You can create new libraries, remove/rename existing ones and switch between libraries easily.
|
||||||
|
|
||||||
|
You can copy or move books between different libraries (once you have more than one library setup) by right clicking on a book and selecting the :guilabel:`Copy to library` action.
|
||||||
|
|
||||||
How does |app| manage author names and sorting?
|
How does |app| manage author names and sorting?
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ Library
|
|||||||
.. |lii| image:: images/library.png
|
.. |lii| image:: images/library.png
|
||||||
:class: float-right-img
|
:class: float-right-img
|
||||||
|
|
||||||
|lii| The :guilabel:`Library` action allows you to create, switch between, rename or delete a Library. |app| allows you to create as many libraries as you wish. You could for instance create a fiction library, a non fiction library, a foreign language library, a project library, basically any structure that suits your needs. Libraries are the highest organizational structure within |app|, each library has its own set of books, tags, categories and base storage location.
|
|lii| The :guilabel:`Library` action allows you to create, switch between, rename or remove a Library. |app| allows you to create as many libraries as you wish. You could for instance create a fiction library, a non fiction library, a foreign language library, a project library, basically any structure that suits your needs. Libraries are the highest organizational structure within |app|, each library has its own set of books, tags, categories and base storage location.
|
||||||
|
|
||||||
1. **Switch/Create library**: This action allows you to; a) connect to a pre-existing |app| library at another location from your currently open library, b) Create and empty library at a new location or, c) Move the current Library to a newly specified location.
|
1. **Switch/Create library**: This action allows you to; a) connect to a pre-existing |app| library at another location from your currently open library, b) Create and empty library at a new location or, c) Move the current Library to a newly specified location.
|
||||||
2. **Quick Switch**: This action allows you to switch between libraries that have been registered or created within |app|.
|
2. **Quick Switch**: This action allows you to switch between libraries that have been registered or created within |app|.
|
||||||
@ -175,6 +175,8 @@ Library
|
|||||||
|
|
||||||
.. note:: Metadata about your ebooks like title/author/tags/etc. is stored in a single file in your |app| library folder called metadata.db. If this file gets corrupted (a very rare event), you can lose the metadata. Fortunately, |app| automatically backs up the metadata for every individual book in the book's folder as an .opf file. By using the Restore Library action under Library Maintenance described above, you can have |app| rebuild the metadata.db file from the individual .opf files for you.
|
.. note:: Metadata about your ebooks like title/author/tags/etc. is stored in a single file in your |app| library folder called metadata.db. If this file gets corrupted (a very rare event), you can lose the metadata. Fortunately, |app| automatically backs up the metadata for every individual book in the book's folder as an .opf file. By using the Restore Library action under Library Maintenance described above, you can have |app| rebuild the metadata.db file from the individual .opf files for you.
|
||||||
|
|
||||||
|
You can copy or move books between different libraries (once you have more than one library setup) by right clicking on the book and selecting the action :guilabel:`Copy to library`.
|
||||||
|
|
||||||
.. _device:
|
.. _device:
|
||||||
|
|
||||||
Device
|
Device
|
||||||
|
Loading…
x
Reference in New Issue
Block a user