mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Sorted user recipes in serialize_collection
This commit is contained in:
parent
1fd2981689
commit
8c952c2c32
@ -50,6 +50,7 @@ gprefs.defaults['action-layout-context-menu-device'] = (
|
|||||||
|
|
||||||
gprefs.defaults['show_splash_screen'] = True
|
gprefs.defaults['show_splash_screen'] = True
|
||||||
gprefs.defaults['toolbar_icon_size'] = 'medium'
|
gprefs.defaults['toolbar_icon_size'] = 'medium'
|
||||||
|
gprefs.defaults['automerge'] = 'ignore'
|
||||||
gprefs.defaults['toolbar_text'] = 'auto'
|
gprefs.defaults['toolbar_text'] = 'auto'
|
||||||
gprefs.defaults['show_child_bar'] = False
|
gprefs.defaults['show_child_bar'] = False
|
||||||
gprefs.defaults['font'] = None
|
gprefs.defaults['font'] = None
|
||||||
|
@ -8,7 +8,7 @@ from functools import partial
|
|||||||
from PyQt4.Qt import QThread, QObject, Qt, QProgressDialog, pyqtSignal, QTimer
|
from PyQt4.Qt import QThread, QObject, Qt, QProgressDialog, pyqtSignal, QTimer
|
||||||
|
|
||||||
from calibre.gui2.dialogs.progress import ProgressDialog
|
from calibre.gui2.dialogs.progress import ProgressDialog
|
||||||
from calibre.gui2 import question_dialog, error_dialog, info_dialog
|
from calibre.gui2 import question_dialog, error_dialog, info_dialog, gprefs
|
||||||
from calibre.ebooks.metadata.opf2 import OPF
|
from calibre.ebooks.metadata.opf2 import OPF
|
||||||
from calibre.ebooks.metadata import MetaInformation
|
from calibre.ebooks.metadata import MetaInformation
|
||||||
from calibre.constants import preferred_encoding, filesystem_encoding, DEBUG
|
from calibre.constants import preferred_encoding, filesystem_encoding, DEBUG
|
||||||
@ -185,7 +185,17 @@ class DBAdder(QObject): # {{{
|
|||||||
if identical_book_list: # books with same author and nearly same title exist in db
|
if identical_book_list: # books with same author and nearly same title exist in db
|
||||||
self.merged_books.add(mi.title)
|
self.merged_books.add(mi.title)
|
||||||
for identical_book in identical_book_list:
|
for identical_book in identical_book_list:
|
||||||
self.add_formats(identical_book, formats, replace=False)
|
if gprefs['automerge'] == 'ignore':
|
||||||
|
self.add_formats(identical_book, formats, replace=False)
|
||||||
|
print 'do something for ignore'
|
||||||
|
if gprefs['automerge'] == 'overwrite':
|
||||||
|
self.add_formats(identical_book, formats, replace=True)
|
||||||
|
print 'do something for overwrite'
|
||||||
|
if gprefs['automerge'] == 'new record':
|
||||||
|
id = self.db.create_book_entry(mi, cover=cover, add_duplicates=True)
|
||||||
|
self.number_of_books_added += 1
|
||||||
|
self.add_formats(id, formats)
|
||||||
|
print 'do something for new record'
|
||||||
else:
|
else:
|
||||||
id = self.db.create_book_entry(mi, cover=cover, add_duplicates=True)
|
id = self.db.create_book_entry(mi, cover=cover, add_duplicates=True)
|
||||||
self.number_of_books_added += 1
|
self.number_of_books_added += 1
|
||||||
|
@ -11,6 +11,7 @@ from calibre.gui2.preferences import ConfigWidgetBase, test_widget
|
|||||||
from calibre.gui2.preferences.adding_ui import Ui_Form
|
from calibre.gui2.preferences.adding_ui import Ui_Form
|
||||||
from calibre.utils.config import prefs
|
from calibre.utils.config import prefs
|
||||||
from calibre.gui2.widgets import FilenamePattern
|
from calibre.gui2.widgets import FilenamePattern
|
||||||
|
from calibre.gui2 import gprefs
|
||||||
|
|
||||||
class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||||
|
|
||||||
@ -22,6 +23,10 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
r('read_file_metadata', prefs)
|
r('read_file_metadata', prefs)
|
||||||
r('swap_author_names', prefs)
|
r('swap_author_names', prefs)
|
||||||
r('add_formats_to_existing', prefs)
|
r('add_formats_to_existing', prefs)
|
||||||
|
choices = [(_('Ignore'), 'ignore'), (_('Overwrite'), 'overwrite'),
|
||||||
|
(_('New Record'), 'new record')]
|
||||||
|
r('automerge', gprefs, choices=choices)
|
||||||
|
#print 'The automerge setting is: ', gprefs['automerge']
|
||||||
|
|
||||||
self.filename_pattern = FilenamePattern(self)
|
self.filename_pattern = FilenamePattern(self)
|
||||||
self.metadata_box.layout().insertWidget(0, self.filename_pattern)
|
self.metadata_box.layout().insertWidget(0, self.filename_pattern)
|
||||||
|
@ -31,19 +31,24 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="2">
|
<item row="2" column="0" colspan="1"> #MOD was colspan="2"
|
||||||
<widget class="QCheckBox" name="opt_add_formats_to_existing">
|
<widget class="QCheckBox" name="opt_add_formats_to_existing">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>If an existing book with a similar title and author is found that does not have the format being added, the format is added
|
<string>If an existing book with a similar title and author is found, the incoming format will be added to the existing book record where possible.
|
||||||
to the existing book, instead of creating a new entry. If the existing book already has the format, then it is silently ignored.
|
If the existing book already has the incoming format, then the setting to the right controls and the new format will be ignored, it will overwrite the old format
|
||||||
|
or a new record will be created.
|
||||||
|
|
||||||
Title match ignores leading indefinite articles ("the", "a", "an"), punctuation, case, etc. Author match is exact.</string>
|
Title match ignores leading indefinite articles ("the", "a", "an"), punctuation, case, etc. Author match is exact.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>If books with similar titles and authors found, &merge the new files automatically</string>
|
<string>If books with similar titles and authors found, &try to merge the new formats automatically
|
||||||
|
and do this for duplicate formats: </string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="1"> #MOD added as new item
|
||||||
|
<widget class="QComboBox" name="opt_automerge"/>
|
||||||
|
</item>
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="3" column="0" colspan="2">
|
||||||
<widget class="QGroupBox" name="metadata_box">
|
<widget class="QGroupBox" name="metadata_box">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user