Fixed bug #1
Handling of unsafe publication year fields. If unsafe, then uses the first 4-digit number in the string as the year.
This commit is contained in:
parent
2f9eea0e4e
commit
966c0cf76e
|
@ -2,6 +2,7 @@ import xml.etree.ElementTree as ET
|
||||||
import json
|
import json
|
||||||
import datetime
|
import datetime
|
||||||
import sys
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
|
|
||||||
|
@ -32,7 +33,8 @@ def getLibrary(path, lastUpdate):
|
||||||
for j in i.iterfind('tellico:publisher', namespace):
|
for j in i.iterfind('tellico:publisher', namespace):
|
||||||
newbook['publisher'] = j.text
|
newbook['publisher'] = j.text
|
||||||
for j in i.iterfind('tellico:pub_year', namespace):
|
for j in i.iterfind('tellico:pub_year', namespace):
|
||||||
newbook['year'] = int(j.text)
|
match = re.search('[0-9]{4}', j.text)
|
||||||
|
newbook['year'] = int(match.group())
|
||||||
for j in i.iterfind('tellico:isbn', namespace):
|
for j in i.iterfind('tellico:isbn', namespace):
|
||||||
newbook['isbn'] = j.text.replace('-', '')
|
newbook['isbn'] = j.text.replace('-', '')
|
||||||
for j in i.iterfind('tellico:pages', namespace):
|
for j in i.iterfind('tellico:pages', namespace):
|
||||||
|
|
Loading…
Reference in New Issue