- 依赖软件
- shell 脚本使用
- Windows 系统
- trojan
- proxifier
- termius
- raidrive
- winsw
- scoop
- notepad++
- git
- python
- you-get
- jq
- cygwin
- openssh
- aria2
- ffmpeg
- sshpass
- frp
- php
- apache2
- nginx
- lighttpd
- caddy
- h5ai
- Linux 系统
- docker
- trojan
- privoxy
- git
- python
- you-get
- jq
- openssh
- aria2
- ffmpeg
- sshpass
- frp
- php
- apache2
- nginx
- lighttpd
- caddy
- h5ai
- shell 脚本(传承给聪明的有缘人)
#!/bin/bash
proxy_host_port="127.0.0.1:58591"
url_json_path=/mnt/cygdrive/e/Software/scoop/apps/apache/current/htdocs/music-video
url_video_audio_json_path=/mnt/cygdrive/e/Software/scoop/apps/apache/current/htdocs/music-video
video_audio_download_path=/mnt/cygdrive/e/Software/scoop/apps/apache/current/htdocs/music-video
python3_packages_path=/cygdrive/e/Software/scoop/apps/python/current/Lib/site-packages
MV_path=$video_audio_download_path/MV
Video_path=$video_audio_download_path/Video
webm_path=$Video_path/webm
mp4_path=$Video_path/mp4
Music_path=$video_audio_download_path/Music
flac_path=$Music_path/flac
mp3_path=$Music_path/mp3
server_host="192.168.50.140"
server_port=22
server_username=root
server_password=root
server_folder=/root/Share/music-video/Video/webm
check_global_path() {
folders=($url_json_path $url_video_audio_json_path $video_audio_download_path $MV_path $Video_path $webm_path $mp4_path $Music_path $flac_path $mp3_path)
for folder in ${folders[*]}
do
if ! test -d $folder
then
mkdir -p $folder
fi
done
}
extract_video_audio_url() {
video_url=$1
video_url_length=`expr ${#video_url[*]} - 1`
audio_url=$2
audio_url_length=`expr ${#audio_url[*]} - 1`
#echo ${#video_url[*]}
# echo ${#audio_url[*]}
video_url1=${video_url[0]}
video_url1=(${video_url1//range=0-/ })
video_url2=${video_url[video_url_length]}
video_url2=(${video_url2//-/ })
video_url2_length=`expr ${#video_url2[*]} - 1`
video="${video_url1[0]}range=0-${video_url2[video_url2_length]}"
audio_url1=${audio_url[0]}
audio_url1=(${audio_url1//range=0-/ })
audio_url2=${audio_url[audio_url_length]}
audio_url2=(${audio_url2//-/ })
audio_url2_length=`expr ${#audio_url2[*]} - 1`
audio="${audio_url1[0]}range=0-${audio_url2[audio_url2_length]}"
#echo -e "${video_url[0]}nn${video_url[video_url_length]}nn${video}n"
# echo -e "${audio_url[0]}nn${audio_url[audio_url_length]}nn${audio}n"
# echo ${#video_url1[*]}
cd $url_video_audio_json_path
echo ${video} > url_video_audio.json
echo ${audio} >> url_video_audio.json
#scp -P 8022 /sdcard/url_video_audio.json u0_a135@localhost:/storage/3532-6362/1/
#cp url_video_audio.json /sdcard
cd $url_json_path
}
get_array_video_audio_url() {
cd $url_json_path
video=(`cat url.json | jq .streams | jq keys | sed -f replace.txt`)
for v in ${video[*]}
do
o1="'.streams."${v}".quality'"
cmd1=`echo "cat url.json | jq $o1"`
q1=`eval $cmd1`
o2="'.streams."${v}".src'"
cmd2=`echo "cat url.json | jq $o2"`
q2=`eval $cmd2`
o3="'.streams."${v}".container'"
cmd3=`echo "cat url.json | jq $o3"`
q3=`eval $cmd3`
# echo $v,$1,$2
#echo -e "${v}、${c}n"
q1=`echo $q1 | tr 'A-Z' 'a-z'`
#echo $q1
if [[ $q1 == *$1* && $q2 != "null" && $q3 == *$2* ]]
then
#echo $q1,$q2,$q3
o1="'.streams."${v}".src[0]'"
cmd1=`echo "cat url.json | jq $o1"`
temp1=`eval $cmd1 | sed -f replace.txt`
video_url=(`echo $temp1 | sed -f replace.txt`)
#video_url=(`eval $cmd1 | sed -f replace.txt`)
#echo $video_url > video_url.json
#echo $cmd1
#echo ${#video_url[*]}
#echo -e ${video_url[*]} > video_url.json
o2="'.streams."${v}".src[1]'"
cmd2=`echo "cat url.json | jq $o2"`
temp2=`eval $cmd2 | sed -f replace.txt`
audio_url=(`echo $temp2 | sed -f replace.txt`)
#audio_url=(`eval $cmd2 | sed -f replace.txt`)
#echo $audio_url > audio_url.json
#echo $cmd2
#echo ${#audio_url[*]}
#echo -e ${audio_url[*]} > audio_url.json
extract_video_audio_url $video_url $audio_url
# echo ${#video_url[*]}
# echo ${#audio_url[*]}
#echo -e "${v}、${c}n"
return 1
fi
done
return 0
}
get_url_video_audio_json() {
quality=("1080p" "720p" "480p" "360p" "240p")
container=$1
if [[ $container == "webm" ]]
then
container=("webm" "mp4" "flv")
else
container=("mp4" "webm" "flv")
fi
for q in ${quality[*]}
do
flag=0
for c in ${container[*]}
do
#echo -e "$q $cn"
get_array_video_audio_url $q $c
if [ $? -eq 1 ]
then
flag=1
echo -e "$q $c"
echo $c > container.txt
break
fi
done
if [ $flag -eq 1 ]
then
break
fi
done
}
get_youtube_video_url_json() {
echo -n "请输入视频链接(输入true使用代理):"
read params
params_array=($params)
url=${params_array[0]}
if [[ $url == *"m.youtube"* ]]
then
url=(${url//m.youtube/ })
url=${url[0]}www.youtube${url[1]}
elif [[ $url == *"m.bilibili"* ]]
then
url=${url%.html*}
url=(${url//m.bilibili/ })
url=${url[0]}www.bilibili${url[1]}
fi
#echo $url
cd $url_json_path
if [[ ${#params_array[*]} -eq 2 ]]
then
proxy=${params_array[1]}
if [[ $proxy == "true" ]]
then
you-get -x $proxy_host_port --json $url > url.json
fi
else
you-get -x $proxy_host_port --json $url > url.json
fi
}
rename_remove_video_audio_files() {
cd $video_audio_download_path
files=(`ls -t`)
#echo $files
video=${files[0]}
video_size=`ls -l $video | awk '{ print $5 }'`
audio=${files[1]}
audio_size=`ls -l $audio | awk '{ print $5 }'`
if [[ ${video_size} -lt ${audio_size} ]]
then
temp=$video
video=$audio
audio=$temp
fi
#echo $video $audio
#((0)) && {
container=`cat $url_json_path/container.txt`
if [[ ${container} == "webm" ]]
then
mv ${video} videoplayback.webm
mv ${audio} videoplayback.weba
else
mv ${video} videoplayback.mp4
mv ${audio} videoplaybacka.mp4
fi
#}
cd $url_json_path
dir_name=`cat url.json | jq .title | sed -f dir_name_replace.txt`
cd $video_audio_download_path
#mkdir ${dir_name}
eval `echo "mkdir $dir_name"`
if [[ ${container} == *"webm"* ]]
then
eval `echo "mv videoplayback.webm ${dir_name}"`
eval `echo "mv videoplayback.weba ${dir_name}"`
else
eval `echo "mv videoplayback.mp4 ${dir_name}"`
eval `echo "mv videoplaybacka.mp4 ${dir_name}"`
fi
echo "音视频文件修改成功"
}
direct_download_video_audio_files() {
cd $url_json_path
url=$1
#echo $url
if [[ ${#url} -eq 0 ]]
then
echo -n "请输入视频链接:"
read url
fi
params_array=($url)
proxy="false"
if [[ ${#params_array[*]} -eq 2 ]]
then
url=${params_array[0]}
proxy=${params_array[1]}
fi
#https://m.bilibili.com/video/av90184732.html
if [[ $url == *"m.bilibili"* ]]
then
url=${url%.html*}
url=(${url//m.bilibili/ })
url=${url[0]}www.bilibili${url[1]}
elif [[ $url == *"m.youku"* ]]
then
#https://m.youku.com/video/id_XNDU1MzM5MzAyNA==.html?refer=seo_operation.liuxiao.liux_00003303_3000_Qzu6ve_19042900
#https://m.youku.com/alipay_video/id_XMjQ4MTM1NjM3Mg==.html?spm=a2h0c.8166622.PhoneSokuUgc_12.dtitle
#https://v-wb.youku.com/v_show/id_XNDU1MzM5MzAyNA==.html
url=${url%.html*}
url=(${url//m.youku/ })
url=${url[0]}v-wb.youku${url[1]}
if [[ $url == *"alipay_video"* ]]
then
url=(${url//alipay_video/ })
else
url=(${url//video/ })
fi
url=${url[0]}v_show${url[1]}.html
elif [[ $url == *"m.iqiyi"* ]]
then
#https://m.iqiyi.com/v_19rxvoz4rw.html?vfrm=2-3-3-1
#https://www.iqiyi.com/v_19rxvoz4rw.html
url=${url%.html*}
url=(${url//m.iqiyi/ })
url=${url[0]}www.iqiyi${url[1]}.html
elif [[ $url == *"m.v.qq"* ]]
then
#http://m.v.qq.com/page/x/0/p/x0737a2dxup.html
#https://v.qq.com/x/page/x0737a2dxup.html
#http://m.v.qq.com/page/v/0/8/v0834gjg198.html
#https://v.qq.com/x/page/v0834gjg198.html
url=(${url//m.v.qq/ })
url=${url[0]}v.qq${url[1]}
url=(${url//"page"/ })
url=${url[0]}x/page/${url[1]#/*/*/*/}
fi
#echo $url
#cd /sdcard/Download/
if [[ $proxy == "true" ]]
then
you-get -x $proxy_host_port $url
else
you-get $url
fi
sleep 1s
OLDIFS=$IFS
IFS=$'n'
cd $url_json_path
files=(`ls -t`)
for v in ${files[*]}
do
if [[ $v == *".mp4" || $v == *".webm" || $v == *".flv" ]]
then
if ! test -f "$video_audio_download_path/$v"
then
mv "$v" $video_audio_download_path
fi
#echo "mv '$v' /sdcard/Download"
#eval `echo "mv '$v' /sdcard/Download"`
#rm "$video"
elif [[ $v == *".xml" ]]
then
rm "$v"
#eval `echo "rm '$v'"`
fi
done
IFS=$OLDIFS
url=$1
if [[ ${#url} -eq 0 ]]
then
create_video_folder
fi
}
concat() {
file=$1
container=$2
if ! test -d 1
then
mkdir 1
fi
if [[ $container == *"mp4"* ]]
then
video="videoplayback.mp4"
audio="videoplaybacka.mp4"
out="out.mp4"
name="${file}.mp4"
else
video="videoplayback.webm"
audio="videoplayback.weba"
out="out.webm"
name="${file}.webm"
fi
#echo "mv '$file'/$video '$file'/$audio 1-----"
#eval `echo "mv '$file'/$video '$file'/$audio 1"`
mv "$file/$video" "$file/$audio" 1
cd 1
ffmpeg -i $video -i $audio -c copy $out
cd ..
#eval `echo "mv 1/$video 1/$audio 1/$out '$file'/"`
#eval `echo "mv '$file'/$out '$file'/'$name'"`
mv "1/$video" "1/$audio" "1/$out" "$file/"
mv "$file/$out" "$file/$name"
if ! test -d "$MV_path/$file"
then
mv "$file" $MV_path
fi
rm -r 1
}
concat_video_audio() {
OLDIFS=$IFS
IFS=$'n'
cd $video_audio_download_path
files=`ls -t`
#echo ${#files[*]}
i=0
for f in $files
do
#echo "test -d $f"
#echo -e "test -d '$f'" >> files-1.txt
#if eval `echo "test -d '$f'"`
if test -d "$f"
then
#echo -e "$fn" >> files-1.txt
#echo -e "$fn"
#cmd=`echo "ls -t '$f'"`
#video_audios=(`eval $cmd`)
video_audios=(`ls -t "$f"`)
v_a=${video_audios[0]}
number=${#video_audios[*]}
#echo ${#video_audios[*]}---
if [[ $number -eq 2 && $v_a == *videoplayback* ]]
then
if [[ $v_a == *mp4* ]]
then
concat $f "mp4"
else
concat $f "webm"
fi
works[$i]=$f
i=`expr $i + 1`
fi
#break
fi
done
echo
echo -e "音视频文件合并成功nn已处理目录:n"
for w in ${works[*]}
do
echo $w
done
echo
echo -e "目录总数:${#works[*]}"
IFS=$OLDIFS
#create_video_folder
}
compress_flac_to_mp3() {
OLDIFS=$IFS
IFS=$'n'
cd $Music_path
files=`ls flac`
i=0
for f in $files
do
if [[ $f == *".mp3"* ]]
then
name=${f%.mp3*}
elif [[ $f == *".ape"* ]]
then
name=${f%.ape*}
elif [[ $f == *".flac"* ]]
then
name=${f%.flac*}
elif [[ $f == *".wav"* ]]
then
name=${f%.wav*}
fi
cmd=`echo "ffmpeg -i flac/'$f' -b:a 192k -acodec mp3 -ar 44100 -ac 2 mp3/'$name.mp3'"`
eval $cmd
echo -e "$cmdn$namen$cmd"
done
echo "音频文件压缩转换成功"
IFS=$OLDIFS
}
compress_webm_to_mp4() {
OLDIFS=$IFS
IFS=$'n'
echo -e "1.1080pn2.720pn3.480p"
echo -n "请输入视频画质所对应的数字:"
read number
if [[ $number -eq 1 ]]
then
quality="1920x1080"
elif [[ $number -eq 2 ]]
then
quality="1280x720"
elif [[ $number -eq 3 ]]
then
quality="640x480"
fi
echo -e "n1.默认n2.1Mbpsn3.768Kbpsn4.512Kbps"
echo -n "请输入视频比特率所对应的数字:"
read number
if [[ $number -eq 1 ]]
then
bit=""
elif [[ $number -eq 2 ]]
then
bit="-b:v 1024k"
elif [[ $number -eq 3 ]]
then
bit="-b:v 768k"
elif [[ $number -eq 3 ]]
then
bit="-b:v 512k"
fi
cd $Video_path
files=`ls webm`
i=0
for f in $files
do
if [[ $f == *".webm"* ]]
then
name=${f%.webm*}
elif [[ $f == *".mp4"* ]]
then
name=${f%.mp4*}
elif [[ $f == *".flv"* ]]
then
name=${f%.flv*}
elif [[ $f == *".mkv"* ]]
then
name=${f%.mkv*}
fi
tempName=${f//$name/1}
mv webm/"$f" webm/"$tempName"
#cmd=`echo "ffmpeg -i webm/'$f' -s $quality $bit -acodec copy mp4/'$name.mp4'"`
cmd=`echo "ffmpeg -i webm/'$tempName' -s $quality $bit -acodec copy mp4/'$tempName'"`
eval $cmd
mv webm/"$tempName" webm/"$f"
mv mp4/"$tempName" mp4/"$f"
#ffmpeg -i "webm/$f" -s $quality $bit -acodec copy "mp4/$name.mp4"
#echo -e "n$quality"
done
echo
echo "视频文件压缩转换成功"
IFS=$OLDIFS
}
create_video_folder() {
OLDIFS=$IFS
IFS=$'n'
cd $video_audio_download_path
files=`ls -t`
unset works
unset moveWorks
i=0
j=0
for f in $files
do
#if eval `echo "test -f '$f'"`
if test -f "$f"
then
folderName="/"
if [[ $f != *"[00]"* && $f != *"[01]"* ]]
then
if [[ $f == *".webm"* ]]
then
folderName=${f%.webm*}
elif [[ $f == *".mp4"* ]]
then
folderName=${f%.mp4*}
elif [[ $f == *".flv"* ]]
then
folderName=${f%.flv*}
elif [[ $f == *".mkv"* ]]
then
folderName=${f%.mkv*}
elif [[ $f == *".xml" ]]
then
#eval `echo "rm '$f'"`
rm "$f"
fi
else
# 重命名并删除
mv "$f" "${f}1"
rm "${f}1"
fi
if [[ $folderName != "/" ]]
then
if test -d "$MV_path/$folderName"
then
if ! test -f "$MV_path/$folderName/$f"
then
mv "$f" "$MV_path/$folderName"
moveWorks[$j]=$f
j=`expr $j + 1`
else
mv "$f" $mp4_path
moveWorks[$j]=$f
j=`expr $j + 1`
fi
else
#echo $f-12
# 判断是否存在分割视频
newFolderName=`echo $f | sed 's/(.*)s-s.*/1/g'`
if test -d "$MV_path/$newFolderName"
then
# 分割视频移动到mp4文件夹
mv "$f" $mp4_path
moveWorks[$j]=$f
j=`expr $j + 1`
else
if ! test -d "$folderName"
then
mkdir "$folderName"
works[$i]=$f
i=`expr $i + 1`
fi
if ! test -f "$folderName/$f"
then
mv "$f" "$folderName"
mv "$folderName" $MV_path
fi
fi
fi
fi
fi
done
if [[ ${#works[*]} -gt 0 ]]
then
#echo
echo -e "视频文件夹创建成功nn已处理视频:n"
for w in ${works[*]}
do
echo $w
done
echo
echo -e "视频总数:${#works[*]}"
echo
fi
if [[ ${#moveWorks[*]} -gt 0 ]]
then
echo -e "视频移动成功nn已处理视频:n"
for w in ${moveWorks[*]}
do
echo $w
done
echo
echo -e "视频总数:${#moveWorks[*]}"
fi
IFS=$OLDIFS
}
update_you_get_from_github() {
you_get_path=$url_json_path/you-get
new_you_get_src_path=$you_get_path/src/you_get
old_pycache_path=$new_you_get_src_path/__pycache__
old_you_get_src_path=$python3_packages_path/you_get
new_pycache_path=$old_you_get_src_path/__pycache__
cd $url_json_path
if ! test -d $you_get_path
then
git clone https://github.com/soimort/you-get.git
fi
cd $you_get_path
git pull
if test -d $old_pycache_path
then
rm -r $old_pycache_path
fi
mv $new_pycache_path $new_you_get_src_path
rm -r $old_you_get_src_path
cp -r $new_you_get_src_path $python3_packages_path
echo
echo -e "you-get更新成功!"
}
download_bilibili_videos() {
echo -n "请输入视频链接以及两个数字:"
read url_array
url_array=($url_array)
#echo ${#url_array[*]}
if [[ ${#url_array[*]} -eq 3 ]]
then
for i in `seq ${url_array[1]} ${url_array[2]}`
do
#echo $i
url=${url_array[0]}?p=$i
direct_download_video_audio_files $url
if [[ $i -ne ${url_array[2]} ]]
then
echo
fi
#echo $url
done
fi
}
split_my_video() {
echo -n "请输入剪切视频长度以及视频的长度(分钟和秒钟):"
read times
times_array=($times)
if [[ ${#times_array[*]} -eq 3 ]]
then
cd $Video_path
video=`ls webm`
name=${video%.*}
suffix=${video##*.}
#echo $name
#echo $suffix
part_time=`expr ${times_array[0]} * 60`
total_time=`expr ${times_array[1]} * 60 + ${times_array[2]}`
number=`expr $total_time / $part_time`
#echo $number
i=0
for n in `seq $number`
do
#echo $i
time1=`expr $i * $part_time`
time2=`expr $n * $part_time - 1`
#echo $time1
#echo $time2
#cmd=`echo "ffmpeg -ss $time1 -t $time2 -accurate_seek -i webm/'$video' -codec copy -avoid_negative_ts 1 mp4/'$name - $n.$suffix'"`
cmd=`echo "ffmpeg -ss $time1 -to $time2 -accurate_seek -i webm/'$video' -codec copy -avoid_negative_ts 1 -y mp4/'$name - $n.$suffix'"`
eval $cmd
#echo $cmd
i=`expr $i + 1`
done
time1=`expr $number * $part_time`
time2=$total_time
n=`expr $number + 1`
echo "$time1 --- $time2"
#cmd=`echo "ffmpeg -ss $time1 -t $time2 -accurate_seek -i webm/'$video' -codec copy -avoid_negative_ts 1 mp4/'$name - $n.$suffix'"`
#cmd=`echo "ffmpeg -ss $time1 -t $time2 -accurate_seek -i webm/'$video' -avoid_negative_ts 1 mp4/'$name - $n.$suffix'"`
cmd=`echo "ffmpeg -ss $time1 -to $time2 -accurate_seek -i webm/'$video' -codec copy -avoid_negative_ts 1 -y mp4/'$name - $n.$suffix'"`
eval $cmd
echo
echo -e "视频[$video]切割成功!nn总共切割成$n段视频"
fi
}
cutting_my_video() {
echo -n "请输入切割视频起始时间和结束时间(起始时间:秒钟,结束时间:秒钟或分钟+秒钟):"
read times
times_array=($times)
if [[ ${#times_array[*]} -eq 3 ]]
then
cd $Video_path
video=`ls webm`
start_time=${times_array[0]}
end_time=`expr ${times_array[1]} * 60 + ${times_array[2]}`
cmd=`echo "ffmpeg -ss $start_time -to $end_time -accurate_seek -i webm/'$video' -codec copy -avoid_negative_ts 1 -y mp4/'$video'"`
eval $cmd
echo
echo -e "视频[$video]切割成功!"
else
cd $Video_path
video=`ls webm`
start_time=${times_array[0]}
end_time=${times_array[1]}
cmd=`echo "ffmpeg -ss $start_time -to $end_time -accurate_seek -i webm/'$video' -codec copy -avoid_negative_ts 1 -y mp4/'$video'"`
eval $cmd
echo
echo -e "视频[$video]切割成功!"
fi
}
video_audio_aria2_download() {
cd $url_video_audio_json_path
aria2c --https-proxy="http://$proxy_host_port" -c -x 16 -s 16 -d $video_audio_download_path -j 2 -i url_video_audio.json
#aria2c -c -x 16 -s 16 -d $video_audio_download_path -j 2 -i url_video_audio.json
}
generate_url_replace_and_dir_name_replace() {
cd $url_json_path
if ! test -f "replace.txt"
then
echo -e "# sed url escapingns:,: :gns:[: :gns:]: :g" > replace.txt
echo -n "s:"::g" >> replace.txt
echo >> replace.txt
echo -n "s: \r : :g" >> replace.txt
echo >> replace.txt
echo -n "s:\r ::g" >> replace.txt
echo >> replace.txt
echo -n "s:\r \r::g" >> replace.txt
echo >> replace.txt
echo -n "s:\r::g" >> replace.txt
fi
if ! test -f "dir_name_replace.txt"
then
echo -e "# sed url escaping" > dir_name_replace.txt
echo -n "s:\" >> dir_name_replace.txt
echo -n "\:-:g" >> dir_name_replace.txt
echo -e "ns:/:-:gns:::-:gns:*:-:gns:?:-:gns:<:-:gns:>:-:gns:|:-:g" >> dir_name_replace.txt
echo -n "s: : :g" >> dir_name_replace.txt
fi
}
copy_new_mv_to_webm_folder() {
OLDIFS=$IFS
IFS=$'n'
cd $webm_path
files=`ls -t`
for f in $files
do
mv "$f" "${f}1"
rm "${f}1"
done
cd $MV_path
folders=`ls -t`
for folder in $folders
do
cd "$folder"
files=`ls -t`
for file in $files
do
cp "$file" $webm_path
echo -e "复制新MV视频[$file]到webm工作目录成功!"
break
done
break
done
IFS=$OLDIFS
}
move_new_mv_or_new_handle_mv_to_download_folder() {
OLDIFS=$IFS
IFS=$'n'
echo -e "1.移动新mv视频视频到音视频下载目录n2.移动新处理mv视频到音视频下载目录n3.移动新处理mv视频到webm工作目录"
echo -n "请输入要进行操作所对应的数字:"
read number
if [[ $number -eq 1 ]]
then
cd $MV_path
folders=`ls -t`
for folder in $folders
do
cd "$folder"
files=`ls -t`
for file in $files
do
mv "$file" $video_audio_download_path
echo
echo -e "移动新MV视频[$file]到音视频下载目录成功!"
break
done
break
done
elif [[ $number -eq 2 ]]
then
cd $mp4_path
files=`ls -t`
for file in $files
do
mv "$file" $video_audio_download_path
echo
echo -e "移动新处理MV视频[$file]到音视频下载目录成功!"
break
done
elif [[ $number -eq 3 ]]
then
cd $webm_path
files=`ls -t`
for f in $files
do
mv "$f" "${f}1"
rm "${f}1"
done
cd $mp4_path
files=`ls -t`
for file in $files
do
mv "$file" $webm_path
echo
echo -e "移动新处理MV视频[$file]到webm工作目录成功!"
break
done
fi
IFS=$OLDIFS
}
send_new_mv_or_new_handle_mv_to_server_folder() {
OLDIFS=$IFS
IFS=$'n'
echo -e "1.发送新mv视频到服务器目录n2.发送新处理mv视频到服务器目录"
echo -n "请输入要进行操作所对应的数字:"
read number
if [[ $number -eq 1 ]]
then
cd $MV_path
folders=`ls -t`
for folder in $folders
do
cd "$folder"
files=`ls -t`
for file in $files
do
#mv "$file" $video_audio_download_path
#scp -P 8022 /sdcard/url_video_audio.json u0_a135@localhost:/storage/3532-6362/1/
sshpass -p ${server_password} scp -P $server_port "$file" ${server_username}@${server_host}:${server_folder}
#sshpass -p ${server_password} ssh -p $server_port ${server_username}@${server_host} "chmod -R 755 /var/www/html/video"
#echo
#echo "sshpass -p ${server_password} scp -P $server_port '$MV_path/$folder/$file' ${server_username}@${server_host}:${server_folder}"
echo
echo -e "发送新MV视频[$file]到服务器目录成功!"
break
done
break
done
elif [[ $number -eq 2 ]]
then
cd $mp4_path
files=`ls -t`
for file in $files
do
#mv "$file" $video_audio_download_path
sshpass -p ${server_password} scp -P $server_port "$file" ${server_username}@${server_host}:${server_folder}
#sshpass -p ${server_password} ssh -p $server_port ${server_username}@${server_host} "chmod -R 755 /var/www/html/video"
#echo
#echo "sshpass -p ${server_password} scp -P $server_port '$mp4_path/$file' ${server_username}@${server_host}:${server_folder}"
echo
echo -e "发送新处理MV视频[$file]到服务器目录成功!"
break
done
fi
IFS=$OLDIFS
}
delete_all_mv_and_all_handle_mv() {
OLDIFS=$IFS
IFS=$'n'
echo -e "确认要删除所有MV视频以及处理MV视频?"
echo -n "请输入true确认删除,输入其他取消操作:"
read choose
if [[ $choose == "true" ]]
then
unset works
i=0
cd $MV_path
folders=`ls -t`
for folder in $folders
do
cd "$folder"
files=`ls -t`
for f in $files
do
mv "$f" "${f}1"
rm "${f}1"
if [[ "$f" == "$folder"* ]]
then
works[$i]=$f
i=`expr $i + 1`
fi
done
cd ..
rm -r "$folder"
done
cd $mp4_path
files=`ls -t`
for f in $files
do
mv "$f" "${f}1"
rm "${f}1"
works[$i]=$f
i=`expr $i + 1`
done
if [[ ${#works[*]} -gt 0 ]]
then
echo -e "MV视频删除成功nn已处理视频:n"
for w in ${works[*]}
do
echo $w
done
echo
echo -e "视频总数:${#works[*]}"
echo
fi
fi
IFS=$OLDIFS
}
main() {
check_global_path
generate_url_replace_and_dir_name_replace
echo -n "欢迎使用视频下载处理脚本!"
echo
while true
do
echo -e "n1.获取含有视频url信息的json文件n2.提取高画质的音视频(mp4)url信息n3.重命名以及移动已下载的音视频文件n4.直接从视频链接下载视频n5.调用ffmpeg合并已下载好的音视频文件n6.使用aria2下载youtube音视频n7.音频文件压缩转换为MP3格式n8.视频文件压缩转换为MP4格式n9.复制新MV视频到webm工作目录n10.移动新mv视频或新处理mv视频到音视频下载目录n11.发送新mv视频或新处理mv视频到服务器目录n12.删除所有mv视频和处理mv视频n13.提取高画质的音视频(webm)url信息n14.创建与视频文件名称相同的文件夹n15.直接从Github下载源码更新you-getn16.批量下载bilibili中的视频集n17.将下载好的视频分段切割n18.根据起始结束时间切割视频n19.退出"
echo -n "请输入要进行操作所对应的数字:"
read choose
echo
if [[ ${choose} == "1" ]]
then
get_youtube_video_url_json
elif [[ ${choose} == "2" ]]
then
get_url_video_audio_json "mp4"
elif [[ ${choose} == "3" ]]
then
rename_remove_video_audio_files
elif [[ ${choose} == "4" ]]
then
direct_download_video_audio_files
elif [[ ${choose} == "5" ]]
then
concat_video_audio
elif [[ ${choose} == "6" ]]
then
video_audio_aria2_download
elif [[ ${choose} == "7" ]]
then
compress_flac_to_mp3
elif [[ ${choose} == "8" ]]
then
compress_webm_to_mp4
elif [[ ${choose} == "9" ]]
then
copy_new_mv_to_webm_folder
elif [[ ${choose} == "10" ]]
then
move_new_mv_or_new_handle_mv_to_download_folder
elif [[ ${choose} == "11" ]]
then
send_new_mv_or_new_handle_mv_to_server_folder
elif [[ ${choose} == "12" ]]
then
delete_all_mv_and_all_handle_mv
elif [[ ${choose} == "13" ]]
then
get_url_video_audio_json "webm"
elif [[ ${choose} == "14" ]]
then
create_video_folder
elif [[ ${choose} == "15" ]]
then
update_you_get_from_github
elif [[ ${choose} == "16" ]]
then
download_bilibili_videos
elif [[ ${choose} == "17" ]]
then
split_my_video
elif [[ ${choose} == "18" ]]
then
cutting_my_video
elif [[ ${choose} == "19" ]]
then
break
fi
done
}
main
- 使用方法
待更新,敬请期待。



