Created
December 31, 2013 13:40
-
-
Save chesster/8196923 to your computer and use it in GitHub Desktop.
Daily planner on Conky
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1234567;0700;Pobudka; | |
1234567;0730;Kawa, fajka, eztv; | |
1234567;0800;Zakupy, Śniadanie; | |
1234567;0900;Robota; | |
1234567;1300;Obiad serial; | |
1234567;1400;Robota; | |
1234567;1800;Telefon; | |
1234567;1900;Kawa, seriale; | |
1234567;1945;Plan na Jutro; | |
1234567;2000;Robota, zalążek roboty na jutro; | |
1234567;2040;Research; | |
1234567;2130;Mycie; | |
1234567;2200;Telefon; | |
1234567;2220;Film, net; | |
1234567;2330;Koniec dnia; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from string import maketrans | |
from time import strftime | |
import codecs | |
def ogonki(str): | |
intab = "aeiou" | |
outtab = "12345" | |
trantab = maketrans(intab, outtab) | |
return str.translate(trantab); | |
def read(file_name): | |
list = [] | |
file = codecs.open(file_name,"r", "utf-8") | |
for line in file: | |
line_split = line.split(';') | |
if len(line_split) == 1 : | |
list.append(line_split[0]) | |
else : | |
list.append(line_split) | |
file.close() | |
return list | |
planner = {"1":{},"2":{},"3":{},"4":{},"5":{},"6":{},"7":{}} | |
list = read('/home/chstr/.conky/scripts/planer') | |
for listitem in list: | |
days = listitem[0] | |
for day in days: | |
try: | |
planner[day][listitem[1]]=listitem[2] | |
except KeyError: | |
break | |
for day in days: | |
planner[day] | |
time = strftime("%H%M") | |
weekday = "%s" % ((int(strftime("%w"))+6)%7+1 ) # wg pythona niedziela est pierwszym dniam tygondnia | |
last = None | |
nextdate = None | |
planner_keys = planner[weekday].keys() | |
planner_keys.sort() | |
for plan in planner_keys: | |
if plan < time: | |
last = planner[weekday][plan] | |
else: | |
nextdate = plan | |
break | |
if last: | |
if nextdate: | |
print u'$color1${font Sans:size=14}%s ${font Sans:size=10}do %s:%s $font$color' % (last, nextdate[:2], nextdate[2:]) | |
else: | |
print u'$color1${font Sans:size=14}%s ${font Sans:size=10} $font$color' % last |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment