diff --git a/ratatoskr.sh b/ratatoskr.sh index de9d0bf..62635e0 100755 --- a/ratatoskr.sh +++ b/ratatoskr.sh @@ -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 }