Compare commits

...

81 Commits

Author SHA1 Message Date
daf3acd8a2 moving to trixie
All checks were successful
/ Plan (push) Successful in 8m17s
/ Plan (pull_request) Successful in 29s
/ Deploy (pull_request) Successful in 25s
2025-08-18 14:39:16 -05:00
56a0f40d01 added the missing period
All checks were successful
/ Plan (push) Successful in 42s
/ Plan (pull_request) Successful in 3m50s
/ Deploy (pull_request) Successful in 14s
2025-01-01 00:27:32 -06:00
45f67c3cce changing logic for ill check
All checks were successful
/ Plan (push) Successful in 50s
/ Plan (pull_request) Successful in 8s
/ Deploy (pull_request) Successful in 18s
2025-01-01 00:23:48 -06:00
6ad7709983 forgot to initialize isill properly
All checks were successful
/ Plan (push) Successful in 1m4s
/ Plan (pull_request) Successful in 9s
/ Deploy (pull_request) Successful in 19s
2025-01-01 00:18:32 -06:00
402b265cdc ILL's first pass
All checks were successful
/ Plan (push) Successful in 5m33s
/ Plan (pull_request) Successful in 12s
/ Deploy (pull_request) Successful in 54s
2024-12-31 23:58:26 -06:00
cb53ade476 Merge pull request 'dev build separate from latest' (#38) from work into main
Reviewed-on: #38
2024-11-26 08:05:48 -06:00
0388bb3641 dev build separate from latest
All checks were successful
/ Plan (push) Successful in 13s
/ Plan (pull_request) Successful in 15s
/ Deploy (pull_request) Successful in 12s
2024-11-26 08:03:57 -06:00
c73f91afe2 Merge pull request 'forcing push' (#37) from work into main
Reviewed-on: #37
2024-11-26 01:56:23 -06:00
8680121a04 forcing push
All checks were successful
/ Plan (push) Successful in 6s
/ Plan (pull_request) Successful in 7s
/ Deploy (pull_request) Successful in 13s
2024-11-26 01:55:59 -06:00
eb6c9931df Merge pull request 'fixing order' (#36) from work into main
Reviewed-on: #36
2024-11-26 01:54:29 -06:00
500299f7a0 fixing order
All checks were successful
/ Plan (push) Successful in 14s
2024-11-26 01:53:25 -06:00
6deb3b4f3b Merge pull request 'finalize deployment automation' (#35) from work into main
Reviewed-on: #35
2024-11-26 01:49:34 -06:00
3dc9042a36 finalize deployment automation
All checks were successful
/ Plan (push) Successful in 12s
/ Plan (pull_request) Successful in 14s
/ Deploy (pull_request) Successful in 4s
2024-11-26 01:48:27 -06:00
abf5ba1952 Merge pull request 'crontab works, moving to correct time' (#34) from work into main
Reviewed-on: #34
2024-11-26 01:16:02 -06:00
4cc6c8daed crontab works, moving to correct time
All checks were successful
/ Plan (push) Successful in 38s
/ Plan (pull_request) Successful in 18s
2024-11-26 01:15:47 -06:00
8bdaf5c1b9 Merge pull request 'Crontab changes' (#33) from work into main
Reviewed-on: #33
2024-11-26 01:09:28 -06:00
96011017bc Crontab changes
All checks were successful
/ Plan (push) Successful in 32s
/ Plan (pull_request) Successful in 19s
2024-11-26 01:08:34 -06:00
0dc6a1d8c7 Merge pull request 'Added a space for last updated.' (#32) from work into main
Reviewed-on: #32
2024-11-26 00:57:07 -06:00
e914656041 newline
All checks were successful
/ Plan (push) Successful in 39s
/ Plan (pull_request) Successful in 21s
2024-11-26 00:56:41 -06:00
9f2b8de131 Added a space for last updated.
All checks were successful
/ Plan (push) Successful in 36s
2024-11-26 00:53:24 -06:00
a32b996b13 Merge pull request 'add newline after total table' (#31) from work into main
Reviewed-on: #31
2024-11-26 00:24:14 -06:00
d1ae8faad3 add newline after total table
All checks were successful
/ Plan (push) Successful in 41s
/ Plan (pull_request) Successful in 19s
2024-11-26 00:23:04 -06:00
750ab3d85d Merge pull request 'fix table mistake' (#30) from work into main
Reviewed-on: #30
2024-11-26 00:21:07 -06:00
e70e1c7757 fix table mistake
All checks were successful
/ Plan (push) Successful in 35s
/ Plan (pull_request) Successful in 14s
2024-11-26 00:20:52 -06:00
8dcac00c34 Merge pull request 'finish table' (#29) from work into main
Reviewed-on: #29
2024-11-26 00:18:46 -06:00
8a32ebff4b finish table
All checks were successful
/ Plan (push) Successful in 31s
/ Plan (pull_request) Successful in 14s
2024-11-26 00:18:34 -06:00
ec359b924e Merge pull request 'missed one' (#28) from work into main
Reviewed-on: #28
2024-11-26 00:14:16 -06:00
97b66a7bbc missed one
All checks were successful
/ Plan (push) Successful in 42s
/ Plan (pull_request) Successful in 18s
2024-11-26 00:14:02 -06:00
d79b734f2f Merge pull request 'fix account property' (#27) from work into main
Reviewed-on: #27
2024-11-26 00:12:32 -06:00
d832b9a5bd fix account property
All checks were successful
/ Plan (push) Successful in 33s
/ Plan (pull_request) Successful in 15s
2024-11-26 00:12:21 -06:00
35b203cc31 Merge pull request 'adding section for per person count' (#26) from work into main
Reviewed-on: #26
2024-11-26 00:10:42 -06:00
362e57c770 adding section for per person count
All checks were successful
/ Plan (push) Successful in 31s
/ Plan (pull_request) Successful in 18s
2024-11-26 00:09:58 -06:00
078a1601fa Merge pull request 'work' (#25) from work into main
Reviewed-on: #25
2024-11-25 23:56:55 -06:00
82e34a8cdc trying to fix ILL books that are missing thumbnails
All checks were successful
/ Plan (push) Successful in 40s
/ Plan (pull_request) Successful in 17s
2024-11-25 23:56:02 -06:00
c56a6526dc #21 remove returnlist
All checks were successful
/ Plan (push) Successful in 42s
2024-11-25 23:50:49 -06:00
2584ec7c14 Merge pull request 'fixing tables' (#24) from work into main
Reviewed-on: #24
2024-11-25 23:46:11 -06:00
320cfdf266 fixing tables
All checks were successful
/ Plan (push) Successful in 40s
/ Plan (pull_request) Successful in 19s
2024-11-25 23:45:10 -06:00
b1c6a289fa Merge pull request 'crontab testing' (#23) from work into main
Reviewed-on: #23
2024-11-25 22:33:00 -06:00
ff7b4a42cb crontab testing
All checks were successful
/ Plan (push) Successful in 50s
/ Plan (pull_request) Successful in 18s
2024-11-25 22:31:44 -06:00
09eb639175 Merge pull request 'fixes for php button' (#19) from work into main
Reviewed-on: #19
2024-11-25 15:11:32 -06:00
9e3f8b99bb fixes for php button
All checks were successful
/ Plan (push) Successful in 3m56s
/ Plan (pull_request) Successful in 49s
2024-11-25 15:06:17 -06:00
cf834cadaf Merge pull request 'updating to use timezone' (#18) from work into main
Reviewed-on: #18
2024-11-25 14:41:35 -06:00
5e68151a2d updating to use timezone
All checks were successful
/ Plan (push) Successful in 39s
/ Plan (pull_request) Successful in 23s
2024-11-25 14:40:30 -06:00
11eff2d940 Merge pull request 'moving to init.sh' (#17) from work into main
Reviewed-on: #17
2024-11-25 14:27:41 -06:00
0c2679cab5 moving to init.sh
All checks were successful
/ Plan (push) Successful in 37s
/ Plan (pull_request) Successful in 22s
2024-11-25 14:27:04 -06:00
48f4fc60ae Merge pull request 'dockerfile fix' (#16) from work into main
Reviewed-on: #16
2024-11-25 14:18:17 -06:00
cca4e08feb dockerfile fix
All checks were successful
/ Plan (push) Successful in 7s
/ Plan (pull_request) Successful in 7s
2024-11-25 14:18:01 -06:00
1ee6e95c05 Merge pull request 'add shebang' (#15) from work into main
Reviewed-on: #15
2024-11-25 14:13:45 -06:00
b5d3749ca3 add shebang
All checks were successful
/ Plan (push) Successful in 41s
/ Plan (pull_request) Successful in 19s
2024-11-25 14:13:29 -06:00
27643697a7 Merge pull request 'scriopt update' (#14) from work into main
Reviewed-on: #14
2024-11-25 14:12:12 -06:00
036afddf2c scriopt update
All checks were successful
/ Plan (push) Successful in 7s
/ Plan (pull_request) Successful in 9s
2024-11-25 14:12:00 -06:00
913e8a63b3 Merge pull request 'python change' (#13) from work into main
Reviewed-on: #13
2024-11-25 14:11:37 -06:00
2cdd2da9b2 python change
All checks were successful
/ Plan (push) Successful in 7s
/ Plan (pull_request) Successful in 6s
2024-11-25 14:11:17 -06:00
f5933d0b62 Merge pull request 'fixing extra quotes' (#12) from work into main
Reviewed-on: #12
2024-11-25 14:10:20 -06:00
09622f555b fixing extra quotes
All checks were successful
/ Plan (push) Successful in 9s
/ Plan (pull_request) Successful in 7s
2024-11-25 14:10:11 -06:00
e4bee8268f Merge pull request 'dockerfile changes' (#11) from work into main
Reviewed-on: #11
2024-11-25 14:09:37 -06:00
bea887526d dockerfile changes
All checks were successful
/ Plan (push) Successful in 8s
/ Plan (pull_request) Successful in 7s
2024-11-25 14:09:26 -06:00
165d1e0f24 Merge pull request 'bash changes' (#10) from work into main
Reviewed-on: #10
2024-11-25 14:08:16 -06:00
b6a9a8e8a4 bash changes
All checks were successful
/ Plan (push) Successful in 10s
/ Plan (pull_request) Successful in 7s
2024-11-25 14:08:04 -06:00
f66d597061 Merge pull request 'dockerfile changes' (#9) from work into main
Reviewed-on: #9
2024-11-25 14:07:18 -06:00
9c0d0aa6c2 dockerfile changes
All checks were successful
/ Plan (push) Successful in 12s
/ Plan (pull_request) Successful in 11s
2024-11-25 14:07:05 -06:00
4f2ade7423 Merge pull request 'dockerfile changes' (#8) from work into main
Reviewed-on: #8
2024-11-25 14:05:53 -06:00
bee741211e dockerfile changes
All checks were successful
/ Plan (push) Successful in 7s
/ Plan (pull_request) Successful in 8s
2024-11-25 14:05:37 -06:00
db9c779dae Merge pull request 'dockerfile fixes' (#7) from work into main
Reviewed-on: #7
2024-11-25 14:04:33 -06:00
a00ecb84f4 dockerfile fixes
All checks were successful
/ Plan (push) Successful in 10s
/ Plan (pull_request) Successful in 11s
2024-11-25 14:03:54 -06:00
d1a64d6538 Merge pull request 'work' (#6) from work into main
Reviewed-on: #6
2024-11-25 14:01:38 -06:00
50098fd0d4 command fixes
All checks were successful
/ Plan (push) Successful in 11s
/ Plan (pull_request) Successful in 7s
2024-11-25 14:01:04 -06:00
57b96f91aa dockerfile fix
All checks were successful
/ Plan (push) Successful in 7s
2024-11-25 13:59:21 -06:00
2c1e992147 Merge pull request 'work' (#5) from work into main
Reviewed-on: #5
2024-11-25 13:56:32 -06:00
3cf8ebd9c9 Fixed requirements
All checks were successful
/ Plan (push) Successful in 43s
/ Plan (pull_request) Successful in 32s
2024-11-25 13:55:14 -06:00
2d60d6aba1 fixing requirements and dockerfiles
Some checks failed
/ Plan (push) Failing after 17s
2024-11-25 13:53:56 -06:00
a440a9fe3c Merge pull request 'testing' (#4) from work into main
Reviewed-on: #4
2024-11-25 13:25:38 -06:00
d0a3bf76f5 testing
All checks were successful
/ Plan (push) Successful in 13s
/ Plan (pull_request) Successful in 17s
2024-11-25 13:24:36 -06:00
f832bd2a9d Merge pull request 'dockerfile updates' (#3) from work into main
Reviewed-on: #3
2024-11-25 13:22:38 -06:00
98c64e86ea dockerfile updates
All checks were successful
/ Plan (push) Successful in 10s
2024-11-25 13:21:46 -06:00
b24da075b8 Merge pull request 'work' (#2) from work into main
Reviewed-on: #2
2024-11-25 13:19:10 -06:00
5f942d7604 fix branch build check
All checks were successful
/ Plan (push) Successful in 7s
/ Plan (pull_request) Successful in 7s
2024-11-25 13:18:48 -06:00
754fd1265a dockerfile changes
All checks were successful
/ Plan (push) Successful in 7s
2024-11-25 13:17:34 -06:00
fe9da6064d Merge pull request 'work' (#1) from work into main
Some checks failed
/ Plan (push) Has been cancelled
Reviewed-on: #1
2024-11-25 13:13:30 -06:00
58703478e0 Updated Compose file
All checks were successful
/ Plan (push) Successful in 7s
/ Plan (pull_request) Successful in 50s
2024-11-25 13:12:55 -06:00
5b73d20751 update with new dockerfile settings
All checks were successful
/ Plan (push) Successful in 8s
2024-11-25 13:11:57 -06:00
8 changed files with 102 additions and 32 deletions

View File

@@ -4,7 +4,7 @@ on:
push:
branches:
- "**"
- "!master"
- "!main"
jobs:
Plan:
@@ -25,4 +25,5 @@ jobs:
- name: Deploy
run: |
echo "${{ secrets.GITEASECRET_TOKEN }}" | docker login git.hamik.net -u paradizelost --password-stdin
docker build -t git.hamik.net/paradizelost/librarynotices:latest .
docker build -t git.hamik.net/paradizelost/librarynotices:dev .
docker push git.hamik.net/paradizelost/librarynotices:dev

View File

@@ -21,4 +21,22 @@ jobs:
run: |
echo "${{ secrets.GITEASECRET_TOKEN }}" | docker login git.hamik.net -u paradizelost --password-stdin
docker build -t git.hamik.net/paradizelost/librarynotices:latest .
docker push git.hamik.net/paradizelost/librarynotices
docker push git.hamik.net/paradizelost/librarynotices
Deploy:
needs: [Plan] #
runs-on: librarynoticehost
defaults:
run:
working-directory: /docker/librarynotices
steps:
- name: Destroy Container
id: down
run: docker compose down
- name: Pull Updates
id: pull
run: docker compose pull
- name: Start Containers
id: start
run: docker compose up -d

View File

@@ -1,10 +1,9 @@
FROM debian:bullseye-slim
RUN apt update && apt install cron apache2 python3 python3-pip -y
COPY crontab /etc/cron.d/crontab
FROM debian:trixie-slim
#
COPY requirements.txt crontab init.sh /
COPY refresh.php /var/www/html/
RUN apt update && apt install cron apache2 python3 python3-pip php libapache2-mod-php -y && pip3 install -r /requirements.txt --break-system-packages && apt clean && a2enmod php* && chmod +x /init.sh && mkdir /var/www/.aws
COPY libnotices.py /usr/local/bin/
COPY requirements.txt /
RUN pip3 install -r /requirements.txt
RUN chmod +x /usr/local/bin/libnotices.py
#COPY img/* /var/www/html/img/
RUN chmod +x /usr/local/bin/libnotices.py && chown www-data:www-data /var/www -R && crontab -u www-data /crontab
EXPOSE 80
CMD ["/init.sh"]

View File

@@ -1 +1 @@
0 17 * * * python3 /usr/local/bin/libnotices.py
0 17 * * * python3 /usr/local/bin/libnotices.py

10
docker-compose.yml Normal file
View File

@@ -0,0 +1,10 @@
services:
libnotices:
image: git.hamik.net/paradizelost/librarynotices:latest
container_name: libnotices
restart: always
ports:
- "80:80"
volumes:
- "./libaccounts.json:/var/www/data/libaccounts.json"
- "./credentials:/var/www/.aws/credentials"

4
init.sh Normal file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
cron -l 8 &
su - www-data -s /usr/local/bin/libnotices.py
apache2ctl -D FOREGROUND

View File

@@ -1,3 +1,4 @@
#!/usr/bin/python3
import requests
import datetime
from tabulate import tabulate
@@ -5,6 +6,8 @@ import boto3
import json
from json import JSONEncoder
import logging
import re
from zoneinfo import ZoneInfo
logging.basicConfig(level=logging.INFO)
class libaccount(dict):
def __init__(self,name,barcode,pin):
@@ -15,14 +18,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,isill):
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
@@ -31,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)
@@ -128,6 +131,7 @@ for myaccount in accounts:
outs = session.get(checkoutsuri)
if len(outs.json()) >=1:
for mybook in outs.json():
isill=False
if mybook['vendor']=='overdrive':
continue
if mybook['vendor']=='hoopla':
@@ -135,7 +139,18 @@ for myaccount in accounts:
try:
myisbn = mybook['resource']['coverUrl']['small'].split('=')[1].split("/")[0]
except:
myisbn=''
myisbn=''
if myisbn=='':
if re.match(".*ILL",mybook['resource']['title']):
isill=True
try:
mycoverurl = mybook['resource']['coverUrl']['small']
except:
mycoverurl = ''
try:
myresourceid=mybook['resource']['id']
except:
myresourceid=''
duedate = datetime.datetime.strptime(mybook['dueDate'].split('T')[0],'%Y-%m-%d').date()
if datetime.date.today() > duedate:
overdue=True
@@ -148,16 +163,16 @@ for myaccount in accounts:
datetime.datetime.strptime(mybook['checkOutDate'].split('T')[0],'%Y-%m-%d').date(),
duedate,
mybook['vendor'],
mybook['resource']['id'],
mybook['resource']['instanceId'],
myresourceid,
mybook['resource']['title'],
mybook['resource']['materialType'],
mybook['resource']['coverUrl']['small'],
mycoverurl,
account.name,
session,
'None',
overdue,
myisbn
myisbn,
isill
)
if thisbook.materialtype in mediatypes:
pass
@@ -165,7 +180,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)
@@ -184,10 +198,9 @@ TH {border-width: 1px; padding: 3px; border-style: solid; border-color: black; b
TD {border-width: 1px; padding: 3px; border-style: solid; border-color: black;}
</style><table>"""
tableend="</table> </body></html>"
returntable="Last Updated" + str(datetime.datetime.now())
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>'
timezone = ZoneInfo("America/Chicago")
returntable="Last Updated<BR> " + str(datetime.datetime.now(timezone))
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>
@@ -197,9 +210,30 @@ returntable += """<form action="https://librarynotice.hamik.net/refresh.php">
td="</td><td>"
th="</th><th>"
#returntable = '<a href="https://librarynotice.hamik.net">Click to return to main list</a>'
returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Name'+ th +'Count</th></tr>'
for account in accounts:
accountcount = sum(b.person == account.name for b in allbooks)
if accountcount >0:
returntable += "<tr><td>" + account.name + td + str(accountcount) + "</td></tr>"
totalcheckedout = len(allbooks)
returntable += "<tr><td><b>Total" + td + str(totalcheckedout) + "</b></td></tr>" + tableend + "<BR>"
ills = [d for d in allbooks if (d.isill==True)]
if len(ills) >=1:
returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Type'+ th +'Count</th></tr>'
for type in mediatypes:
typecount = sum(b.materialtype == type for b in ills)
if typecount>0:
returntable += "<tr><td>" + type + td + str(typecount) + "</td></tr>"
totalreturnbooks = len(ills)
returntable += "<tr><td><b>" + "Total" + td + str(totalreturnbooks) + "</b></td></tr>"
returntable += tableend + "<br>"
returntable += tablestart + "<colgroup><col/><col/><col/><col/><col/><col/><col/><col/></colgroup><tr><th>Name"+th+"Type"+th+"Times Renewed"+ th + "Renewal Status" + th+"Checked Out"+th+"Due Date"+th+"Title" + th + "ISBN" + th + "Thumbnail</th></tr>"
for item in ills:
returntable += "<TR><TD>" + item.person + td + item.materialtype + td + str(item.renewalcount) + td + str(item.renewresult)+ td + str(item.checkoutdate) + td + str(item.duedate) + td + item.title + td + item.isbn + td +'<img src="'+ item.coverurl+'">' +"</td></tr>\n"
returntable += tableend + "<BR>"
duesoon = [d for d in allbooks if (d.duedate < datetime.date.today() + datetime.timedelta(days=10)) and not (str(d.renewresult).lower() == 'None'.lower())]
if len(duesoon) >=1:
returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Name'+ th +'Count</th></tr>'
returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Type'+ th +'Count</th></tr>'
for type in mediatypes:
typecount = sum(b.materialtype == type for b in duesoon)
if typecount>0:
@@ -215,7 +249,7 @@ returnlist = [d for d in allbooks if (d.renewalcount == 3)]
if len(returnlist) == 0:
pass
else:
returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Name'+ th +'Count</th></tr>'
returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Type'+ th +'Count</th></tr>'
for type in mediatypes:
typecount = sum(b.materialtype == type for b in returnlist)
if typecount>0:
@@ -226,11 +260,12 @@ else:
returntable += tablestart + "<colgroup><col/><col/><col/><col/><col/><col/><col/><col/></colgroup><tr><th>Name"+th+"Type"+th+"Times Renewed"+th+"Checked Out"+th+"Due Date"+th+"Title" + th + "ISBN" + th + "Thumbnail</th></tr>"
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
returnlist = [d for d in allbooks if (d.renewalcount == 2)]
if len(returnlist) == 0:
pass
else:
returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Name'+ th +'Count</th></tr>'
returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Type'+ th +'Count</th></tr>'
for type in mediatypes:
typecount = sum(b.materialtype == type for b in returnlist)
if typecount>0:
@@ -241,11 +276,12 @@ else:
returntable += tablestart + "<colgroup><col/><col/><col/><col/><col/><col/><col/><col/></colgroup><tr><th>Name"+th+"Type"+th+"Times Renewed"+th+"Checked Out"+th+"Due Date"+th+"Title" + th + "ISBN" + th + "Thumbnail</th></tr>"
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
returnlist = [d for d in allbooks if (d.renewalcount == 1)]
if len(returnlist) == 0:
pass
else:
returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Name'+ th +'Count</th></tr>'
returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Type'+ th +'Count</th></tr>'
for type in mediatypes:
typecount = sum(b.materialtype == type for b in returnlist)
if typecount>0:
@@ -256,11 +292,12 @@ else:
returntable += tablestart + "<colgroup><col/><col/><col/><col/><col/><col/><col/><col/></colgroup><tr><th>Name"+th+"Type"+th+"Times Renewed"+th+"Checked Out"+th+"Due Date"+th+"Title" + th + "ISBN" + th + "Thumbnail</th></tr>"
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
returnlist = [d for d in allbooks if (d.renewalcount == 0)]
if len(returnlist) == 0:
pass
else:
returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Name'+ th +'Count</th></tr>'
returntable += tablestart + '<colgroup><col/><col/></colgroup><tr><th>Type'+ th +'Count</th></tr>'
for type in mediatypes:
typecount = sum(b.materialtype == type for b in returnlist)
if typecount>0:
@@ -271,8 +308,7 @@ else:
returntable += tablestart + "<colgroup><col/><col/><col/><col/><col/><col/><col/><col/></colgroup><tr><th>Name"+th+"Type"+th+"Times Renewed"+th+"Checked Out"+th+"Due Date"+th+"Title" + th + "ISBN" + th + "Thumbnail</th></tr>"
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"
with open("/var/www/html/returnlist.html","w",encoding='utf-8') as outhtml:
outhtml.write(returntable)
returntable += tableend
htmltable = returntable
with open("/var/www/html/index.html","w",encoding='utf-8') as outhtml:
outhtml.write(htmltable)

View File

@@ -1,3 +1,5 @@
boto==2.49.0
boto3==1.26.27
botocore==1.29.27
botocore==1.29.27
requests==2.28.1
tabulate==0.8.9