Commit f6938618 authored by hujun's avatar hujun

注释

parent 1d9f25f2
...@@ -16,7 +16,8 @@ class DownFile: ...@@ -16,7 +16,8 @@ class DownFile:
self.page_string = page_string self.page_string = page_string
self.call_date_string = call_date_string self.call_date_string = call_date_string
def ali_yun_sdk(self, call_time, call_id): @staticmethod
def ali_yun_sdk(call_time, call_id):
""" """
获取下载链接 获取下载链接
:param call_time: :param call_time:
...@@ -47,7 +48,8 @@ class DownFile: ...@@ -47,7 +48,8 @@ class DownFile:
down_url = '' down_url = ''
return down_url return down_url
def get_data(self, url): @staticmethod
def get_data(url):
""" """
获取通话记录 获取通话记录
:param url: :param url:
...@@ -153,13 +155,25 @@ class DownFile: ...@@ -153,13 +155,25 @@ class DownFile:
self.log("download_num", num) self.log("download_num", num)
self.log("old_num", old_num) self.log("old_num", old_num)
def check_file(self, file): @staticmethod
def check_file(file):
"""
检查文件是否存在
:param file:
:return:
"""
result = False result = False
if os.path.exists(file): if os.path.exists(file):
result = True result = True
return result return result
def check_dir(self, dir): @staticmethod
def check_dir(dir):
"""
检查目录是否存在
:param dir:
:return:
"""
if os.path.exists(dir): if os.path.exists(dir):
result = True result = True
else: else:
...@@ -181,7 +195,13 @@ class DownFile: ...@@ -181,7 +195,13 @@ class DownFile:
self.log('download_successful', self.page_string + "=" + str(page_no)) self.log('download_successful', self.page_string + "=" + str(page_no))
def log(self, title, content): @staticmethod
def log(title, content):
"""
日志记录
:param title:
:param content:
"""
time_str = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) time_str = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
insert_string = "[{time}] {a} {b} {c}".format(time=time_str, a=title, b=content, c='\n') insert_string = "[{time}] {a} {b} {c}".format(time=time_str, a=title, b=content, c='\n')
date = time.strftime("%Y-%m-%d", time.localtime()) date = time.strftime("%Y-%m-%d", time.localtime())
...@@ -191,6 +211,10 @@ class DownFile: ...@@ -191,6 +211,10 @@ class DownFile:
f.close() f.close()
def start_thread(self, day_num=7): def start_thread(self, day_num=7):
"""
开启多线程下载录音
:param day_num: int 天数
"""
today = datetime.date.today() today = datetime.date.today()
page_no = 1 page_no = 1
while day_num > 0: while day_num > 0:
......
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