You are not logged in.
Pages: 1
Hi all!
I made a bash script that reads informations on the current track from dbus and displays them on conky.
I will let you take a look at it with a screenshot.
It works pretty fine, I would like to share it with you, and I would like that someone gave me some hints for letting it work better.
Criticities I noticed:
- I have to read every 1 second from dbus even if the song doesn't change.
- I have to download the album cover from the spotify album URL, but I suppose I already have it somewhere in cache.
I uploaded the code on github, so that you can see it here.
If you have any other suggestion, let me know.
Thank you in advance.
Last edited by Dexxt (2014-03-26 18:40:26)
Offline
Moving to Community Contribs...
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
@Dexxt: Are you still running your script? I made something similar for clementine some time ago. I've been without archlinux for some time and am setting up a fresh install. However, running the bash script that gathers the music information doesn't work when executed by conky since the dbus queries yield no result. Running them from the terminal works fine. Maybe I forgot to install/configure something, or did you encounter something similar?
Offline
Hey! It's nice to hear from you.
What Desktop Environment are you using? - I use Gnome!
If you have troubles with permissions do the following further steps:
#: chmod -R 777 ~/.conkycolors/spotify
I tried it on a fresh install and it seems to work, but first I had to install wget.
#: pacman -S wget
then everything went fine.
How do you run spotify? I just use:
$: conky -c ~/.conkycolors/conkyrc
Offline
Hi Dexxt,
I doubt it was a problem with permissions in my case. To be honest, I don't really know why it wasn't working back then or why it is working again now. My WM is Awesome, I think I tried running it with dbus-launch in .xinitrc, maybe that fixed it. However, checking my .xinitrc now, I see that I'm just running plain "exec awesome" :s
I run conky from .xinitrc. However, I added a delay before starting conky so that it would only be launched after an Internet connection could be established (since a few sections require it), that might have helped as well... my .xinitrc entry looks like this:
sleep 90 && conky -c $HOME/git/linux-scripts/conky/.conkyrc &
Offline
Hello, great job but I'm facing some issues and I wonder if you could help me.
If the bash script files are changed to executable conky won't load. If I remove the x attribute it loads but the scripts won't work (as expected). The weirdest thing is that the scripts work separately (they can be run in on a terminal) but the output is not presented on conky (cause conky won't load).
Has anyone faced something similar?
Thank you
Last edited by vanderlaars (2014-11-01 11:59:24)
Offline
Hi vanderlaars, bash scripts executed by conky should be executable (like all bash scripts). How does .conkyrc look like? Have you checked whether the bash scripts are actually being executed? And whether they produce errors?
Offline
Hello Mystyfly, thank you for your answer.
I'm no newbie to Linux. I'm not a bash expert but I know about the file "properties".
It was (like I wrote) expected that the bash scripts wouldn't be run after I removed the execution property of them. I just wanted to check if it was this that kept my conky from loading. And it was that.
My conkyrc (conky.conf) is somewhat large but it's the spotify part (copied from the code that Dexxt published) that's causing the problem. Here it is:
${voffset 4}${font DroidSans:bold:size=8}${color4}SPOTIFY${offset 8}${color8}${voffset -2}${hr 2}${font}
${if_running spotify}${voffset -2}${font Liberation Sans:style=Bold:size=8}
${voffset -10}${goto 73}Title:
${goto 73}${color2}${exec ~/conkyscripts/.spotify/spotify_info_title}${color}
${goto 73}Artist:
${goto 73}${color2}${exec ~/conkyscripts/.spotify/spotify_info_artist}${color}
${goto 73}Album:
${goto 73}${color2}${exec ~/conkyscripts/.spotify/spotify_info_album}${color}
${voffset -20}
${exec ~/conkyscripts/.spotify/spotify_album_cover}
${image ~/conkyscripts/.spotify/last_album_pic.png -p 0,604 -s 60x60}
${else}${voffset -5}${color0}${font ConkyColors:size=16}G${font}${color}${voffset -10}${goto 32}Spotify: ${color2}off${color}${voffset 7}
${endif}
It's the same code only adapted to my system (directories).
Offline
If it's a code-specific problem then you should probably wait from a response from Dexxt, I don't use his script myself. I can't really tell why conky wouldn't load without seeing any error message or something similar.
FWIW, I created a similar script that reads dbus information about clementine (since that's the music player I use) and displays the data on conky. However, I put all the scripting into the bash script, so it's clearer and easier to use and also that all data is retrieved by one single call (rather than calling for each attribute separately). My bash script outputs "conky code" that is added to conky with "execpi". You can have a look at it here.
Offline
Does conky need special permission to run exec? Cause this is what seems to be the problem.
Offline
Hello again Mystyfly, thank you once again for your answer.
Will have a look at your script now. And yeah, I agree that calling three bashscripts and I've seen a few spotify examples around but Dexxts was the one that looked better.
I will look now at your solution.
Thank you once again.
Offline
No, conky shouldn't require special permissions, if the user that started conky is the same user that owns the scripts. Have you tried running other scripts (like "echo foo") from conky? That could help tell you where the problem lies... Is there no output from conky that points you in that direction?
Offline
Hi @mystyfly!
Could you please paste here the output of:
ls -la ~/.conkycolors/spotify
that could be fast to understand your problem!
Offline
You probably meant vanderlaars
Offline
Hello Dexxt, it was actually me who's having issues.
Here's my result:
-rw-rw-r-- 1 olivju olivju 20761 Nov 1 16:40 last_album_pic.png
-rwxrwxrwx 1 olivju olivju 953 Oct 31 21:16 spotify_album_cover
-rwxrwxrwx 1 olivju olivju 924 Oct 31 21:09 spotify_info_album
-rwxrwxrwx 1 olivju olivju 951 Oct 31 21:09 spotify_info_artist
-rwxrwxrwx 1 olivju olivju 925 Oct 31 21:09 spotify_info_title
olivju@4MO-R4V1-A016:~/conkyscripts/.spotify$ ls -al > result.txt
As you can see, all bash files are executable and I changed the permissions so everyone can read/write and execute. It shouldn't be a problem but conky won't load if the files exe executable.
Offline
Hey Mystyfly, could you please publish some screenshot with your conky???? PLZ????
Offline
Offline
vanderlaars,
have you tried moving the .spotify folder inside ./conkycolors?
cp -r ~/conkyscripts/.spotify ~/.conkycolors/spotify
because the script may need a common root.
Last edited by Dexxt (2014-11-02 14:31:34)
Offline
Hey Mystyfly, thank you for your answer. Busy day today but I finally had time to test your code:
Now I need to tweak a little more to get the rest done.PS: I also had to install Clementine and teh spotify plugin but I'm happy I did it.
Thank you very much!!!
Offline
Pages: 1