Commit 7e8af164 authored by hujun's avatar hujun

1

parent 59b9124f
......@@ -75,22 +75,6 @@ class DownFile:
time.sleep(10)
count_sleep = 0
if len(item['voice_file']) > 0:
local_file = self.save_path + item['voice_file']
string_end = item['voice_file'].find('/')
local_dir = item['voice_file'][0: string_end]
else:
string_end = str.find("?")
file_url = str[0:string_end]
time_array = time.strptime(item['call_time'], '%Y-%m-%d')
local_dir = time.strftime('%Y-%m-%d', time_array)
local_file = self.save_path + local_dir + re.findall(r".com\D.*", file_url)[0][5:]
if self.check_file(local_file):
old_num = old_num + 1
continue
try:
count_sleep = count_sleep + 1 # 增加暂停计数
url = self.ali_yun_sdk(item['call_time'], item['call_id'])
......@@ -113,6 +97,22 @@ class DownFile:
if url == '':
continue
if len(item['voice_file']) > 0:
local_file = self.save_path + item['voice_file']
string_end = item['voice_file'].find('/')
local_dir = item['voice_file'][0: string_end]
else:
string_end = url.find("?")
file_url = str[0:string_end]
time_array = time.strptime(item['call_time'], '%Y-%m-%d')
local_dir = time.strftime('%Y-%m-%d', time_array)
local_file = self.save_path + local_dir + re.findall(r".com\D.*", file_url)[0][5:]
if self.check_file(local_file):
old_num = old_num + 1
continue
self.check_dir(self.save_path + local_dir)
result = request.urlretrieve(url, local_file)
download_num = download_num + 1
......
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