12 lines
327 B
Python
12 lines
327 B
Python
|
import redis, os
|
||
|
|
||
|
UPLOAD_DIR = '/storage/'
|
||
|
|
||
|
r = redis.StrictRedis()
|
||
|
pubsub = r.pubsub()
|
||
|
pubsub.psubscribe("*")
|
||
|
for msg in pubsub.listen():
|
||
|
if msg['channel'].decode('utf-8') == '__keyevent@0__:expired':
|
||
|
os.remove(UPLOAD_DIR + msg['data'].decode('utf-8'))
|
||
|
print("Deleted file " + msg['data'].decode('utf-8'))
|