#!/usr/bin/python
# coding: UTF-8
# Rec10 TS Recording Tools
# Copyright (C) 2009 Yukikaze
import recdb
tasks = recdb.getall()
for task in tasks:
    #value=line.split(",")
    if task["type"] == "res":#"res,"+chtxt+","+title+","+btime+","+etime+","+opt
        chtxt = task['chtxt']
        title = task['title']
        btime = task['btime']
        etime = task['etime']
        opt = task['opt']
        print "res" + "," + chtxt + "," + title + "," + btime + "," + etime + "," + opt
    elif task["type"] == "key":#"key,"+chtxt+","+keyword+","+btime+","+deltatime+","+opt
        chtxt = task['chtxt']
        #title=task['title']
        btime = task['btime']
        #etime=task['etime']
        keyword = task['title']
        deltatime = task['deltatime']
        opt = task['opt']
        print "key" + "," + chtxt + "," + keyword + "," + btime + "," + deltatime + "," + opt
    elif task["type"] == "keyevery":#"keyevery,"+chtxt+","+keyword+","+btime+","+deltatime+","+opt+","+deltaday
        chtxt = task['chtxt']
        #title=task['title']
        btime = task['btime']
        #etime=task['etime']
        keyword = task['title']
        deltatime = task['deltatime']
        opt = task['opt']
        deltaday = task['deltaday']
        print "keyevery" + "," + chtxt + "," + keyword + "," + btime + "," + deltatime + "," + opt + "," + deltaday
    elif task["type"] == "rec":#"rec,"+chtxt+","+title+","+btime+","+etime+","+opt
        chtxt = task['chtxt']
        title = task['title']
        print title
        btime = task['btime']
        etime = task['etime']
        #keyword=task['keyword']
        #deltatime==task['deltatime']
        opt = task['opt']
        print "rec" + "," + chtxt + "," + title + "," + btime + "," + etime + "," + opt
