Nearly have music posting working. Currently if you use it there is a lot of output because curl is in verbose mode. It is giving an Invalid credentials error.

This commit is contained in:
stormdragon2976 2023-01-29 14:32:13 -05:00
parent 5a4abe1643
commit a55ce4db79
1 changed files with 8 additions and 2 deletions

View File

@ -32,8 +32,9 @@ get_oauth_token() {
fi
done
redirectURI="https://billy.wolfe.casa/ratatoskr-success.html"
website="https://git.stormux.org/storm/ratatoskr"
# get client id and secret
curl -s -X POST -d client_name="${softwareName}" -d "redirect_uris=${redirectURI}" -d "scopes=read write follow push" -d "website=https://git.stormux.org/storm/ratatoskr" "${instanceURL}/api/v1/apps" |
curl -s -X POST -d client_name="${softwareName}" -d "redirect_uris=${redirectURI}" -d "scopes=read write follow push" -d "website=${website}" "${instanceURL}/api/v1/apps" |
jq --raw-output '"client_id=\"\(.client_id)\"\nclient_secret=\"\(.client_secret)\""' > "${configPath}/${configFile}"
# Load the new variables from the configuration file
source "${configPath}/${configFile}"
@ -50,6 +51,7 @@ get_oauth_token() {
fi
read -er oauth_token
echo "oauth_token=\"${oauth_token}\"" >> "${configPath}/${configFile}"
echo "instanceURL=\"${instanceURL}\"" >> "${configPath}/${configFile}"
}
@ -57,7 +59,11 @@ get_oauth_token() {
# Post music with -M flag
post_music() {
echo "Work in progress..."
curl -vS --oauth2-bearer "${oauth_token}" \
-d "$(playerctl metadata -f 'album={{album}}')" \
-d "$(playerctl metadata -f 'artist={{artist}}')" \
-d "$(playerctl metadata -f 'title={{title}}')" \
"${instanceURL}/api/v1/pleroma/scrobble"
exit 0
}