trying to fix ILL books that are missing thumbnails
All checks were successful
/ Plan (push) Successful in 40s
/ Plan (pull_request) Successful in 17s

This commit is contained in:
Dan Hamik 2024-11-25 23:56:02 -06:00
parent c56a6526dc
commit 82e34a8cdc

View File

@ -17,14 +17,13 @@ class libaccount(dict):
def toJson(self):
return json.dumps(self,default=lambda o: o.__dict__)
class book():
def __init__(self,itemid,renewalcount,checkoutdate,duedate,vendor,resourceid,resourceinstanceid,title,materialtype,coverurl,person,authsession,renewresult,overdue,isbn):
def __init__(self,itemid,renewalcount,checkoutdate,duedate,vendor,resourceid,title,materialtype,coverurl,person,authsession,renewresult,overdue,isbn):
self.id=itemid
self.renewalcount=renewalcount
self.checkoutdate=checkoutdate
self.duedate=duedate
self.vendor=vendor
self.resourceid=resourceid
self.resourceinstanceid=resourceinstanceid
self.title=title
self.materialtype=materialtype
self.coverurl=coverurl
@ -138,6 +137,10 @@ for myaccount in accounts:
myisbn = mybook['resource']['coverUrl']['small'].split('=')[1].split("/")[0]
except:
myisbn=''
try:
mycoverurl = mybook['resource']['coverUrl']['small']
except:
mycoverurl = ''
duedate = datetime.datetime.strptime(mybook['dueDate'].split('T')[0],'%Y-%m-%d').date()
if datetime.date.today() > duedate:
overdue=True
@ -151,10 +154,9 @@ for myaccount in accounts:
duedate,
mybook['vendor'],
mybook['resource']['id'],
mybook['resource']['instanceId'],
mybook['resource']['title'],
mybook['resource']['materialType'],
mybook['resource']['coverUrl']['small'],
mycoverurl,
account.name,
session,
'None',
@ -167,7 +169,6 @@ for myaccount in accounts:
mediatypes.append(thisbook.materialtype)
except Exception as e:
print(e,mybook)
allbooks.append(thisbook)
for book in allbooks:
#print(datetime.date.today(),book.duedate)