-
Notifications
You must be signed in to change notification settings - Fork 2
/
model.py
60 lines (43 loc) · 1.16 KB
/
model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# -*- coding:utf-8 -*-
import datetime
import time
from config import r
def getStarttime():
return r.get("stime")
def getContinue():
return r.get('continue')
def getaiContinue():
return r.get("aicontinue")
def setUTCStarttime():
shiftts = time.time() - 30*24*60*60
stime = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.localtime(shiftts))
r.set("stime", stime)
return stime
def setNonetime():
r.delete("stime")
def setContinue(cont):
r.set("continue", cont)
def setaiContinue(acont):
r.set("aicontinue", acont)
def pushNorefList(imagenames):
for i in imagenames:
r.sadd("noreflist", i)
def swapLists():
r.sinterstore("expirelist", "noreflist")
r.delete("noreflist")
def getStartflag():
return r.get("startflag")
def setStartflag(flag):
r.set("startflag", flag)
def markRemovableImages():
r.sinterstore("resultset", "noreflist", "expirelist")
r.incr("counter")
return list(r.smembers("resultset"))
def getRemovableImages():
return list(r.smembers("resultset"))
def initCounter():
r.set("counter", 0)
def getCounter():
return r.get("counter")
def cleanup():
r.delete("continue", "aicontinue", "startflag", "stime", "noreflist", "expirelist", "counter")