mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -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
|
mi.isbn = si
|
||||||
except (IndexError, ValueError):
|
except (IndexError, ValueError):
|
||||||
pass
|
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'):
|
if mi.is_null('title'):
|
||||||
mi.title = name
|
mi.title = name
|
||||||
return mi
|
return mi
|
||||||
|
@ -206,6 +206,46 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -121,6 +121,12 @@ class FilenamePattern(QWidget, Ui_Form):
|
|||||||
else:
|
else:
|
||||||
self.series_index.setText(_('No match'))
|
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))
|
self.isbn.setText(_('No match') if mi.isbn is None else str(mi.isbn))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user