![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
|
General Help All your general support questions for Ubuntu, Kubuntu, Edubuntu and Xubuntu. |
| View Poll Results: How useful is this? | |||
| Very useful |
|
1 | 50.00% |
| Useless |
|
0 | 0% |
| I just want to view the poll result |
|
1 | 50.00% |
| Voters: 2. You may not vote on this poll | |||
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
100% Pure Ubuntu
![]() Join Date: Aug 2008
Location: germany
Beans: 857
|
Conky gmusicbrowser script
Hi folks.
I decided to write a script to integrate gmusicbrowser into conky without having to patch the source, which isn't really necessary imho. If anyone is interested in it, here it is: Code:
See below for updated version ~/Scripts/gmusicinfo.sh Assuming you saved it to the place above, you gotta make it executable with: Code:
chmod +x ~/Scripts/gmusicinfo.sh A conky example: Code:
${color black}${font Comic Sans MS:size=11}${if_existing ~/.config/gmusicbrowser/gmusicbrowser.fifo}${execi 2 cat ~/.config/gmusicbrowser/nowplaying.info|grep "Artist:"|cut -d":" -f2} - ${execi 2 cat ~/.config/gmusicbrowser/nowplaying.info|grep "Title:"|cut -d":" -f2}${else} ${alignr}${font Comic Sans MS:size=7}no music played $endif$color$font
${color black}${font Comic Sans MS}${if_existing ~/.config/gmusicbrowser/gmusicbrowser.fifo}${execi 5 cat ~/.config/gmusicbrowser/nowplaying.info|grep "Album:"|cut -d":" -f2}(${execi 5 cat ~/.config/gmusicbrowser/nowplaying.info|grep "Date:"|cut -d":" -f2}) ${else} $endif
${font Sans:size=8}${if_existing ~/.config/gmusicbrowser/gmusicbrowser.fifo}${execi 2 ~/Scripts/gmusicinfo.sh position} of ${execi 10 ~/Scripts/gmusicinfo.sh total} ${execibar 2 ~/Scripts/gmusicinfo.sh progress} $endif
Enjoy.
__________________
Tips&Tricks JABBER/GAJIM transport setup -- free image&file hosting -- GRUB usage conky&gmusicbrowser -- nVidia-get Last edited by loomsen; April 29th, 2009 at 03:13 AM.. Reason: deleted residual custom formatting |
|
|
|
|
|
#2 |
|
100% Pure Ubuntu
![]() Join Date: Aug 2008
Location: germany
Beans: 857
|
Re: Conky gmusicbrowser script
OBSOLETE - SEE NEW VERSION BELOW
However, the part about the ratings isn't included in the new script, thus I won't remove it Added rating... But, obviously I'm a pretty lonesome using gmusicbrowser? However, here it is: Code:
#!/bin/bash
# gmusicbrowser script by loomsen
# if you want to contact me: loomsen<at>googlemail.com
#
# You should enable the nowplaying plugin in gmusicbrowsers options, i.e. you could specify the command as:
# tee ~/.config/gmusicbrowser/nowplaying.info
# and check option to send standard input. Usage of this script:
# ./gmusicbrowser.sh <variable> (Possible var: total, position, progress)
# for conky you could use sth like this:
# ${execi 2 ~/path/to/script/gmusicbrowser.sh position}
# to get the current position
file=~/.config/gmusicbrowser/nowplaying.info ## the file gmusic sends standard input to
time=`cat $file | grep "Length" | cut -d":" -f2`
elapsed=`dbus-send --print-reply --dest=org.gmusicbrowser /org/gmusicbrowser org.gmusicbrowser.GetPosition | grep "double" | cut -d" " -f5 | cut -d"." -f1`
stars=`cat /home/docter/.config/gmusicbrowser/nowplaying.info | grep "Rating: " | cut -d" " -f2`
case $stars in
10|20|30|40|50|60|70|80|90|100 )
WERTUNG=`expr $stars / 1`
;;
* )
WERTUNG=`expr 50 / 1`
;;
esac
case "$1" in
total)
{
MINS=`expr $time / 60`
REST=`expr $time % 60`
SECS=`expr $REST % 60`
printf "%02d:%02d" "$MINS" "$SECS"
}
;;
position)
{
MINSEL=`expr $elapsed / 60`
RESTEL=`expr $elapsed % 60`
SECSEL=`expr $RESTEL % 60`
printf "%02d:%02d" "$MINSEL" "$SECSEL"
}
;;
progress)
expr $elapsed \* 100 / $time
;;
## rating)
#{
# printf $WERTUNG
#}
#;;
sterne)
{
case $WERTUNG in
0|5|10|15 )
printf "rrrrr"
;;
20|25|30|35 )
printf "srrrr"
;;
40|45|50|55 )
printf "ssrrr"
;;
60|65|70|75 )
printf "sssrr"
;;
80|85|90|95 )
printf "ssssr"
;;
100 )
printf "sssss"
;;
esac
}
esac
You may grab em, and some of pizzadudes other fonts, by clicking here. To install just extract the .ttf file to ~/.fonts. Further if you wanna use the rating you have to edit the nowplaying plugin. Code:
sudo gedit /usr/share/gmusicbrowser/plugins/nowplaying.pm Code:
{ my $ref=$::Songs[$ID];
my $string= 'Artist:'.$ref->[::SONG_ARTIST]."\n"
.'Title:'. $ref->[::SONG_TITLE]." \n"
.'Album:'.$ref->[::SONG_ALBUM]."\n"
.'Date:'.$ref->[::SONG_DATE]."\n"
.'Length: '.$ref->[::SONG_LENGTH]."\n"
ADD THIS LINE -----> .'Rating: '.$ref->[::SONG_RATING]."\n"
;
open my$out,'|-',@cmd;
The updated conky code for gmusic with rating: Code:
${color black}${font Comic Sans MS:size=11}${if_existing /home/docter/.config/gmusicbrowser/gmusicbrowser.fifo}${goto 950}${execi 2 cat ~/.config/gmusicbrowser/nowplaying.info|grep "Artist:"|cut -d":" -f2} - ${execi 2 cat ~/.config/gmusicbrowser/nowplaying.info|grep "Title:"|cut -d":" -f2}${voffset 15}${goto 1350}${font Pizzadude Stars:size=15}${execi 10 ~/Scripts/gmusic_custom_2.sh sterne}${else} ${alignr}${font Comic Sans MS:size=7}no music played $endif$color
${color black}${font Comic Sans MS}${if_existing /home/docter/.config/gmusicbrowser/gmusicbrowser.fifo}${goto 950}${execi 5 cat ~/.config/gmusicbrowser/nowplaying.info|grep "Album:"|cut -d":" -f2} (${execi 5 cat ~/.config/gmusicbrowser/nowplaying.info|grep "Date:"|cut -d":" -f2}) $endif
${font Sans:size=8}${if_existing /home/docter/.config/gmusicbrowser/gmusicbrowser.fifo}${goto 950}${execi 2 ~/Scripts/gmusic_custom.sh position} of ${execi 10 ~/Scripts/gmusic_custom.sh total} ${execibar 2 ~/Scripts/gmusic_custom.sh progress} $endif
__________________
Tips&Tricks JABBER/GAJIM transport setup -- free image&file hosting -- GRUB usage conky&gmusicbrowser -- nVidia-get Last edited by loomsen; June 14th, 2009 at 05:31 PM.. |
|
|
|
|
|
#3 |
|
Just Give Me the Beans!
![]() Join Date: Jun 2007
Beans: 49
|
Re: Conky gmusicbrowser script
I recently also started using gmusicbrowser instead of banshee, so far it looks really nice/usefull. As soon as I get home Ill give this a try.
|
|
|
|
|
|
#4 |
|
100% Pure Ubuntu
![]() Join Date: Aug 2008
Location: germany
Beans: 857
|
Re: Conky gmusicbrowser script
Good, then I didn't write it for me exclusively at least
__________________
Tips&Tricks JABBER/GAJIM transport setup -- free image&file hosting -- GRUB usage conky&gmusicbrowser -- nVidia-get |
|
|
|
|
|
#5 |
|
100% Pure Ubuntu
![]() Join Date: Aug 2008
Location: germany
Beans: 857
|
Re: Conky gmusicbrowser script
I worked around the layout a lil bit.
![]() Code:
${goto 1050}${execi 5 cat ~/.config/gmusicbrowser/nowplaying.info|grep "Album:"|cut -d":" -f2|cut -d"(" -f1} ${alignr}${execi 5 cat ~/.config/gmusicbrowser/nowplaying.info|grep "Date:"|cut -d":" -f2}
${goto 1050}${color black}${font PizzaDude Stars:size=25}${execi 10 ~/Scripts/gmusic_custom_2.sh sterne}$font ${voffset -10}${font Comic Sans MS}${execi 2 ~/Scripts/gmusic_custom_2.sh position} - ${execi 10 ~/Scripts/gmusic_custom_2.sh total} ${voffset 5}${execibar 2 ~/Scripts/gmusic_custom_2.sh progress}
${else} ${alignr}${font Comic Sans MS:size=7}no music played $endif
__________________
Tips&Tricks JABBER/GAJIM transport setup -- free image&file hosting -- GRUB usage conky&gmusicbrowser -- nVidia-get |
|
|
|
|
|
#6 |
|
Way Too Much Ubuntu
![]() |
Re: Conky gmusicbrowser script
good script, and great idea to add other information to standard output of gmusicbrowser, i use a similar script same time ago, but i didn't know how to add more information.
Is the picture at the bottom the cover of album? How do you draw in desktop?
__________________
mujeres y hombres de esta tierra
un otro mundo es posible otro mundo diferente justo si, y sin miedo de su gente Last edited by jjgomera; October 27th, 2008 at 02:05 PM.. |
|
|
|
|
|
#7 |
|
100% Pure Ubuntu
![]() Join Date: Aug 2008
Location: germany
Beans: 857
|
Re: Conky gmusicbrowser script
Thanks, glad you like it
Well, actually it's kind of a workaround. I created a layout containing the cover only, using compiz to have it undecorated, sticky and placed. What I didn't figure out tho, maybe you know... Is there a possibility to call fwd through dbus/fifo somehow? Only play/stop is what I figured out so far... And second, is it possible to change the popup for click on cover? Actually, I'd like to change the album window into some kind of control window if I click on the cover. Hard to explain, did you get me? Added the only cover and my custom layout... ![]() ![]() ![]() ![]()
__________________
Tips&Tricks JABBER/GAJIM transport setup -- free image&file hosting -- GRUB usage conky&gmusicbrowser -- nVidia-get Last edited by loomsen; October 27th, 2008 at 05:00 PM.. |
|
|
|
|
|
#8 |
|
100% Pure Ubuntu
![]() Join Date: Aug 2008
Location: germany
Beans: 857
|
Re: Conky gmusicbrowser script
OK,
forget it. Figured out (by reading the howto ^^) and integrated it with compiz deskmenu, which is a quite nice solution imho. Rightclick on my desktop gives me this menu: ![]() Lovin' it, now I can easily switch through different layouts if I feel like, and have all main controls just one click away Here's the part to add to ~/.config/compiz/deskmenu/menu.xml, to the bottom of it, right before the last </menu> Code:
<menu name="gmusicbrowser">
<item type="launcher">
<name>Show/Hide</name>
<command>gmusicbrowser -remotecmd ShowHide</command>
<icon>gmb-playlist</icon>
</item>
<item type="launcher">
<name>Next</name>
<command>gmusicbrowser -remotecmd NextSong</command>
<icon>gtk-media-next</icon>
</item>
<item type="launcher">
<name>Mute/Unmute</name>
<command>gmusicbrowser -remotecmd TogMute</command>
<icon>gmb-vol3</icon>
</item>
<item type="launcher">
<name>Previous</name>
<command>gmusicbrowser -remotecmd PrevSong</command>
<icon>gtk-media-previous</icon>
</item>
<item type="launcher">
<name>Quit</name>
<command>gmusicbrowser -remotecmd Quit</command>
<icon>gmb-turnoff</icon>
</item>
<menu name="Layout">
<item type="launcher">
<name>big</name>
<command>gmusicbrowser -remotecmd SetPlayerLayout aaaab</command>
</item>
<item type="launcher">
<name>nur cover</name>
<command>gmusicbrowser -remotecmd SetPlayerLayout custom_nur-cover</command>
</item>
<item type="launcher">
<name>default</name>
<command>gmusicbrowser -remotecmd SetPlayerLayout custom default</command>
</item>
</menu>
<menu name="Misc">
<item type="launcher">
<command>gmusicbrowser -remotecmd OpenPref</command>
<name>Preferences</name>
<icon>gtk-preferences</icon>
</item>
<item type="launcher">
<command>gmusicbrowser -remotecmd ChangeDisplay :1</command>
<name>Display TV</name>
<icon>tv_icon</icon>
</item>
<item type="launcher">
<name>Display Laptop</name>
<command>gmusicbrowser -remotecmd ChangeDisplay :0</command>
<icon>laptop_icon</icon>
</item>
<item type="launcher">
<command>gmusicbrowser -remotecmd OpenContext</command>
<name>Context</name>
<icon>gmb-context</icon>
</item>
<item type="launcher">
<name>Properties</name>
<command>gmusicbrowser -remotecmd OpenSongProp</command>
<icon>gmb-prop</icon>
</item>
</menu>
</menu>
![]()
__________________
Tips&Tricks JABBER/GAJIM transport setup -- free image&file hosting -- GRUB usage conky&gmusicbrowser -- nVidia-get |
|
|
|
|
|
#9 |
|
Way Too Much Ubuntu
![]() |
Re: Conky gmusicbrowser script
Im trying with this other, rough script:
Code:
#!/bin/bash # # script para mostrar por pantalla la caratula del disco actualmente en escucha por gmusicbrowser # dependencias: tener instalado el paquete feh de manipulación de imagenes sleep 10 while [ -e "/home/jjgomera/.config/gmusicbrowser/gmusicbrowser.fifo" ] do killall feh longitud=`cat /home/jjgomera/.config/gmusicbrowser/nowplaying | grep "Length" | cut -d"=" -f2` estado=`dbus-send --print-reply --dest=org.gmusicbrowser /org/gmusicbrowser org.gmusicbrowser.GetPosition | grep "double" | cut -d" " -f5` time=$(($longitud-$estado)) album=`cat /home/jjgomera/.config/gmusicbrowser/nowplaying | grep "Album" | cut -d"=" -f2` caratula=`dbus-send --print-reply --dest=org.gmusicbrowser /org/gmusicbrowser org.gmusicbrowser.GetAlbumCover string:"$album" | grep "string" | cut -d" " -f5- | cut --delimiter='"' -f2` feh -x -g "150x150+250+850" "$caratula" & sleep $time done ![]()
__________________
mujeres y hombres de esta tierra
un otro mundo es posible otro mundo diferente justo si, y sin miedo de su gente Last edited by jjgomera; November 5th, 2008 at 05:21 AM.. Reason: update script |
|
|
|
|
|
#10 |
|
100% Pure Ubuntu
![]() Join Date: Aug 2008
Location: germany
Beans: 857
|
Re: Conky gmusicbrowser script
Hi guys.
I've received a few PMs and decided to rewrite the script, should run better now I hope. Please let me know, I didn't try it in conky yet (shell output, however, does what it is intended to do) It doesn't need the nowplaying plugin anymore, instead you'll need to save the script to access dbus and get some standard output from HERE Put the path to the perl script on top of mine, you will figure out I think.... Code:
#!/bin/bash
# gmusicbrowser script by loomsen
# if you want to contact me: loomsen<at>googlemail.com
#
## requires this script to access dbus and get std output:
# http://squentin.free.fr/gmusicbrowser/dokuwiki/doku.php?id=dbus_api
###
## Put path to your tempfile holding the song info here
songinfo=~/tmp/nowplaying.info
## ------- insert path to perl script here
DBUSINFO=~/Scripts/gmusic-dbus.pl
## -------
INFO=`perl $DBUSINFO > $songinfo`
time_tot=`awk /length/ $songinfo | awk '{print $3}'`
elapsed=`dbus-send --print-reply --dest=org.gmusicbrowser /org/gmusicbrowser org.gmusicbrowser.GetPosition | grep "double" | awk '{print $2}' | cut -d '.' -f1`
function tmp_cur
{
MINS=`expr $elapsed / 60`
REST=`expr $elapsed % 60`
SECS=`expr $REST % 60`
printf "%02d:%02d" "$MINS" "$SECS"
}
function tmp_tot
{
MINS=`expr $time_tot / 60`
REST=`expr $time_tot % 60`
SECS=`expr $REST % 60`
printf "%02d:%02d" "$MINS" "$SECS"
}
function progress
{
expr $elapsed \* 100 / $time_tot
}
## here it starts, you may either
case "$1" in
cur_pos ) tmp_cur
;;
length ) tmp_tot
;;
progress ) progress
;;
*)
if [ "$1" != "" ];then
for i in "$@";do
# ----------------- FIXME: uncomment if you prefer RAW values (without tags)
####### ↓
awk /"$i"/ $songinfo # | cut -d ':' -f2
# -----------------
done
else
# ------------------ FIXME: uncomment if you prefer RAW values (without tags)
####### ↓
awk /""/ $songinfo # | cut -d ':' -f2
# ------------------
fi
;;
esac
exit 0
The variables for total length, current position and progress have to be used each as a single option. Possible values: foobar.sh cur_pos foobar.sh length foobar.sh progress (this should be useful for a progress bar) I hope things improved a little bit Enjoy.
__________________
Tips&Tricks JABBER/GAJIM transport setup -- free image&file hosting -- GRUB usage conky&gmusicbrowser -- nVidia-get |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|