diff --git a/libnotices.py b/libnotices.py index c7bcdb0..9ca82f4 100644 --- a/libnotices.py +++ b/libnotices.py @@ -6,6 +6,7 @@ import boto3 import json from json import JSONEncoder import logging +import re from zoneinfo import ZoneInfo logging.basicConfig(level=logging.INFO) class libaccount(dict): @@ -17,7 +18,7 @@ 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,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,isill): self.id=itemid self.renewalcount=renewalcount self.checkoutdate=checkoutdate @@ -32,6 +33,7 @@ class book(): self.renewresult=renewresult self.overdue=overdue self.isbn=isbn + self.isill=isill #self.ill=ill def print(self): print(self.person, self.id, self.title, self.checkoutdate, self.renewalcount, self.duedate, self.materialtype,self.renewresult, self.isbn) @@ -136,7 +138,9 @@ for myaccount in accounts: try: myisbn = mybook['resource']['coverUrl']['small'].split('=')[1].split("/")[0] except: - myisbn='' + myisbn='' + if re.match("*ILL",mybook['resource']['title']): + isill=True try: mycoverurl = mybook['resource']['coverUrl']['small'] except: @@ -165,7 +169,8 @@ for myaccount in accounts: session, 'None', overdue, - myisbn + myisbn, + isill ) if thisbook.materialtype in mediatypes: pass @@ -210,6 +215,20 @@ for account in accounts: returntable += "