mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Implement #744020 (Add Publisher and Publication Date to Adding Books Possible Fields)
This commit is contained in:
parent
0eff1312b6
commit
3d63ef67dd
@ -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
|
||||
|
@ -206,6 +206,46 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Publisher:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="publisher">
|
||||
<property name="toolTip">
|
||||
<string>Regular expression (?P<publisher>)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>No match</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Published:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="pubdate">
|
||||
<property name="toolTip">
|
||||
<string>Regular expression (?P<published>)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>No match</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -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))
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user