scrobble-me.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. #
  3. # Copyright 2023 Jeff Cliff
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or (at
  8. # your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful, but
  11. # WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. # General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program at COPYING.GPL. If not, see <https://www.gnu.org/licenses/>.
  17. #
  18. #
  19. # add this to audacity's "song change" plugin
  20. # for PATH_TO_SCRIPT wherever you put this
  21. # echo "%a" > /tmp/scrobblescript-artist; echo "%b" > /tmp/scrobblescript-album; echo "%T" > /tmp/scrobblescript-title; [PATH_TO_SCRIPT]/scrobble-me.sh
  22. # in song start song end and network filename change
  23. HOME=/home/themusicgod1
  24. INSTANCE=shitposter.world
  25. #echo "
  26. TITLE=`cat /tmp/scrobblescript-title`;
  27. #echo "ARTIST:"
  28. ARTIST=`cat /tmp/scrobblescript-artist`;
  29. #echo "ALBUM:"
  30. ALBUM=`cat /tmp/scrobblescript-album`;
  31. echo "TOKEN:"
  32. TOKEN=`cat $HOME/.config/toot/config.json | grep access_token | awk -F':' '{print $2}' | awk -F'"' '{print $2}'`
  33. #echo $TOKEN
  34. #echo $ARTIST " " $TITLE " " $ALBUM
  35. curl -X POST \
  36. -d "title=$TITLE " \
  37. -d "album=$ALBUM " \
  38. -d "artist=$ARTIST " \
  39. -H 'Authorization: Bearer '$TOKEN \
  40. https://$INSTANCE/api/v1/pleroma/scrobble