Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#2101 Le 05/12/2012, à 18:41

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

en fait ça m'est égal du moment qu'il extrait l'image demandée.Il y a deux sites proposant les images du jour donc je ne sais pas avec lequel cela serait le plus simple.

Hors ligne

#2102 Le 05/12/2012, à 18:48

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

aller un une ligne en bash, juste pour obtenir l'adresse de ton image.

le premier site
l'image affiché sur la page

curl -s http://apod.nasa.gov/apod/astropix.html | grep -A 0 '<IMG SRC=' | sed -e 's/<IMG SRC=//' -e 's/"//g' | sed 's/^/http:\/\/apod\.nasa\.gov\/apod\//'

l'image pointé par le lien (quand ont clic sur l'image du site)

curl -s http://apod.nasa.gov/apod/astropix.html | grep -m 1 '.jpg' | sed -e 's/^.*f="//' -e 's/">//' | sed 's/^/http:\/\/apod\.nasa\.gov\/apod\//'

pour le second site

curl -s http://www.nasa.gov/rss/image_of_the_day.rss | grep 'url=' | sed 's/^.*url="//' | sed 's/".*$//'

Dernière modification par Didier-T (Le 05/12/2012, à 19:06)

Hors ligne

#2103 Le 05/12/2012, à 19:06

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Merci Didier-T; effectivement ça fonctionne, mais ce que je ne comprends pas c'est comment lancer dans conky une image dont on ne connait pas le nom;je crois qu'il faudrait un truc du genre (*.jpg) ?

Hors ligne

#2104 Le 05/12/2012, à 19:13

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

pourquoi tu ne connaîtrai pas son nom ?

wget est ton amis.

test=`curl -s http://apod.nasa.gov/apod/astropix.html | grep -m 1 '.jpg' | sed -e 's/^.*f="//' -e 's/">//' | sed 's/^/http:\/\/apod\.nasa\.gov\/apod\//'` 
wget -O image.jpg $test

comme sa ton image s’appelle toujours image.jpg

Dernière modification par Didier-T (Le 05/12/2012, à 19:14)

Hors ligne

#2105 Le 05/12/2012, à 19:17

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Wahoo jolie maîtrise !
Je suis bluffé (oo)
Merci !

Hors ligne

#2106 Le 05/12/2012, à 19:29

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

pour l'autre site....j'ai essayer mais je crois qu'il me faudra une semaine pour trouver comment faire pour donner aussi un nom à cette image...
En tous cas cela aidera peut-être nos amis Anglophone; merci encore

Dernière modification par ragamatrix (Le 05/12/2012, à 19:30)

Hors ligne

#2107 Le 05/12/2012, à 19:46

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

ragamatrix a écrit :

pour l'autre site....j'ai essayer mais je crois qu'il me faudra une semaine pour trouver comment faire pour donner aussi un nom à cette image...
En tous cas cela aidera peut-être nos amis Anglophone; merci encore

pour l'autre site tu refait la même chose, il faut juste remplacer la ligne qui renseigne test par l'autre

Hors ligne

#2108 Le 05/12/2012, à 19:55

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Didier-T a écrit :
ragamatrix a écrit :

pour l'autre site....j'ai essayer mais je crois qu'il me faudra une semaine pour trouver comment faire pour donner aussi un nom à cette image...
En tous cas cela aidera peut-être nos amis Anglophone; merci encore

pour l'autre site tu refait la même chose, il faut juste remplacer la ligne qui renseigne test par l'autre

je crois que ne suis pas...moi être élève en difficulté smile

  test=curl -s http://www.nasa.gov/rss/image_of_the_day.rss | grep 'url=' | sed 's/^.*url="//' | sed 's/".*$//' wget -O image.jpg $test

mais ça c'est pas bon hmm

Dernière modification par ragamatrix (Le 05/12/2012, à 19:58)

Hors ligne

#2109 Le 05/12/2012, à 20:12

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

ragamatrix a écrit :
Didier-T a écrit :
ragamatrix a écrit :

pour l'autre site....j'ai essayer mais je crois qu'il me faudra une semaine pour trouver comment faire pour donner aussi un nom à cette image...
En tous cas cela aidera peut-être nos amis Anglophone; merci encore

pour l'autre site tu refait la même chose, il faut juste remplacer la ligne qui renseigne test par l'autre

je crois que ne suis pas...moi être élève en difficulté smile

  test=curl -s http://www.nasa.gov/rss/image_of_the_day.rss | grep 'url=' | sed 's/^.*url="//' | sed 's/".*$//' wget -O image.jpg $test

mais ça c'est pas bon hmm

Toi il faut que tu fasse une bonne cure de sommeil.

test=`curl -s http://www.nasa.gov/rss/image_of_the_day.rss | grep 'url=' | sed 's/^.*url="//' | sed 's/".*$//'` 
wget -O image.jpg $test

il te manque les ` qui s'obtiennent avec <Alt Gr><7>
et si tu veux mettre la deuxième ligne avec la première il faut && pour faire la jonction (comme sa ont exécute la commande wget uniquement si la commande lié a test a réussit.

Sa donnerai ceci

[code]test=`curl -s http://www.nasa.gov/rss/image_of_the_day.rss | grep 'url=' | sed 's/^.*url="//' | sed 's/".*$//'` && wget -O image.jpg $test[/code]

Hors ligne

#2110 Le 05/12/2012, à 20:18

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Je ne crois pas que cela vienne d'un manque de sommeil...quoique...Sûrement un manque de connaissance dans ce domaine wink Encore merci pour ta dispo.

Hors ligne

#2111 Le 05/12/2012, à 22:22

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Hum Hum...
Je voulais sphériser une carte sat pour les us mais celle que j'ai trouvée n'affiche pas de radar de précipitation aussi bien actualisée que celle-ci:
radar
Le probleme c'est que c'est une page html et qu'il faut extraire la carte comme précédemment, car lorque l'on clique sur l'image, c'est un jpg qui change de nom à chaque actualisation.Je pensais qu'il fallait faire la même chose que tu m'as montré avant avec curl et sed mais je n'y arrive encore pas...

J'ai fais cette commande qui me parraissait correct mais j'ai des erreurs:

 test=`curl -s http://weather.msfc.nasa.gov/GOES/goeseastconusir.html| grep -A 0 '<IMG SRC=' | sed -e 's/<IMG SRC=//' -e 's/"//g' | sed 's/^/http:\/\/weather\.msfc\.nasa\.gov\/GOES\//'`&& wget -O image.jpg $test

erreurs:

 --2012-12-05 21:34:17--  http://weather.msfc.nasa.gov/GOES/colorbarvert.gif
Résolution de weather.msfc.nasa.gov (weather.msfc.nasa.gov)... 198.122.199.231
Connexion vers weather.msfc.nasa.gov (weather.msfc.nasa.gov)|198.122.199.231|:80... connecté.
requête HTTP transmise, en attente de la réponse... 200 OK
Longueur: 4331 (4,2K) [image/gif]
Sauvegarde en : «image.jpg»

100%[======================================>] 4 331       --.-K/s   ds 0,1s    

2012-12-05 21:34:17 (28,9 KB/s) - «image.jpg» sauvegardé [4331/4331]

--2012-12-05 21:34:17--  http://height=260/
Résolution de height=260 (height=260)... échec: Nom ou service inconnu.
wget : impossible de résoudre l'adresse de l'hôte «height=260»
--2012-12-05 21:34:17--  http://width=170%3E/
Résolution de width=170> (width=170>)... échec: Nom ou service inconnu.
wget : impossible de résoudre l'adresse de l'hôte «width=170>»
FINISHED --2012-12-05 21:34:17--
Total wall clock time: 0,5s
Downloaded: 1 files, 4,2K in 0,1s (28,9 KB/s)
 

J'ai l'impression que c'est presque bon big_smile

Dernière modification par ragamatrix (Le 05/12/2012, à 22:37)

Hors ligne

#2112 Le 05/12/2012, à 22:44

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

ragamatrix a écrit :

Hum Hum...
Je voulais sphériser une carte sat pour les us mais celle que j'ai trouvée n'affiche pas de radar de précipitation aussi bien actualisée que celle-ci:
radar
Le probleme c'est que c'est une page html et qu'il faut extraire la carte comme précédemment, car lorque l'on clique sur l'image, c'est un jpg qui change de nom à chaque actualisation.Je pensais qu'il fallait faire la même chose que tu m'as montré avant avec curl et sed mais je n'y arrive encore pas...

J'ai fais cette commande qui me parraissait correct mais j'ai des erreurs:

 test=`curl -s http://weather.msfc.nasa.gov/GOES/goeseastconusir.html| grep -A 0 '<IMG SRC=' | sed -e 's/<IMG SRC=//' -e 's/"//g' | sed 's/^/http:\/\/weather\.msfc\.nasa\.gov\/GOES\//'`&& wget -O image.jpg $test

erreurs:

 --2012-12-05 21:34:17--  http://weather.msfc.nasa.gov/GOES/colorbarvert.gif
Résolution de weather.msfc.nasa.gov (weather.msfc.nasa.gov)... 198.122.199.231
Connexion vers weather.msfc.nasa.gov (weather.msfc.nasa.gov)|198.122.199.231|:80... connecté.
requête HTTP transmise, en attente de la réponse... 200 OK
Longueur: 4331 (4,2K) [image/gif]
Sauvegarde en : «image.jpg»

100%[======================================>] 4 331       --.-K/s   ds 0,1s    

2012-12-05 21:34:17 (28,9 KB/s) - «image.jpg» sauvegardé [4331/4331]

--2012-12-05 21:34:17--  http://height=260/
Résolution de height=260 (height=260)... échec: Nom ou service inconnu.
wget : impossible de résoudre l'adresse de l'hôte «height=260»
--2012-12-05 21:34:17--  http://width=170%3E/
Résolution de width=170> (width=170>)... échec: Nom ou service inconnu.
wget : impossible de résoudre l'adresse de l'hôte «width=170>»
FINISHED --2012-12-05 21:34:17--
Total wall clock time: 0,5s
Downloaded: 1 files, 4,2K in 0,1s (28,9 KB/s)
 

J'ai l'impression que c'est presque bon big_smile

J'ai trouvé en fait c'est un .gif et non un .jpg ça c'est une bonne nouvelle; la mauvaise c'est que ce n'est pas vraiment cette image que je voulais...
imgsatushmm

Hors ligne

#2113 Le 05/12/2012, à 23:20

maan

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Didier-T a écrit :

@ maan,

poste donc ton ring lua, mais si c'est du wlourf, il y a deux arguments a modifier pour chaque ring, name et arg.

dans name tu met execi
et dans arg tout le reste

en tous cas c'est bien de t’intéresser a sed, c'est un outils très puissant.

Oui enfin je ne comprend encore bien les possibilité de sed mais bon j'ai réussi en m'en servir pour arriver à mes fin tongue

Par contre toujours pas réussi à régler mes rings. J'ai mis 'execi' en name, et en arg j'ai essayer pas mal de chose mais rien ni fait roll

Les rings sont dessinés mais vide sad

Voici mon script

--[[
Clock Rings by londonali1010 (2009)

This script draws percentage meters as rings, and also draws clock hands if you want! It is fully customisable; all options are described in the script. This script is based off a combination of my clock.lua script and my rings.lua script.

IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement near the end of the script uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num > 5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num > 3; conversely if you update Conky every 0.5s, you should use update_num > 10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.

To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
	lua_load ~/.conky/conky22/script/clock_rings-v1.1.1.lua
	lua_draw_hook_pre clock_rings

Changelog:
+ v1.1.1 -- Fixed minor bug that caused the script to crash if conky_parse() returns a nil value (20.10.2009)
+ v1.1 -- Added colour option for clock hands (07.10.2009)
+ v1.0 -- Original release (30.09.2009)
]]

settings_table = {
	{
		-- Edit this table to customise your rings.
		-- You can create more rings simply by adding more elements to settings_table.
		-- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
		name='time',
		-- "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
		arg='%I.%M',
		-- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
		max=12,
		-- "bg_colour" is the colour of the base ring.
		bg_colour=0x666666,
		-- "bg_alpha" is the alpha value of the base ring.
		bg_alpha=0.1,
		-- "fg_colour" is the colour of the indicator part of the ring.
		fg_colour=0xFF6600,
		-- "fg_alpha" is the alpha value of the indicator part of the ring.
		fg_alpha=0.9,
		-- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
		x=150, y=150,
		-- "radius" is the radius of the ring.
		radius=135,
		-- "thickness" is the thickness of the ring, centred around the radius.
		thickness=4,
		-- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
		start_angle=0,
		-- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger than start_angle.
		end_angle=360
	},
	{
		name='time',
		arg='%M.%S',
		max=60,
		bg_colour=0x666666,
		bg_alpha=0.4,
		fg_colour=0xFF6600,
		fg_alpha=0.5,
		x=150, y=150,
		radius=140,
		thickness=4,
		start_angle=0,
		end_angle=360
		
	},
	{
		name='time',
		arg='%S',
		max=60,
		bg_colour=0x666666,
		bg_alpha=0.15,
		fg_colour=0xFF6600,
		fg_alpha=0.3,
		x=150, y=150,
		radius=145,
		thickness=4,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=0.1,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=150,
		radius=80,
		thickness=130,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFFFFFF,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=150,
		radius=1,
		thickness=10,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=85, y=150,
		radius=24,
		thickness=1,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=0.1,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=85, y=150,
		radius=35,
		thickness=27,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=85, y=150,
		radius=1,
		thickness=2,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=215, y=150,
		radius=24,
		thickness=1,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=0.1,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=215, y=150,
		radius=35,
		thickness=27,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=215, y=150,
		radius=1,
		thickness=2,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=75,
		radius=19,
		thickness=1,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=0.1,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=75,
		radius=33,
		thickness=22,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=75,
		radius=1,
		thickness=2,
		start_angle=0,
		end_angle=360
	},   
	{
        	name='cpu',
        	arg='cpu0',
        	max=100,
      	        bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xFF6600,
        	fg_alpha=0.8,
        	x=60, y=415,
        	radius=25,
        	thickness=7,
        	start_angle=-90,
        	end_angle=180
    	},
    	{
        	name='memperc',
        	arg='',
        	max=100,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xFF6600,
        	fg_alpha=0.8,
        	x=85, y=470,
        	radius=25,
        	thickness=7,
        	start_angle=-90,
        	end_angle=180
    	},
    	{
        	name='swapperc',
        	arg='',
        	max=100,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xFF6600,
        	fg_alpha=0.8,
        	x=110, y=524,
        	radius=25,
        	thickness=7,
        	start_angle=-90,
        	end_angle=180
    	},
    	{
        	name='fs_used_perc',
        	arg='/',
        	max=100,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xFF6600,
        	fg_alpha=0.8,
        	x=135, y=578,
        	radius=25,
        	thickness=7,
        	start_angle=-90,
        	end_angle=180
    	},
    	{
        	name='fs_used_perc',
        	arg='/home/maan',
        	max=100,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xFF6600,
        	fg_alpha=0.8,
        	x=160, y=632,
        	radius=25,
        	thickness=7,
        	start_angle=-90,
        	end_angle=180
    	},
    	{
        	name='downspeedf',
        	arg='eth0',
        	max=1000,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0x339900,
        	fg_alpha=0.8,
        	x=235, y=680,
        	radius=26,
        	thickness=7,
        	start_angle=-90,
        	end_angle=190
    	},
        {
        	name='upspeedf',
        	arg='eth0',
        	max=100,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xff6600,
        	fg_alpha=0.6,
        	x=235, y=680,
        	radius=18,
        	thickness=5,
        	start_angle=-90,
        	end_angle=190
    	},
--Core 0	
	{
    		name='execi',
    		arg="sensors | grep 'Core 0'",
    		max=100,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xCC0000,
    		fg_alpha=0.3,
    		x=145, y=420,
    		radius=26,
    		thickness=10,
    		start_angle=-90,
    		end_angle=90,
    	},
--Core 1
	{
    		name='execi',
    		arg="sensors | grep 'Core 1'",
    		max=100,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xFFCC00,
    		fg_alpha=0.5,
    		x=197, y=420,
    		radius=26,
    		thickness=10,
    		start_angle=90,
    		end_angle=270,
    	},
--Cpu	
	{
    		name='execi',
    		arg="sensors | grep 'CPU Temperature'",
    		max=100,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xF339900,
    		fg_alpha=0.5,
    		x=249, y=420,
    		radius=26,
    		thickness=10,
    		start_angle=-90,
    		end_angle=90,
    	},
--M/b   	
	{
    		name='execi',
    		arg="sensors | grep 'MB Temperature'",
    		max=100,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xFFCC00,
    		fg_alpha=0.5,
    		x=203, y=575,
    		radius=26,
    		thickness=10,
    		start_angle=-90,
    		end_angle=90,
    	},
--Gpu 	
	{
    		name='execi',
    		arg="sensors | grep 'temp2'",
    		max=100,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xCC0000,
    		fg_alpha=0.3,
    		x=255, y=575,
    		radius=26,
    		thickness=10,
    		start_angle=90,
    		end_angle=270,
    	},
--Cpu 
 	{
    		name='execi',
    		arg="sensors | grep 'CPU FAN Speed'",
    		max=3000,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xCC0000,
    		fg_alpha=0.3,
    		x=80, y=715,
    		radius=70,
    		thickness=20,
    		start_angle=90,
    		end_angle=322,
    	},
    	{
    		name='execi',
    		arg="sensors | grep 'CHASSIS2 FAN Speed'",
    		max=3000,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xFFCC00,
    		fg_alpha=0.3,
    		x=80, y=715,
    		radius=50,
    		thickness=15,
    		start_angle=90,
    		end_angle=322,
    	},
    	{
    		name='execi',
    		arg="sensors | grep 'CHASSIS FAN Speed'",
    		max=3000,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0x339900,
    		fg_alpha=0.3,
    		x=80, y=715,
    		radius=35,
    		thickness=10,
    		start_angle=90,
    		end_angle=322,
    	},
	}

-- Use these settings to define the origin and extent of your clock.

clock_r=127

-- "clock_x" and "clock_y" are the coordinates of the centre of the clock, in pixels, from the top left of the Conky window.

clock_x=150
clock_y=150

-- Colour & alpha of the clock hands

clock_colour=0xFF6600
clock_alpha=1

-- Do you want to show the seconds hand?

show_seconds=true

require 'cairo'

function rgb_to_r_g_b(colour,alpha)
	return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function draw_ring(cr,t,pt)
	local w,h=conky_window.width,conky_window.height

	local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
	local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']

	local angle_0=sa*(2*math.pi/360)-math.pi/2
	local angle_f=ea*(2*math.pi/360)-math.pi/2
	local t_arc=t*(angle_f-angle_0)

	-- Draw background ring

	cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
	cairo_set_line_width(cr,ring_w)
	cairo_stroke(cr)

	-- Draw indicator ring

	cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
	cairo_stroke(cr)
end

function draw_clock_hands(cr,xc,yc)
	local secs,mins,hours,secs_arc,mins_arc,hours_arc
	local xh,yh,xm,ym,xs,ys

	secs=os.date("%S")
	mins=os.date("%M")
	hours=os.date("%I")

	secs_arc=(2*math.pi/60)*secs
	mins_arc=(2*math.pi/60)*mins+secs_arc/60
	hours_arc=(2*math.pi/12)*hours+mins_arc/12

	-- Draw hour hand

	xh=xc+0.7*clock_r*math.sin(hours_arc)
	yh=yc-0.7*clock_r*math.cos(hours_arc)
	cairo_move_to(cr,xc,yc)
	cairo_line_to(cr,xh,yh)

	cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
	cairo_set_line_width(cr,5)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(clock_colour,clock_alpha))
	cairo_stroke(cr)

	-- Draw minute hand

	xm=xc+clock_r*math.sin(mins_arc)
	ym=yc-clock_r*math.cos(mins_arc)
	cairo_move_to(cr,xc,yc)
	cairo_line_to(cr,xm,ym)

	cairo_set_line_width(cr,3)
	cairo_stroke(cr)

	-- Draw seconds hand

	if show_seconds then
		xs=xc+clock_r*math.sin(secs_arc)
		ys=yc-clock_r*math.cos(secs_arc)
		cairo_move_to(cr,xc,yc)
		cairo_line_to(cr,xs,ys)

		cairo_set_line_width(cr,1)
		cairo_stroke(cr)
	end
end

function conky_clock_rings()
	local function setup_rings(cr,pt)
		local str=''
		local value=0

		str=string.format('${%s %s}',pt['name'],pt['arg'])
		str=conky_parse(str)

		value=tonumber(str)
		if value == nil then value = 0 end
		pct=value/pt['max']

		draw_ring(cr,pct,pt)
	end

	-- Check that Conky has been running for at least 5s

	if conky_window==nil then return end
	local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)

	local cr=cairo_create(cs)	

	local updates=conky_parse('${updates}')
	update_num=tonumber(updates)

	if update_num>5 then
		for i in pairs(settings_table) do
			setup_rings(cr,settings_table[i])
		end
	end

	draw_clock_hands(cr,clock_x,clock_y)
end

1354742344.jpg

Dernière modification par maan (Le 05/12/2012, à 23:20)


Ubuntu_studio 14.04

Hors ligne

#2114 Le 06/12/2012, à 00:13

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Bon voici un script qui affiche la photo du jour proposée par la nasa.Avec un petit effet convert pour donner un peu de volume...
L'image est à appeler dans conky depuis /tmp.
nom image: imageday_nasa.png
imagedaynasa
script et remerciements à Didier-T et jpdipsy (convert)
nasa-day.sh:

 #!/bin/bash

test=`curl -s http://www.nasa.gov/rss/image_of_the_day.rss | grep 'url=' | sed 's/^.*url="//' | sed 's/".*$//'` && wget -O /tmp/image_nasa.jpg $test
convert /tmp/image_nasa.jpg  /tmp/image_nasa.png
##aqua effect
convert /tmp/image_nasa.png -alpha off -fill white -colorize 100% \
     -draw 'fill black polygon 0,0 0,15 15,0 fill white circle 15,15 15,0' \
     \( +clone -flip \) -compose Multiply -composite \
     \( +clone -flop \) -compose Multiply -composite \
     -background gray60 -alpha Shape    /tmp/thumbnail_mask.png
###aqua effect2
convert /tmp/thumbnail_mask.png -bordercolor None -border 1x1 \
          -alpha Extract -blur 0x10  -shade 130x30 -alpha On \
          -background gray60 -alpha background -auto-level \
          -function polynomial  3.5,-5.05,2.05,0.3 \
          \( +clone -alpha extract  -blur 0x2 \) \
          -channel RGB -compose multiply -composite \
          +channel +compose -chop 1x1 \
          /tmp/thumbnail_lighting.png
##final
convert /tmp/image_nasa.png -alpha Set /tmp/thumbnail_lighting.png \
          \( -clone 0,1 -alpha Opaque -compose Hardlight -composite \) \
          -delete 0 -compose In -composite \
          /tmp/imageday_nasa.png

rm /tmp/thumbnail_lighting.png ;rm /tmp/thumbnail_mask.png  

Hors ligne

#2115 Le 06/12/2012, à 07:47

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

maan a écrit :
Didier-T a écrit :

@ maan,

poste donc ton ring lua, mais si c'est du wlourf, il y a deux arguments a modifier pour chaque ring, name et arg.

dans name tu met execi
et dans arg tout le reste

en tous cas c'est bien de t’intéresser a sed, c'est un outils très puissant.

Oui enfin je ne comprend encore bien les possibilité de sed mais bon j'ai réussi en m'en servir pour arriver à mes fin tongue

Par contre toujours pas réussi à régler mes rings. J'ai mis 'execi' en name, et en arg j'ai essayer pas mal de chose mais rien ni fait roll

Les rings sont dessinés mais vide sad

Voici mon script

--[[
Clock Rings by londonali1010 (2009)

This script draws percentage meters as rings, and also draws clock hands if you want! It is fully customisable; all options are described in the script. This script is based off a combination of my clock.lua script and my rings.lua script.

IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement near the end of the script uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num > 5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num > 3; conversely if you update Conky every 0.5s, you should use update_num > 10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.

To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
	lua_load ~/.conky/conky22/script/clock_rings-v1.1.1.lua
	lua_draw_hook_pre clock_rings

Changelog:
+ v1.1.1 -- Fixed minor bug that caused the script to crash if conky_parse() returns a nil value (20.10.2009)
+ v1.1 -- Added colour option for clock hands (07.10.2009)
+ v1.0 -- Original release (30.09.2009)
]]

settings_table = {
	{
		-- Edit this table to customise your rings.
		-- You can create more rings simply by adding more elements to settings_table.
		-- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
		name='time',
		-- "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
		arg='%I.%M',
		-- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
		max=12,
		-- "bg_colour" is the colour of the base ring.
		bg_colour=0x666666,
		-- "bg_alpha" is the alpha value of the base ring.
		bg_alpha=0.1,
		-- "fg_colour" is the colour of the indicator part of the ring.
		fg_colour=0xFF6600,
		-- "fg_alpha" is the alpha value of the indicator part of the ring.
		fg_alpha=0.9,
		-- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
		x=150, y=150,
		-- "radius" is the radius of the ring.
		radius=135,
		-- "thickness" is the thickness of the ring, centred around the radius.
		thickness=4,
		-- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
		start_angle=0,
		-- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger than start_angle.
		end_angle=360
	},
	{
		name='time',
		arg='%M.%S',
		max=60,
		bg_colour=0x666666,
		bg_alpha=0.4,
		fg_colour=0xFF6600,
		fg_alpha=0.5,
		x=150, y=150,
		radius=140,
		thickness=4,
		start_angle=0,
		end_angle=360
		
	},
	{
		name='time',
		arg='%S',
		max=60,
		bg_colour=0x666666,
		bg_alpha=0.15,
		fg_colour=0xFF6600,
		fg_alpha=0.3,
		x=150, y=150,
		radius=145,
		thickness=4,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=0.1,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=150,
		radius=80,
		thickness=130,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFFFFFF,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=150,
		radius=1,
		thickness=10,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=85, y=150,
		radius=24,
		thickness=1,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=0.1,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=85, y=150,
		radius=35,
		thickness=27,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=85, y=150,
		radius=1,
		thickness=2,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=215, y=150,
		radius=24,
		thickness=1,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=0.1,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=215, y=150,
		radius=35,
		thickness=27,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=215, y=150,
		radius=1,
		thickness=2,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=75,
		radius=19,
		thickness=1,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=0.1,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=75,
		radius=33,
		thickness=22,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=75,
		radius=1,
		thickness=2,
		start_angle=0,
		end_angle=360
	},   
	{
        	name='cpu',
        	arg='cpu0',
        	max=100,
      	        bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xFF6600,
        	fg_alpha=0.8,
        	x=60, y=415,
        	radius=25,
        	thickness=7,
        	start_angle=-90,
        	end_angle=180
    	},
    	{
        	name='memperc',
        	arg='',
        	max=100,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xFF6600,
        	fg_alpha=0.8,
        	x=85, y=470,
        	radius=25,
        	thickness=7,
        	start_angle=-90,
        	end_angle=180
    	},
    	{
        	name='swapperc',
        	arg='',
        	max=100,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xFF6600,
        	fg_alpha=0.8,
        	x=110, y=524,
        	radius=25,
        	thickness=7,
        	start_angle=-90,
        	end_angle=180
    	},
    	{
        	name='fs_used_perc',
        	arg='/',
        	max=100,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xFF6600,
        	fg_alpha=0.8,
        	x=135, y=578,
        	radius=25,
        	thickness=7,
        	start_angle=-90,
        	end_angle=180
    	},
    	{
        	name='fs_used_perc',
        	arg='/home/maan',
        	max=100,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xFF6600,
        	fg_alpha=0.8,
        	x=160, y=632,
        	radius=25,
        	thickness=7,
        	start_angle=-90,
        	end_angle=180
    	},
    	{
        	name='downspeedf',
        	arg='eth0',
        	max=1000,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0x339900,
        	fg_alpha=0.8,
        	x=235, y=680,
        	radius=26,
        	thickness=7,
        	start_angle=-90,
        	end_angle=190
    	},
        {
        	name='upspeedf',
        	arg='eth0',
        	max=100,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xff6600,
        	fg_alpha=0.6,
        	x=235, y=680,
        	radius=18,
        	thickness=5,
        	start_angle=-90,
        	end_angle=190
    	},
--Core 0	
	{
    		name='execi',
    		arg="sensors | grep 'Core 0'",
    		max=100,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xCC0000,
    		fg_alpha=0.3,
    		x=145, y=420,
    		radius=26,
    		thickness=10,
    		start_angle=-90,
    		end_angle=90,
    	},
--Core 1
	{
    		name='execi',
    		arg="sensors | grep 'Core 1'",
    		max=100,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xFFCC00,
    		fg_alpha=0.5,
    		x=197, y=420,
    		radius=26,
    		thickness=10,
    		start_angle=90,
    		end_angle=270,
    	},
--Cpu	
	{
    		name='execi',
    		arg="sensors | grep 'CPU Temperature'",
    		max=100,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xF339900,
    		fg_alpha=0.5,
    		x=249, y=420,
    		radius=26,
    		thickness=10,
    		start_angle=-90,
    		end_angle=90,
    	},
--M/b   	
	{
    		name='execi',
    		arg="sensors | grep 'MB Temperature'",
    		max=100,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xFFCC00,
    		fg_alpha=0.5,
    		x=203, y=575,
    		radius=26,
    		thickness=10,
    		start_angle=-90,
    		end_angle=90,
    	},
--Gpu 	
	{
    		name='execi',
    		arg="sensors | grep 'temp2'",
    		max=100,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xCC0000,
    		fg_alpha=0.3,
    		x=255, y=575,
    		radius=26,
    		thickness=10,
    		start_angle=90,
    		end_angle=270,
    	},
--Cpu 
 	{
    		name='execi',
    		arg="sensors | grep 'CPU FAN Speed'",
    		max=3000,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xCC0000,
    		fg_alpha=0.3,
    		x=80, y=715,
    		radius=70,
    		thickness=20,
    		start_angle=90,
    		end_angle=322,
    	},
    	{
    		name='execi',
    		arg="sensors | grep 'CHASSIS2 FAN Speed'",
    		max=3000,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xFFCC00,
    		fg_alpha=0.3,
    		x=80, y=715,
    		radius=50,
    		thickness=15,
    		start_angle=90,
    		end_angle=322,
    	},
    	{
    		name='execi',
    		arg="sensors | grep 'CHASSIS FAN Speed'",
    		max=3000,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0x339900,
    		fg_alpha=0.3,
    		x=80, y=715,
    		radius=35,
    		thickness=10,
    		start_angle=90,
    		end_angle=322,
    	},
	}

-- Use these settings to define the origin and extent of your clock.

clock_r=127

-- "clock_x" and "clock_y" are the coordinates of the centre of the clock, in pixels, from the top left of the Conky window.

clock_x=150
clock_y=150

-- Colour & alpha of the clock hands

clock_colour=0xFF6600
clock_alpha=1

-- Do you want to show the seconds hand?

show_seconds=true

require 'cairo'

function rgb_to_r_g_b(colour,alpha)
	return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function draw_ring(cr,t,pt)
	local w,h=conky_window.width,conky_window.height

	local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
	local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']

	local angle_0=sa*(2*math.pi/360)-math.pi/2
	local angle_f=ea*(2*math.pi/360)-math.pi/2
	local t_arc=t*(angle_f-angle_0)

	-- Draw background ring

	cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
	cairo_set_line_width(cr,ring_w)
	cairo_stroke(cr)

	-- Draw indicator ring

	cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
	cairo_stroke(cr)
end

function draw_clock_hands(cr,xc,yc)
	local secs,mins,hours,secs_arc,mins_arc,hours_arc
	local xh,yh,xm,ym,xs,ys

	secs=os.date("%S")
	mins=os.date("%M")
	hours=os.date("%I")

	secs_arc=(2*math.pi/60)*secs
	mins_arc=(2*math.pi/60)*mins+secs_arc/60
	hours_arc=(2*math.pi/12)*hours+mins_arc/12

	-- Draw hour hand

	xh=xc+0.7*clock_r*math.sin(hours_arc)
	yh=yc-0.7*clock_r*math.cos(hours_arc)
	cairo_move_to(cr,xc,yc)
	cairo_line_to(cr,xh,yh)

	cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
	cairo_set_line_width(cr,5)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(clock_colour,clock_alpha))
	cairo_stroke(cr)

	-- Draw minute hand

	xm=xc+clock_r*math.sin(mins_arc)
	ym=yc-clock_r*math.cos(mins_arc)
	cairo_move_to(cr,xc,yc)
	cairo_line_to(cr,xm,ym)

	cairo_set_line_width(cr,3)
	cairo_stroke(cr)

	-- Draw seconds hand

	if show_seconds then
		xs=xc+clock_r*math.sin(secs_arc)
		ys=yc-clock_r*math.cos(secs_arc)
		cairo_move_to(cr,xc,yc)
		cairo_line_to(cr,xs,ys)

		cairo_set_line_width(cr,1)
		cairo_stroke(cr)
	end
end

function conky_clock_rings()
	local function setup_rings(cr,pt)
		local str=''
		local value=0

		str=string.format('${%s %s}',pt['name'],pt['arg'])
		str=conky_parse(str)

		value=tonumber(str)
		if value == nil then value = 0 end
		pct=value/pt['max']

		draw_ring(cr,pct,pt)
	end

	-- Check that Conky has been running for at least 5s

	if conky_window==nil then return end
	local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)

	local cr=cairo_create(cs)	

	local updates=conky_parse('${updates}')
	update_num=tonumber(updates)

	if update_num>5 then
		for i in pairs(settings_table) do
			setup_rings(cr,settings_table[i])
		end
	end

	draw_clock_hands(cr,clock_x,clock_y)
end

http://pix.toile-libre.org/upload/img/1354742344.jpg

sa ne fonctionne pas par ce que tu oublie d'indiquer le temps pour execi
le premier exemple que je vois dans la table.

{
    		name='execi',
    		arg="sensors | grep 'Core 0'",
    		max=100,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xCC0000,
    		fg_alpha=0.3,
    		x=145, y=420,
    		radius=26,
    		thickness=10,
    		start_angle=-90,
    		end_angle=90,
    	},

devrait être

{
    		name='execi',
    		arg="10 sensors | grep 'Core 0'",
    		max=100,
    		bg_colour=0xffffff,
    		bg_alpha=0.15,
    		fg_colour=0xCC0000,
    		fg_alpha=0.3,
    		x=145, y=420,
    		radius=26,
    		thickness=10,
    		start_angle=-90,
    		end_angle=90,
    	},

normalement sa devrait fonctionner

Hors ligne

#2116 Le 06/12/2012, à 07:58

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

@ ragamatrix,

voici la ligne pour récupérer l'adresse de ton image.

curl -s http://weather.msfc.nasa.gov/GOES/goeseastconusir.html | grep -m 1 'GOES-E CONUS" TYPE=' | sed -e 's/^.*SRC="//' | sed -e 's/".*$//' | sed 's/^/http:\/\/weather\.msfc\.nasa\.gov/'

Hors ligne

#2117 Le 06/12/2012, à 11:05

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

@Didier-T
Génial; merci encore maintenant il faut choisir, la meilleure carte que j'ai trouvé est celle-ci par contre losque j'applique convert dessus le cpu Chauffe chauffe !!
Peut-être faudrait-il choisir la dernière que tu m'as gentillement aider à extraire; qui est plus petite donc consomerait moins de cpu...
j'en suis là :
globsatus

Hors ligne

#2118 Le 06/12/2012, à 12:20

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

avant de faire tourner ton script, n'oublie pas de faire un resize.

Hors ligne

#2119 Le 06/12/2012, à 12:27

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Didier-T a écrit :

avant de faire tourner ton script, n'oublie pas de faire un resize.


J'ai mis le resize à la fin du script...fallait-il le mettre au début ?
script:

 #!/bin/bash
###Script de sphérisation carte satellite pour les Etats-Unis  		  ## http://weather.msfc.nasa.gov/GOES/ICG13-09312012339.jpg ##
									  ## http://www.meteo-mc.fr/dedie/Images/sat/satireu1.gif
									  ## http://weather.rap.ucar.edu/satellite/g13.2012339.1645_US_vis.jpg
									  ## http://www.meteo.gc.ca/data/satellite/goes_enam_1070_100.jpg

##--[[test=`curl -s http://weather.msfc.nasa.gov/GOES/goeseastconusir.html | grep -m 1 'GOES-E CONUS" TYPE=' | sed -e 's/^.*SRC="//' | sed -e 's/".*$//' | sed 's/^/http:\/\/weather\.msfc\.nasa\.gov/'` && wget -O /tmp/gwsus.jpg $test---]##

wget  -q -O  /tmp/goes_enam_1070_100.jpg "http://www.meteo.gc.ca/data/satellite/goes_enam_1070_100.jpg"
									  


convert /tmp/goes_enam_1070_100.jpg -filter Lanczos -crop  950x950+0+45\! /tmp/goes_enam_1070_100.png

#creation du masque 
convert -size 950x950 xc:black -fill white -draw 'circle 474.5,474.5 474.5,0'   /tmp/masque.png

convert -size 950x950 xc:  -channel R  -fx 'yy=(j+.5)/h-.5; (i/w-.5)/(sqrt(1-4*yy^2))+.5' \
-separate  +channel     /tmp/sphere_lut.png

convert /tmp/masque.png \
 \( +clone -blur 0x20 -shade 110x21.7 -contrast-stretch 0% \
 +sigmoidal-contrast 6x50% -fill grey50 -colorize 10%  \) \
 -composite /tmp/overlay.png



convert /tmp/goes_enam_1070_100.png -resize 950x950   /tmp/sphere_lut.png   -fx 'p{ v*w, j }' \
/tmp/overlay.png   -compose HardLight  -composite \
/tmp/masque.png -alpha off -compose CopyOpacity -composite \
/tmp/sphere_goes_enam_1070_100.png
convert /tmp/sphere_goes_enam_1070_100.png -resize 450x450 /tmp/sphere_goes_enam_1070_100.png 

rm /tmp/overlay.png ;rm /tmp/masque.png ;rm /tmp/sphere_lut.png 

Hors ligne

#2120 Le 06/12/2012, à 13:05

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

en effet c'est mieux avant (pour ton processeur), en fait juste après avoir téléchargé l'image.

Hors ligne

#2121 Le 06/12/2012, à 15:12

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

@Didier-T
Fallait juste y penser effectivement ça soulage.

Autre chose...demain j' arrête big_smile
J'ai un script qui permet d'afficher les images et les explications de celles-ci (archive_images_nasa)
pour ensuite faire un fond d'ecran dynamique.
Ce qui m'interessait c'était de faire une sorte de conky diaporama avec ces photos et ces explications scientifiques...tournant en boucle.
Donc j'ai modifié ce script afin que les photos soient seulement enregistrées dans un dossier.
Ce que je n'arrive pas à faire c'est de les redimensionner et de le faire tourner dans conky...je peux les redimensionner comme ça :

 mogrify -resize 30% ~/wallpapers/*.jpg  

mais comment les appeler dans conky ?
script original en perl
random-nasa-wallpaper.pl:

 #!/usr/bin/perl
# Copyright (c) Laszlo Simon.
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or ( at your option) any later version.
#             
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
#                            
# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA)

# CONFIGURATION
$explonation = 'true';        # true | false
$explonation_place = 'south'; # east|north|west|south|norteast|...

# INIT
if (`xdpyinfo | grep dimensions` =~ /(\d+)x(\d+)\s+pixels/)
{
  ($width, $height) = ($1,$2);
}
else
{
  die("Can not determine screen resolution. Maybe 'xdpyinfo' not installed.\n");
}
  
$explonation_width = int($width * 2 / 3);
$explonation_height = int($width / 10);

$date = sprintf("%02d",0+int(rand(8)))
        .sprintf("%02d",1+int(rand(12)))
        .sprintf("%02d",1+int(rand(28)));

if (system("wget --version"))
{
  die("'wget' should be installed.\n")
}

system("wget -O /tmp/apxxxxxx.html 'http://antwrp.gsfc.nasa.gov/apod/ap$date.html'");

# Get image

open HTML, "/tmp/apxxxxxx.html";
$content = join('',(<HTML>));
close HTML;

$content =~ /\<a\s+href\=\"((?:\w+\/)*)(\w+)(\.\w+)\"\s*\>\s*\n*\s*\<img/ims;

$path = $1;
$img = $2;
$ext = $3;

`mkdir -p ~/wallpapers`;
print ">>>>http://antwrp.gsfc.nasa.gov/$path$img$ext\n";
system("wget -O ~/wallpapers/$img$ext 'http://antwrp.gsfc.nasa.gov/$path$img$ext'");

# Get text

if (system("html2text -version"))
{
  warn("Explonation disabled. 'html2text' should be installed.\n");
  $explonation = 'false';
}

if (system("convert -version"))
{
  warn("Explonation disabled. 'convert' (imagemagick) should be installed. \n");
  $explonation = 'false';
}


if ($explonation eq 'true')
{
  system("html2text -style pretty -o /tmp/apxxxxxx.txt /tmp/apxxxxxx.html");
 
  open TXT, "/tmp/apxxxxxx.txt";
  $content = join('',(<TXT>));
  close TXT;

  $text = 
    ($content =~ /Explanation:\s*(.*)\s*Tomorrow\'s picture:/s)
    ? $1
    : '';

  print $text."\n";
  
  $text =~ s/\n/ /g;

  open TXT, ">/tmp/apxxxxxx-anno.txt";
  print TXT $text;
  close TXT;

  system("convert ~/wallpapers/$img$ext "
         ."-resize $width"."x$height\\> "
         ."-size $width"."x$height xc:black +swap "
         ."-gravity center "
         ."-composite "
         ."~/wallpapers/$img$ext"
         );
         
  system("convert "
         ."-background '#0008' "
         ."-fill white "
         ."-gravity northwest "
         ."-pointsize 14 "
         ."-size $explonation_width"."x$explonation_height "
         ."caption:\@/tmp/apxxxxxx-anno.txt "
         ."~/wallpapers/$img$ext "
         ."+swap -gravity $explonation_place -composite "
         ."~/wallpapers/$img$ext"
         );
}

system("gconftool -t string -s /desktop/gnome/background/picture_filename ~/wallpapers/$img$ext");
system("xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s ~/wallpapers/$img$ext");

J'ai seulement effacé dans l'avant dernière ligne ceci :

 gconftool -t string -s /desktop/gnome/background/picture_filename 

et commenté la dernière...

Dernière modification par ragamatrix (Le 06/12/2012, à 15:13)

Hors ligne

#2122 Le 06/12/2012, à 19:11

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

N'étant pas très alaise en perl, je te proposerai une petite modification.
Juste sur les deux dernières lignes.

random-nasa-wallpaper.pl:

 #!/usr/bin/perl
# Copyright (c) Laszlo Simon.
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or ( at your option) any later version.
#             
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
#                            
# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA)

# CONFIGURATION
$explonation = 'true';        # true | false
$explonation_place = 'south'; # east|north|west|south|norteast|...

# INIT
if (`xdpyinfo | grep dimensions` =~ /(\d+)x(\d+)\s+pixels/)
{
  ($width, $height) = ($1,$2);
}
else
{
  die("Can not determine screen resolution. Maybe 'xdpyinfo' not installed.\n");
}
  
$explonation_width = int($width * 2 / 3);
$explonation_height = int($width / 10);

$date = sprintf("%02d",0+int(rand(8)))
        .sprintf("%02d",1+int(rand(12)))
        .sprintf("%02d",1+int(rand(28)));

if (system("wget --version"))
{
  die("'wget' should be installed.\n")
}

system("wget -O /tmp/apxxxxxx.html 'http://antwrp.gsfc.nasa.gov/apod/ap$date.html'");

# Get image

open HTML, "/tmp/apxxxxxx.html";
$content = join('',(<HTML>));
close HTML;

$content =~ /\<a\s+href\=\"((?:\w+\/)*)(\w+)(\.\w+)\"\s*\>\s*\n*\s*\<img/ims;

$path = $1;
$img = $2;
$ext = $3;

`mkdir -p ~/wallpapers`;
print ">>>>http://antwrp.gsfc.nasa.gov/$path$img$ext\n";
system("wget -O ~/wallpapers/$img$ext 'http://antwrp.gsfc.nasa.gov/$path$img$ext'");

# Get text

if (system("html2text -version"))
{
  warn("Explonation disabled. 'html2text' should be installed.\n");
  $explonation = 'false';
}

if (system("convert -version"))
{
  warn("Explonation disabled. 'convert' (imagemagick) should be installed. \n");
  $explonation = 'false';
}


if ($explonation eq 'true')
{
  system("html2text -style pretty -o /tmp/apxxxxxx.txt /tmp/apxxxxxx.html");
 
  open TXT, "/tmp/apxxxxxx.txt";
  $content = join('',(<TXT>));
  close TXT;

  $text = 
    ($content =~ /Explanation:\s*(.*)\s*Tomorrow\'s picture:/s)
    ? $1
    : '';

  print $text."\n";
  
  $text =~ s/\n/ /g;

  open TXT, ">/tmp/apxxxxxx-anno.txt";
  print TXT $text;
  close TXT;

  system("convert ~/wallpapers/$img$ext "
         ."-resize $width"."x$height\\> "
         ."-size $width"."x$height xc:black +swap "
         ."-gravity center "
         ."-composite "
         ."~/wallpapers/$img$ext"
         );
         
  system("convert "
         ."-background '#0008' "
         ."-fill white "
         ."-gravity northwest "
         ."-pointsize 14 "
         ."-size $explonation_width"."x$explonation_height "
         ."caption:\@/tmp/apxxxxxx-anno.txt "
         ."~/wallpapers/$img$ext "
         ."+swap -gravity $explonation_place -composite "
         ."~/wallpapers/$img$ext"
         );
}

system("mv ~/wallpapers/$img$ext ~/wallpapers/image.jpg");

et donc pour appeler l'image le chemin est ~/wallpapers/image.jpg

Hors ligne

#2123 Le 06/12/2012, à 19:21

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

bon j'ai trouvé un script pouvant faire un diaporama avec des photos au hasard...Par contre je voudrais enlever l'effet convert qui rend illisible les explications...Comme ce script est écrit en bash je ne sais pas trop comment supprimer ces fonctions.

 #!/bin/bash
#
# Photo in conky
# by Sbskl

cd "$1"
let "expire = 60"
let "nombre = `ls /tmp/conkyPhoto*.png | wc -l`"

if [ $nombre -gt 1 ]
then
	let "minute = `date +%-M` % nombre + 1"
	if [ $minute != $2 ]
	then
		exit 0
	fi
fi
if [ -e /tmp/conkyPhoto$2 ] # La liste existe-t-elle ?
then
	# Nombre de minutes depuis la derniere création de la liste.
	let "temps=(`date +%s`-`stat -c%Y /tmp/conkyPhoto$2`)/60"
else
	let "temps=$expire" # Il n'existe pas donc périmé.
fi
if [ $temps -ge $expire ] # Est ce que ça fait plus d'une heure ?
then
	find . -iname "*.jpg" > /tmp/conkyPhoto$2
fi

##let "ligne = $RANDOM % `cat /tmp/conkyPhoto$2 | wc -l` + 2" # Une ligne au hasard dans la liste
##let "angle = $RANDOM % 9 - 4" # Un angle au hasard compris entre -4° et +4°

fichier="`cat /tmp/conkyPhoto$2 | head -n $ligne | tail -n 1`" # Fichier correspondant à la ligne choisie
photo=/tmp/conkyPhoto$2.png # Image obtenue après transformation

# Transformation...

# Taille de 360x360 pour ne pas avoir un effet polaroid trop présent
convert "$fichier" -gravity center -resize 640x360^ -extent 640x360 -bordercolor snow -background black -polaroid $angle "$photo"
# Taille de 180x180 pour ne pas prendre trop de place à l'écran
convert "$photo" -resize 640x360  "$photo"

exit 0 

diaponasa

Dernière modification par ragamatrix (Le 06/12/2012, à 19:31)

Hors ligne

#2124 Le 06/12/2012, à 19:28

ljere

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

@ragamatrix je crois que tu t'es planté de lien


ancien PC Toshiba satellite_c670d-11 / Linux Mint 21 Vanessa
Nouveau PC ASUS TUF GAMING A17 GPU RTX 4070 CPU AMD Ryzen 9 7940HS w/ Radeon 780M Graphics / Linux Mint 21.2 Victoria / Kernel: 6.4.8-1-liquorix / Desktop: Cinnamon

Hors ligne

#2125 Le 06/12/2012, à 19:28

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Didier-T a écrit :

N'étant pas très alaise en perl, je te proposerai une petite modification.
Juste sur les deux dernières lignes.

random-nasa-wallpaper.pl:

 #!/usr/bin/perl
# Copyright (c) Laszlo Simon.
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or ( at your option) any later version.
#             
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
#                            
# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA)

# CONFIGURATION
$explonation = 'true';        # true | false
$explonation_place = 'south'; # east|north|west|south|norteast|...

# INIT
if (`xdpyinfo | grep dimensions` =~ /(\d+)x(\d+)\s+pixels/)
{
  ($width, $height) = ($1,$2);
}
else
{
  die("Can not determine screen resolution. Maybe 'xdpyinfo' not installed.\n");
}
  
$explonation_width = int($width * 2 / 3);
$explonation_height = int($width / 10);

$date = sprintf("%02d",0+int(rand(8)))
        .sprintf("%02d",1+int(rand(12)))
        .sprintf("%02d",1+int(rand(28)));

if (system("wget --version"))
{
  die("'wget' should be installed.\n")
}

system("wget -O /tmp/apxxxxxx.html 'http://antwrp.gsfc.nasa.gov/apod/ap$date.html'");

# Get image

open HTML, "/tmp/apxxxxxx.html";
$content = join('',(<HTML>));
close HTML;

$content =~ /\<a\s+href\=\"((?:\w+\/)*)(\w+)(\.\w+)\"\s*\>\s*\n*\s*\<img/ims;

$path = $1;
$img = $2;
$ext = $3;

`mkdir -p ~/wallpapers`;
print ">>>>http://antwrp.gsfc.nasa.gov/$path$img$ext\n";
system("wget -O ~/wallpapers/$img$ext 'http://antwrp.gsfc.nasa.gov/$path$img$ext'");

# Get text

if (system("html2text -version"))
{
  warn("Explonation disabled. 'html2text' should be installed.\n");
  $explonation = 'false';
}

if (system("convert -version"))
{
  warn("Explonation disabled. 'convert' (imagemagick) should be installed. \n");
  $explonation = 'false';
}


if ($explonation eq 'true')
{
  system("html2text -style pretty -o /tmp/apxxxxxx.txt /tmp/apxxxxxx.html");
 
  open TXT, "/tmp/apxxxxxx.txt";
  $content = join('',(<TXT>));
  close TXT;

  $text = 
    ($content =~ /Explanation:\s*(.*)\s*Tomorrow\'s picture:/s)
    ? $1
    : '';

  print $text."\n";
  
  $text =~ s/\n/ /g;

  open TXT, ">/tmp/apxxxxxx-anno.txt";
  print TXT $text;
  close TXT;

  system("convert ~/wallpapers/$img$ext "
         ."-resize $width"."x$height\\> "
         ."-size $width"."x$height xc:black +swap "
         ."-gravity center "
         ."-composite "
         ."~/wallpapers/$img$ext"
         );
         
  system("convert "
         ."-background '#0008' "
         ."-fill white "
         ."-gravity northwest "
         ."-pointsize 14 "
         ."-size $explonation_width"."x$explonation_height "
         ."caption:\@/tmp/apxxxxxx-anno.txt "
         ."~/wallpapers/$img$ext "
         ."+swap -gravity $explonation_place -composite "
         ."~/wallpapers/$img$ext"
         );
}

system("mv ~/wallpapers/$img$ext ~/wallpapers/image.jpg");

et donc pour appeler l'image le chemin est ~/wallpapers/image.jpg

Merci tu m'as devancé...je vais essayer de mettre un peu d'ordre et supprimer mes essais de scripts précédents; mais ta solution semble être ce que je cherchais; merci

Hors ligne