-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcaterpillar_docker
More file actions
47 lines (36 loc) · 1.15 KB
/
Copy pathcaterpillar_docker
File metadata and controls
47 lines (36 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM alpine:3.12
MAINTAINER carewse1986@163.com
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk update \
&& apk upgrade \
&& apk add --no-cache --virtual .build-deps bash yasm ffmpeg python3 py3-pip \
&& rm -rf /var/cache/apk/*
RUN pip3 install pydub
RUN apk del .build-deps
VOLUME /data
WORKDIR /tmp
RUN echo -e '#!/usr/bin/python3\n\
from pydub import AudioSegment\n\
from pydub.silence import detect_silence\n\
import os\n\
apath = "/data/sli_mp3/"\n\
if os.path.exists(apath):\n\
for fpath in os.listdir(apath):\n\
fp = os.path.join(apath,fpath)\n\
if os.path.isfile(fp):\n\
os.remove(fp)\n\
else:\n\
f = os.mkdir(apath)\n\
song = AudioSegment.from_mp3("target.mp3")\n\
start_end = detect_silence(song,300,-35,1)\n\
start = start_end[0][1]\n\
n=0;\n\
for i in start_end[1:]:\n\
end = i[0]\n\
song[start:end].export(apath+str(n)+".mp3",format="mp3")\n\
start = i[1]\n\
n=n+1\n' > exec.py
RUN echo 'wget $1 -O target.mp3 && python3 /tmp/exec.py' > exec.sh
ENTRYPOINT ["/bin/sh","exec.sh"]
CMD ["http://tcv.clewm.net/f0ZhdfBuStBT1zwU3OUQUMDT9tQ=/lnxMiLtB_Ra1WpjF2IVY0Zzkgg_0"]
#CMD ["/bin/sh"]