From 0d80aa0cfeca2c9eca686ccb5ac25a8912e7935d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=87=E8=B6=A3=E4=BF=9D=E7=BD=97?= Date: Tue, 3 Oct 2023 00:30:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=81=A2=E5=A4=8D=E9=AD=85=E6=97=8F=20?= =?UTF-8?q?16=20=E5=9C=A8=E5=B0=8F=E7=AA=9D=E4=B8=8A=E7=9A=84=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=88=AA=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- meizu-16-photo-recover.sh | 2 +- meizu-16-screenshot-recover.sh | 51 ++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 meizu-16-screenshot-recover.sh diff --git a/meizu-16-photo-recover.sh b/meizu-16-photo-recover.sh index 94ff7b4..2ccd5e1 100644 --- a/meizu-16-photo-recover.sh +++ b/meizu-16-photo-recover.sh @@ -4,7 +4,7 @@ server="https://paul.ren/api" #server="https://home.paul.xin/api" -token="eyJpZCI6MSwibmFtZSI6IlBhdWwiLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE2OTYwNzE0NDIsImV4cCI6MTY5NjA5MzA0Mn0=@/r0lW8rqIDoQuv5KrxSQ/O9VTxtHgRH5uZg10BWhYXo=" +token="eyJpZCI6MSwibmFtZSI6IlBhdWwiLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE2OTYxNTk5MzAsImV4cCI6MTY5NjE4MTUzMH0=@l7dtsNeuqZ6FzoU1FGhcrUNoRh69sS/iLCNdoks+jdE=" # 创建文件夹 output mkdir -p output diff --git a/meizu-16-screenshot-recover.sh b/meizu-16-screenshot-recover.sh new file mode 100644 index 0000000..a389bc0 --- /dev/null +++ b/meizu-16-screenshot-recover.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# 恢复魅族 16 在小窝上的部分截图 + +server="https://paul.ren/api" +#server="https://home.paul.xin/api" +token="eyJpZCI6MSwibmFtZSI6IlBhdWwiLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE2OTYxNTk5MzAsImV4cCI6MTY5NjE4MTUzMH0=@l7dtsNeuqZ6FzoU1FGhcrUNoRh69sS/iLCNdoks+jdE=" + +# 创建文件夹 output +mkdir -p output + +# 遍历当前文件夹下的所有 jpg 文件 +for file in *.png; do + + # 存储图片名到变量 + filename=$(basename "$file") + + # 将文件名中的 .png 替换为 .jpg + new_filename=${filename/.png/.jpg} + + # 发送 GET 请求获取 JSON 数据 + response=$(curl --header "paul-token: $token" -s "$server/media/get/?origin_name=$new_filename") + + # 提取 id + id=$(echo "$response" | jq -r '.data.id') + + # 如果没有 id,则跳过当前循环 + if [ -z "$id" ]; then + echo "匹配 $new_filename 失败\n" + continue + fi + + echo "匹配 $new_filename 成功,id 是 $id\n" + + # 使用 ImageMagick 处理图片 + convert "$file" -quality 80 "output/$new_filename" + + # 使用 exiftool 抹掉图片的 gps 信息,并设置作者名称为 Paul + #exiftool -gps:all= -artist="Paul" -overwrite_original "output/$filename" + exiftool -overwrite_original -gps:all= -artist="奇趣保罗" -CreatorTool= "output/$new_filename" + + # 提交该文件给服务器 + curl --location "$server/media/update" \ + --header "paul-token: $token" \ + --form "id=$id" \ + --form "photo=@output/$new_filename" \ + --form 'IGNORE_UPDATE_TIME="1"' + + echo "\n\n" + +done