[Remind-Fans] Periodic Reminders Using Omits

Jason Stein jason_t_stein at yahoo.ca
Mon Mar 27 07:38:58 EST 2006


This seems like the most viable option. I was able to get a pure remind solution by noting the number of omitted days and counting the number of week ends, but I like this better. I know python, so I shouldn't have any more problems.
   
  Thank you for your thoughts (all of you)

Daniel Graham <daniel.graham at duke.edu> wrote:
  I know this is cheating, but here is a simple python script that
will write the relevant remind entries to stdout which could, of
course, be redirected to a file "included" in your reminders file.

To use it you would need to create a datafile with the following
format:

---------- start datafile -----------------
startdate = (2006,1,2)
enddate = (2006,6,6)
holidays = [
(2006,1,16), # Martin Luther King
(2006,4,17), # Easter
]
---------- end datafile -------------------

Then invoke the following:

---------- start script -------------------
#!/usr/bin/python
#### edit the following to point to the datafile ####
datafile = "schedule.data"
#####################################################

import datetime
oneday = datetime.timedelta(days=1)

# Get the data
execfile(datafile)

# Convert relevant dates to datetime objects
startday = datetime.date(startdate[0],startdate[1],startdate[2])
endday = datetime.date(enddate[0],enddate[1],enddate[2])

skipdays = []
for date in holidays:
skipdays.append(datetime.date(date[0],date[1],date[2]))

day = startday
count = 0
scheduledays = []
while day <= endday:
if day.weekday() < 5:
try:
skipdays.index(day)
except:
sequenceday = (count % 6) + 1
count += 1
scheduledays.append("REM %s MSG Day %d" % \
(day.strftime('%a %d %b %Y'), sequenceday))
day = day + oneday

numdays = len(scheduledays)
for i in range(numdays):
# print "%s%%" % scheduledays[i]
print "%s (%d/%d)%%" % (scheduledays[i],i+1,numdays)
---------- end script ---------------------

Sample output:

REM Mon 02 Jan 2006 MSG Day 1 (1/110)%
REM Tue 03 Jan 2006 MSG Day 2 (2/110)%
REM Wed 04 Jan 2006 MSG Day 3 (3/110)%
REM Thu 05 Jan 2006 MSG Day 4 (4/110)%
REM Fri 06 Jan 2006 MSG Day 5 (5/110)%
REM Mon 09 Jan 2006 MSG Day 6 (6/110)%
REM Tue 10 Jan 2006 MSG Day 1 (7/110)%
REM Wed 11 Jan 2006 MSG Day 2 (8/110)%
REM Thu 12 Jan 2006 MSG Day 3 (9/110)%
REM Fri 13 Jan 2006 MSG Day 4 (10/110)%
REM Tue 17 Jan 2006 MSG Day 5 (11/110)%
REM Wed 18 Jan 2006 MSG Day 6 (12/110)%
REM Thu 19 Jan 2006 MSG Day 1 (13/110)%
REM Fri 20 Jan 2006 MSG Day 2 (14/110)%
REM Mon 23 Jan 2006 MSG Day 3 (15/110)%
REM Tue 24 Jan 2006 MSG Day 4 (16/110)%
REM Wed 25 Jan 2006 MSG Day 5 (17/110)%
REM Thu 26 Jan 2006 MSG Day 6 (18/110)%
.
.
.
REM Thu 01 Jun 2006 MSG Day 5 (107/110)%
REM Fri 02 Jun 2006 MSG Day 6 (108/110)%
REM Mon 05 Jun 2006 MSG Day 1 (109/110)%
REM Tue 06 Jun 2006 MSG Day 2 (110/110)%

-Dan
_______________________________________________
Remind-fans mailing list
Remind-fans at lists.whatexit.org
http://lists.whatexit.org/mailman/listinfo/remind-fans


				
---------------------------------
Make free worldwide PC-to-PC calls. Try the new Yahoo! Canada Messenger with Voice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.roaringpenguin.com/pipermail/remind-fans/attachments/20060327/884f81f8/attachment.htm>


More information about the Remind-fans mailing list