Page 1 sur 1

[conky] intégrer information venant de spotify

Publié : ven. 04 nov. 2011, 23:48
par milouse
Youp,

Depuis quelques temps je cherchais comment afficher sur conky des infos sur la piste en cours de spotify et j'ai finalement trouvé. Les dernières versions de spotify utilisent DBus, du coup il suffisait d'aller chercher là dedans, de créer un petit script qui m'affiche tout ça et de l'appeler via un execi depuis le .conkyrc.

Le script en question est le suivant :

Code : Tout sélectionner

#!/bin/bash

echo `dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 2 "artist"|egrep -v "artist"|egrep -v "array"|cut -b 27-|cut -d '"' -f 1|egrep -v ^$` "-" `dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 1 "title"|egrep -v "title"|cut -b 44-|cut -d '"' -f 1|egrep -v ^$`
Alors ça reste un peu brut de décoffrage, mais ça suffit nan ? ;)

Re: [conky] intégrer information venant de spotify

Publié : sam. 05 nov. 2011, 09:20
par FoolEcho
Je dirai qu'heureusement l'essentiel des commandes est compréhensible parce qu'enchaîner autant de pipes, c'est proprement illisible (bon, j'ai un peu l'habitude du bash aussi). :copain: :pastaper: :merci:

Re: [conky] intégrer information venant de spotify

Publié : dim. 06 nov. 2011, 01:14
par milouse
[troll]Ben voui mais bon, si DBus était moins verbeux, y'aurait moins de pipe[/troll] ^^

Re: [conky] intégrer information venant de spotify

Publié : dim. 06 nov. 2011, 09:00
par FoolEcho
Dbus étant un processus de communication, vaut mieux qu'il y ait du verbe. :humour:

Re: [conky] intégrer information venant de spotify

Publié : jeu. 19 janv. 2012, 13:48
par webdarek
une proposition: http://webdarek.tumblr.com/


Code : Tout sélectionner

# this file goes in ~


background yes
use_xft yes
#xftfont monospace:pixelsize=10
xftfont ubuntu:pixelsize=10
xftalpha 0.8
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
stippled_borders 0
border_margin 4
border_width 0
default_color black
default_shade_color grey
default_outline_color white
alignment top_right
gap_x 10
gap_y 20
no_buffers yes
blink no
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
use_spacer yes

maximum_width 320


TEXT
${font StyleBats:pixelsize=18}A${font}${goto 50}${font Arial:bold:size=7}SYSTEM :${font}:
${goto 50}distro: ${exec lsb_release -d -s} (${exec lsb_release -c -s})
${goto 50}kernel: $kernel $machine 
${font Poky:pixelsize=18}q${font}${voffset 6}${goto 50}${font Arial:bold:size=7}PROCCESSORS :${font}:
${goto 50}cpu 1:${offset 16}${cpubar cpu0 4,75}  | ${cpu cpu0}%
${goto 50}cpu 2:${offset 16}${cpubar cpu1 4,75}  | ${cpu cpu1}%
${goto 50}temp nvidia: ${hwmon temp 1}°C${goto 200}temp hdd: ${hddtemp /dev/sda} °C 
${font Poky:pixelsize=18}1${font}${goto 50}${font Arial:bold:size=7}BATTERY :${font}:
${goto 50}battery: ${battery BAT0}
${font Poky:pixelsize=18}a${font}${goto 50}${font Arial:bold:size=7}HDD :${font}:         
${goto 50}root: ${offset 37}${fs_bar 4,55 /}  | ${fs_used /} / ${fs_size /}${goto 265}${fs_used_perc /} %
${goto 50}platinet: ${offset 20}${fs_bar 4,55 /media/platinet}  | ${fs_used /media/platinet} / ${fs_size /media/platinet}${goto 265}${fs_used_perc /media/platinet} %
${goto 50}verbatim: ${offset 15}${fs_bar 4,55 /media/Verbatim}  | ${fs_used /media/Verbatim} / ${fs_size /media/Verbatim}${goto 265}${fs_used_perc /media/Verbatim} %
${font Poky:pixelsize=18}w${font}${goto 50}${font Arial:bold:size=7}LAN :${font}:
${goto 50}download: ${downspeed eth0}
${goto 50}upload: ${upspeed eth0}
${goto 50}total Download: ${totaldown eth0} 
${font Poky:pixelsize=18}Y${font}${goto 50}${font Arial:bold:size=7}WIFI :${font}:
${goto 50}essid:   '${wireless_essid wlan0}'${color}    -    ${wireless_bitrate wlan0}    -    ${wireless_link_qual_perc wlan0}%
${goto 50}download: ${downspeed wlan0}${goto 200}total download: ${totaldown wlan0} 
${goto 50}upload: ${upspeed wlan0}${goto 200}total upload:   ${totalup wlan0} 
${goto 50}local IP:  ${color 000000}${addr wlan0}${color}${goto 200}public IP: ${color 000000}${execi 1800 wget -q -O - http://ip.tupeux.com | tail }${color}
${font Poky:pixelsize=18}A${font} ${goto 50}${font Arial:bold:size=7}MEMORY :${font}:
${goto 50}ram: ${offset 19}${membar 4,75}  | $memperc%    exe: $processes   run: $running_processes
${goto 50}swap: ${offset 14}${swapbar 4,75}  | $swapperc%
${goto 50}${voffset 10}NAME $alignc ${goto 185}${alignr}MEM   ${alignr}  CPU
${goto 50}${top name 1} ${goto 175}$alignr${top mem 1} $alignr${top cpu 1}
${goto 50}${top name 2} ${goto 175}$alignr${top mem 2} $alignr${top cpu 2}
${goto 50}$stippled_hr
${goto 50}${top_mem name 1} ${goto 175}$alignr${top_mem cpu 1} $alignr${top_mem mem 1}
${goto 50}${top_mem name 2} ${goto 175}$alignr${top_mem cpu 2} $alignr${top_mem mem 2}
${if_running mocp}${color}
${goto 50}$stippled_hr
${font Poky:pixelsize=18}l${font} ${goto 50}${font Arial:bold:size=7}MOCP :${font}:

${goto 50}Wykonawca: 
${goto 50}${exec mocp -i | sed -n -e 's/\(Artist:\) \(.*\)/\2/p'}
${goto 50}Tytuł:     
${goto 50}${exec mocp -i | sed -n -e 's/\(SongTitle:\) \(.*\)/\2/p'}
${goto 50}Album:     
${goto 50}${exec mocp -i | sed -n -e 's/\(Album:\) \(.*\)/\2/p'}${endif}
${font Pricedown:pixelsize=76}${alignc}${time %H:%M}${font}
${voffset 10}${font Blue Highway:pixelsize=16}${alignc}${time %A} | ${time %d} ${time  %B} ${time %Y}
${voffset 10}${font Blue Highway:pixelsize=16}${alignc}uptime: $uptime_short  ${font}
#${color}MAC: ${alignr} $color${wireless_ap wlan0}
#${font ConkySymbols:pixelsize=18}uYy