Last active
August 28, 2024 04:01
-
-
Save rvllvd/4b6cd1cea23d7d30c62d29179c24881d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| ## -----------------------------------------------------------------------------------/ | |
| ## -- Requires cli mastodon toot client to work (https://github.com/ihabunek/toot) --/ | |
| ## -- Arch install: `pacman -S toot` -----------------------------------------------/ | |
| ## --------------------------------------------------------------------------------/ | |
| get_info() { | |
| cmus-remote -Q | grep "$1 " | sed "s/$1 //" | |
| } | |
| COVER=$(get_info "file" | rev | cut -d "/" -f2- | rev)/cover.jpg | |
| TITLE=$(get_info "tag title") | |
| ALBUM=$(get_info "tag album") | |
| ARTIST=$(get_info "tag artist") | |
| ALBUM_HASHTAG=$(echo $ALBUM | sed "s/ //gi") | |
| ARTIST_HASHTAG=$(echo $ARTIST | sed "s/ //gi") | |
| ALTTEXT="Cover of the music album «$ALBUM» by $ARTIST" | |
| MESSAGE="#NowPlaying $ARTIST — $TITLE | |
| #Music #$ARTIST_HASHTAG #$ALBUM_HASHTAG" | |
| toot post "$MESSAGE" -d "$ALTTEXT" --media "$COVER" -v public |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment