예제 #1
0
def batch_export_upload(full_dir):
    global upload_md5_pic_position
    upload_md5_pic_position = 0
    global index
    start_time = int(time.time())
    config = MonitorConfig()
    sleeptime = 3 * 60
    value = config.get_value('appiumConfig', 'batch_pic_seconds')
    if value:
        sleeptime = int(value)
    Logger.println(
        f"【====================开始批量导出并上传图片batch_pic_seconds={sleeptime}=======================】")
    while True:
        time.sleep(5)
        time_start_time = int(time.time()) - start_time
        if sleeptime - time_start_time > 0:
            Logger.println(
                f"=================【{sleeptime - time_start_time}秒后执行第={index}个批量导出并上传图片任务===================】")
        if time_start_time >= sleeptime:
            index = index + 1
            break
        time.sleep(5)
    PicClassfyUtil.classify_from(full_dir)
    excel_full_dir = FilePathUtil.get_lastmodify_file(
        FilePathUtil.get_full_dir("wxfriend", "excel", "pic"))
    main(excel_full_dir)
    if wx_stop.stopFlag:
        Logger.println(f"【===================批量导出并上传图片任务停止=================】")
        return
    batch_export_upload(full_dir)
예제 #2
0
 def __init__(self):
     """
     初始化
     """
     # 驱动配置
     super().__init__()
     self.md5_contents = []
     self.today_md5_contents = []
     full_dir = FilePathUtil.get_lastmodify_file(
         FilePathUtil.get_full_dir("wxfriend", "excel", "pic"))
     array = excel_util.excel2array(full_dir)
     if array:
         for item in array:
             self.today_md5_contents.append(item['content_md5'])
예제 #3
0
def classify_from(source_full):
    # 2.excel获取朋友圈所有说说的md5以及图片的保存起始时间值
    full_dir = FilePathUtil.get_lastmodify_file(
        FilePathUtil.get_full_dir("wxfriend", "excel", "pic"))
    Logger.println(f"【().full_dir={full_dir}】")
    array = excel_util.excel2array(full_dir)
    count = 0
    for index, item in enumerate(array):
        content_md5 = item['content_md5']
        start = int(item['start'])
        end = int(item['end'])
        count = int(item['count'])
        if count > 0:
            # Logger.println(f"【classify().item={item}】")
            # 3.根据起始时间值以及md5值分类好图片
            des_dir = FilePathUtil.get_full_dir('wxfriend', 'pic',
                                                'WeiXinCopy', content_md5)
            files = FilePathUtil.move_files_by_time(source_full, des_dir,
                                                    start, end)
예제 #4
0
    value = config.get_value('appiumConfig', 'batch_pic_seconds')
    if value:
        sleeptime = int(value)
    Logger.println(
        f"【====================开始批量导出并上传图片batch_pic_seconds={sleeptime}=======================】")
    while True:
        time.sleep(5)
        time_start_time = int(time.time()) - start_time
        if sleeptime - time_start_time > 0:
            Logger.println(
                f"=================【{sleeptime - time_start_time}秒后执行第={index}个批量导出并上传图片任务===================】")
        if time_start_time >= sleeptime:
            index = index + 1
            break
        time.sleep(5)
    PicClassfyUtil.classify_from(full_dir)
    excel_full_dir = FilePathUtil.get_lastmodify_file(
        FilePathUtil.get_full_dir("wxfriend", "excel", "pic"))
    main(excel_full_dir)
    if wx_stop.stopFlag:
        Logger.println(f"【===================批量导出并上传图片任务停止=================】")
        return
    batch_export_upload(full_dir)


if __name__ == '__main__':
    full_dir = FilePathUtil.get_lastmodify_file(
        FilePathUtil.get_full_dir("wxfriend", "excel", "pic"))
    batch_export_upload(full_dir)
    # main(full_dir)
예제 #5
0
def main():
    export()
    full_dir = FilePathUtil.get_lastmodify_file(
        FilePathUtil.get_full_dir("wxfriend", "excel", "pic"))
    classify(full_dir)
예제 #6
0
def upload():
    full_dir = FilePathUtil.get_lastmodify_file(
        FilePathUtil.get_full_dir("dist"))
    token = files_token()
    filepath = upload_file(token[0], full_dir)
    print(f"【().filepath={filepath}】")