readme, days
This commit is contained in:
12
vatsched.py
12
vatsched.py
@@ -4,15 +4,18 @@ from datetime import datetime, timedelta
|
||||
|
||||
abbreviations = {}
|
||||
|
||||
def EveryXWeeksFromStartdate(startdate, x, numberofdates = 1):
|
||||
def EveryXDaysFromStartdate(startdate, x, numberofdates = 1):
|
||||
startdate = parse(startdate)
|
||||
days = []
|
||||
while (len(days) < numberofdates):
|
||||
startdate += timedelta(days=x*7)
|
||||
startdate += timedelta(days=x)
|
||||
if(datetime.today() <= startdate):
|
||||
days.append(startdate)
|
||||
return days
|
||||
|
||||
def EveryXWeeksFromStartdate(startdate, x, numberofdates = 1):
|
||||
return EveryXDaysFromStartdate(startdate, x * 7, numberofdates)
|
||||
|
||||
def EveryWeekday(weekday, numberofdates=1):
|
||||
startdate = datetime.today() + timedelta((weekday - datetime.today().weekday()) % 7)
|
||||
days = []
|
||||
@@ -85,9 +88,10 @@ def createImage(displaydates, stations, filename):
|
||||
|
||||
text = maketable(stations, displaydates, relbookings)
|
||||
css = 'layout.css'
|
||||
config = imgkit.config(wkhtmltoimage='C:/Program Files/wkhtmltopdf/bin/wkhtmltoimage.exe')
|
||||
options = {'width': (100 + 75 * len(displaydates)), 'disable-smart-width': ''}
|
||||
imgkit.from_string(text, filename, css=css, config=config, options=options)
|
||||
# config = imgkit.config(wkhtmltoimage='C:/Program Files/wkhtmltopdf/bin/wkhtmltoimage.exe')
|
||||
config = imgkit.config(wkhtmltoimage='/usr/bin/wkhtmltoimage')
|
||||
imgkit.from_string(text, filename, css=css, options=options, config=config)
|
||||
return
|
||||
|
||||
def fetchData(startdate = datetime.today(), enddate = (datetime.today() + timedelta(1))):
|
||||
|
Reference in New Issue
Block a user