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.

#2276 Le 24/01/2013, à 11:26

ragamatrix

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

Didier-T a écrit :

avec cette adresse ci, il y a moyen de faire quelque chose de bien.

il y a les liens pour les photos, ainsi que leurs descriptions en anglais

Oui c'est vrai, mais c'est sur ce site que je rencontre le problème des vidéos ou des gifs qui font planter le précédent script perl qui utilise cette adresse...(en effet c'est une bonne adresse mais je crois qu'il faut filtrer les vidéo et là....)

Hors ligne

#2277 Le 24/01/2013, à 11:37

Didier-T

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

sa n'est pas bien grave, il suffit de mettre une sécurité.

Hors ligne

#2278 Le 24/01/2013, à 11:49

ragamatrix

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

j'ai fais un test avec cette adresse mais j'ai des erreurs :

  └─> '/home/climatix/développement/pas1.1/pictureday.sh' 
/home/climatix/développement/pas1.1/pictureday.sh: ligne 26 : [: -le : opérateur unaire attendu
--2013-01-24 11:45:56--  http://apod.nasa.gov/apod/archivepix.html/page/1
Résolution de apod.nasa.gov (apod.nasa.gov)... 129.164.179.22
Connexion vers apod.nasa.gov (apod.nasa.gov)|129.164.179.22|:80... connecté.
requête HTTP transmise, en attente de la réponse... 404 Not Found
2013-01-24 11:45:57 ERREUR 404: Not Found.

sed: impossible de lire /1.xml: Aucun fichier ou dossier de ce type
wget: URL manquante
Usage: wget [OPTION]... [url]...
 

Hors ligne

#2279 Le 24/01/2013, à 11:55

Didier-T

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

Normal, elle donne sur rien, voici le lien que tu cherche a charger.
http://apod.nasa.gov/apod/archivepix.html/page/1

Hors ligne

#2280 Le 24/01/2013, à 12:32

ragamatrix

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

effectivement....Je croyais que /page/1 faisait partie du script.
Il doit y avoir du nettoyage à faire...
J'ai changé par cette ligne :

 wget http://apod.nasa.gov/apod/archivepix.html/$i -O $i.xml 

et j'ai cette erreur:

 '/home/climatix/développement/pas1.1/pictureday.sh' 
/home/climatix/développement/pas1.1/pictureday.sh: ligne 26 : [: -le : opérateur unaire attendu
--2013-01-24 12:31:02--  http://apod.nasa.gov/apod/archivepix.html/1
Résolution de apod.nasa.gov (apod.nasa.gov)... 129.164.179.22
Connexion vers apod.nasa.gov (apod.nasa.gov)|129.164.179.22|:80... connecté.
requête HTTP transmise, en attente de la réponse... 404 Not Found
2013-01-24 12:31:02 ERREUR 404: Not Found.

sed: impossible de lire /1.xml: Aucun fichier ou dossier de ce type
wget: URL manquante
Usage: wget [OPTION]... [url]...

Essayez « wget --help » pour plus d'informations.
rm: impossible de supprimer «openboxlogout-0.1»: est un dossier
sed: impossible de lire /list_maj: Aucun fichier ou dossier de ce type
convert: impossible d'ouvrir l'image `/.jpg':  @ error/blob.c/OpenBlob/2587.
convert: pas de délégué pour décoder ce format d'image `/.jpg' @ error/constitute.c/ReadImage/532.
convert: nom de fichier d'image absent `/tmp/..png' @ error/convert.c/ConvertImageCommand/3011.
convert: impossible d'ouvrir l'image `/trix.png.jpg':  @ error/blob.c/OpenBlob/2587.
convert: nom de fichier d'image absent `/tmp/.trix.png.png' @ error/convert.c/ConvertImageCommand/3011.
${image /tmp/..png -p 2,2}
${image /tmp/.trix.png.png -p 2,300}
┌─( climatix ) - ( 3.2.0-36-generic ) - ( ~ )
└─> 
 

C'est comme s'il prenait n'importe quelle image dans mon home ...?

J' ai aussi essayé ça :

 GET http://apod.nasa.gov/apod/archivepix.html > get_image.txt 

qui me renvoie un fichier texte avec toutes les donneés... J'y vais à l'aveuglette, je ne connais pas trop le code...

(juste quelques lignes car ça va jusqu'en 1997...) get_image.txt:

 2013 January 24:  <a href="ap130124.html">ISS and the Summer Milky Way</a><br>
2013 January 23:  <a href="ap130123.html">Nearby Spiral Galaxy NGC 4945</a><br>
2013 January 22:  <a href="ap130122.html">The Cygnus Wall of Star Formation</a><br>
2013 January 21:  <a href="ap130121.html">Huygens: Titan Descent Movie</a><br>
2013 January 20:  <a href="ap130120.html">The Antikythera Mechanism</a><br>
2013 January 19:  <a href="ap130119.html">Barnard Stares at NGC 2170</a><br>
2013 January 18:  <a href="ap130118.html">Stickney Crater</a><br>
2013 January 17:  <a href="ap130117.html">Cas A: Optical and X-ray</a><br>
2013 January 16:  <a href="ap130116.html">NGC 1309: Spiral Galaxy and Friends</a><br>
2013 January 15:  <a href="ap130115.html">A Solar Ballet</a><br>
2013 January 14:  <a href="ap130114.html">NGC 2170: Celestial Still Life</a><br>
2013 January 13:  <a href="ap130113.html">NGC 602 and Beyond</a><br>
2013 January 12:  <a href="ap130112.html">Ten Billion Earths</a><br>
2013 January 11:  <a href="ap130111.html">The Fornax Cluster of Galaxies</a><br>
2013 January 10:  <a href="ap130110.html">The Orion Bullets</a><br>
2013 January 09:  <a href="ap130109.html">The Elusive Jellyfish Nebula</a><br>
2013 January 08:  <a href="ap130108.html">Grand Spiral Galaxy NGC 7424</a><br>
2013 January 07:  <a href="ap130107.html">AE Aurigae and the Flaming Star Nebula</a><br>
2013 January 06:  <a href="ap130106.html">The Dark Tower in Scorpius</a><br>
2013 January 05:  <a href="ap130105.html">Stereo Helene</a><br>
2013 January 04:  <a href="ap130104.html">Sunrise at Tycho</a><br>
2013 January 03:  <a href="ap130103.html">Open Star Clusters M35 and NGC 2158</a><br>
2013 January 02:  <a href="ap130102.html">The Einstein Cross Gravitational Lens</a><br>
2013 January 01:  <a href="ap130101.html">A Double Star Cluster</a><br>
2012 December 31:  <a href="ap121231.html">Saturn's Rings from the Dark Side</a><br>
2012 December 30:  <a href="ap121230.html">Doomed Star Eta Carinae</a><br>
2012 December 29:  <a href="ap121229.html">Zeta Oph: Runaway Star</a><br>
2012 December 28:  <a href="ap121228.html">NGC 6188 and NGC 6164</a><br>
2012 December 27:  <a href="ap121227.html">Curiosity Rover at Rocknest on Mars</a><br>
2012 December 26:  <a href="ap121226.html">Makemake of the Outer Solar System</a><br>
2012 December 25:  <a href="ap121225.html">Yosemite Winter Night</a><br>..........etc 

Dernière modification par ragamatrix (Le 24/01/2013, à 12:51)

Hors ligne

#2281 Le 24/01/2013, à 13:25

Didier-T

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

L'adresse que je te donnais, est juste une source d'information, après il faut traiter les données.

Hors ligne

#2282 Le 24/01/2013, à 13:36

ragamatrix

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

Didier-T a écrit :

L'adresse que je te donnais, est juste une source d'information, après il faut traiter les données.

oui traiter les données...
Bon je mets ça de coté...C'est un peut trop "hard" pour moi.Merci pour les infos smile

Dernière modification par ragamatrix (Le 24/01/2013, à 14:31)

Hors ligne

#2283 Le 24/01/2013, à 15:06

ragamatrix

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

ce diaporama à l'air aussi très sympa; par contre je n'arrive pas à le faire tourner chez moi... à suivre...

Hors ligne

#2284 Le 28/01/2013, à 17:41

ragamatrix

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

Didier-T a écrit :

sa n'est pas bien grave, il suffit de mettre une sécurité.

Salut !

Peut_on mettre ce genre de sécurité dans un script perl ?
Quel  genre de syntaxe faut-il utiliser ?
Merci.

Hors ligne

#2285 Le 29/01/2013, à 20:10

Angelsword

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

Salut à tous,

J'ai une petite question, pensez-vous qu'il existe un moyen de faire bosser Conky en 60 fps ?
Je m'explique, apparemment de visu, l'affichage des différents paramètres (CPU/Ram etc ) ont un délais de rafraîchissement d'environ une à 2s, n'y aurait-il pas un moyen d'augmenter cette fréquence ?


Ubuntu 64 / Asus ROG Maximus VII / i7 4790k / 16 go Ram 1600 Mhz Corsair Vengeance / SSD Corsair Force Series GS 240 Go /
Geforce GTX 980 Gainward 4Go
Asus Front base panel ROG.
Thermaltake Xaser III toujours au poste !

Hors ligne

#2286 Le 29/01/2013, à 20:42

Rolinh

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

Salut,

C'est le paramètre update_interval qui permet de déterminer le taux de rafraichissement.
Cependant, il faut savoir que c'est couteux en ressource système de récupérer les informations et vouloir le faire plus de 1 fois par seconde n'est pas souhaitable, d'autant plus que ça n'apporterait pas grand chose.

Dernière modification par Rolinh (Le 29/01/2013, à 20:44)

Hors ligne

#2287 Le 29/01/2013, à 20:47

Angelsword

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

Merci Rolinh, c'était surtout pour une question de confort visuel rien de plus, je trouve ça tellement plus joli wink
Je ne pensais pas que ça coûterait tant en ressource.


Ubuntu 64 / Asus ROG Maximus VII / i7 4790k / 16 go Ram 1600 Mhz Corsair Vengeance / SSD Corsair Force Series GS 240 Go /
Geforce GTX 980 Gainward 4Go
Asus Front base panel ROG.
Thermaltake Xaser III toujours au poste !

Hors ligne

#2288 Le 02/02/2013, à 05:44

Didier-T

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

@ragamatrix,

j'ai modifié ton script de manière a ce qu'il trouve toujours une image.
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);

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

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

  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;
}
while ($path eq "");

`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 north "
#         ."-pointsize 20 "
#         ."-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");  

Hors ligne

#2289 Le 03/02/2013, à 17:51

ragamatrix

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

@Didier-T
Merci de t'être penché sur ce script par contre j'ai une erreur :

 '/home/climatix/développement/pgcrs-0.2.1/random-nasa-wallpaper2.pl' 
syntax error at /home/climatix/développement/pgcrs-0.2.1/random-nasa-wallpaper2.pl line 36, near "do
"
syntax error at /home/climatix/développement/pgcrs-0.2.1/random-nasa-wallpaper2.pl line 54, near "}"
Execution of /home/climatix/développement/pgcrs-0.2.1/random-nasa-wallpaper2.pl aborted due to compilation errors.
┌─( climatix ) - ( 3.2.0-37-generic ) - ( ~ )
└─> 
 

Hors ligne

#2290 Le 03/02/2013, à 18:01

Didier-T

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

oups, j'ai oublié un ;

 #!/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);

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

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

  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;
}
while ($path eq "");

`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 north "
#         ."-pointsize 20 "
#         ."-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");  

Hors ligne

#2291 Le 03/02/2013, à 18:18

ragamatrix

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

@Didier-T
ça a l'air de tourner, encore un grand MERCI alors !

Hors ligne

#2292 Le 04/02/2013, à 10:34

ragamatrix

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

Salut !
Pour les fous de lua (bizarre je pensais à Didier-T... wink ) je suis tombé la dessus :
Un script entièrement customisable, un peu dur à lire pour la date mais joli technique....
cl1
cl3
cl3
cl4
cl5
Le script:
ScriptClock.lua----->

 --this lua script for use in conky
require 'cairo'
extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
function conky_clock()
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)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
--######################################################################
-- Settings ############################################################
--######################################################################
center_x=110
center_y=110
--style set 0 for none or 1, 2, 3, 4, or mine
style_set=2
--clock face 1 or 2
clock_face=2
--hours on the clock 12 or 24
hours=12
--visiblity 1 or 0
hands=1
lights=0
digital=0
chrono=0
gears=0
texts=1
--the second interval displayed 5, 10, or 15
seconds=15
-- Colors
d_font_red=.8
d_font_green=.8
d_font_blue=.8
d_font_alpha=1
br_red=.5
br_green=.5
br_blue=.5
br_alpha=1
bg_red=.05
bg_green=.05
bg_blue=.05
bg_alpha=1
lights_red=.2
lights_green=.2
lights_blue=1
lights_alpha=.75
hands_red=.5
hands_green=.5
hands_blue=.5
hands_ired=.25
hands_igreen=.25
hands_iblue=.25
hands_alpha=1
--######################################################################
-- Style Sets ##########################################################
--######################################################################
if style_set == 1 then
clock_face=1
hours=12
hands=0
lights=1
digital=1
chrono=0
gears=0
texts=1
seconds=5
end
if style_set == 2 then
clock_face=2
hours=12
hands=1
lights=0
digital=0
chrono=0
gears=0
texts=1
seconds=5
end
if style_set == 3 then
clock_face=1
hours=24
hands=0
lights=1
digital=0
chrono=1
gears=1
texts=1
seconds=10
end
if style_set == 4 then
clock_face=2
hours=24
hands=1
lights=0
digital=0
chrono=1
gears=1
texts=1
seconds=10
end
if style_set == mine then
clock_face=2
hours=24
hands=1
lights=1
digital=0
chrono=1
gears=1
texts=1
seconds=5
end
--######################################################################
-- Strings #############################################################
--######################################################################
d_line_width=1
d_math=math.pi/180
d_font="mono"
d_font_size=11
d_font_slant=CAIRO_FONT_SLANT_NORMAL
d_font_face=CAIRO_FONT_WEIGHT_NORMAL
outer_radius=100
year=conky_parse("${time %y}")
month_number=tonumber(conky_parse("${time %m}"))
weekday=conky_parse("${time %u}")
day=conky_parse("${time %a}")
abbr_month=conky_parse("${time %b}")
day_number=conky_parse("${time %d}")
ampm=conky_parse("${time %p}")
second=tonumber(conky_parse("${time %S}"))
minute=tonumber(conky_parse("${time %M}"))
if hours ~= 12 then hours=24 end
if hours == 12 then
hour=tonumber(conky_parse("${time %I}"))
time_hms=conky_parse("${time %r}")
i_start=1
i_end=12
else
hour=tonumber(conky_parse("${time %H}"))
time_hms=conky_parse("${time %T}")
i_start=0
i_end=hours-1
end
--######################################################################
-- Gears ###############################################################
--######################################################################
if gears == 1 then
gear((center_x+45),(center_y+45),25,25,6,second,60,1,.75)
gear((center_x-45),(center_y+45),25,20,6,((minute*60)+second),(60*60),0,.75)
gear((center_x+45),(center_y-45),25,15,6,((hour*60)+(minute*60)+second),(60*60*60),1,.75)
gear((center_x-45),(center_y-45),25,10,6,((day_number*24)+(hour*60)+(minute*60)+second),(60*60*60*24),1,.75)
end
--######################################################################
-- Chrono ##############################################################
--######################################################################
if chrono == 1 then
--left weekday
cairo_set_line_width(cr,2)
cairo_arc(cr,(center_x-35),center_y,25,(0*d_math),(360*d_math))
cairo_arc_negative(cr,(center_x-35),center_y,12,(360*d_math),(0*d_math))
cairo_set_source_rgba(cr,bg_red,bg_green,bg_blue,bg_alpha)
cairo_fill(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,(center_x-35),center_y,25,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,(center_x-35),center_y,12,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
cairo_set_source_rgba(cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
for i=1,7 do
weekdays={"D","L","M","M","J","V","S"}
	x,y=pt((center_x-35),center_y,18.5,((360/7)*(i-1)))
	text({y=y,x=x,t=(weekdays[i]),hj="c",vj="m"})
end--for
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
cairo_stroke(cr)
weekday_position=(-90*d_math)+(((360/7)*weekday)*d_math)
cairo_set_line_width(cr,2)
cairo_move_to(cr,(center_x-35),center_y)
cairo_arc(cr,(center_x-35),center_y,20,weekday_position,weekday_position)
cairo_set_source_rgba(cr,.75,.75,.75,1)
cairo_stroke(cr)
--up month day
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,(center_y-35),25,(0*d_math),(360*d_math))
cairo_arc_negative(cr,center_x,(center_y-35),12,(360*d_math),(0*d_math))
cairo_set_source_rgba(cr,bg_red,bg_green,bg_blue,bg_alpha)
cairo_fill(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,(center_y-35),25,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,(center_y-35),12,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
month_days={31,28,31,30,31,30,31,31,30,31,30,31}
month_set=month_days[(month_number)]
for i=1,(month_set) do
month_day_marker=(-90*d_math)+(((360/month_set)*i)*d_math)
cairo_set_line_width(cr,1)
cairo_arc(cr,center_x,(center_y-35),25,month_day_marker,month_day_marker)
cairo_arc(cr,center_x,(center_y-35),20,month_day_marker,month_day_marker)
cairo_set_source_rgba(cr,.75,.75,.75,1)
cairo_stroke(cr)
end--for
cairo_set_source_rgba(cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
cairo_set_font_size (cr,8)
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
for i=1,(month_set) do
	if i == 5 or i == 10 or i == 15 or i == 20 or i == 25 or i == month_set then
	x,y=pt(center_x,(center_y-35),18.5,((360/month_set)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
cairo_stroke(cr)
day_indicator=(-90*d_math)+(((360/month_set)*day_number)*d_math)
cairo_set_line_width(cr,2)
cairo_move_to(cr,center_x,(center_y-35))
cairo_arc(cr,center_x,(center_y-35),20,day_indicator,day_indicator)
cairo_set_source_rgba(cr,.75,.75,.75,1)
cairo_stroke(cr)
--right year
cairo_set_line_width(cr,2)
cairo_arc(cr,(center_x+35),center_y,25,(0*d_math),(360*d_math))
cairo_arc_negative(cr,(center_x+35),center_y,12,(360*d_math),(0*d_math))
cairo_set_source_rgba(cr,bg_red,bg_green,bg_blue,bg_alpha)
cairo_fill(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,(center_x+35),center_y,25,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,(center_x+35),center_y,12,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
--when the year needs updated replace the start_year with the current year
start_year=13
cairo_set_font_size(cr,9)
cairo_set_source_rgba(cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
for i=1,4 do
	x,y=pt((center_x+35),center_y,18.5,((360/4)*i))
	text({y=y,x=x,t=(start_year+(i-1)),hj="c",vj="m"})
end--for
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
cairo_stroke(cr)
cairo_set_font_size (cr,d_font_size)
year_indicator=(-90*d_math)+(((360/4)*(year-(start_year-1)))*d_math)
cairo_set_line_width(cr,2)
cairo_move_to(cr,(center_x+35),center_y)
cairo_arc(cr,(center_x+35),center_y,20,year_indicator,year_indicator)
cairo_set_source_rgba(cr,.75,.75,.75,1)
cairo_stroke(cr)
--down month
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,(center_y+35),25,(0*d_math),(360*d_math))
cairo_arc_negative(cr,center_x,(center_y+35),12,(360*d_math),(0*d_math))
cairo_set_source_rgba(cr,bg_red,bg_green,bg_blue,bg_alpha)
cairo_fill(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,(center_y+35),25,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,(center_y+35),12,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
for i=1,12 do
month_indicator_marks=((360/12)*d_math)*i
cairo_set_line_width(cr,1)
cairo_arc(cr,center_x,(center_y+35),25,month_indicator_marks,month_indicator_marks)
cairo_arc(cr,center_x,(center_y+35),20,month_indicator_marks,month_indicator_marks)
cairo_set_source_rgba(cr,.75,.75,.75,1)
cairo_stroke(cr)
end--for
cairo_set_source_rgba(cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
for i=1,12 do
	if i == 3 or i == 6 or i == 9 or i == 12 then
	x,y=pt(center_x,(center_y+35),18,((360/12)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
cairo_stroke(cr)
month_indicator=(-90*d_math)+(((360/12)*month_number)*d_math)
cairo_set_line_width(cr,2)
cairo_move_to(cr,center_x,(center_y+35))
cairo_arc(cr,center_x,(center_y+35),20,month_indicator,month_indicator)
cairo_set_source_rgba(cr,.75,.75,.75,1)
cairo_stroke(cr)
end--chrono
--######################################################################
-- Face one ############################################################
--######################################################################
if clock_face == 1 then
--background
cairo_set_line_width(cr,5)
cairo_arc(cr,center_x,center_y,outer_radius,(-90*d_math),(270*d_math))
cairo_arc_negative(cr,center_x,center_y,(outer_radius-35),(270*d_math),(-90*d_math))
cairo_set_source_rgba(cr,bg_red,bg_green,bg_blue,bg_alpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
--seconds
second_radius1=outer_radius-2.5
second_radius2=second_radius1-10
for i=0,59 do
second_start=((i*(360/60))*d_math)
second_end=second_start+((360/60)*d_math)
second_start_math=(second_end-second_start)/2
second_start1=second_start-second_start_math-(90*d_math)
second_end1=second_start1+((360/60)*d_math)
cairo_set_line_width(cr,d_line_width)
cairo_arc(cr,center_x,center_y,second_radius1,second_start1,second_end1)
cairo_arc_negative(cr,center_x,center_y,second_radius2,second_end1,second_start1)
cairo_close_path(cr)
if lights == 1 then
if i == second then
cairo_set_source_rgba(cr,lights_red,lights_green,lights_blue,lights_alpha)
cairo_fill_preserve(cr)
end
end--lights
cairo_set_source_rgba(cr,.25,.25,.25,1)
cairo_stroke(cr)
end--for seconds end
--minutes
for i=0,59 do
minute_radius=second_radius2-10
minute_start=((i*(360/60))*d_math)
minute_end=minute_start+((360/60)*d_math)
minute_start_math=(minute_end-minute_start)/2
minute_start1=minute_start-minute_start_math-(90*d_math)
minute_end1=minute_start1+((360/60)*d_math)
cairo_set_line_width(cr,d_line_width)
cairo_arc(cr,center_x,center_y,second_radius2,minute_start1,minute_end1)
cairo_arc_negative(cr,center_x,center_y,minute_radius,minute_end1,minute_start1)
cairo_close_path(cr)
if lights == 1 then
if i == minute then
cairo_set_source_rgba(cr,lights_red,lights_green,lights_blue,lights_alpha)
cairo_fill_preserve(cr)
end
end--lights
cairo_set_source_rgba(cr,.25,.25,.25,1)
cairo_stroke(cr)
end--for minutes end
--hours
for i=i_start,i_end do
hour_radius=minute_radius-10
hour_start=((i*(360/hours))*d_math)
hour_end=hour_start+((360/hours)*d_math)
hour_start_math=((hour_end-hour_start)/2)
hour_start1=hour_start-hour_start_math-(90*d_math)
hour_end1=hour_start1+((360/hours)*d_math)
cairo_set_line_width(cr,d_line_width)
cairo_arc(cr,center_x,center_y,minute_radius,hour_start1,hour_end1)
cairo_arc_negative(cr,center_x,center_y,hour_radius,hour_end1,hour_start1)
cairo_close_path(cr)
if lights == 1 then
if i == hour then
cairo_set_source_rgba(cr,lights_red,lights_green,lights_blue,lights_alpha)
cairo_fill_preserve(cr)
end
end--lights
cairo_set_source_rgba(cr,.25,.25,.25,1)
cairo_stroke(cr)
end--for hours end
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
if texts==1 then
cairo_set_source_rgba(cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
if hours==24 then
for i=0,23 do
	if i==0 or i==2 or i==4 or i==6 or i==8 or i==10 or i==12 or i==14 or i==16 or i==18 or i==20 or i==22 then
	x,y=pt(center_x,center_y,(hour_radius+5),((360/24)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
elseif hours==12 then
for i=1,12 do
	x,y=pt(center_x,center_y,(hour_radius+5),((360/12)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
end--for
end--hours
if seconds==5 then
for i=0,59 do
	if i==0 or i==5 or i==10 or i==15 or i==20 or i==25 or i==30 or i==35 or i==40 or i==45 or i==50 or i==55 then
	x,y=pt(center_x,center_y,(second_radius2),((360/60)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
elseif seconds==10 then
for i=0,59 do
	if i==0 or i==10 or i==20 or i==30 or i==40 or i==50 then
	x,y=pt(center_x,center_y,(second_radius2),((360/60)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
elseif seconds==15 then
for i=0,59 do
	if i==0 or i==15 or i==30 or i==45 then
	x,y=pt(center_x,center_y,(second_radius2),((360/60)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
end--second
cairo_stroke(cr)
end--texts
--######################################################################
-- mrpeacy code end ####################################################
--######################################################################
end--clock face one
--######################################################################
-- Face two ############################################################
--######################################################################
if clock_face == 2 then
hour_markers_radius=outer_radius-20
second_markers_radius=outer_radius-10
--background
cairo_set_line_width(cr,1)
cairo_arc(cr,center_x,center_y,outer_radius,(-90*d_math),(270*d_math))
cairo_arc_negative(cr,center_x,center_y,(hour_markers_radius-13),(270*d_math),(-90*d_math))
cairo_set_source_rgba(cr,bg_red,bg_green,bg_blue,bg_alpha)
cairo_fill(cr)
cairo_set_line_width(cr,5)
cairo_arc(cr,center_x,center_y,outer_radius,(-90*d_math),(270*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,center_y,(hour_markers_radius-13),(-90*d_math),(270*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
if texts==1 then
cairo_set_source_rgba(cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
if hours==24 then
for i=0,23 do
	if i==0 or i==2 or i==4 or i==6 or i==8 or i==10 or i==12 or i==14 or i==16 or i==18 or i==20 or i==22 then
	x,y=pt(center_x,center_y,(hour_markers_radius-5),((360/24)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
elseif hours==12 then
for i=1,12 do
	x,y=pt(center_x,center_y,(hour_markers_radius-5),((360/12)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
end--for
end--hours
if seconds==5 then
for i=0,59 do
	if i==0 or i==5 or i==10 or i==15 or i==20 or i==25 or i==30 or i==35 or i==40 or i==45 or i==50 or i==55 then
	x,y=pt(center_x,center_y,second_markers_radius,((360/60)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
elseif seconds==10 then
for i=0,59 do
	if i==0 or i==10 or i==20 or i==30 or i==40 or i==50 then
	x,y=pt(center_x,center_y,second_markers_radius,((360/60)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
elseif seconds==15 then
for i=0,59 do
	if i==0 or i==15 or i==30 or i==45 then
	x,y=pt(center_x,center_y,second_markers_radius,((360/60)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
end--seconds
cairo_stroke(cr)
end--texts
--######################################################################
-- mrpeacy code end ####################################################
--######################################################################
--second lights
sl_math1=(-90*d_math)+(((360/60)*second)*d_math)
if lights ==1 then
cairo_set_line_width(cr,3)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_arc(cr,center_x,center_y,hour_markers_radius,(-90*d_math),sl_math1)
cairo_set_source_rgba(cr,lights_red,lights_green,lights_blue,lights_alpha)
cairo_stroke(cr)
end--lights
--minute
for i=1,60 do
second_markers_position=(-90*d_math)+((i*(360/60))*d_math)
cairo_set_line_width(cr,d_line_width)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_BUTT)
cairo_arc(cr,center_x,center_y,outer_radius,second_markers_position,second_markers_position)
cairo_arc(cr,center_x,center_y,second_markers_radius,second_markers_position,second_markers_position)
cairo_set_source_rgba(cr,.75,.75,.75,1)
cairo_stroke(cr)
if lights == 1 then
if i == minute then
cairo_set_line_width(cr,6)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_arc(cr,center_x,center_y,(outer_radius-2),second_markers_position,second_markers_position)
cairo_arc(cr,center_x,center_y,(second_markers_radius-5),second_markers_position,second_markers_position)
cairo_set_source_rgba(cr,lights_red,lights_green,lights_blue,lights_alpha)
cairo_stroke(cr)
end--minute
end--lights
end--for
--hour
for i=i_start,i_end do
hour_markers_position=(-90*d_math)+(i*(360/hours))*d_math
cairo_set_line_width(cr,d_line_width)
cairo_arc(cr,center_x,center_y,outer_radius,hour_markers_position,hour_markers_position)
cairo_arc(cr,center_x,center_y,hour_markers_radius,hour_markers_position,hour_markers_position)
cairo_set_source_rgba(cr,1,1,1,1)
cairo_stroke(cr)
if lights == 1 then
if i == hour then
cairo_set_line_width(cr,6)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_arc(cr,center_x,center_y,(outer_radius-2),hour_markers_position,hour_markers_position)
cairo_arc(cr,center_x,center_y,(hour_markers_radius-5),hour_markers_position,hour_markers_position)
cairo_set_source_rgba(cr,lights_red,lights_green,lights_blue,lights_alpha)
cairo_stroke(cr)
end--hour
end--lights
end--for hour
--outer ring
cairo_set_line_width(cr,d_line_width)
cairo_arc(cr,center_x,center_y,outer_radius,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,1,1,1,1)
cairo_stroke(cr)
end--clock face two
--######################################################################
-- Hands ###############################################################
--######################################################################
if hands == 1 then
hour_hand_radius1=outer_radius-30
hour_hand_radius2=outer_radius-50
hour_position=(-90*d_math)+(((360/(hours*60*60))*((hour*60*60)+(minute*60)+second))*d_math)
cairo_set_line_width(cr,d_line_width)
cairo_arc(cr,center_x,center_y,10,(hour_position-(20*d_math)),(hour_position+(20*d_math)))
cairo_arc(cr,center_x,center_y,hour_hand_radius2,(hour_position+(5*d_math)),(hour_position+(5*d_math)))
cairo_arc(cr,center_x,center_y,hour_hand_radius1,hour_position,hour_position)
cairo_arc(cr,center_x,center_y,hour_hand_radius2,(hour_position-(5*d_math)),(hour_position-(5*d_math)))
cairo_close_path(cr)
cairo_set_source_rgba(cr,hands_ired,hands_igreen,hands_iblue,hands_alpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,hands_red,hands_green,hands_blue,hands_alpha)
cairo_stroke(cr)
minute_hand_radius1=outer_radius-15
minute_hand_radius2=outer_radius-35
minute_position=(-90*d_math)+(((360/(60*60))*((minute*60)+second))*d_math)
cairo_set_line_width(cr,d_line_width)
cairo_arc(cr,center_x,center_y,10,(minute_position-(20*d_math)),(minute_position+(20*d_math)))
cairo_arc(cr,center_x,center_y,minute_hand_radius2,(minute_position+(5*d_math)),(minute_position+(5*d_math)))
cairo_arc(cr,center_x,center_y,minute_hand_radius1,minute_position,minute_position)
cairo_arc(cr,center_x,center_y,minute_hand_radius2,(minute_position-(5*d_math)),(minute_position-(5*d_math)))
cairo_close_path(cr)
cairo_set_source_rgba(cr,hands_ired,hands_igreen,hands_iblue,hands_alpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,hands_red,hands_green,hands_blue,hands_alpha)
cairo_stroke(cr)
second_hand_radius=outer_radius-5
second_position=(-90*d_math)+(((360/60)*second)*d_math)
cairo_set_line_width(cr,2)
cairo_move_to(cr,center_x,center_y)
cairo_arc(cr,center_x,center_y,second_hand_radius,second_position,second_position)
cairo_set_source_rgba(cr,hands_red,hands_green,hands_blue,hands_alpha)
cairo_stroke(cr)
cairo_set_line_width(cr,1)
cairo_arc(cr,center_x,center_y,10,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,0,0,0,1)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,.5,.5,.5,1)
cairo_stroke(cr)
--am & pm
if hours == 12 then
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,10)
cairo_set_source_rgba (cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
cairo_move_to (cr,(center_x-6.25),(center_y+3.25))
cairo_show_text (cr,ampm)
cairo_stroke (cr)
else
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,center_y,5,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_fill(cr)
end--am & pm
end-- hands
--######################################################################
-- Digital #############################################################
--######################################################################
if digital == 1 then
ph=15
pw=40
p1x=center_x-pw
p1y=center_y-ph
p2x=center_x+pw
p2y=center_y+ph
pr=10
cairo_set_line_width(cr,2)
cairo_arc(cr,p1x,p1y,pr,(180*d_math),(270*d_math))
cairo_arc(cr,p2x,p1y,pr,(270*d_math),0)
cairo_arc(cr,p2x,p2y,pr,0,(90*d_math))
cairo_arc(cr,p1x,p2y,pr,(90*d_math),(180*d_math))
cairo_close_path(cr)
cairo_set_source_rgba(cr,bg_red,bg_green,bg_blue,bg_alpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
for i=1,4 do
line=6
x1=center_x-40
y1=center_y-line
x2=center_x
y2=center_y-line
x3=center_x+25
y3=center_y-line
x4=center_x-45
y4=center_y+15
if hours == 12 then time_s=14 else time_s=18 end
s={16,d_font_size,d_font_size,time_s}
x={x1,x2,x3,x4}
y={y1,y2,y3,y4}
t={day,abbr_month,day_number,time_hms}
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,s[i])
cairo_set_source_rgba (cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
cairo_move_to (cr,x[i],y[i])
cairo_show_text (cr,t[i])
cairo_stroke (cr)
end--for
end--digital
--######################################################################
--######################################################################
--######################################################################
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function
--######################################################################
--Functions ############################################################
--######################################################################
function gear(position_x,position_y,radius,outer_teeth,inner_teeth,speed,speed_scale,direction,visibility)
gear_red=.75
gear_green=.75
gear_blue=.75
gear_line_width=4
gear_math=(math.pi/180)
gear_start=0
gear_end=360*gear_math
outer_teeth_radius=(radius)+gear_line_width
inner_radius=10
inner_teeth_radius=inner_radius+gear_line_width
--outer gear
cairo_set_line_width(cr,gear_line_width)
cairo_set_source_rgba(cr,gear_red,gear_green,gear_blue,(visibility))
cairo_arc(cr,(position_x),(position_y),(radius),gear_start,gear_end)
cairo_stroke(cr)
--outer gear teeth
for i=1,(outer_teeth) do
tooth_size=(360/(outer_teeth))/3
tooth_space=(360/(outer_teeth))
tooth_math=(((i-1)*tooth_space)+tooth_size)*gear_math
tooth_math2=(((360/(speed_scale))*(speed))*gear_math)
if (direction) == 1 then tooth=tooth_math+tooth_math2 else tooth=tooth_math-tooth_math2 end
teeth_s=tooth-((tooth_size/2)*gear_math)
teeth_e=tooth+((tooth_size/2)*gear_math)
cairo_set_line_width(cr,gear_line_width)
cairo_arc(cr,(position_x),(position_y),outer_teeth_radius,teeth_s,teeth_e)
cairo_set_source_rgba(cr,gear_red,gear_green,gear_blue,(visibility))
cairo_stroke(cr)
end--for loop
--inner gear
cairo_set_line_width(cr,gear_line_width)
cairo_set_source_rgba(cr,gear_red,gear_green,gear_blue,(visibility))
cairo_arc(cr,(position_x),(position_y),inner_radius,gear_start,gear_end)
cairo_stroke(cr)
--inner gear teeth
for i=1,(inner_teeth) do
tooth_size=(360/(inner_teeth))/3
tooth_space=(360/(inner_teeth))
tooth_math=(((i-1)*tooth_space)+tooth_size)*gear_math
tooth_math2=(((360/(speed_scale))*(speed))*gear_math)
if (direction) == 1 then tooth=tooth_math+tooth_math2 else tooth=tooth_math-tooth_math2 end
teeth_s=tooth-((tooth_size/2)*gear_math)
teeth_e=tooth+((tooth_size/2)*gear_math)
cairo_set_line_width(cr,gear_line_width)
cairo_arc(cr,(position_x),(position_y),inner_teeth_radius,teeth_s,teeth_e)
cairo_set_source_rgba(cr,gear_red,gear_green,gear_blue,(visibility))
cairo_stroke(cr)
end--for loop
end
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
function pt(px,py,prad,pdeg)
local ppo=(math.pi/180)*pdeg
local px1=px+prad*(math.sin(ppo))
local py1=py-prad*(math.cos(ppo))
return px1,py1
end
function font(fontt)
local name=fontt.f	or default_font_name	or "mono"
local size=fontt.fs	or default_font_size	or 12
local face=fontt.ff	or default_font_face	or "n"
if face=="n" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="b" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD)
elseif face=="i" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="bi" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_BOLD)
end
cairo_set_font_size(cr,size)
end
function hexcolor(hexcolort)
local col=hexcolort.c	or default_hex_color	or 0xffffff
local a=hexcolort.a	or default_alpha	or 1
local r,g,b=((col/0x10000) % 0x100)/255,((col/0x100) % 0x100)/255,(col % 0x100)/255
cairo_set_source_rgba(cr,r,g,b,a)
end
function text(textt)
local x=textt.x 		or 100
local y=textt.y 		or 100
local t=textt.t 		or "set txt"
local hj=textt.hj 		or default_horizontal_justify		or "l"
local vj=textt.vj 		or default_vertical_justify		or "n"
local r=textt.r			or default_rotation			or 0
cairo_text_extents(cr,t,extents)
local wx=extents.x_advance
local wd=extents.width
local hy=extents.height
local bx=extents.x_bearing
local by=extents.y_bearing+hy
--hl-- l=left, c=center, r=right
if hj=="l" then
xa=x-bx
rad=0
elseif hj=="c" then
xa=x-((wx-bx)/2)-bx
rad=(wx-bx)/2
elseif hj=="r" then
xa=x-wx
rad=wx-bx
else
print ('hj not set correctly for text: '..t..' - "l", "c" or "r"')
xa=0
rad=0
end
--vj-- n=normal, nb=normal-ybearing, m=middle, mb=middle-ybearing, t=top
if vj=="n" then
ya=y
rad2=0
ry=by
elseif vj=="nb" then
ya=y-by
rad2=-by
ry=by
elseif vj=="m" then
ya=y+((hy-by)/2)
rad2=((hy-by)/2)
ry=((hy-by)/2)-by
elseif vj=="mb" then
ya=y+(hy/2)-by
rad2=(hy/2)-by
ry=((hy-by)/2)-by
elseif vj=="t" then
ya=y+hy-by
rad2=hy-by
ry=0+by
else
print ('vj not set correctly for text: '..t..' - "n", "nb", "m", "mb" or "t"')
ya=0
rad2=0
ry=0
end
--rotation
if r~=0 then
local x2,y2=pt(x,y,rad2,r-180)
local x1,y1=pt(x2,y2,rad,r-90)
cairo_save (cr)
cairo_translate (cr,x1,y1)
cairo_rotate(cr,(math.pi/180)*r)
cairo_show_text (cr,t)
cairo_stroke (cr)
cairo_restore (cr)
else
cairo_move_to (cr,xa,ya)
cairo_show_text (cr,t)
cairo_stroke (cr)
end--if ro
--set non local variables to nil
xa=nil;ya=nil;rad=nil;rad2=nil;ry=nil
end--function text #####################################################  

Conky---->

 # Conky settings #
background yes
update_interval 1
own_window_argb_visual yes
cpu_avg_samples 2
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048
#imlib_cache_size 0

temperature_unit fahrenheit

# Window specifications #

own_window yes
#own_window_type override
own_window_transparent yes
#own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

border_inner_margin 0
border_outer_margin 0

minimum_size 220 220
maximum_width 220

alignment tr
gap_x 100
gap_y 250

# Graphics settings #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# Text settings #
use_xft yes
xftfont Mono:size=8
xftalpha 0.5

uppercase no

temperature_unit celsius


default_color FFFFFF

# Lua Load  #
lua_load ~/développement/CLOCKIII/ScriptClock.lua
lua_draw_hook_pre clock

#lua_load ~/.conky/conky27/transbg.lua
#lua_draw_hook_post draw_bg 90 10 10 180 180 0x140C0B 0.3


TEXT
 

Merci à Mr Peachy et ansem_of_nexus du forum crunchbang !
sources:
crunchbang
Pour les ConkyAddict ce forum est aussi très dynamique.
Bon tests wink

Dernière modification par ragamatrix (Le 04/02/2013, à 10:36)

Hors ligne

#2293 Le 04/02/2013, à 14:09

ragamatrix

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

Pour ces différentes horloges j'aimerais écrire la date comme ça: Jour date mois
mais dans le script je ne trouve pas comment inverser ces paramètres ?

Hors ligne

#2294 Le 04/02/2013, à 17:52

chepioq

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

ragamatrix a écrit :

Pour ces différentes horloges j'aimerais écrire la date comme ça: Jour date mois
mais dans le script je ne trouve pas comment inverser ces paramètres ?

Après quelques recherches, j'ai trouvé :
dans le script lua il faut remplacer la ligne 648

t={day,abbr_month,day_number,time_hms}

par

t={day,day_number,abbr_month,time_hms}

Mais le résultat dépasse un peu du cadre...


Tout est dans tout et réciproquement....

Hors ligne

#2295 Le 05/02/2013, à 07:40

chepioq

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

Bon, j'ai pu modifié le code pour que tout soit bien centré.
J'ai remplacé

for i=1,4 do
line=6
x1=center_x-40
y1=center_y-line
x2=center_x
y2=center_y-line
x3=center_x+25
y3=center_y-line
x4=center_x-45
y4=center_y+15
if hours == 12 then time_s=14 else time_s=18 end
s={16,d_font_size,d_font_size,time_s}
x={x1,x2,x3,x4}
y={y1,y2,y3,y4}
t={day,abbr_month,day_number,time_hms}

par

for i=1,4 do
line=6
x1=center_x-40
y1=center_y-line
x2=center_x-10
y2=center_y-line
x3=center_x+10
y3=center_y-line
x4=center_x-35
y4=center_y+15
if hours == 12 then time_s=14 else time_s=18 end
s={11,d_font_size,d_font_size,time_s}
x={x1,x2,x3,x4}
y={y1,y2,y3,y4}
t={day,day_number,abbr_month,time_hms}

1360046357.png


Tout est dans tout et réciproquement....

Hors ligne

#2296 Le 05/02/2013, à 08:37

ragamatrix

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

@chepioq
J'aurais eu un peu de mal à trouver.
Merci !

Hors ligne

#2297 Le 05/02/2013, à 18:36

ragamatrix

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

Didier-T a écrit :

@ragamatrix,

j'ai modifié ton script de manière a ce qu'il trouve toujours une image.
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);

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

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

  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;
}
while ($path eq "");

`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 north "
#         ."-pointsize 20 "
#         ."-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");  

Merci Didier-T pour cette modification; mais il y aquelque chose que je ne comprends pas....
J'ai toujours la même chose qui apparait dans le dossier où sont traitées les images.
Aléatoirement j'ai plein d'images qui se créent ... Ce qui donne un truc de ce genre :
bug

Hors ligne

#2298 Le 05/02/2013, à 20:26

Didier-T

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

@ ragamatrix,

j'aurais peut être du utiliser un autre argument pour la boucle, $img par exemple.

 #!/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);

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

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

  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;
}
while ($img eq "");

`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 north "
#         ."-pointsize 20 "
#         ."-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");  

Hors ligne

#2299 Le 06/02/2013, à 12:50

ragamatrix

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

Didier-T a écrit :

@ ragamatrix,

j'aurais peut être du utiliser un autre argument pour la boucle, $img par exemple.

 #!/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);

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

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

  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;
}
while ($img eq "");

`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 north "
#         ."-pointsize 20 "
#         ."-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");  

Celui-ci me retourne une erreur...

Hors ligne

#2300 Le 06/02/2013, à 13:22

Didier-T

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

autant pour moi j'ai oublié d'initialiser la variable.

 #!/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);

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

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

  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;
}
while ($img eq "");

`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 north "
#         ."-pointsize 20 "
#         ."-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");  

Hors ligne