From c56a6526dc6e8afd1ec91b4e5e3b013e3d009744 Mon Sep 17 00:00:00 2001 From: Dan Hamik <dan@hamik.net> Date: Mon, 25 Nov 2024 23:50:49 -0600 Subject: [PATCH 1/2] #21 remove returnlist --- libnotices.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libnotices.py b/libnotices.py index b2f09a8..6574ee7 100644 --- a/libnotices.py +++ b/libnotices.py @@ -188,8 +188,7 @@ TD {border-width: 1px; padding: 3px; border-style: solid; border-color: black;} tableend="</table> </body></html>" timezone = ZoneInfo("America/Chicago") returntable="Last Updated" + str(datetime.datetime.now(timezone)) -returntable+='<br>Click <a href="https://librarynotice.hamik.net">Here</a> to be able to refresh the list.' -returntable+='<br>Click for the <a href="https://librarynotice.hamik.net/returnlist.html">return list</a>' +returntable+='<br>Click <a href="https://librarynotice.hamik.net">Here</a> to visit the site.' returntable += """<form action="https://librarynotice.hamik.net/refresh.php"> <input type="submit" value="Refresh Items"> </form> @@ -277,8 +276,6 @@ else: for item in returnlist: returntable += "<TR><TD>" + item.person + td + item.materialtype + td + str(item.renewalcount) + td + str(item.checkoutdate) + td + str(item.duedate) + td + item.title + td + item.isbn + td +'<img src="'+ item.coverurl+'">' +"</td></tr>\n" returntable += tableend -with open("/var/www/html/returnlist.html","w",encoding='utf-8') as outhtml: - outhtml.write(returntable) htmltable = returntable with open("/var/www/html/index.html","w",encoding='utf-8') as outhtml: outhtml.write(htmltable) -- 2.47.1 From 82e34a8cdc757510925cca7eb5d090d35dcb2640 Mon Sep 17 00:00:00 2001 From: Dan Hamik <dan@hamik.net> Date: Mon, 25 Nov 2024 23:56:02 -0600 Subject: [PATCH 2/2] trying to fix ILL books that are missing thumbnails --- libnotices.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libnotices.py b/libnotices.py index 6574ee7..10c2078 100644 --- a/libnotices.py +++ b/libnotices.py @@ -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) -- 2.47.1