Skip to content

Instantly share code, notes, and snippets.

@rvllvd
Last active August 28, 2024 04:01
Show Gist options
  • Select an option

  • Save rvllvd/4b6cd1cea23d7d30c62d29179c24881d to your computer and use it in GitHub Desktop.

Select an option

Save rvllvd/4b6cd1cea23d7d30c62d29179c24881d to your computer and use it in GitHub Desktop.
#!/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