diff --git a/setup.py b/setup.py index 993d7c9b07..549a0e42bd 100644 --- a/setup.py +++ b/setup.py @@ -256,7 +256,6 @@ if __name__ == '__main__': with open('images.qrc', 'wb') as f: f.write(manifest) subprocess.check_call(['pyrcc4', '-o', images, 'images.qrc']) - os.remove('images.qrc') else: print 'Images are up to date' finally: diff --git a/src/calibre/ebooks/metadata/opf.py b/src/calibre/ebooks/metadata/opf.py index dcda78258a..aa77e6aeed 100644 --- a/src/calibre/ebooks/metadata/opf.py +++ b/src/calibre/ebooks/metadata/opf.py @@ -241,7 +241,7 @@ class OPF(MetaInformation): def get_title(self): title = self.soup.package.metadata.find('dc:title') - if title: + if title and title.string: return self.ENTITY_PATTERN.sub(entity_to_unicode, title.string).strip() return self.default_title.strip() diff --git a/src/calibre/gui2/dialogs/metadata_single.py b/src/calibre/gui2/dialogs/metadata_single.py index 3dca51107d..9e17b83b4f 100644 --- a/src/calibre/gui2/dialogs/metadata_single.py +++ b/src/calibre/gui2/dialogs/metadata_single.py @@ -144,7 +144,9 @@ class MetadataSingleDialog(QDialog, Ui_MetadataSingleDialog): QObject.connect(self.tag_editor_button, SIGNAL('clicked()'), self.edit_tags) QObject.connect(self.remove_series_button, SIGNAL('clicked()'), - self.remove_unused_series) + self.remove_unused_series) + QObject.connect(self.auto_author_sort, SIGNAL('clicked()'), + self.deduce_author_sort) self.connect(self.swap_button, SIGNAL('clicked()'), self.swap_title_author) self.timeout = float(prefs['network_timeout']) self.title.setText(db.title(row)) @@ -195,6 +197,16 @@ class MetadataSingleDialog(QDialog, Ui_MetadataSingleDialog): if not pm.isNull(): self.cover.setPixmap(pm) + def deduce_author_sort(self): + au = unicode(self.authors.text()) + tokens = au.split() + for x in (',', ';'): + if x in tokens: + tokens.remove(x) + if tokens: + tokens = [tokens[-1]+';'] + tokens[:-1] + self.author_sort.setText(u' '.join(tokens)) + def swap_title_author(self): title = self.title.text() self.title.setText(self.authors.text()) diff --git a/src/calibre/gui2/dialogs/metadata_single.ui b/src/calibre/gui2/dialogs/metadata_single.ui index 82dbfebb71..35a086dcaa 100644 --- a/src/calibre/gui2/dialogs/metadata_single.ui +++ b/src/calibre/gui2/dialogs/metadata_single.ui @@ -5,7 +5,7 @@ 0 0 - 796 + 923 715 @@ -116,11 +116,29 @@ - - - Specify how the author(s) of this book should be sorted. For example Charles Dickens should be sorted as Dickens, Charles. - - + + + + + Specify how the author(s) of this book should be sorted. For example Charles Dickens should be sorted as Dickens, Charles. + + + + + + + Automatically create the author sort entry based on the current author entry + + + ... + + + + :/images/auto_author_sort.svg:/images/auto_author_sort.svg + + + + diff --git a/src/calibre/gui2/images/auto_author_sort.svg b/src/calibre/gui2/images/auto_author_sort.svg new file mode 100644 index 0000000000..edcf9e4704 --- /dev/null +++ b/src/calibre/gui2/images/auto_author_sort.svg @@ -0,0 +1,1472 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + +