diff --git a/src/calibre/ebooks/metadata/meta.py b/src/calibre/ebooks/metadata/meta.py
index cbd9db3f04..b0c43a8182 100644
--- a/src/calibre/ebooks/metadata/meta.py
+++ b/src/calibre/ebooks/metadata/meta.py
@@ -182,6 +182,19 @@ def metadata_from_filename(name, pat=None):
mi.isbn = si
except (IndexError, ValueError):
pass
+ try:
+ publisher = match.group('publisher')
+ mi.publisher = publisher
+ except (IndexError, ValueError):
+ pass
+ try:
+ pubdate = match.group('published')
+ if pubdate:
+ from calibre.utils.date import parse_date
+ mi.pubdate = parse_date(pubdate)
+ except:
+ pass
+
if mi.is_null('title'):
mi.title = name
return mi
diff --git a/src/calibre/gui2/filename_pattern.ui b/src/calibre/gui2/filename_pattern.ui
index 68b3108e06..c8a9b4f6f6 100644
--- a/src/calibre/gui2/filename_pattern.ui
+++ b/src/calibre/gui2/filename_pattern.ui
@@ -206,6 +206,46 @@
+ -
+
+
+ Publisher:
+
+
+
+ -
+
+
+ Regular expression (?P<publisher>)
+
+
+ No match
+
+
+ true
+
+
+
+ -
+
+
+ Published:
+
+
+
+ -
+
+
+ Regular expression (?P<published>)
+
+
+ No match
+
+
+ true
+
+
+
diff --git a/src/calibre/gui2/widgets.py b/src/calibre/gui2/widgets.py
index ea0509b51a..e5f1c94342 100644
--- a/src/calibre/gui2/widgets.py
+++ b/src/calibre/gui2/widgets.py
@@ -121,6 +121,12 @@ class FilenamePattern(QWidget, Ui_Form):
else:
self.series_index.setText(_('No match'))
+ if mi.publisher:
+ self.publisher.setText(mi.publisher)
+
+ if mi.pubdate:
+ self.pubdate.setText(mi.pubdate.strftime('%Y-%m-%d'))
+
self.isbn.setText(_('No match') if mi.isbn is None else str(mi.isbn))