Commit c483296e authored by hujun's avatar hujun

self

parent d4d77b95
......@@ -10,6 +10,9 @@ import threading
class DownFile:
download_num = 0
old_num = 0
def __init__(self, url, save_path="./", call_date_string="call_date", page_string="page_no"):
"""
初始化
......@@ -77,8 +80,6 @@ class DownFile:
:return:
"""
url = local_file = ""
download_num = 0
old_num = 0
count_sleep = 0
for item in data:
if count_sleep == 50:
......@@ -90,7 +91,7 @@ class DownFile:
local_file = self.save_path + item['voice_file']
if self.check_file(local_file):
self.lock.acquire()
old_num = old_num + 1
self.old_num = self.old_num + 1
self.lock.release()
continue
......@@ -138,7 +139,7 @@ class DownFile:
if self.check_file(local_file):
self.lock.acquire()
old_num = old_num + 1
self.old_num = self.old_num + 1
self.lock.release()
continue
......@@ -146,12 +147,12 @@ class DownFile:
result = request.urlretrieve(url, local_file)
self.lock.acquire()
download_num = download_num + 1
self.download_num = self.download_num + 1
self.lock.release()
self.log('download_file', result)
self.log("download_num", download_num)
self.log("old_num", old_num)
self.log("download_num", self.download_num)
self.log("old_num", self.old_num)
def download_remote(self, data):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment