various scripts for various tasks.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73lab.sh 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #########################################
  2. #!/bin/bash
  3. # AjoutPingus 1.0
  4. # 23/06/2002
  5. #########################################
  6. # vérifie si de nouveaux
  7. # ouallpépères sont arrivés
  8. # et dans ce cas les télécharge,
  9. # et les converti dans les formats:
  10. # - 1280x1204 png&jpeg
  11. # - 1024x768 png&jpeg
  12. # - 1024x768 png&jpeg
  13. # - 800x600 png&jpeg
  14. # et envoie un mail pour prévenir.
  15. #########################################
  16. # IMPORTANT: nécessite l'utilitaire
  17. # ImageMagick http://www.imagemagick.org
  18. #########################################
  19. sujet="Ajout Pingus";
  20. dest="n@tourmentine.com";
  21. log="/tmp/ayo.log";
  22. ok="";
  23. if test -e $log;
  24. then rm -f $log;
  25. fi
  26. wget -O /tmp/73lab.html http://www.73lab.com/index.php\?menu_item=1\&page=ALL\&curr_lang=0
  27. for i in `cat /tmp/73lab.html | grep javascript | cut -d '&' -f 2 | tail +2 | cut -b 117- | cut -d '.' -f 1 | sed s/_1280_1024// | tail +1`
  28. do
  29. # image originale (1280x1024 png)
  30. if test -e /var/ftp/pub/wallpaper/ayo73/png/1280x1024/$i\_1280\_1024.png;
  31. then echo $ok;
  32. else
  33. wget -O /var/ftp/pub/wallpaper/ayo73/png/1280x1024/$i\_1280\_1024.png http://73lab.free.fr/distant_file/dessins/wallpaper/$i\_1280\_1024.png;
  34. chown ftp:ftp /var/ftp/pub/wallpaper/ayo73/png/1280x1024/$i\_1280\_1024.png;
  35. echo "var/ftp/pub/wallpaper/ayo73/png/1280x1024/$i-1280-1024.png">>$log;
  36. fi
  37. # 1024x768 png
  38. if test -e /var/ftp/pub/wallpaper/ayo73/png/1024x768/$i\_1024\_768.png;
  39. then echo $ok;
  40. else
  41. convert -enhance -geometry 1024x768! /var/ftp/pub/wallpaper/ayo73/png/1280x1024/$i\_1280\_1024.png /var/ftp/pub/wallpaper/ayo73/png/1024x768/$i\_1024\_768.png;
  42. chown ftp:ftp /var/ftp/pub/wallpaper/ayo73/png/1024x768/$i\_1024\_768.png;
  43. echo "/var/ftp/pub/wallpaper/ayo73/png/1280x1024/$i-1024-768.png">>$log;
  44. fi
  45. # 800x600 png
  46. if test -e /var/ftp/pub/wallpaper/ayo73/png/800x600/$i\_800\_600.png;
  47. then echo $ok;
  48. else
  49. convert -enhance -geometry 800x600! /var/ftp/pub/wallpaper/ayo73/png/1280x1024/$i\_1280\_1024.png /var/ftp/pub/wallpaper/ayo73/png/800x600/$i\_800\_600.png;
  50. chown ftp:ftp /var/ftp/pub/wallpaper/ayo73/png/800x600/$i\_800\_600.png;
  51. echo "/var/ftp/pub/wallpaper/ayo73/png/800x600/$i-800-600.png">>$log;
  52. fi
  53. # 1280x1024 jpeg
  54. if test -e /var/ftp/pub/wallpaper/ayo73/jpeg/1280x1024/$i\_1280\_1024.jpg;
  55. then echo $ok;
  56. else
  57. convert -enhance /var/ftp/pub/wallpaper/ayo73/png/1280x1024/$i\_1280\_1024.png /var/ftp/pub/wallpaper/ayo73/jpeg/1280x1024/$i\_1280\_1024.jpg;
  58. chown ftp:ftp /var/ftp/pub/wallpaper/ayo73/jpeg/1280x1024/$i\_1280\_1024.jpg;
  59. echo "/var/ftp/pub/wallpaper/ayo73/jpeg/1280x1024/$i-1280-1024.jpg">>$log;
  60. fi
  61. # 1024x768 jpeg
  62. if test -e /var/ftp/pub/wallpaper/ayo73/jpeg/1024x768/$i\_1024\_768.jpg;
  63. then echo $ok;
  64. else
  65. convert -enhance /var/ftp/pub/wallpaper/ayo73/png/1024x768/$i\_1024\_768.png /var/ftp/pub/wallpaper/ayo73/jpeg/1024x768/$i\_1024\_768.jpg;
  66. chown ftp:ftp /var/ftp/pub/wallpaper/ayo73/jpeg/1024x768/$i\_1024\_768.jpg;
  67. echo "/var/ftp/pub/wallpaper/ayo73/jpeg/1024x768/$i-1024-768.jpg">>$log;
  68. fi
  69. # ajoute ça à mes ouallepépères persos
  70. if test -e /home/n/.wallpap/ayo73/$i\_1280\_1024.jpg;
  71. then echo $ok;
  72. else
  73. cp /var/ftp/pub/wallpaper/ayo73/jpeg/1280x1024/$i\_1280\_1024.jpg /home/n/.wallpap/ayo73/;
  74. chown n:n /home/n/.wallpap/ayo73/$i\_1280\_1024.jpg;
  75. echo "/home/n/.wallpap/ayo73/$i-1280-1024.jpg">>$log;
  76. fi
  77. # 800x600 jpeg
  78. if test -e /var/ftp/pub/wallpaper/ayo73/jpeg/800x600/$i\_800\_600.jpg;
  79. then echo $ok;
  80. else
  81. convert -enhance /var/ftp/pub/wallpaper/ayo73/png/800x600/$i\_800\_600.png /var/ftp/pub/wallpaper/ayo73/jpeg/800x600/$i\_800\_600.jpg;
  82. chown ftp:ftp /var/ftp/pub/wallpaper/ayo73/jpeg/800x600/$i\_800\_600.jpg;
  83. echo "/var/ftp/pub/wallpaper/ayo73/jpeg/800x600/$i-800-600.jpg">>$log;
  84. fi
  85. # vignettes (153x122 jpeg)
  86. if test -e /home/n/website/images/ayo73/$i\_1280\_1024.jpg;
  87. then echo $ok;
  88. else
  89. convert -enhance -geometry 153x122! /var/ftp/pub/wallpaper/ayo73/png/1280x1024/$i\_1280\_1024.png /home/n/website/images/ayo73/$i\_1280\_1024.jpg;
  90. chown n:n /home/n/website/images/ayo73/$i\_1280\_1024.jpg;
  91. echo "/home/n/website/images/ayo73/$i-1280-1024.jpg">>$log;
  92. fi
  93. done
  94. if test -e $log;
  95. then sort $log | mail -s "$sujet" $dest
  96. fi
  97. rm -f /tmp/73lab.html;