lsd-transfer/listener.py
2019-07-30 13:08:45 +02:00

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'))