diff --git a/src/calibre/ebooks/metadata/isbndb.py b/src/calibre/ebooks/metadata/isbndb.py
index 7ab2f16949..38c6e68d3c 100644
--- a/src/calibre/ebooks/metadata/isbndb.py
+++ b/src/calibre/ebooks/metadata/isbndb.py
@@ -49,7 +49,7 @@ class ISBNDBMetadata(MetaInformation):
def __init__(self, book):
MetaInformation.__init__(self, None, [])
- self.isbn = book['isbn']
+ self.isbn = book.get('isbn13', book.get('isbn'))
self.title = book.find('titlelong').string
if not self.title:
self.title = book.find('title').string
@@ -74,7 +74,6 @@ class ISBNDBMetadata(MetaInformation):
self.comments = 'SUMMARY:\n'+summ.string
-
def build_isbn(base_url, opts):
return base_url + 'index1=isbn&value1='+opts.isbn
diff --git a/src/calibre/gui2/dialogs/fetch_metadata.py b/src/calibre/gui2/dialogs/fetch_metadata.py
index aab564e05d..ea076b42a1 100644
--- a/src/calibre/gui2/dialogs/fetch_metadata.py
+++ b/src/calibre/gui2/dialogs/fetch_metadata.py
@@ -14,6 +14,7 @@ from calibre.gui2.dialogs.fetch_metadata_ui import Ui_FetchMetadata
from calibre.gui2 import error_dialog, NONE, info_dialog
from calibre.gui2.widgets import ProgressIndicator
from calibre.utils.config import prefs
+from calibre import strftime
class Fetcher(QThread):
@@ -45,7 +46,7 @@ class Matches(QAbstractTableModel):
return len(self.matches)
def columnCount(self, *args):
- return 5
+ return 6
def headerData(self, section, orientation, role):
if role != Qt.DisplayRole:
@@ -57,6 +58,7 @@ class Matches(QAbstractTableModel):
elif section == 2: text = _("Author Sort")
elif section == 3: text = _("Publisher")
elif section == 4: text = _("ISBN")
+ elif section == 5: text = _("Published")
return QVariant(text)
else:
@@ -80,6 +82,9 @@ class Matches(QAbstractTableModel):
res = book.publisher
elif col == 4:
res = book.isbn
+ elif col == 5:
+ if hasattr(book.pubdate, 'timetuple'):
+ res = strftime('%b %Y', book.pubdate.timetuple())
if not res:
return NONE
return QVariant(res)
@@ -126,7 +131,7 @@ class FetchMetadata(QDialog, Ui_FetchMetadata):
prefs['isbndb_com_key'] = key
else:
key = None
- title = author = publisher = isbn = None
+ title = author = publisher = isbn = pubdate = None
if self.isbn:
isbn = self.isbn
if self.title:
diff --git a/src/calibre/gui2/dialogs/metadata_single.py b/src/calibre/gui2/dialogs/metadata_single.py
index bf153ba932..d25d0609c8 100644
--- a/src/calibre/gui2/dialogs/metadata_single.py
+++ b/src/calibre/gui2/dialogs/metadata_single.py
@@ -10,8 +10,9 @@ import os
import re
import time
import traceback
+from datetime import datetime
-from PyQt4.QtCore import SIGNAL, QObject, QCoreApplication, Qt, QTimer, QThread
+from PyQt4.QtCore import SIGNAL, QObject, QCoreApplication, Qt, QTimer, QThread, QDate
from PyQt4.QtGui import QPixmap, QListWidgetItem, QErrorMessage, QDialog, QCompleter
from calibre.gui2 import qstring_to_unicode, error_dialog, file_icon_provider, \
@@ -234,6 +235,7 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
self.cover.setAcceptDrops(True)
self._author_completer = AuthorCompleter(self.db)
self.authors.setCompleter(self._author_completer)
+ self.pubdate.setMinimumDate(QDate(100,1,1))
self.connect(self.cover, SIGNAL('cover_changed()'), self.cover_dropped)
QObject.connect(self.cover_button, SIGNAL("clicked(bool)"), \
self.select_cover)
@@ -279,6 +281,9 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
comments = self.db.comments(row)
self.comments.setPlainText(comments if comments else '')
cover = self.db.cover(row)
+ pubdate = db.pubdate(self.id, index_is_id=True)
+ self.pubdate.setDate(QDate(pubdate.year, pubdate.month,
+ pubdate.day))
exts = self.db.formats(row)
if exts:
@@ -441,6 +446,9 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
if book.author_sort: self.author_sort.setText(book.author_sort)
if book.publisher: self.publisher.setEditText(book.publisher)
if book.isbn: self.isbn.setText(book.isbn)
+ if book.pubdate:
+ d = book.pubdate
+ self.pubdate.setDate(QDate(d.year, d.month, d.day))
summ = book.comments
if summ:
prefix = qstring_to_unicode(self.comments.toPlainText())
@@ -485,6 +493,9 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
self.db.set_series(self.id, qstring_to_unicode(self.series.currentText()), notify=False)
self.db.set_series_index(self.id, self.series_index.value(), notify=False)
self.db.set_comment(self.id, qstring_to_unicode(self.comments.toPlainText()), notify=False)
+ d = self.pubdate.date()
+ self.db.set_pubdate(self.id, datetime(d.year(), d.month(), d.day()))
+
if self.cover_changed:
self.db.set_cover(self.id, pixmap_to_data(self.cover.pixmap()))
QDialog.accept(self)
diff --git a/src/calibre/gui2/dialogs/metadata_single.ui b/src/calibre/gui2/dialogs/metadata_single.ui
index 4163c51583..3f44b28d1c 100644
--- a/src/calibre/gui2/dialogs/metadata_single.ui
+++ b/src/calibre/gui2/dialogs/metadata_single.ui
@@ -325,6 +325,19 @@
-
+ -
+
+
+ Publishe&d:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ pubdate
+
+
+
-
@@ -348,6 +361,16 @@
+ -
+
+
+ MMM yyyy
+
+
+ true
+
+
+
@@ -632,6 +655,7 @@
tag_editor_button
remove_series_button
isbn
+ pubdate
comments
fetch_metadata_button
fetch_cover_button