Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
download
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
download
Commits
120092d6
Commit
120092d6
authored
Jan 06, 2020
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
兼容容联云下载
parent
525e1618
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
12 deletions
+20
-12
download.py
download.py
+20
-12
No files found.
download.py
View file @
120092d6
...
@@ -65,7 +65,7 @@ class DownFile:
...
@@ -65,7 +65,7 @@ class DownFile:
下载录音
下载录音
:return:
:return:
"""
"""
url
=
""
url
=
local_file
=
""
download_num
=
0
download_num
=
0
old_num
=
0
old_num
=
0
count_sleep
=
0
count_sleep
=
0
...
@@ -83,6 +83,11 @@ class DownFile:
...
@@ -83,6 +83,11 @@ class DownFile:
if
self
.
check_file
(
local_file
):
if
self
.
check_file
(
local_file
):
old_num
=
old_num
+
1
old_num
=
old_num
+
1
continue
continue
time_array
=
time
.
strptime
(
item
[
'call_time'
],
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
local_dir
=
time
.
strftime
(
'
%
Y
%
m
%
d'
,
time_array
)
if
item
[
'type'
]
==
1
:
try
:
try
:
count_sleep
=
count_sleep
+
1
# 增加暂停计数
count_sleep
=
count_sleep
+
1
# 增加暂停计数
url
=
self
.
ali_yun_sdk
(
item
[
'call_time'
],
item
[
'call_id'
])
url
=
self
.
ali_yun_sdk
(
item
[
'call_time'
],
item
[
'call_id'
])
...
@@ -102,17 +107,24 @@ class DownFile:
...
@@ -102,17 +107,24 @@ class DownFile:
"two exception error-----call_time="
+
item
[
'call_time'
]
+
'&call_id='
+
item
[
'call_id'
],
"two exception error-----call_time="
+
item
[
'call_time'
]
+
'&call_id='
+
item
[
'call_id'
],
str
(
result
))
str
(
result
))
if
url
==
''
:
if
len
(
url
)
==
0
:
continue
continue
#
当数据库未有记录
#
当数据库未有记录
if
item
[
'voice_file'
]
==
''
:
if
item
[
'voice_file'
]
==
''
:
string_end
=
url
.
find
(
"?"
)
string_end
=
url
.
find
(
"?"
)
file_url
=
url
[
0
:
string_end
]
file_url
=
url
[
0
:
string_end
]
local_file
=
self
.
save_path
+
local_dir
+
'/'
+
re
.
findall
(
r".com\D.*"
,
file_url
)[
0
][
5
:]
# 阿里云文件名
else
:
if
len
(
item
[
'mp3_url'
])
==
0
:
continue
time_array
=
time
.
strptime
(
item
[
'call_time'
],
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
url
=
item
[
'mp3_url'
]
local_dir
=
time
.
strftime
(
'
%
Y
%
m
%
d'
,
time_array
)
array
=
url
.
split
(
'/'
)
local_file
=
self
.
save_path
+
local_dir
+
'/'
+
re
.
findall
(
r".com\D.*"
,
file_url
)[
0
][
5
:]
local_file
=
self
.
save_path
+
local_dir
+
'/'
+
array
[
-
1
]
# 容联云文件名
if
len
(
local_file
)
==
0
:
continue
if
self
.
check_file
(
local_file
):
if
self
.
check_file
(
local_file
):
old_num
=
old_num
+
1
old_num
=
old_num
+
1
...
@@ -218,12 +230,8 @@ class DownFile:
...
@@ -218,12 +230,8 @@ class DownFile:
self
.
log
(
'download_over'
,
''
)
self
.
log
(
'download_over'
,
''
)
# today = datetime.date.today()
# start_url = "https://api.tonglianjituan.com/task/getDownVoiceParamsReport?source=3&call_date=2019-12-10"
# one_day = datetime.timedelta(days=1)
# DownFile(start_url).start()
# yesterday = today - one_day
# params_url = "https://api.tonglianjituan.com/task/getDownVoiceParamsReport?page_size=3000&source=3&call_date=" + str(yesterday)
start_url
=
"https://api.tonglianjituan.com/task/getDownVoiceParamsReport?source=3&call_date=2019-12-10"
# DownFile(params_url).start()
#
#
params_url
=
"https://api.tonglianjituan.com/task/getDownVoiceParamsReport?source=3"
params_url
=
"https://api.tonglianjituan.com/task/getDownVoiceParamsReport?source=3"
save_path
=
"/data/html/tl_estate/public/static/voice/"
save_path
=
"/data/html/tl_estate/public/static/voice/"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment