diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2024-02-13 13:21:05 +0100 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2024-02-13 13:21:05 +0100 |
commit | df55f83d1394842559abfa3ebb883dc4ce99975b (patch) | |
tree | 35cd1f6a0e5e31cd55ded0ae86b9f297881253c1 | |
parent | fc529f9632144037b416e965f0c941fecde277fc (diff) | |
download | scripts-df55f83d1394842559abfa3ebb883dc4ce99975b.tar.gz scripts-df55f83d1394842559abfa3ebb883dc4ce99975b.zip |
Minor adjustments to cmusShow.sh and vol.sh.
-rwxr-xr-x | cmusShow.sh | 33 | ||||
-rwxr-xr-x | vol.sh | 2 |
2 files changed, 25 insertions, 10 deletions
diff --git a/cmusShow.sh b/cmusShow.sh index b61e908..4382e68 100755 --- a/cmusShow.sh +++ b/cmusShow.sh @@ -21,11 +21,20 @@ sToTime() { echo "${min}:${s}" } -# Album art info +getAlbumIcon() { + albumIcon="/tmp/$(echo "$playingFile" | base64 -w0).png" + ffmpeg -y -i "$playingFile" -an -vf scale="${iconSize}:${iconSize}" "$albumIcon" + echo "$albumIcon" +} + +# Song info playingFile="$(getCmusInfo 'file' '2')" -albumArt="/tmp/$(echo "$playingFile" | base64 -w0).png" -ffmpeg -y -i "$playingFile" -an -vf scale="${iconSize}:${iconSize}" "$albumArt" +title="πΆ $(getCmusInfo 'tag title' '3') πΆ" +artist="π§βπ€ $(getCmusInfo 'tag artist' '3')" +album="$(getCmusInfo 'tag album' '3') π½" +duration="$(getCmusInfo 'duration' '2')" +albumIcon="$(getAlbumIcon)" # Bluetooth info @@ -40,25 +49,31 @@ if bluetoothctl info; then bluetoothInfo="\n${device} - ${battery}" fi +playingIcon='' i=0 while [ "$i" -lt "$steps" ]; do - playingIcon='' + currentlyPlayingFile="$(getCmusInfo 'file' '2')" + if [ "$currentlyPlayingFile" != "$playingFile" ]; then + albumIcon="$(getAlbumIcon)" + title="πΆ $(getCmusInfo 'tag title' '3') πΆ" + artist="π§βπ€ $(getCmusInfo 'tag artist' '3')" + album="$(getCmusInfo 'tag album' '3') π½" + duration="$(getCmusInfo 'duration' '2')" + playingFile="$currentlyPlayingFile" + fi + [ "$(getCmusInfo 'status' 2)" = 'playing' ] && playingIcon='βΆοΈ' [ "$(getCmusInfo 'status' 2)" = 'paused' ] && playingIcon='βΈοΈ' - title="πΆ $(getCmusInfo 'tag title' '3') πΆ" - artist="π§βπ€ $(getCmusInfo 'tag artist' '3')" - album="$(getCmusInfo 'tag album' '3') π½" position="$(getCmusInfo 'position' '2')" - duration="$(getCmusInfo 'duration' '2')" percentage="$(awk "BEGIN { print int(${position}/${duration}*100) }")" dunstify \ -r "$(dunstifyIDs.sh cmusShow)" \ -t 1000 \ - -i "$albumArt" \ + -i "$albumIcon" \ -h "int:value:${percentage}" \ "${title}" \ "${artist} - ${album}\n${playingIcon} $(sToTime "${position}") - $(sToTime "${duration}")${bluetoothInfo}" @@ -9,7 +9,7 @@ else fi text="$(~/scripts/i3blocks/i3vol.sh)" -vol="$(echo "$text" | cut -d' ' -f2-)" +vol="$(echo "$text" | grep -Eo '[0-9]+')" dunstify -r "$(dunstifyIDs.sh "vol")" \ -t 500 \ |