From a62579fe0f403b0173a6758e7a7b046af1377055 Mon Sep 17 00:00:00 2001 From: "akshay@mrtsukimoto.in" Date: Sat, 17 Dec 2022 12:07:57 +0530 Subject: [PATCH] polybar music script update --- neomutt/neomuttrc | 8 ++++---- polybar/scripts/music | 21 +++++++++++++++------ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/neomutt/neomuttrc b/neomutt/neomuttrc index 7a6ef5e..8b5b11b 100644 --- a/neomutt/neomuttrc +++ b/neomutt/neomuttrc @@ -186,10 +186,10 @@ source /usr/lib/neomutt/source-neomuttrc.d| #set query_command = "khard email --parsable --search-in-source-files '%s'" set mbox_type = Maildir -set smtp_url = "https://example.com:587 " -set smtp_pass = "secret" -set folder = "" -set imap_pass = "secret" +set smtp_url = "smtp://akshay@10.22.13.6:25" +set smtp_pass = "Mee1ujo2eegeingu" +set folder = "imaps://akshay@10.22.13.6:143" +set imap_pass = "Mee1ujo2eegeingu" set realname = "Akshay Pushparaj" set spoolfile = "+INBOX" set ssl_starttls = yes diff --git a/polybar/scripts/music b/polybar/scripts/music index ad746b5..d656346 100755 --- a/polybar/scripts/music +++ b/polybar/scripts/music @@ -10,22 +10,31 @@ if [ "$down" = "$none" -o "$down" = "Stopped" ]; then else tracklength=$(playerctl metadata mpris:length 2>&1| sed 's/.\{6\}$//') current=$(playerctl position 2>&1 | sed 's/.\{7\}$//') - if [ "$tracklength" -ge 3600 ]; then + if [ "$tracklength" = "No player could handle this c" ]; then + duration="" + elif [ "$tracklength" -ge 3600 ]; then duration=$(date -d@"$tracklength" -u +%H:%M:%S 2>&1) else + echo $tracklength duration=$(date -d@"$tracklength" -u +%M:%S 2>&1) fi - if [ "$current" -ge 3600 ]; then + if [ "$current" = "No player could handle this " ]; then + position = "" + elif [ "$current" -ge 3600 ]; then position=$(date -d@"$current" -u +%H:%M:%S 2>&1) else position=$(date -d@"$current" -u +%M:%S 2>&1) fi artist=$(playerctl metadata xesam:artist 2>&1) song=$(playerctl metadata xesam:title 2>&1) - if [ "$down" = "Playing" ]; then - echo "$song | $position" - elif [ "$down" = "Paused" ]; then - echo "$song | $position | $duration | paused" + if [ "$down" = "Playing" -a "$position" != "" ]; then + echo "$song - $position" + elif [ "$down" = "Paused" -a "$position" != "" ]; then + echo "$song | $position - $duration" + elif [ "$down" = "Playing" -a "$position" = "" ]; then + echo "$song" + elif [ "$down" = "Paused" -a "$position" = "" ]; then + echo "$song" else exit fi