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:
giomba 2018-12-23 12:00:14 +01:00
parent 2f9eea0e4e
commit 966c0cf76e
1 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,7 @@ import xml.etree.ElementTree as ET
import json
import datetime
import sys
import re
import glob
@ -32,7 +33,8 @@ def getLibrary(path, lastUpdate):
for j in i.iterfind('tellico:publisher', namespace):
newbook['publisher'] = j.text
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):
newbook['isbn'] = j.text.replace('-', '')
for j in i.iterfind('tellico:pages', namespace):