mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Easily manage the extra data files associated with a book by right clicking the edit metadata button and choose "Manage data files". Fixes #2023509 [[Enhancement] Simple extra files manager](https://bugs.launchpad.net/calibre/+bug/2023509)
This commit is contained in:
parent
6b61efa4ab
commit
bf6efc1abf
@ -57,7 +57,7 @@ Add books
|
|||||||
|
|
||||||
6. **Add files to selected book records**: Allows you to add or update the files associated with an existing book in your library.
|
6. **Add files to selected book records**: Allows you to add or update the files associated with an existing book in your library.
|
||||||
|
|
||||||
7. **Add data files to selected book records**: Allows you to add any number of extra files that will be stored in a :file:`data` sub-directory in the book directory
|
7. **Add data files to selected book records**: Allows you to add any number of extra files that will be stored in a :file:`data` sub-directory in the book directory. See :ref:`data_files` for details.
|
||||||
|
|
||||||
8. **Add an empty file to selected book records**: Allows you to add an empty file of the specified format to the selected book records.
|
8. **Add an empty file to selected book records**: Allows you to add an empty file of the specified format to the selected book records.
|
||||||
|
|
||||||
@ -72,16 +72,6 @@ To add an additional format for an existing book you can do any of three things:
|
|||||||
|
|
||||||
3. Click the :guilabel:`Add books` button in the top right area of the :guilabel:`Edit metadata` dialog, accessed by the :ref:`edit_meta_information` action.
|
3. Click the :guilabel:`Add books` button in the top right area of the :guilabel:`Edit metadata` dialog, accessed by the :ref:`edit_meta_information` action.
|
||||||
|
|
||||||
.. note::
|
|
||||||
The extra data files added to a book will be managed by calibre, as part of
|
|
||||||
the book. However, they cannot be viewed directly or used as conversion
|
|
||||||
sources. Nor are they indexed by the Full text search engine in calibre. To
|
|
||||||
view them select the book and press the :kbd:`O` key which will open up the
|
|
||||||
book folder in your file manager, from where the extra files can be viewed
|
|
||||||
using any program you like. They are most useful to store any auxiliary
|
|
||||||
data associated with a book such as supplementary reading material, digital
|
|
||||||
resources, etc.
|
|
||||||
|
|
||||||
.. _edit_meta_information:
|
.. _edit_meta_information:
|
||||||
|
|
||||||
Edit metadata
|
Edit metadata
|
||||||
@ -95,6 +85,7 @@ Edit metadata
|
|||||||
2. **Edit metadata in bulk**: Allows you to edit common metadata fields for large numbers of books simultaneously. It operates on all the books you have selected in the :ref:`Library view <search_sort>`.
|
2. **Edit metadata in bulk**: Allows you to edit common metadata fields for large numbers of books simultaneously. It operates on all the books you have selected in the :ref:`Library view <search_sort>`.
|
||||||
3. **Download metadata and covers**: Downloads metadata and covers (if available) for the books that are selected in the book list.
|
3. **Download metadata and covers**: Downloads metadata and covers (if available) for the books that are selected in the book list.
|
||||||
4. **Merge book records**: Gives you the capability of merging the metadata and formats of two or more book records. You can choose to either delete or keep the records that were not clicked first.
|
4. **Merge book records**: Gives you the capability of merging the metadata and formats of two or more book records. You can choose to either delete or keep the records that were not clicked first.
|
||||||
|
5. **Manage data files**: Manage the extra data files associated with the selected books.
|
||||||
|
|
||||||
For more details, see :ref:`metadata`.
|
For more details, see :ref:`metadata`.
|
||||||
|
|
||||||
|
@ -82,3 +82,19 @@ Bulk downloading of metadata
|
|||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
If you want to download the metadata for multiple books at once, right-click the :guilabel:`Edit metadata` button and select :guilabel:`Download metadata`. You can choose to download only metadata, only covers, or both.
|
If you want to download the metadata for multiple books at once, right-click the :guilabel:`Edit metadata` button and select :guilabel:`Download metadata`. You can choose to download only metadata, only covers, or both.
|
||||||
|
|
||||||
|
|
||||||
|
.. _data_files:
|
||||||
|
|
||||||
|
Adding extra data files to a book
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
calibre can store any number of extra data files associated to a book. These
|
||||||
|
can be alternate covers, supplementary material, etc. They cannot be viewed
|
||||||
|
directly or used as conversion sources. Nor are they indexed by the Full text
|
||||||
|
search engine in calibre. To view/add/delete them select the book and right
|
||||||
|
click the :guilabel:`Edit metadata` button and choose :guilabel:`Manage data
|
||||||
|
files`. This will pop-up a window where you can perform operations on these
|
||||||
|
files. Alternately, you can right click the :guilabel:`Add books` button and
|
||||||
|
choose :guilabel:`Add data files to selected book records` to more quickly add
|
||||||
|
data files.
|
||||||
|
@ -105,6 +105,8 @@ class EditMetadataAction(InterfaceAction):
|
|||||||
self.action_merge = cm('merge', _('Merge book records'), icon='merge_books.png',
|
self.action_merge = cm('merge', _('Merge book records'), icon='merge_books.png',
|
||||||
shortcut=_('M'), triggered=self.merge_books)
|
shortcut=_('M'), triggered=self.merge_books)
|
||||||
self.action_merge.setMenu(mb)
|
self.action_merge.setMenu(mb)
|
||||||
|
self.action_manage_data_files = cm(
|
||||||
|
'manage_data_files', _('Manage data files'), icon='unpack-book.png', triggered=self.manage_data_files)
|
||||||
|
|
||||||
self.qaction.triggered.connect(self.edit_metadata)
|
self.qaction.triggered.connect(self.edit_metadata)
|
||||||
ac = QAction(_('Copy URL to show book in calibre'), self.gui)
|
ac = QAction(_('Copy URL to show book in calibre'), self.gui)
|
||||||
@ -124,6 +126,14 @@ class EditMetadataAction(InterfaceAction):
|
|||||||
ac.text(), description=ac.toolTip(),
|
ac.text(), description=ac.toolTip(),
|
||||||
action=ac, group=self.action_spec[0])
|
action=ac, group=self.action_spec[0])
|
||||||
|
|
||||||
|
def manage_data_files(self):
|
||||||
|
from calibre.gui2.dialogs.data_files_manager import DataFilesManager
|
||||||
|
db = self.gui.current_db
|
||||||
|
ids = [db.id(row.row()) for row in self.gui.library_view.selectionModel().selectedRows()]
|
||||||
|
for book_id in ids:
|
||||||
|
d = DataFilesManager(db, book_id, self.gui)
|
||||||
|
d.exec()
|
||||||
|
|
||||||
def _copy_links(self, lines):
|
def _copy_links(self, lines):
|
||||||
urls = QUrl.fromStringList(lines)
|
urls = QUrl.fromStringList(lines)
|
||||||
cb = QApplication.instance().clipboard()
|
cb = QApplication.instance().clipboard()
|
||||||
|
@ -188,6 +188,7 @@ class DataFilesManager(Dialog):
|
|||||||
self.bb.addButton(b, QDialogButtonBox.ButtonRole.ActionRole)
|
self.bb.addButton(b, QDialogButtonBox.ButtonRole.ActionRole)
|
||||||
self.remove_button = b = QPushButton(QIcon.ic('minus.png'), _('&Remove files'), self)
|
self.remove_button = b = QPushButton(QIcon.ic('minus.png'), _('&Remove files'), self)
|
||||||
b.clicked.connect(self.remove_files)
|
b.clicked.connect(self.remove_files)
|
||||||
|
b.setToolTip(_('Move all selected files to the system Recycle bin.\nThey can be restored from there if needed'))
|
||||||
self.bb.addButton(b, QDialogButtonBox.ButtonRole.ActionRole)
|
self.bb.addButton(b, QDialogButtonBox.ButtonRole.ActionRole)
|
||||||
|
|
||||||
self.current_changed()
|
self.current_changed()
|
||||||
@ -227,7 +228,10 @@ class DataFilesManager(Dialog):
|
|||||||
if idx.isValid():
|
if idx.isValid():
|
||||||
txt = self.files.file_display_name(idx.row())
|
txt = self.files.file_display_name(idx.row())
|
||||||
txt = prepare_string_for_xml(txt)
|
txt = prepare_string_for_xml(txt)
|
||||||
self.current_label.setText('<p>{} <a href="open_with://{}">{}</a>'.format(txt, idx.row(), prepare_string_for_xml(_('Open with'))))
|
if txt:
|
||||||
|
self.current_label.setText('<p>{} <a href="open_with://{}">{}</a>'.format(txt, idx.row(), prepare_string_for_xml(_('Open with'))))
|
||||||
|
else:
|
||||||
|
self.current_label.setText('')
|
||||||
|
|
||||||
def open_with_menu(self, file_path):
|
def open_with_menu(self, file_path):
|
||||||
m = QMenu(_('Open with...'), parent=self)
|
m = QMenu(_('Open with...'), parent=self)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user