Update 'post.sh'

This commit is contained in:
NaiJi ✨ 2022-05-13 11:29:11 +00:00
parent daf2a87ad6
commit 5494badd0e
1 changed files with 10 additions and 1 deletions

11
post.sh
View File

@ -1,4 +1,5 @@
#!/bin/bash
if [ -z $(which jq) ]
then
echo "Missing jq package, please install"
@ -21,6 +22,11 @@ then
exit 1
fi
if [ 0 -eq $(ls ./music | wc -l) ];
then
mv posted_already/* music/
fi
api_base_url="https://udongein.xyz/"
access_token="$(cat ${token_dat})"
@ -51,10 +57,13 @@ media_music_id=$(jq -r ".id" <<< ${media_music_json})
echo $media_json
curl -X POST -d '{"status":" :mikulove: '"${full_title}"' by '"${full_artist}"' '"${link}"'", "visibility":"'unlisted'", "media_ids":'[\"${media_cover_id}\",\"${media_music_id}\"]'}' \
curl -X POST -d '{"status":"'"${full_title}"' by '"${full_artist}"' :mikulove: '"${link}"'", "visibility":"'unlisted'", "media_ids":'[\"${media_cover_id}\",\"${media_music_id}\"]'}' \
-H "Authorization: Bearer ${access_token}" \
-H "Content-Type: application/json" \
"${api_base_url}/api/v1/statuses"
rm -f temp.opus
rm -f cover.*
mkdir -p posted_already/
mv music/"$folder_name" posted_today/