Created
August 13, 2021 01:00
-
-
Save yunginnanet/af37f3bbcc7fc7011a16ac28367d2dcd 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 | |
####################### | |
# | |
# Example Screenshot: | |
# tcp.ac/i/bg9Xb | |
# | |
# Dependencies | |
# 1) figlet | |
# 2) playerctl | |
# 3) jp2a | |
# 4) colorize | |
# | |
# IRC usage examples: | |
# | |
# A) weechat local: | |
# /exec -o spotify.sh | |
# | |
# B) weechat remote: | |
# (in weechat client) | |
# 1) /exec mkfifo /tmp/art | |
# 2) /exec -o cat /tmp/art | |
# | |
# (on your local computer) added accounts field for verified email status | |
# 1) bash spotify.sh | ssh [email protected] "cat - > /tmp/art" | |
# | |
# - kayos | |
# | |
# ircd.chat/6697 | |
# #tcpdirect | |
# | |
####################### | |
# COLOR CHOICES # | |
# none, black, red, | |
# green, yellow, blue, | |
# magenta, cyan, white, | |
# default, random | |
# ONE LINER FIGLET FONT DEMO # | |
# find /usr/share/figlet/ -type f -print | while read _f; do _font=$(echo "$_f" | \ sed 's|/usr/share/figlet/||g'); echo -e "------------\n$_font\n"; toilet -w 100 -f "$_font" "Rick Astley" 2>/dev/null; done | less | |
##### CONFIG ##### | |
# font to use for artist and song title | |
_titlefont="fig.wideterm" | |
# font to use for album art | |
_albumfont="fig.wideterm" | |
# number of columns for the album art | |
_albumartwidth=55 | |
# max columns for artist and song title before wrapping | |
_titlewidth=100 | |
# max columns for album title before wrapping | |
_albumwidth=55 | |
# color for artist and song | |
_titlecolor="yellow" | |
# color for album title | |
_albumcolor="none" | |
################# | |
# use MPRIS from our boi dbus (playerctl) to grab the spotify art and fix the broken link they give you | |
playerctl metadata | | |
sed 's/open.spotify.com/i.scdn.co/g' | | |
grep image | | |
awk '{print $NF}' | | |
xargs jp2a --color --color-depth=24 --width="$_albumartwidth"; | |
# assign metadata to variables | |
_artist=$(playerctl metadata artist) | |
_album=$(playerctl metadata album) | |
_title=$(playerctl metadata title) | |
_url=$(playerctl metadata xesam:url) | |
# ???? | |
echo -e "\t"; figlet -f "$_titlefont" "$_artist - $_title" -w "$_titlewidth" | colorize "$_titlecolor/none" | |
figlet -n -f "$_albumfont" -w "$_albumwidth" " $_album" | colorize "$_albumcolor/none"; | |
echo -e "[ $_url ]" | |
# PROFIT!!!!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment