import os
from lib.path import APP_PATH
from lib.path import APP_PICTURE_PATH
import yaml
from lib.logger import logger
class Tool(object):
@property
def app_data(self):
with open(APP_PATH, 'rb') as f:
data = yaml.load(f)
return data
@property
def app_error_picture(self):
app_list = os.listdir(APP_PICTURE_PATH)
app_picture = []
for item in app_list:
if item.endswith('.jpg'):
# app_picture.append((APP_ERROR + item,))
app_picture.append((APP_PICTURE_PATH + item,))
return app_picture
@staticmethod
def app_clear():
app_list = os.listdir(APP_PICTURE_PATH)
logger.debug('上次执行的未删除的图片:%s' % app_list)
for p in app_list:
if p.endswith('jpg') or p.endswith('png'):
os.remove(os.path.join(APP_PICTURE_PATH, p))
if __name__ == '__main__':
Tool().app_clear()
# print(Tool().app_error_picture)
# print(Tool().app_data)