# installed by hand right now. might put it in deb package. python-dateutil
from dateutil.parser import *
from dateutil.relativedelta import *

file_time_format="%Y-%m-%d_%H.%M.%S.ogg"
start_date=parse("20040201T000000+2000")
cutup_dir="/mnt/t2/Reboot/doku3"
cutout_dir="/mnt/t2/Reboot/links3"
i=0
day=0
days=90
while i<days:
    hour=0
    print "mkdir -p %s/%02d" %(cutout_dir,i)
    while hour<24:
        if hour<6 or hour>=12:
            piece=0
            while piece<12:
                sec_start = (piece * 300) + 150
                begin=start_date+relativedelta(days=day,hours=hour,seconds=sec_start)
                input_filename="%s/%s" %(cutup_dir,(start_date+relativedelta(days=day,hours=hour,seconds=sec_start)).strftime("%H.%M.%S_%Y-%m-%d.ogg"))

                output_filename="%s/%02d/%s" %(cutout_dir,i,(start_date+relativedelta(days=day,hours=hour,seconds=sec_start)).strftime("%H.%M.%S_%Y-%m-%d.ogg"))
                print "ln -s %s %s"%(input_filename,output_filename)
                piece +=1
                day+=1
                if day>days: day=0
        hour+=1
    i+=1
