Compare commits

...

40 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
c73f91afe2 Merge pull request 'forcing push' (#37) from work into main
Reviewed-on: #37
2024-11-26 01:56:23 -06:00
eb6c9931df Merge pull request 'fixing order' (#36) from work into main
Reviewed-on: #36
2024-11-26 01:54:29 -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
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
8bdaf5c1b9 Merge pull request 'Crontab changes' (#33) from work into main
Reviewed-on: #33
2024-11-26 01:09:28 -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
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
750ab3d85d Merge pull request 'fix table mistake' (#30) from work into main
Reviewed-on: #30
2024-11-26 00:21:07 -06:00
8dcac00c34 Merge pull request 'finish table' (#29) from work into main
Reviewed-on: #29
2024-11-26 00:18:46 -06:00
ec359b924e Merge pull request 'missed one' (#28) from work into main
Reviewed-on: #28
2024-11-26 00:14:16 -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
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
078a1601fa Merge pull request 'work' (#25) from work into main
Reviewed-on: #25
2024-11-25 23:56:55 -06:00
2584ec7c14 Merge pull request 'fixing tables' (#24) from work into main
Reviewed-on: #24
2024-11-25 23:46:11 -06:00
b1c6a289fa Merge pull request 'crontab testing' (#23) from work into main
Reviewed-on: #23
2024-11-25 22:33:00 -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
cf834cadaf Merge pull request 'updating to use timezone' (#18) from work into main
Reviewed-on: #18
2024-11-25 14:41:35 -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
48f4fc60ae Merge pull request 'dockerfile fix' (#16) from work into main
Reviewed-on: #16
2024-11-25 14:18:17 -06:00
1ee6e95c05 Merge pull request 'add shebang' (#15) from work into main
Reviewed-on: #15
2024-11-25 14:13:45 -06:00
27643697a7 Merge pull request 'scriopt update' (#14) from work into main
Reviewed-on: #14
2024-11-25 14:12:12 -06:00
913e8a63b3 Merge pull request 'python change' (#13) from work into main
Reviewed-on: #13
2024-11-25 14:11:37 -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
e4bee8268f Merge pull request 'dockerfile changes' (#11) from work into main
Reviewed-on: #11
2024-11-25 14:09:37 -06:00
165d1e0f24 Merge pull request 'bash changes' (#10) from work into main
Reviewed-on: #10
2024-11-25 14:08:16 -06:00
f66d597061 Merge pull request 'dockerfile changes' (#9) from work into main
Reviewed-on: #9
2024-11-25 14:07:18 -06:00
4f2ade7423 Merge pull request 'dockerfile changes' (#8) from work into main
Reviewed-on: #8
2024-11-25 14:05:53 -06:00
db9c779dae Merge pull request 'dockerfile fixes' (#7) from work into main
Reviewed-on: #7
2024-11-25 14:04:33 -06:00
d1a64d6538 Merge pull request 'work' (#6) from work into main
Reviewed-on: #6
2024-11-25 14:01:38 -06:00
2c1e992147 Merge pull request 'work' (#5) from work into main
Reviewed-on: #5
2024-11-25 13:56:32 -06:00
a440a9fe3c Merge pull request 'testing' (#4) from work into main
Reviewed-on: #4
2024-11-25 13:25:38 -06:00
f832bd2a9d Merge pull request 'dockerfile updates' (#3) from work into main
Reviewed-on: #3
2024-11-25 13:22:38 -06:00
b24da075b8 Merge pull request 'work' (#2) from work into main
Reviewed-on: #2
2024-11-25 13:19:10 -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
2 changed files with 29 additions and 18 deletions

View File

@@ -1,19 +1,9 @@
FROM debian:bullseye-slim
FROM debian:trixie-slim
#
RUN apt update && apt install cron apache2 python3 python3-pip php libapache2-mod-php -y
RUN a2enmod php*
COPY crontab /crontab
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 /
COPY init.sh /
RUN chmod +x /init.sh
RUN pip3 install -r /requirements.txt
RUN mkdir /var/www/.aws
RUN chmod +x /usr/local/bin/libnotices.py
RUN chown www-data:www-data /var/www -R
RUN crontab -u www-data /crontab
RUN apt clean
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"]
#(cron -l 8 & ) && su - www-data -s /usr/local/bin/libnotices.py & apache2ctl -D FOREGROUND]
CMD ["/init.sh"]

View File

@@ -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)
@@ -129,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':
@@ -136,7 +139,10 @@ 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:
@@ -165,7 +171,8 @@ for myaccount in accounts:
session,
'None',
overdue,
myisbn
myisbn,
isill
)
if thisbook.materialtype in mediatypes:
pass
@@ -210,6 +217,20 @@ for account in accounts:
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>Type'+ th +'Count</th></tr>'