修复图片异常比例判断逻辑

master
panqihua 3 years ago
parent 622520ceb2
commit e8116a3560
  1. 8
      pixiv/pixiv.sh

@ -321,7 +321,7 @@ do
echo "download image file name=$webp_file_name,url=$webp_url" echo "download image file name=$webp_file_name,url=$webp_url"
curl -v $webp_url -o $webp_file_name curl -v $webp_url -o $webp_file_name
image_ratio=`file $webp_file_name|awk '{print $9}'|sed -e 's/,//'|sed '/^$/d'|awk '{split($0,a,"x");f=a[1]>a[2]?a[1]/a[2]:a[2]/a[1];print f}'` image_ratio=`file $webp_file_name|awk '{print $9}'|sed -e 's/,//'|sed '/^$/d'|awk '{split($0,a,"x");f=a[1]>a[2]?a[1]/a[2]:a[2]/a[1];print f}'`
if [[ -n $image_ratio && $image_ratio > $maxRatio ]] if [[ -n $image_ratio && `echo "$image_ratio > $maxRatio"|bc` -eq 1 ]]
then then
echo "图片分辨率`file $webp_file_name|awk '{print $9}'|sed -e 's/,//'`比率:$image_ratio>$maxRatio,视为异常,返回异常图片" echo "图片分辨率`file $webp_file_name|awk '{print $9}'|sed -e 's/,//'`比率:$image_ratio>$maxRatio,视为异常,返回异常图片"
watermark=`echo "画作pid:$pid"|base64` watermark=`echo "画作pid:$pid"|base64`
@ -349,9 +349,11 @@ do
then then
command="curl -v -F chat_id=$chat_id $fileList -F media='[`echo $media | cut -c 2-`]' $baseApi/sendMediaGroup" command="curl -v -F chat_id=$chat_id $fileList -F media='[`echo $media | cut -c 2-`]' $baseApi/sendMediaGroup"
echo "上传图片命令:$command" echo "上传图片命令:$command"
bash -c "$command" result=`bash -c "$command"`
message_id=`echo $result|jq .result.message_id`
echo "message_id:$message_id"
sleep $sleepImage sleep $sleepImage
curl -v -d chat_id=$chat_id -d text="以上作品日榜排名分别是 #排名${start_rank}_${end_rank} #rank${start_rank}_${end_rank} ,点击作品可以查看pid/标题/画师/tag信息." $baseApi/sendMessage curl -v -d chat_id=$chat_id -d reply_to_message_id=$message_id -d text="以上作品日榜排名分别是 #排名${start_rank}_${end_rank} #rank${start_rank}_${end_rank} ,点击作品可以查看pid/标题/画师/tag信息." $baseApi/sendMessage
sleep $sleepText sleep $sleepText
fileCountSize=0 fileCountSize=0
fileList='' fileList=''

Loading…
Cancel
Save