You are not logged in.

#2541 2025-11-02 17:40:20

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 952

Re: Show us your conky

@loutch

Let's go back to my 'percentage' line:

percentage=$(echo "scale=1;$current*100/15 + 0.5" | bc | awk '{print int($1)}')

Your last screenshot shows 01:55 on the left and 04:04 on the right.
If we convert to seconds, that's 115 seconds (60+55) on the left and 244 seconds (4x60+4) on the right.

It would look like this in my percentage line:

$ echo "scale=1;115*100/244 + 0.5" | bc | awk '{print int($1)}'
47

That's the correct result.

You know I can't test, but try adding "percentage" to the script:

...
		else
            percentage=$(echo "scale=1;$POS*100/$TOTAL + 0.5" | bc | awk '{print int($1)}')
            positionTime=$(convertsec $POS)
            lengthTime=$(convertsec $TOTAL)
			length=$(($TOTAL/1000000))
			position=$(($POS/1000000))  #  ←←←←←← here  
		fi
		
vol=$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Volume)

echo $percentage
	
#    echo $length 
#    echo $position 
#   echo $positionTime 
#    echo $lengthTime		

Last edited by marens (2025-11-02 18:24:50)


If people would know how little brain is ruling the world, they would die of fear.

Offline

#2542 2025-11-02 19:00:55

loutch
Member
Registered: 2015-12-12
Posts: 929

Re: Show us your conky

Re
For my part, I took the opposite approach.
I took Bleys' conky and tinkered with it until it picked up Spotify  in progress  .

For now, I have everything except the cover art.

For that, I'm using Madh93's script.

All of this gives me the following result.

gAa0FgK9_t.png

I still don't understand how now.lua manages to make the exbar the right length.

Thanks again, I'll take a look at your part of the script.

@+

Last edited by loutch (2025-11-02 19:59:15)


Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX

Offline

#2543 2025-11-03 00:42:40

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 952

Re: Show us your conky

loutch wrote:

Thanks again, I'll take a look at your part of the script.

Let's first go back to your execbar here:
https://forums.bunsenlabs.org/viewtopic … 43#p146743

Replace:

${execbar 2, 250 expr 100 \* $(audtool --current-song-output-length-seconds) \/ $(audtool --current-song-length-seconds)}

with:

${if_match "${exec qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep "^mpris:length" | awk '{print $2}'}" != "0"}\
${execbar 2,250 exec echo "scale=1;$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Position)*100/$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep "^mpris:length" | awk '{print $2}') + 0.5" | bc | awk '{print int($1)}'}\
${else}${execbar 2,250 exec echo '0.05'}${endif}

I hope there are no typos.  smile

Last edited by marens (2025-11-03 03:12:00)


If people would know how little brain is ruling the world, they would die of fear.

Offline

#2544 2025-11-03 09:42:16

loutch
Member
Registered: 2015-12-12
Posts: 929

Re: Show us your conky

Hello

Sorry don't work

this in console & this

uZ4UgrUs_t.png

sh: 1: Syntax error: end of file unexpected (expecting ")")
conky: reading exec value failed (perhaps it's not the correct format?)
sh: 1: Syntax error: end of file unexpected (expecting ")")
conky: reading exec value failed (perhaps it's not the correct format?)
sh: 1: Syntax error: end of file unexpected (expecting ")")
conky: reading exec value failed (perhaps it's not the correct format?)
sh: 1: Syntax error: end of file unexpected (expecting ")")
conky: reading exec value failed (perhaps it's not the correct format?)
............ect ...

without it's okay , no errors in terminal.


nXLkLYHt_t.png

@+


Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX

Offline

#2545 2025-11-03 13:31:21

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 952

Re: Show us your conky

marens wrote:

I hope there are no typos.  smile

As expected.  big_smile


If people would know how little brain is ruling the world, they would die of fear.

Offline

#2546 2025-11-03 14:22:30

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 952

Re: Show us your conky

Try in the terminal when conky is running (the song is playing):

echo "scale=1;$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Position)*100/$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep "^mpris:length" | awk '{print $2}') + 0.5" | bc | awk '{print int($1)}'

It should be the percentage for the execbar.


If people would know how little brain is ruling the world, they would die of fear.

Offline

#2547 2025-11-03 15:44:07

loutch
Member
Registered: 2015-12-12
Posts: 929

Re: Show us your conky

Re

work great in terminal & in conky .

Made a script & run it in conky with this command.

execbar 2,164 ~/.conky/conky-spotify/scripts/marens_bare.sh

7G8S51bV_t.png

HJv2AcBf_t.png

MANY TANKS


@+

Last edited by loutch (2025-11-03 16:20:29)


Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX

Offline

#2548 2025-11-03 18:34:20

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 952

Re: Show us your conky

^ Very nice, but not finished yet.

When the song doesn't play, then we have to divide by zero.
That's not possible.

We have to work around that in the script.

The script should look like this:

#!/bin/bash

total=$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep "^mpris:length" | awk '{print $2}')

if [[ "$total" != "0" ]]; then

     percentage=$(echo "scale=1;$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Position)*100/$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep "^mpris:length" | awk '{print $2}') + 0.5" | bc | awk '{print int($1)}')

     echo $percentage
      
   else
   
     echo '0.05'
      
fi

The command echo '0.05'  is a little trick to make the execbar work properly.  big_smile

EDIT

You know I can't test it, but this is also possible:

if [[ "$total" != "" ]]; then

Last edited by marens (2025-11-03 18:46:29)


If people would know how little brain is ruling the world, they would die of fear.

Offline

#2549 2025-11-03 19:18:17

loutch
Member
Registered: 2015-12-12
Posts: 929

Re: Show us your conky

Re

Oki-doki.

@+


Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX

Offline

#2550 2025-11-04 10:10:52

loutch
Member
Registered: 2015-12-12
Posts: 929

Re: Show us your conky

Hello

This morning

BLKOvdca_t.png

@+


Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX

Offline

#2551 2025-11-08 08:16:15

loutch
Member
Registered: 2015-12-12
Posts: 929

Re: Show us your conky

Hello

Conky-spotify

40qfGxup_t.png

Modified when there is advertising.

QlfW68N4_t.png

@+

Last edited by loutch (2025-11-08 08:18:39)


Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX

Offline

Board footer

Powered by FluxBB