예제 #1
0
    def save(self, file_name):
        """Save DB to disk.

        :param file_name: File to save to.
        :type file_name: str

        """
        PF.write(self, file_name)
예제 #2
0
파일: tmtBot.py 프로젝트: showyou/tmt
def tmtBot(userData):

    try:
        latestTime = picklefile.read(homePath+"/user/latesttime")
    except:
        latestTime = datetime.datetime.today()-datetime.timedelta(days=1)

    conf = auth_api.loadJSON(homePath+"/config.json")
    tw = auth_api.connect(conf["consumer_token"], conf["consumer_secret"],
    homePath)

    analyzeDM(userData,tw,latestTime)
    latestTime = datetime.datetime.today()

    picklefile.write(homePath+"/user/latesttime",latestTime)
예제 #3
0
파일: tmtControl.py 프로젝트: showyou/tmt
# twitter/tmtの監視とメールを送る処理を行う
import os 

homePath = os.path.abspath(os.path.dirname(__file__))

import picklefile,tmt,datetime,tmtBot
try:
	userData = picklefile.read(homePath+"/user/twdata_tmtMail")
except:
	userData = []
	

# userData は、({"user":user,"mail":mail,
# "time":nexttime(次の定期更新時刻),"now":flag(直ぐに送信するか)},...)
tmtBot.tmtBot(userData)
picklefile.write(homePath+"/user/twdata_tmtMail",userData)

for u in userData:
	
	if u["now"]:
		u["now"] = False
		tmt.tmt(u["user"],u["mail"])
		
	#もし最終更新時刻~現在時刻の間にtimeがあったら、メールを送る
	#elif datetime.today() > u["time"] and \
	#	u["time"] > latestTime :
	tmt.sendTmt(u["user"],u["mail"])
	u["time"] += datetime.timedelta(days=1)

picklefile.write(homePath+"/user/twdata_tmtMail",userData)