Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bugfixes, revamp slim mode

commit c51e8d55801a21a1403abd09acef932e3930b878 1 parent fadaf04
@helmuthdu authored
Showing with 265 additions and 2,593 deletions.
  1. 0  AUTHORS
  2. 0  COPYING
  3. 0  ChangeLog
  4. +0 −4 Makefile
  5. 0  README
  6. +0 −9 conkycolors/.conkyForecast.config
  7. 0  conkycolors/bin/conkyBBCWeather
  8. 0  conkycolors/bin/conkyBanshee
  9. 0  conkycolors/bin/conkyBatteryIcon
  10. 0  conkycolors/bin/conkyCalendar
  11. 0  conkycolors/bin/conkyClementine
  12. 0  conkycolors/bin/conkyClock
  13. 0  conkycolors/bin/conkyClock_h
  14. 0  conkycolors/bin/conkyClock_m
  15. 0  conkycolors/bin/conkyColorsGUI.sh
  16. 0  conkycolors/bin/conkyEmail
  17. 0  conkycolors/bin/conkyExaile
  18. +0 −16 conkycolors/bin/conkyForecast
  19. 0  conkycolors/bin/conkyHD1
  20. 0  conkycolors/bin/conkyHD2
  21. 0  conkycolors/bin/conkyHD3
  22. 0  conkycolors/bin/conkyHD4
  23. 0  conkycolors/bin/conkyIp
  24. 0  conkycolors/bin/conkyKeyring
  25. 0  conkycolors/bin/conkyMPD
  26. 0  conkycolors/bin/conkyPacman
  27. +52 −45 conkycolors/bin/conkyPhoto
  28. +54 −48 conkycolors/bin/conkyPhotoRandom
  29. +0 −60 conkycolors/bin/conkyPhotoRandom~
  30. +0 −56 conkycolors/bin/conkyPhoto~
  31. 0  conkycolors/bin/conkyPidgin
  32. 0  conkycolors/bin/conkyRhythmbox
  33. 0  conkycolors/bin/conkySlideshow
  34. 0  conkycolors/bin/conkyStart
  35. 0  conkycolors/bin/conkyTask
  36. +0 −119 conkycolors/bin/conkyTask~
  37. 0  conkycolors/bin/conkyYahooWeather
  38. 0  conkycolors/bin/conkyZimCalendar
  39. 0  conkycolors/bin/conkyZimEvents
  40. 0  conkycolors/icons/CD/base.png
  41. 0  conkycolors/icons/CD/top.png
  42. 0  conkycolors/icons/Case/base.png
  43. 0  conkycolors/icons/Case/top.png
  44. 0  conkycolors/icons/Glassy/base.png
  45. 0  conkycolors/icons/Glassy/top.png
  46. 0  conkycolors/icons/Moon/01.png
  47. 0  conkycolors/icons/Moon/02.png
  48. 0  conkycolors/icons/Moon/03.png
  49. 0  conkycolors/icons/Moon/04.png
  50. 0  conkycolors/icons/Moon/05.png
  51. 0  conkycolors/icons/Moon/06.png
  52. 0  conkycolors/icons/Moon/07.png
  53. 0  conkycolors/icons/Moon/08.png
  54. 0  conkycolors/icons/Moon/09.png
  55. 0  conkycolors/icons/Moon/10.png
  56. 0  conkycolors/icons/Moon/11.png
  57. 0  conkycolors/icons/Moon/12.png
  58. 0  conkycolors/icons/Moon/13.png
  59. 0  conkycolors/icons/Moon/14.png
  60. 0  conkycolors/icons/Moon/15.png
  61. 0  conkycolors/icons/Moon/16.png
  62. 0  conkycolors/icons/Moon/17.png
  63. 0  conkycolors/icons/Moon/18.png
  64. 0  conkycolors/icons/Moon/19.png
  65. 0  conkycolors/icons/Moon/20.png
  66. 0  conkycolors/icons/Moon/21.png
  67. 0  conkycolors/icons/Moon/22.png
  68. 0  conkycolors/icons/Moon/23.png
  69. 0  conkycolors/icons/Moon/24.png
  70. 0  conkycolors/icons/Players/banshee.png
  71. 0  conkycolors/icons/Players/exaile.png
  72. 0  conkycolors/icons/Players/rhythmbox.png
  73. 0  conkycolors/icons/SLS/Cover.png
  74. 0  conkycolors/icons/SLS/Cover.svg
  75. 0  conkycolors/icons/SLS/Cover_White.svg
  76. 0  conkycolors/icons/SLS/Cover_white.png
  77. 0  conkycolors/icons/Vinyl/base.png
  78. 0  conkycolors/icons/Vinyl/top.png
  79. 0  conkycolors/icons/Weather/0.png
  80. 0  conkycolors/icons/Weather/1.png
  81. 0  conkycolors/icons/Weather/10.png
  82. 0  conkycolors/icons/Weather/11.png
  83. 0  conkycolors/icons/Weather/12.png
  84. 0  conkycolors/icons/Weather/13.png
  85. 0  conkycolors/icons/Weather/14.png
  86. 0  conkycolors/icons/Weather/15.png
  87. 0  conkycolors/icons/Weather/16.png
  88. 0  conkycolors/icons/Weather/17.png
  89. 0  conkycolors/icons/Weather/18.png
  90. 0  conkycolors/icons/Weather/19.png
  91. 0  conkycolors/icons/Weather/2.png
  92. 0  conkycolors/icons/Weather/20.png
  93. 0  conkycolors/icons/Weather/21.png
  94. 0  conkycolors/icons/Weather/22.png
  95. 0  conkycolors/icons/Weather/23.png
  96. 0  conkycolors/icons/Weather/24.png
  97. 0  conkycolors/icons/Weather/25.png
  98. 0  conkycolors/icons/Weather/26.png
  99. 0  conkycolors/icons/Weather/27.png
  100. 0  conkycolors/icons/Weather/28.png
  101. 0  conkycolors/icons/Weather/29.png
  102. 0  conkycolors/icons/Weather/3.png
  103. 0  conkycolors/icons/Weather/30.png
  104. 0  conkycolors/icons/Weather/31.png
  105. 0  conkycolors/icons/Weather/32.png
  106. 0  conkycolors/icons/Weather/33.png
  107. 0  conkycolors/icons/Weather/34.png
  108. 0  conkycolors/icons/Weather/35.png
  109. 0  conkycolors/icons/Weather/36.png
  110. 0  conkycolors/icons/Weather/37.png
  111. 0  conkycolors/icons/Weather/38.png
  112. 0  conkycolors/icons/Weather/39.png
  113. 0  conkycolors/icons/Weather/4.png
  114. 0  conkycolors/icons/Weather/40.png
  115. 0  conkycolors/icons/Weather/41.png
  116. 0  conkycolors/icons/Weather/42.png
  117. 0  conkycolors/icons/Weather/43.png
  118. 0  conkycolors/icons/Weather/44.png
  119. 0  conkycolors/icons/Weather/45.png
  120. 0  conkycolors/icons/Weather/46.png
  121. 0  conkycolors/icons/Weather/47.png
  122. 0  conkycolors/icons/Weather/5.png
  123. 0  conkycolors/icons/Weather/6.png
  124. 0  conkycolors/icons/Weather/7.png
  125. 0  conkycolors/icons/Weather/8.png
  126. 0  conkycolors/icons/Weather/9.png
  127. 0  conkycolors/icons/Weather/na.png
  128. 0  conkycolors/icons/oldVinyl/base.png
  129. 0  conkycolors/icons/oldVinyl/top.png
  130. 0  conkycolors/scripts/conkyBanshee.py
  131. 0  conkycolors/scripts/conkyBoard.lua
  132. 0  conkycolors/scripts/conkyCairo.lua
  133. 0  conkycolors/scripts/conkyClementine.py
  134. 0  conkycolors/scripts/conkyClock_h.py
  135. 0  conkycolors/scripts/conkyClock_m.py
  136. 0  conkycolors/scripts/conkyEmail.py
  137. 0  conkycolors/scripts/conkyExaile.py
  138. +0 −1,702 conkycolors/scripts/conkyForecast.py
  139. 0  conkycolors/scripts/conkyGoogleCalendar.py
  140. 0  conkycolors/scripts/conkyGoogleReader.py
  141. 0  conkycolors/scripts/conkyGuayadeque.py
  142. +7 −9 conkycolors/scripts/conkyHD1.py
  143. +3 −4 conkycolors/scripts/conkyHD2.py
  144. +6 −7 conkycolors/scripts/conkyHD3.py
  145. +3 −5 conkycolors/scripts/conkyHD4.py
  146. 0  conkycolors/scripts/conkyKeyring.py
  147. 0  conkycolors/scripts/conkyPidgin.py
  148. 0  conkycolors/scripts/conkyRhythmbox.py
  149. 0  conkycolors/scripts/conkyRing.lua
  150. +14 −6 conkycolors/scripts/conkySLS.lua
  151. +0 −295 conkycolors/scripts/conkySlideshow.py
  152. +48 −50 conkycolors/scripts/conkySlim.lua
  153. 0  conkycolors/scripts/conkyText.py
  154. 0  conkycolors/scripts/conkyTransmission.py
  155. 0  conkycolors/scripts/conkyZimCalendar.py
  156. 0  conkycolors/scripts/conkyZimEvents.py
  157. +0 −7 conkycolors/templates/conkyForecast.template
  158. 0  conkycolors/templates/conkyPlayer.template
  159. +0 −5 conkycolors/templates/conkySlideshow.imagelist
  160. +0 −2  conkycolors/templates/conkySlideshow.template
  161. 0  fonts/conkycolors/Arial_Black.ttf
  162. 0  fonts/conkycolors/Arrows.ttf
  163. 0  fonts/conkycolors/BTNSWTCH.TTF
  164. BIN  fonts/conkycolors/ConkyWeather.otf
  165. BIN  fonts/conkycolors/ConkyWind.otf
  166. BIN  fonts/conkycolors/ConkyWindN.otf
  167. BIN  fonts/conkycolors/ConkyWindNESW.otf
  168. 0  fonts/conkycolors/Devil_inside.ttf
  169. BIN  fonts/conkycolors/Moon Phases.ttf
  170. 0  fonts/conkycolors/Musicelements.ttf
  171. 0  fonts/conkycolors/PIE4MAP.TTF
  172. 0  fonts/conkycolors/PizzadudeBullets.ttf
  173. 0  fonts/conkycolors/Poky.ttf
  174. 0  fonts/conkycolors/RSBILLSD.TTF
  175. 0  fonts/conkycolors/StyleBats.ttf
  176. 0  fonts/conkycolors/Varis.ttf
  177. 0  fonts/conkycolors/Webdings.ttf
  178. 0  fonts/conkycolors/aClock_Hour.ttf
  179. 0  fonts/conkycolors/aClock_Min.ttf
  180. 0  fonts/conkycolors/clockfaces.ttf
  181. 0  fonts/conkycolors/conky_symbols_by_wiltur-d3ij3mi.ttf
  182. 0  fonts/conkycolors/digirtu.ttf
  183. 0  fonts/conkycolors/marvosym.ttf
  184. 0  fonts/conkycolors/openlogos.ttf
  185. BIN  fonts/conkycolors/weather.ttf
  186. 0  fonts/conkycolors/zoraclockH.ttf
  187. 0  fonts/conkycolors/zoraclockM.ttf
  188. 0  fonts/conkycolors/zoraclockS.ttf
  189. 0  src/confinstall.c
  190. 0  src/confinstall.h
  191. 0  src/conky-colors.c
  192. 0  src/conkycover.c
  193. 0  src/conkycover.h
  194. 0  src/conkyforecast.c
  195. 0  src/conkyforecast.h
  196. 0  src/conkyplayer.c
  197. 0  src/conkyplayer.h
  198. 0  src/conkyrc_board.c
  199. 0  src/conkyrc_board.h
  200. +9 −9 src/conkyrc_cairo.c
  201. 0  src/conkyrc_cairo.h
  202. +23 −66 src/conkyrc_default.c
  203. 0  src/conkyrc_default.c~
  204. 0  src/conkyrc_default.h
  205. +9 −9 src/conkyrc_ring.c
  206. 0  src/conkyrc_ring.h
  207. +2 −2 src/conkyrc_slim.c
  208. 0  src/conkyrc_slim.h
  209. +7 −15 src/conkyrc_sls.c
  210. 0  src/conkyrc_sls.h
  211. +14 −13 src/coverposition.c
  212. 0  src/coverposition.h
  213. 0  src/finddir.c
  214. 0  src/finddir.h
  215. +1 −4 src/help.c
  216. 0  src/help.h
  217. 0  src/initialize.c
  218. 0  src/initialize.h
  219. +1 −13 src/options.c
  220. 0  src/options.h
  221. +12 −13 src/photoposition.c
  222. 0  src/photoposition.h
  223. 0  src/themes.c
  224. 0  src/themes.h
  225. 0  src/translations.c
  226. 0  src/translations.h
  227. 0  src/utils.c
  228. 0  src/utils.h
  229. 0  src/variables.c
  230. 0  src/variables.h
View
0  AUTHORS 100644 → 100755
File mode changed
View
0  COPYING 100644 → 100755
File mode changed
View
0  ChangeLog 100644 → 100755
File mode changed
View
4 Makefile 100644 → 100755
@@ -17,7 +17,6 @@ install: conky-colors conkyrc
cp -v -r conkycolors $(DESTDIR)/usr/share
ln -fs $(DESTDIR)/usr/share/conkycolors/bin/conkyTask $(DESTDIR)/usr/bin/ct
cp -v fonts/conkycolors/*.ttf fonts/conkycolors/*.TTF $(DESTDIR)/usr/share/fonts/TTF/conky
- cp -v fonts/conkycolors/*.otf $(DESTDIR)/usr/share/fonts/OTF/conky
chmod +x $(DESTDIR)/usr/share/conkycolors/scripts/*
chmod +x $(DESTDIR)/usr/share/conkycolors/bin/*
chmod -R 755 $(DESTDIR)/usr/share/conkycolors/
@@ -31,9 +30,6 @@ uninstall:
rm -rf $(DESTDIR)/usr/share/conkycolors
rm $(DESTDIR)/usr/bin/conky-colors
rm $(DESTDIR)/usr/bin/ct
- for file in $$(find $(CWD)/fonts/conkycolors -iname *.otf -print0); do \
- rm $(DESTDIR)/usr/share/fonts/OTF/conky/$$(basename $$file); \
- done
for file in $$(find $(CWD)/fonts/conkycolors -iname *.ttf -print0); do \
rm $(DESTDIR)/usr/share/fonts/TTF/conky/$$(basename $$file); \
done
View
0  README 100644 → 100755
File mode changed
View
9 conkycolors/.conkyForecast.config
@@ -1,9 +0,0 @@
-# config settings for conkyForecast.py
-CACHE_FOLDERPATH = /tmp/
-CONNECTION_TIMEOUT = 5
-EXPIRY_MINUTES = 30
-TIME_FORMAT = %H:%M
-DATE_FORMAT = %Y-%m-%d
-LOCALE =
-XOAP_PARTNER_ID =
-XOAP_LICENCE_KEY =
View
0  conkycolors/bin/conkyBBCWeather 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyBanshee 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyBatteryIcon 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyCalendar 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyClementine 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyClock 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyClock_h 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyClock_m 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyColorsGUI.sh 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyEmail 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyExaile 100644 → 100755
File mode changed
View
16 conkycolors/bin/conkyForecast
@@ -1,16 +0,0 @@
-#! /bin/sh
-DIR=$(conky-colors --finddir=scripts/conkyForecast.py)
-pythoncmd="$DIR/scripts/conkyForecast.py $@"
-
-if [ -f /usr/bin/python2 ]; then
- cmd="/usr/bin/python2 $pythoncmd"
-elif [ -f /usr/bin/python2.7 ] ; then
- cmd="/usr/bin/python2.7 $pythoncmd"
-elif [ -f /usr/bin/python2.6 ] ; then
- cmd="/usr/bin/python2.6 $pythoncmd"
-else
- # here's hoping!
- cmd="/usr/bin/python $pythoncmd"
-fi
-
-exec $cmd
View
0  conkycolors/bin/conkyHD1 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyHD2 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyHD3 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyHD4 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyIp 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyKeyring 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyMPD 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyPacman 100644 → 100755
File mode changed
View
97 conkycolors/bin/conkyPhoto 100644 → 100755
@@ -3,55 +3,62 @@
# Photo in conky
# by helmuthdu
-source="/usr/share/backgrounds/Ropey_Photo_by_Bob_Farrell.jpg"
photo="/tmp/conkyPhoto.png"
+template="/usr/share/conkycolors/icons"
+filename="/usr/share/backgrounds/Ropey_Photo_by_Bob_Farrell.jpg"
+
#choose your theme: 1,2 or 3
theme=1
- cp "$source" "$photo"
-
- width=`identify -format %w "$photo"`
- height=`identify -format %h "$photo"`
- picture_aspect=`echo $width - $height | bc`
- v_aligh=`echo $height/100 | bc | sed 's/..[0-9]//'`
+dim="medium"
+# Manage dimension flag
+if [ $dim == "small" ]; then
+ geometry="158x100"
+ geometry_crop="236x212"
+elif [ $dim == "medium" ]; then
+ geometry="238x148"
+ geometry_crop="316x260"
+elif [ $dim == "big" ]; then
+ geometry="318x200"
+ geometry_crop="396x312"
+fi
- if [ $picture_aspect -gt "0" ]; then
- convert "$photo" -thumbnail 280x175 "$photo"
- convert "$photo" -gravity center -crop 175x125+0+0 +repage "$photo"
- else
- convert "$photo" -thumbnail 175x280 "$photo"
- convert "$photo" -crop 175x125+0+$v_aligh +repage "$photo"
- fi
+cp "$filename" "$photo"
- if [ $theme = "1" ]; then
- # Theme 1
- convert "$photo"\
- -bordercolor snow -border 4.5\
- -bordercolor gray55 -border 1 \
- -background black \( +clone -shadow 40x2+1+1 \) +swap \
- -background none -flatten \
- "$photo"
- elif [ $theme = "2" ]; then
- # Theme 2
- convert -page +2+2 "$photo"\
- -bordercolor gray10 -border 1\
- -background black \( +clone -shadow 40x4+2+2 \) +swap \
- -background none -flatten \
- "$photo"
- elif [ $theme = "3" ]; then
- # Theme 3
- convert "$photo"\
- -bordercolor snow -border 4.5\
- -bordercolor gray55 -border 1 \
- -bordercolor none -background none \
- \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
- \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
- \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
- -delete 0 -border 175x125 -gravity center \
- -crop 300x185+0+0 +repage -flatten -trim +repage \
- -background black \( +clone -shadow 40x2+1+1 \) +swap \
- -background none -flatten \
- "$photo"
- fi
+convert $filename -resize $geometry\> -size $geometry xc:black +swap -gravity center -composite $photo
-exit 0
+if [ $theme = "1" ]; then
+# Theme 1
+ convert -page +2+2 "$photo"\
+ -bordercolor snow -border 4.5\
+ -bordercolor gray55 -border 1 \
+ -background black \( +clone -shadow 40x2+1+1 \) +swap \
+ -background none -flatten \
+ "$photo"
+elif [ $theme = "2" ]; then
+# Theme 2
+ convert -page +4+4 "$photo"\
+ -bordercolor gray10 -border 1\
+ -background black \( +clone -shadow 40x4+2+2 \) +swap \
+ -background none -flatten \
+ $photo
+elif [ $theme = "3" ]; then
+# Theme 3
+ convert "$photo" \
+ -bordercolor snow -border 4.5\
+ -bordercolor gray55 -border 1 \
+ -bordercolor none -background none \
+ \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
+ \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
+ \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
+ -delete 0 -border $geometry -gravity center \
+ -crop $geometry_crop+0+0 +repage -flatten -trim +repage \
+ -background black \( +clone -shadow 40x2+1+1 \) +swap \
+ -background none -flatten \
+ "$photo"
+elif [ $theme = "4" ]; then
+# Theme 4
+ convert $template/photobg_bg_$dim.png $photo -geometry +11+11 -composite $photo
+ convert $photo $template/photobg_shadow_$dim.png -composite $photo
+fi
+exit
View
102 conkycolors/bin/conkyPhotoRandom 100644 → 100755
@@ -1,59 +1,65 @@
#!/bin/bash
#
# Photo in conky
-# by helmuthdu and paulvictor
+# by helmuthdu, paulvictor and Alessandro Roncone
-source="/usr/share/backgrounds/"
-#source="/home/helmuth/Imagens/deviantART/"
+source="/usr/share/backgrounds"
photo="/tmp/conkyPhoto.png"
-#choose your theme: 1,2 or 3
-theme=1
+template="/usr/share/conkycolors/icons"
filename=`find $source -type f | shuf -n1`
- cp "$filename" "$photo"
+#choose your theme: 1,2 or 3
+theme=1
- width=`identify -format %w "$photo"`
- height=`identify -format %h "$photo"`
- picture_aspect=`echo $width - $height | bc`
- v_aligh=`echo $height/100 | bc | sed 's/..[0-9]//'`
+dim="medium"
+# Manage dimension flag
+if [ $dim == "small" ]; then
+ geometry="158x100"
+ geometry_crop="236x212"
+elif [ $dim == "medium" ]; then
+ geometry="238x148"
+ geometry_crop="316x260"
+elif [ $dim == "big" ]; then
+ geometry="318x200"
+ geometry_crop="396x312"
+fi
- if [ $picture_aspect -gt "0" ]; then
- convert "$photo" -thumbnail 280x175 "$photo"
- convert "$photo" -gravity center -crop 175x125+0+0 +repage "$photo"
- else
- convert "$photo" -thumbnail 175x280 "$photo"
- convert "$photo" -crop 175x125+0+$v_aligh +repage "$photo"
- fi
+cp "$filename" "$photo"
- if [ $theme = "1" ]; then
- # Theme 1
- convert "$photo"\
- -bordercolor snow -border 4.5\
- -bordercolor gray55 -border 1 \
- -background black \( +clone -shadow 40x2+1+1 \) +swap \
- -background none -flatten \
- "$photo"
- elif [ $theme = "2" ]; then
- # Theme 2
- convert -page +2+2 "$photo"\
- -bordercolor gray10 -border 1\
- -background black \( +clone -shadow 40x4+2+2 \) +swap \
- -background none -flatten \
- $photo
- elif [ $theme = "3" ]; then
- # Theme 3
- convert "$photo" \
- -bordercolor snow -border 4.5\
- -bordercolor gray55 -border 1 \
- -bordercolor none -background none \
- \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
- \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
- \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
- -delete 0 -border 175x125 -gravity center \
- -crop 300x185+0+0 +repage -flatten -trim +repage \
- -background black \( +clone -shadow 40x2+1+1 \) +swap \
- -background none -flatten \
- "$photo"
- fi
+convert $filename -resize $geometry\> -size $geometry xc:black +swap -gravity center -composite $photo
-exit 0
+if [ $theme = "1" ]; then
+# Theme 1
+ convert -page +2+2 "$photo"\
+ -bordercolor snow -border 4.5\
+ -bordercolor gray55 -border 1 \
+ -background black \( +clone -shadow 40x2+1+1 \) +swap \
+ -background none -flatten \
+ "$photo"
+elif [ $theme = "2" ]; then
+# Theme 2
+ convert -page +4+4 "$photo"\
+ -bordercolor gray10 -border 1\
+ -background black \( +clone -shadow 40x4+2+2 \) +swap \
+ -background none -flatten \
+ $photo
+elif [ $theme = "3" ]; then
+# Theme 3
+ convert "$photo" \
+ -bordercolor snow -border 4.5\
+ -bordercolor gray55 -border 1 \
+ -bordercolor none -background none \
+ \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
+ \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
+ \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
+ -delete 0 -border $geometry -gravity center \
+ -crop $geometry_crop+0+0 +repage -flatten -trim +repage \
+ -background black \( +clone -shadow 40x2+1+1 \) +swap \
+ -background none -flatten \
+ "$photo"
+elif [ $theme = "4" ]; then
+# Theme 4
+ convert $template/photobg_bg_$dim.png $photo -geometry +11+11 -composite $photo
+ convert $photo $template/photobg_shadow_$dim.png -composite $photo
+fi
+exit
View
60 conkycolors/bin/conkyPhotoRandom~
@@ -1,60 +0,0 @@
-#!/bin/bash
-#
-# Photo in conky
-# by helmuthdu and paulvictor
-
-source="/usr/share/backgrounds/"
-#source="/home/helmuth/Imagens/deviantART/"
-photo="/tmp/conkyPhoto.png"
-#choose your theme: 1,2 or 3
-theme=1
-filename=`find $source -type f | shuf -n1`
-
- cp "$filename" "$photo"
-
- width=`identify -format %w "$photo"`
- height=`identify -format %h "$photo"`
- picture_aspect=`echo $width - $height | bc`
- v_aligh=`echo $height/2 | bc | sed 's/..[0-9]//'`
-
- if [ $picture_aspect -gt "0" ]; then
- convert "$photo" -thumbnail 280x175 "$photo"
- convert "$photo" -gravity center -crop 175x125+0+0 +repage "$photo"
- else
- convert "$photo" -thumbnail 175x280 "$photo"
- convert "$photo" -crop 175x125+0+$v_aligh +repage "$photo"
- fi
-
- if [ $theme = "1" ]; then
- # Theme 1
- convert $photo\
- -bordercolor snow -border 4.5\
- -bordercolor gray55 -border 1 \
- -background black \( +clone -shadow 40x2+1+1 \) +swap \
- -background none -flatten \
- $photo
- elif [ $theme = "2" ]; then
- # Theme 2
- convert -page +2+2 $photo\
- -bordercolor gray10 -border 1\
- -background black \( +clone -shadow 40x4+2+2 \) +swap \
- -background none -flatten \
- $photo
- elif [ $theme = "3" ]; then
- # Theme 3
- convert $photo \
- -bordercolor snow -border 4.5\
- -bordercolor gray55 -border 1 \
- -bordercolor none -background none \
- \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
- \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
- \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
- -delete 0 -border 175x125 -gravity center \
- -crop 300x185+0+0 +repage -flatten -trim +repage \
- -background black \( +clone -shadow 40x2+1+1 \) +swap \
- -background none -flatten \
- $photo
- fi
-
-exit 0
-
View
56 conkycolors/bin/conkyPhoto~
@@ -1,56 +0,0 @@
-#!/bin/bash
-#
-# Photo in conky
-# by helmuthdu
-
-source="/usr/share/backgrounds/Ropey_Photo_by_Bob_Farrell.jpg"
-photo="/tmp/conkyPhoto.png"
-#choose your theme: 1,2 or 3
-theme=1
-
- cp "$source" "$photo"
-
- width=`identify -format %w "$photo"`
- height=`identify -format %h "$photo"`
- picture_aspect=`echo $width - $height | bc`
- v_aligh=`echo $height/2 | bc | sed 's/..[0-9]//'`
-
- if [ $picture_aspect -gt "0" ]; then
- convert "$photo" -thumbnail 280x175 "$photo"
- convert "$photo" -gravity center -crop 175x125+0+0 +repage "$photo"
- else
- convert "$photo" -thumbnail 175x280 "$photo"
- convert "$photo" -crop 175x125+0+$v_aligh +repage "$photo"
- fi
-
- if [ $theme = "1" ]; then
- # Theme 1
- convert "$photo"\
- -bordercolor snow -border 4.5\
- -bordercolor gray55 -border 1 \
- -background black \( +clone -shadow 40x2+1+1 \) +swap \
- -background none -flatten \
- "$photo"
- elif [ $theme = "2" ]; then
- # Theme 2
- convert -page +2+2 "$photo"\
- -bordercolor gray10 -border 1\
- -background black \( +clone -shadow 40x4+2+2 \) +swap \
- -background none -flatten \
- "$photo"
- elif [ $theme = "3" ]; then
- # Theme 3
- convert "$photo"\
- -bordercolor snow -border 4.5\
- -bordercolor gray55 -border 1 \
- -bordercolor none -background none \
- \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
- \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
- \( -clone 0 -rotate `convert null: -format '%[fx:rand()*30-15]' info:` \) \
- -delete 0 -border 175x125 -gravity center \
- -crop 300x185+0+0 +repage -flatten -trim +repage \
- -background black \( +clone -shadow 40x2+1+1 \) +swap \
- -background none -flatten \
- "$photo"
- fi
-exit 0
View
0  conkycolors/bin/conkyPidgin 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyRhythmbox 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkySlideshow 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyStart 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyTask 100644 → 100755
File mode changed
View
119 conkycolors/bin/conkyTask~
@@ -1,119 +0,0 @@
-#!/bin/bash
-
-TASKLOCATION="${HOME}/.conkycolors"
-TASKFILE="${TASKLOCATION}/tasks"
-TASKFILETEMP="${TASKLOCATION}/tasks.tmp"
-
-ADDTASK="add"
-DONETASK="done"
-REMTASK="del"
-LISTTASK="list"
-SHOWTASK="show"
-NEWTASK="new"
-HELP="help"
-
-function usage() {
-cat << EOF
-Usage: $(basename $0) [new|add <task>|done <num>|del <num>|show <num>|list|help]
-
-Options:
-${LISTTASK} - list all tasks
-${NEWTASK} - create a new list of tasks
-${ADDTASK} - <task> add a new task to the list
-${DONETASK} - <task> done the task of the list
-${REMTASK} - <task> remove the task from the list
-${SHOWTASK} - <task> show selected task
-${HELP} - show this help message
-
-EOF
-exit 0
-}
-
-# check for necessary folders and files
-if [ ! -e ${TASKLOCATION} ]
-then
- mkdir -p ${TASKLOCATION}
-fi
-
-if [ ! -e ${TASKFILE} ]
-then
- touch ${TASKFILE}
-fi
-
-# default option is to list all tasks
-if [ $# == 0 -o "$1" == "$LISTTASK" ]
-then
- cat ${TASKFILE}
- exit 0
-fi
-
-# help option
-if [ "$1" == "$HELP" ]
-then
- usage
- exit 0
-fi
-
-# create a new list of tasks
-if [ $# == 0 -o "$1" == "$NEWTASK" ]
-then
- rm ${TASKFILE}
- touch ${TASKFILE}
- exit 0
-fi
-
-# add task action
-if [ "$1" == "$ADDTASK" ]
-then
- num=$(tail -1 $TASKFILE | cut -d"." -f1)
- [[ $? != 0 ]] && num=0
- ((num++))
- shift
- echo "$num.[ ] $@" >> $TASKFILE
- exit 0
-fi
-
-# done task action
-if [ "$1" == "$DONETASK" ]
-then
- if [[ "$2" -gt "0" ]]
- then
- sed -i "$2s/\[ \]/\[X\]/" $TASKFILE
- else
- usage
- fi
- exit 0
-fi
-
-# remove task action
-if [ "$1" == "$REMTASK" ]
-then
- if [[ "$2" -gt "0" ]]
- then
- sed -i "s/^$2.*$//" $TASKFILE
- sed -i '/^\s*$/d' $TASKFILE
- sed -i 's/^.*\.//' $TASKFILE
- awk '{ print NR"."$0 }' $TASKFILE >> $TASKFILETEMP
- mv $TASKFILETEMP $TASKFILE
- else
- usage
- fi
- exit 0
-fi
-
-# show a task
-if [ "$1" == "$SHOWTASK" ]
-then
- if [[ "$2" -gt "0" ]]
- then
- cat $TASKFILE | grep "$2\."
- [ $? != 0 ] && echo "No such task" >&2
- else
- usage
- fi
- exit 0
-fi
-
-echo "Uknown option: $1" >&2 && usage
-
-# vim: nospell
View
0  conkycolors/bin/conkyYahooWeather 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyZimCalendar 100644 → 100755
File mode changed
View
0  conkycolors/bin/conkyZimEvents 100644 → 100755
File mode changed
View
0  conkycolors/icons/CD/base.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/CD/top.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Case/base.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Case/top.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Glassy/base.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Glassy/top.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/01.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/02.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/03.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/04.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/05.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/06.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/07.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/08.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/09.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/10.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/11.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/12.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/13.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/14.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/15.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/16.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/17.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/18.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/19.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  conkycolors/icons/Moon/20.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Moon/21.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Moon/22.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Moon/23.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Moon/24.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Players/banshee.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Players/exaile.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Players/rhythmbox.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/SLS/Cover.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/SLS/Cover.svg 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/SLS/Cover_White.svg 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/SLS/Cover_white.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Vinyl/base.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Vinyl/top.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/0.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/1.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/10.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/11.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/12.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/13.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/14.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/15.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/16.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/17.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/18.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/19.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/2.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/20.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/21.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/22.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/23.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/24.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/25.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/26.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/27.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/28.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/29.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/3.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/30.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/31.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/32.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/33.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/34.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/35.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/36.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/37.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/38.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/39.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/4.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/40.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/41.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/42.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/43.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/44.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/45.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/46.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/47.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/5.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/6.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/7.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/8.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/9.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/Weather/na.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/oldVinyl/base.png 100644 → 100755
Diff not rendered
View
0  conkycolors/icons/oldVinyl/top.png 100644 → 100755
Diff not rendered
View
0  conkycolors/scripts/conkyBanshee.py 100644 → 100755
File mode changed
View
0  conkycolors/scripts/conkyBoard.lua 100644 → 100755
File mode changed
View
0  conkycolors/scripts/conkyCairo.lua 100644 → 100755
File mode changed
View
0  conkycolors/scripts/conkyClementine.py 100644 → 100755
File mode changed
View
0  conkycolors/scripts/conkyClock_h.py 100644 → 100755
File mode changed
View
0  conkycolors/scripts/conkyClock_m.py 100644 → 100755
File mode changed
View
0  conkycolors/scripts/conkyEmail.py 100644 → 100755
File mode changed
View
0  conkycolors/scripts/conkyExaile.py 100644 → 100755
File mode changed
View
1,702 conkycolors/scripts/conkyForecast.py
@@ -1,1702 +0,0 @@
-#!/usr/bin/env python2
-# -*- coding: utf-8 -*-
-###############################################################################
-# conkyForecast.py is a (not so) simple (anymore) python script to gather
-# details of the current weather for use in conky.
-#
-# Author: Kaivalagi
-# Created: 13/04/2008
-
-from datetime import datetime, timedelta, tzinfo
-from optparse import OptionParser
-from xml.dom import minidom
-import sys
-import os
-import socket
-import urllib2
-import gettext
-import locale
-import re
-import codecs
-import traceback
-import time
-
-# not sure on these, might create more trouble, but here goes...
-reload(sys)
-sys.setdefaultencoding('utf-8')
-
-# cPickle is a pickle class implemented in C - so its faster
-# in case its not available, use regular pickle
-try:
- import cPickle as pickle
-except ImportError:
- import pickle
-
-app_name = "conkyForecast"
-app_path = os.path.dirname(os.path.abspath(__file__))
-module_name = __file__.replace(os.path.dirname (__file__) + "/", "").replace(".pyc","").replace(".py", "")
-
-# default to standard locale translation
-domain = __file__.replace(os.path.dirname (__file__) + "/", "").replace(".py", "")
-localedirectory = os.path.dirname(os.path.abspath(__file__)) + "/locale"
-gettext.bindtextdomain(domain, localedirectory)
-gettext.textdomain(domain)
-gettext.install(domain)
-
-class CommandLineParser:
-
- parser = None
-
- def __init__(self):
-
- self.parser = OptionParser()
- self.parser.add_option("-C", "--config", dest="config", default="~/.conkyForecast.config", type="string", metavar="FILE", help=u"[default: %default] The path to the configuration file, allowing multiple config files to be used.")
- self.parser.add_option("-l", "--location", dest="location", type="string", metavar="CODE", help=u"location code for weather data [default set in config]. Use the following url to determine your location code by city name: http://xoap.weather.com/search/search?where=Norwich")
- self.parser.add_option("-d", "--datatype", dest="datatype", default="HT", type="string", metavar="DATATYPE", help=u"[default: %default] The data type options are: DW (Day of Week), WF (Weather Font output), WI (Weather Icon Path), LT (Forecast:Low Temp,Current:Feels Like Temp), HT (Forecast:High Temp,Current:Current Temp), CC (Current Conditions), CT (Conditions Text), PC (Precipitation Chance), HM (Humidity), VI (Visibility), WD (Wind Direction), WA (Wind Angle - in degrees), WS (Wind Speed), WG (Wind Gusts), BF (Bearing Font), BI (Bearing Icon Path), BS (Bearing font with Speed), CN (City Name), CO (Country), OB (Observatory), SR (SunRise), SS (SunSet), DL (DayLight), MP (Moon Phase), MF (Moon Font), MI (Moon Icon Path), BR (Barometer Reading), BD (Barometer Description), UI (UV Index), UT (UV Text), DP (Dew Point), WM (weather map fetch and image path returned), LU (Last Update at weather.com), LF (Last Fetch from weather.com). Not applicable at command line when using templates.")
- self.parser.add_option("-s", "--startday", dest="startday", type="int", metavar="NUMBER", help=u"define the starting day number, if omitted current conditions are output. Not applicable at command line when using templates.")
- self.parser.add_option("-e", "--endday", dest="endday", type="int", metavar="NUMBER", help=u"define the ending day number, if omitted only starting day data is output. Not applicable at command line when using templates.")
- self.parser.add_option("-S", "--spaces", dest="spaces", type="int", default=1, metavar="NUMBER", help=u"[default: %default] Define the number of spaces between ranged output. Not applicable at command line when using templates.")
- self.parser.add_option("-t", "--template", dest="template", type="string", metavar="FILE", help=u"define a template file to generate output in one call. A displayable item in the file is in the form [--datatype=HT --startday=1]. The following are possible options within each item: --location,--datatype,--startday,--endday,--night,--shortweekday,--imperial,--beaufort,--metrespersecond,--hideunits,--hidedegreesymbol,--spaces,--minuteshide. Note that the short forms of the options are not supported! If any of these options is set from the commandline, it sets the default value of the option for all template items.")
- self.parser.add_option("-L", "--locale", dest="locale", type="string", help=u"override the system locale for language output (bg=bulgarian, cs=czech, de=german, es=spanish, en=english, es=spanish, fj=fijian, fr=french, it=italian, nl=dutch, pl=polish, ro=romanian, sk=slovak, more to come)")
- self.parser.add_option("-i", "--imperial", dest="imperial", default=False, action="store_true", help=u"request imperial units, if omitted output is in metric.")
- self.parser.add_option("-b", "--beaufort", dest="beaufort", default=False, action="store_true", help=u"request beaufort scale for wind speeds, if omitted output is either metric/imperial.")
- self.parser.add_option("-M", "--metrespersecond", dest="metrespersecond", default=False, action="store_true", help=u"request metres per second for wind speeds, if omitted output is either metric/imperial.")
- self.parser.add_option("-n", "--night", dest="night", default=False, action="store_true", help=u"switch output to night data, if omitted day output will be output.")
- self.parser.add_option("-w", "--shortweekday", dest="shortweekday", default=False, action="store_true", help=u"Shorten the day of week data type to 3 characters.")
- self.parser.add_option("-u", "--hideunits", dest="hideunits", default=False, action="store_true", help=u"Hide units such as mph or C, degree symbols (°) are still shown.")
- self.parser.add_option("-x", "--hidedegreesymbol", dest="hidedegreesymbol", default=False, action="store_true", help=u"Hide the degree symbol used with temperature output, this is only valid if used in conjunction with --hideunits.")
- self.parser.add_option("-m", "--minuteshide", dest="minuteshide", type="int", metavar="NUMBER", help=u"Works only with LU and LF. If present, hides the date part of the LU or LF timestamp if the day of the timestamp is today. The time part is also hidden, if the timestamp is older than minutes specified in this argument. If set to 0, the time part is always shown. If set to -1, the value EXPIRY_MINUTES from the config file is used.")
- self.parser.add_option("-c", "--centeredwidth", dest="centeredwidth", type="int", metavar="WIDTH", help=u"If used the output will be centered in a string of the set width, padded out with spaces, if the output width is greater than the setting it will be truncated")
- self.parser.add_option("-r", "--refetch", dest="refetch", default=False, action="store_true", help=u"Fetch data regardless of data expiry.")
- self.parser.add_option("-v", "--verbose", dest="verbose", default=False, action="store_true", help=u"Request verbose output, not a good idea when running through conky!")
- self.parser.add_option("-V", "--version", dest="version", default=False, action="store_true", help=u"Displays the version of the script.")
- self.parser.add_option("--errorlogfile", dest="errorlogfile", type="string", metavar="FILE", help=u"If a filepath is set, the script appends errors to the filepath.")
- self.parser.add_option("--infologfile", dest="infologfile", type="string", metavar="FILE", help=u"If a filepath is set, the script appends info to the filepath.")
-
- def parse_args(self):
- (options, args) = self.parser.parse_args()
- return (options, args)
-
- def print_help(self):
- return self.parser.print_help()
-
-# N.B: The below class member values are defaults and should be left alone, they
-# are there to provide a working script if the script is called without all
-# the expected input. Any issues raised where these values have been
-# changed will get the simple "put the .py file back to it's original
-# state" reply
-class ForecastConfig:
- CACHE_FOLDERPATH = "/tmp/"
- CONNECTION_TIMEOUT = 5
- EXPIRY_MINUTES = 30
- TIME_FORMAT = "%H:%M"
- DATE_FORMAT = "%Y-%m-%d"
- LOCALE = "" # with no setting the default locale of the system is used
- XOAP_PARTNER_ID = "" # need config with correct partner id
- XOAP_LICENCE_KEY = "" # need config with correct licence key
- DEFAULT_LOCATION = "UKXX0103"
- MAXIMUM_DAYS_FORECAST = 4
- AUTO_NIGHT = False
- BASE_XOAP_URL = "http://xoap.weather.com/weather/local/<LOCATION>?cc=*&dayf=10&link=xoap&prod=xoap&par=<XOAP_PARTNER_ID>&key=<XOAP_LICENCE_KEY>&unit=m"
- PROXY_HOST = None
- PROXY_PORT = 8080
- PROXY_USERNAME = None
- PROXY_PASSWORD = None
-
-
-class ForecastDataset:
- def __init__(self, last_update, day_of_week, low, high, condition_code, condition_text, precip, humidity, wind_dir, wind_dir_numeric, wind_speed, wind_gusts, timezone, sunrise, sunset, moon_phase, moon_icon, bar_read, bar_desc, uv_index, uv_text, dew_point, observatory, visibility, city, country, weathermap):
- self.last_update = last_update
- self.day_of_week = day_of_week
- self.low = low
- self.high = high
- self.condition_code = condition_code
- self.condition_text = condition_text
- self.precip = precip
- self.humidity = humidity
- self.wind_dir = wind_dir
- self.wind_dir_numeric = wind_dir_numeric
- self.wind_speed = wind_speed
- self.wind_gusts = wind_gusts
- self.timezone = timezone
- self.sunrise = sunrise
- self.sunset = sunset
- self.moon_phase = moon_phase
- self.moon_icon = moon_icon
- self.bar_read = bar_read
- self.bar_desc = bar_desc
- self.uv_index = uv_index
- self.uv_text = uv_text
- self.dew_point = dew_point
- self.observatory = observatory
- self.visibility = visibility
- self.city = city
- self.country = country
- self.weathermap = weathermap
-
-class ForecastLocation:
- timestamp = None
-
- def __init__(self, current, day, night):
- self.current = current
- self.day = day
- self.night = night
- self.timestamp = datetime.today()
-
- def outdated(self, mins):
- if datetime.today() > self.timestamp + timedelta(minutes=mins):
- return True
- else:
- return False
-
-# start ignoring translations required at runtime
-def _(text): return text
-
-class ForecastText:
-
- # translatable dictionaries
- conditions_text = {
- "0": _(u"Tornado"),
- "1": _(u"Tropical Storm"),
- "2": _(u"Hurricane"),
- "3": _(u"Severe Thunderstorms"),
- "4": _(u"Thunderstorms"),
- "5": _(u"Mixed Rain and Snow"),
- "6": _(u"Mixed Rain and Sleet"),
- "7": _(u"Mixed Precipitation"),
- "8": _(u"Freezing Drizzle"),
- "9": _(u"Drizzle"),
- "10": _(u"Freezing Rain"),
- "11": _(u"Light Rain"),
- "12": _(u"Rain"),
- "13": _(u"Snow Flurries"),
- "14": _(u"Light Snow Showers"),
- "15": _(u"Drifting Snow"),
- "16": _(u"Snow"),
- "17": _(u"Hail"),
- "18": _(u"Sleet"),
- "19": _(u"Dust"),
- "20": _(u"Fog"),
- "21": _(u"Haze"),
- "22": _(u"Smoke"),
- "23": _(u"Blustery"),
- "24": _(u"Windy"),
- "25": _(u"N/A"),
- "26": _(u"Cloudy"),
- "27": _(u"Mostly Cloudy"),
- "28": _(u"Mostly Cloudy"),
- "29": _(u"Partly Cloudy"),
- "30": _(u"Partly Cloudy"),
- "31": _(u"Clear"),
- "32": _(u"Clear"),
- "33": _(u"Fair"),
- "34": _(u"Fair"),
- "35": _(u"Mixed Rain and Hail"),
- "36": _(u"Hot"),
- "37": _(u"Isolated Thunderstorms"),
- "38": _(u"Scattered Thunderstorms"),
- "39": _(u"Scattered Showers"),
- "40": _(u"Heavy Rain"),
- "41": _(u"Scattered Snow Showers"),
- "42": _(u"Heavy Snow"),
- "43": _(u"Heavy Snow"),
- "44": _(u"N/A"),
- "45": _(u"Scattered Showers"),
- "46": _(u"Snow Showers"),
- "47": _(u"Isolated Thunderstorms"),
- "na": _(u"N/A"),
- "-": _(u"N/A")
- }
-
- day_of_week_short = {
- "Today": _(u"Now"),
- "Monday": _(u"Mon"),
- "Tuesday": _(u"Tue"),
- "Wednesday": _(u"Wed"),
- "Thursday": _(u"Thu"),
- "Friday": _(u"Fri"),
- "Saturday": _(u"Sat"),
- "Sunday": _(u"Sun")
- }
-
- # font based character sets, untranslatable
-
- # ConkyWeather.ttf based output
- conditions_weather_font = {
- "0": u"1", #Tornado
- "1": u"2", #Tropical Storm
- "2": u"3", #Hurricane
- "3": u"n", #Severe Thunderstorms
- "4": u"m", #Thunderstorms
- "5": u"x", #Mixed Rain and Snow
- "6": u"x", #Mixed Rain and Sleet
- "7": u"y", #Mixed Precipitation
- "8": u"s", #Freezing Drizzle
- "9": u"h", #Drizzle
- "10": u"t", #Freezing Rain
- "11": u"h", #Light Rain
- "12": u"i", #Rain
- "13": u"p", #Snow Flurries
- "14": u"p", #Light Snow Showers
- "15": u"8", #Drifting Snow
- "16": u"q", #Snow
- "17": u"u", #Hail
- "18": u"w", #Sleet
- "19": u"7", #Dust
- "20": u"0", #Fog
- "21": u"9", #Haze
- "22": u"4", #Smoke
- "23": u"6", #Blustery
- "24": u"6", #Windy
- "25": u"-", #N/A
- "26": u"f", #Cloudy
- "27": u"D", #Mostly Cloudy - night
- "28": u"d", #Mostly Cloudy - day
- "29": u"C", #Partly Cloudy - night
- "30": u"c", #Partly Cloudy - day
- "31": u"A", #Clear - night
- "32": u"a", #Clear - day
- "33": u"B", #Fair - night
- "34": u"b", #Fair - day
- "35": u"v", #Mixed Rain and Hail
- "36": u"5", #Hot
- "37": u"k", #Isolated Thunderstorms - day
- "38": u"k", #Scattered Thunderstorms - day
- "39": u"g", #Scattered Showers - day
- "40": u"j", #Heavy Rain
- "41": u"o", #Scattered Snow Showers - day
- "42": u"r", #Heavy Snow
- "43": u"r", #Heavy Snow
- "44": u"-", #N/A
- "45": u"G", #Scattered Showers - night
- "46": u"O", #Scattered Snow Showers - night
- "47": u"K", #Isolated Thunderstorms - night
- "na": u"-", #N/A
- "-": u"-" #N/A
- }
-
- conditions_moon_font = {
- "0": u"1",
- "1": u"N",
- "2": u"O",
- "3": u"P",
- "4": u"Q",
- "5": u"R",
- "6": u"S",
- "7": u"T",
- "8": u"U",
- "9": u"V",
- "10": u"W",
- "11": u"X",
- "12": u"Y",
- "13": u"Z",
- "14": u"0",
- "15": u"0",
- "16": u"A",
- "17": u"B",
- "18": u"C",
- "19": u"D",
- "20": u"E",
- "21": u"F",
- "22": u"G",
- "23": u"H",
- "24": u"I",
- "25": u"J",
- "26": u"K",
- "27": u"L",
- "28": u"M",
- "29": u"1",
- "N/A": u"",
- "na": u"",
- "-": u""
- }
-
- conditions_moon_icon = {
- "0": u"24",
- "1": u"01",
- "2": u"02",
- "3": u"03",
- "4": u"04",
- "5": u"05",
- "6": u"06",
- "7": u"07",
- "8": u"08",
- "9": u"09",
- "10": u"10",
- "11": u"11",
- "12": u"12",
- "13": u"13",
- "14": u"13",
- "15": u"13",
- "16": u"14",
- "17": u"15",
- "18": u"16",
- "19": u"17",
- "20": u"18",
- "21": u"19",
- "22": u"20",
- "23": u"21",
- "24": u"22",
- "25": u"23",
- "26": u"23",
- "27": u"23",
- "28": u"23",
- "29": u"24",
- "N/A": u"",
- "na": u"",
- "-": u""
- }
-
- # this now returns ascii code
- bearing_arrow_font = {
- "S": 0x31,
- "SSW": 0x32,
- "SW": 0x33,
- "WSW": 0x34,
- "W": 0x35,
- "WNW": 0x36,
- "NW": 0x37,
- "NNW": 0x38,
- "N": 0x39,
- "NNE": 0x3a,
- "NE": 0x3b,
- "ENE": 0x3c,
- "E": 0x3d,
- "ESE": 0x3e,
- "SE": 0x3f,
- "SSE": 0x40,
- }
-
- bearing_icon = {
- "calm": "00",
- "VAR": "01",
- "S": "05",
- "SSW": "06",
- "SW": "07",
- "WSW": "08",
- "W": "09",
- "WNW": "10",
- "NW": "11",
- "NNW": "12",
- "N": "13",
- "NNE": "14",
- "NE": "15",
- "ENE": "16",
- "E": "17",
- "ESE": "18",
- "SE": "19",
- "SSE": "20"
- }
-
- # New translatable strings
- # foppeh >> These arrays are here so they get translated even if they
- # are not used in the code.
-
- # first all about moon phases
- moon_phase = {
- "New": _(u"New"),
- "First Quarter": _(u"First Quarter"),
- "Full": _(u"Full"),
- "Last Quarter": _(u"Last Quarter"),
- "Waning Crescent": _(u"Waning Crescent"),
- "Waning Gibbous": _(u"Waning Gibbous"),
- "Waxing Crescent": _(u"Waxing Crescent"),
- "Waxing Gibbous": _(u"Waxing Gibbous")
- }
-
- # foppeh >> Something is going on with these string. I don't know if they are valid.
- # The weird thing is they are in lower case and the XML seems to spit
- # text with too many Uppercase. So I don't know if strings presented here
- # will ever be a valid output from weather.com. Yet I stored them here for
- # future reference (and because of the French translation).
-
- # all about weather conditions
- # 'blowing dust' => 'tempête de sable',
- # 'blowing snow' => 'tempête de neige',
- # 'blowing snow and windy' => 'blizzard',
- # 'clear' => 'clair ',
- # 'cloudy' => 'nuageux',
- # 'cloudy and windy' => 'nuageux et venteux',
- # 'drizzle' => 'bruine',
- # 'drifting snow' => 'accumulation de neige',
- # 'fair' => 'clair',
- # 'fair and windy' => 'clair et venteux',
- # 'fog' => 'brouillard',
- # 'haze' => 'smog',
- # 'heavy drizzle' => 'bruine intense',
- # 'heavy rain' => 'pluie intense',
- # 'heavy rain and windy' => 'pluie intense et venteux',
- # 'heavy snow' => 'neige intense',
- # 'heavy snow and windy' => 'neige intense et venteux',
- # 'heavy t-storm' => 'orage électrique intense',
- # 'light drizzle' => 'faible bruine',
- # 'light drizzle and windy' => 'bruine légère et venteux',
- # 'light freezing drizzle' => 'bruine légère verglassante',
- # 'light freezing rain' => 'faible pluie verglassante',
- # 'light rain' => 'faible pluie',
- # 'light rain shower' => 'faible averse de pluie',
- # 'light rain and fog' => 'faible pluie et brouillard',
- # 'light rain and freezing rain' => 'pluie faible et pluie erglassante',
- # 'light rain with thunder' => 'faible pluie avec tonnerre',
- # 'light rain and windy' => 'faible pluie et venteux',
- # 'light snow' => 'faible neige',
- # 'light snow shower' => 'faible averse de neige',
- # 'light snow and sleet' => 'leichter Schneefall und Schneeregen',
- # 'light snow and windy' => 'leichter Schneefall und windig',
- # 'mist' => 'brume',
- # 'mostly cloudy' => 'nuageux avec éclaircies',
- # 'mostly cloudy and windy' => 'venteux et nuageux avec éclaircies',
- # 'partial fog' => 'partiellement brumeux',
- # 'partly cloudy' => 'partiellement nuageux',
- # 'partly cloudy and windy' => 'partiellement nuageux et venteux',
- # 'patches of fog' => 'partielles de brouillard',
- # 'rain' => 'pluvieux',
- # 'rain and sleet' => 'pluie et grésil',
- # 'rain and snow' => 'pluie et neige',
- # 'rain shower' => 'averse de pluie',
- # 'rain and fog' => 'pluie et brouillard',
- # 'rain and windy' => 'pluvieux et venteux',
- # 'sand' => 'sable',
- # 'shallow fog' => 'brouillard mince',
- # 'showers in the vicinity' => 'averses à proximité',
- # 'sleet' => 'grésil',
- # 'smoke' => 'fumée',
- # 'snow' => 'neige',
- # 'snow and fog' => 'neige et brouillard',
- # 'snow and freezing rain' => 'neige et pluie verglassante',
- # 'snow grains' => 'neige intermittante',
- # 'snow showers' => 'averse de neige',
- # 'snow and windy and fog' => 'neige, brouillard et venteux',
- # 'squalls and windy' => 'vent et grésil',
- # 'sunny' => 'ensoleillé',
- # 'sunny and windy' => 'ensoleillé et venteux',
- # 't-storm' => 'Orage Électrique',
- # 'thunder' => 'tonnerre',
- # 'thunder in the vicinity' => 'tonnerre aux alentours',
- # 'unknown precip' => 'précipitation inconnue',
- # 'widespread dust' => 'vents de poussière',
- # 'wintry mix' => 'conditions hivernales variables',
-
-
- # some general things...
- general = {
- "n/a": _(u"n/a"),
- 'N/A': _(u"N/A"),
- 'Not Available': _(u"Not Available"),
- 'unknown': _(u"unknown"),
- 'NONE': _(u"NONE"),
- 'day': _(u"day"),
- 'night': _(u"night")
- }
-
- # UV index ...
- UV_index = {
- "Extreme": _(u"Extreme"),
- "Very high": _(u"Very High"),
- "High": _(u"High"),
- "Moderate": (u"Moderate"),
- "Low": _(u"Low")
- }
-
- # tendencies used for barometric pressure
- bar_pressure = {
- "Very Low": _(u"Very Low"),
- "Moderate": _(u"Moderate"),
- "rising": _(u"rising"),
- "falling": _(u"falling"),
- "steady": _(u"steady"),
- "calm": _(u"calm")
- }
-
-
- # wind directions long
- wind_directions_long = {
- "East": _(u"East"),
- "East Northeast": _(u"East Northeast"),
- "East Southeast": _(u"East Southeast"),
- "North": _(u"North"),
- "Northeast": _(u"Northeast"),
- "North Northeast": _(u"North Northeast"),
- "North Northwest": _(u"North Northwest"),
- "Northwest": _(u"Northwest"),
- "South": _(u"South"),
- "Souteast": _(u"Southeast"),
- "South Southeast": _(u"South Southeast"),
- "South Southwest": _(u"South Southwest"),
- "Southwest": _(u"Southwest"),
- "variable": _(u"variable"),
- "West": _(u"West"),
- "West Northwest": _(u"West Northwest"),
- "West Southwest": _(u"West Southwest")
- }
-
- wind_directions_short = {
- "E": _(u"E"),
- "ENE": _(u"ENE"),
- "ESE": _(u"ESE"),
- "N": _(u"N"),
- "NE": _(u"NE"),
- "NNE": _(u"NNE"),
- "NNW": _(u"NNW"),
- "NW": _(u"NW"),
- "S": _(u"S"),
- "SE": _(u"SE"),
- "SSE": _(u"SSE"),
- "SSW": _(u"SSW"),
- "SW": _(u"SW"),
- "W": _(u"W"),
- "WNW": _(u"WNW"),
- "WSW": _(u"WSW")
- }
-
- days_of_week = {
- "Today": _(u"Today"),
- "Monday": _(u"Monday"),
- "Tuesday":_(u"Tuesday"),
- "Wednesday":_(u"Wednesday"),
- "Thursday": _(u"Thursday"),
- "Friday": _(u"Friday"),
- "Saturday": _(u"Saturday"),
- "Sunday": _(u"Sunday")
- }
-
-# end ignoring translations
-del _
-
-class ForecastInfo:
-
- # design time variables
- options = None
- config = None
- forecast_data = {}
- # a list of locations for which an attempt was made to load them
- # locations in this list are not loaded again (if there was an error,
- # this makes sure it doesn't reapeat over and over)
- loaded_locations = []
- error = ""
- errorfound = False
-
- # design time settings
- CACHE_FILENAME = ".conkyForecast-<LOCATION>.cache"
- WEATHERMAP_IMAGE_FILENAME = ".conkyForecast-WM-<LOCATION>.jpg"
-
- def __init__(self, options):
-
- self.options = options
-
- self.loadConfigData()
-
- # setup timeout for connections
- # TODO: seems like this doesn't work in all cases..
- socket.setdefaulttimeout(self.config.CONNECTION_TIMEOUT)
-
- # set the locale
- if self.options.locale == None:
- if self.config.LOCALE == "":
- self.options.locale = locale.getdefaultlocale()[0][0:2]
- else:
- self.options.locale = self.config.LOCALE
-
- self.logInfo("Locale set to " + self.options.locale)
-
- # if not the default "en" locale, configure the i18n language translation
- if self.options.locale != "en":
-
- self.logInfo("Looking for translation file for '%s' under %s" % (self.options.locale, localedirectory))
-
- if gettext.find(domain, localedirectory, languages=[self.options.locale]) != None:
- self.logInfo("Translation file found for '%s'" % self.options.locale)
-
- try:
- trans = gettext.translation(domain, localedirectory, languages=[self.options.locale])
- trans.install(unicode=True)
- self.logInfo("Translation installed for '%s'" % self.options.locale)
-
- except Exception, e:
- self.logError("Unable to load translation for '%s' %s" % (self.options.locale, e.__str__()))
- else:
- self.logInfo("Translation file not found for '%s', defaulting to 'en'" % self.options.locale)
- self.options.locale = "en"
-
- # setup location code if not set
- if self.options.location == None:
- self.options.location = self.config.DEFAULT_LOCATION
-
- # setup a proxy if defined
- if self.config.PROXY_HOST != None:
- if self.config.PROXY_USERNAME != None and self.config.PROXY_PASSWORD != None:
- self.logInfo("Setting up proxy '%s:%d', with username and password"%(self.config.PROXY_HOST,self.config.PROXY_PORT))
- proxyurl = "http://%s:%s@%s:%d"%(self.config.PROXY_USERNAME,self.config.PROXY_PASSWORD,self.config.PROXY_HOST,self.config.PROXY_PORT)
- else:
- self.logInfo("Setting up proxy '%s:%d', without username and password"%(self.config.PROXY_HOST,self.config.PROXY_PORT))
- proxyurl = "http://%s:%d"%(self.config.PROXY_HOST,self.config.PROXY_PORT)
-
- try:
- proxy_support = urllib2.ProxyHandler({"http" : proxyurl})
- opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler)
- urllib2.install_opener(opener)
- except Exception, e:
- self.logError("Unable to setup proxy: %s"%e.__str__())
- else:
- self.logInfo("Not using a proxy as none is defined")
-
- # Check if the location is loaded, if not, load it. If it can't be loaded, there was an error
- if not self.checkAndLoad(self.options.location):
- self.logError("Failed to load the location cache")
-
- def loadConfigData(self):
- try:
- # load .conkyForecast.config from the options setting
- configfilepath = os.path.expanduser(self.options.config)
-
- if os.path.exists(configfilepath):
-
- self.config = ForecastConfig()
-
- #load the file
- fileinput = open(configfilepath)
- lines = fileinput.read().split("\n")
- fileinput.close()
-
- for line in lines:
- line = line.strip()
- if len(line) > 0 and line[0:1] != "#": # ignore commented lines or empty ones
-
- splitpos = line.find("=")
- name = line[:splitpos-1].strip().upper() # config setting name on the left of =
- value = line[splitpos+1:].split("#")[0].strip()
-
- if len(value) > 0:
- if name == "CACHE_FOLDERPATH":
- self.config.CACHE_FOLDERPATH = value
- elif name == "CONNECTION_TIMEOUT":
- try: # NITE: removed the isNumeric() check in favor of this..its more effective and lets the user know something is wrong
- self.config.CONNECTION_TIMEOUT = int(value)
- except:
- self.logError("Invalid value of config option CONNECTION_TIMEOUT: " + value)
- elif name == "EXPIRY_MINUTES":
- try:
- self.config.EXPIRY_MINUTES = int(value)
- except:
- self.logError("Invalid value of config option EXPIRY_MINUTES: " + value)
- elif name == "TIME_FORMAT":
- self.config.TIME_FORMAT = value
- elif name == "DATE_FORMAT":
- self.config.DATE_FORMAT = value
- elif name == "LOCALE":
- self.config.LOCALE = value
- elif name == "XOAP_PARTNER_ID":
- self.config.XOAP_PARTNER_ID = value
- elif name == "XOAP_LICENCE_KEY":
- self.config.XOAP_LICENCE_KEY = value
- elif name == "DEFAULT_LOCATION":
- self.config.DEFAULT_LOCATION = value
- elif name == "MAXIMUM_DAYS_FORECAST":
- self.config.MAXIMUM_DAYS_FORECAST = int(value)
- elif name == "AUTO_NIGHT":
- self.config.AUTO_NIGHT = self.parseBoolString(value)
- elif name == "BASE_XOAP_URL":
- self.config.BASE_XOAP_URL = value
- elif name == "PROXY_HOST":
- self.config.PROXY_HOST = value
- elif name == "PROXY_PORT":
- self.config.PROXY_PORT = int(value)
- elif name == "PROXY_USERNAME":
- self.config.PROXY_USERNAME = value
- elif name == "PROXY_PASSWORD":
- self.config.PROXY_PASSWORD = value
- else:
- self.logError("Unknown option in config file: " + name)
-
- if self.options.verbose == True:
- print >> sys.stdout,"*** CONFIG OPTIONS:"
- print >> sys.stdout," CACHE_FOLDERPATH:", self.config.CACHE_FOLDERPATH
- print >> sys.stdout," CONNECTION_TIMEOUT:", self.config.CONNECTION_TIMEOUT
- print >> sys.stdout," EXPIRY_MINUTES:", self.config.EXPIRY_MINUTES
- print >> sys.stdout," TIME_FORMAT:", self.config.TIME_FORMAT
- print >> sys.stdout," DATE_FORMAT:", self.config.DATE_FORMAT
- print >> sys.stdout," LOCALE:", self.config.LOCALE
- print >> sys.stdout," XOAP_PARTNER_ID:", self.config.XOAP_PARTNER_ID
- print >> sys.stdout," XOAP_LICENCE_KEY:", self.config.XOAP_LICENCE_KEY
- print >> sys.stdout," DEFAULT_LOCATION:", self.config.DEFAULT_LOCATION
- print >> sys.stdout," MAXIMUM_DAYS_FORECAST:", self.config.MAXIMUM_DAYS_FORECAST
- print >> sys.stdout," BASE_XOAP_URL:", self.config.BASE_XOAP_URL
-
- else:
- self.logError("Config data file %s not found, using defaults (Registration info is needed though)" % configfilepath)
-
- except Exception, e:
- self.logError("Error while loading config data, using defaults (Registration info is needed though): " + e.__str__())
-
-
- def checkAndLoad(self, location):
-
- # if the location was not loaded before (or attempted to load)
- if not location in self.loaded_locations:
- # add it to the list so it doesn't get loaded again (or attempted to load)
- self.loaded_locations.append(location)
-
- # define CACHE_FILEPATH based on cache folder and location code
- CACHE_FILEPATH = os.path.join(self.config.CACHE_FOLDERPATH, self.CACHE_FILENAME.replace("<LOCATION>", location))
-
- if not self.forecast_data.has_key(location):
- if os.path.exists(CACHE_FILEPATH):
- try:
- self.logInfo("Loading cache file " + CACHE_FILEPATH)
- file = open(CACHE_FILEPATH, 'rb')
- self.forecast_data[location] = pickle.load(file)
- file.close()
- except Exception, e:
- self.logError("Unable to read the cache file %s: %s" % (CACHE_FILEPATH, e.__str__()))
- #TODO: get to the bottom of failure to load pickled cache file, is this a 2.7.1 issue?
- self.logInfo("Deleting cache file due to loading issues, it will be prepared again")
- os.remove(CACHE_FILEPATH)
- #return False
-
- # check the data in the dictionary and update if outdated
- # if there was an update, store the new data in the cache file
- if self.checkAndUpdate(location) == True:
- try:
- self.logInfo("Saving updated cache file " + CACHE_FILEPATH)
- file = open(CACHE_FILEPATH, 'wb')
- pickle.dump(self.forecast_data[location], file)
- file.close()
- except Exception, e:
- self.logError("Unable to save cache file %s: %s" % (CACHE_FILEPATH, e.__str__()))
- return False
-
- # if the location is still not in cache, print an error and return false to writeOutput()
- if self.forecast_data.has_key(location):
- return True
- else:
- self.logError("Location %s is not in cache." % self.options.location)
- return False
-
-
- def checkAndUpdate(self, location):
- # if the location is outdated or the refetch is forced..
- if not self.forecast_data.has_key(location) or \
- self.forecast_data[location].outdated(self.config.EXPIRY_MINUTES) or \
- self.options.refetch == True:
-
- # obtain current conditions data from xoap service
- try:
- #url = "http://xoap.weather.com/weather/local/" + location + "?cc=*&dayf=10&link=xoap&prod=xoap&par=" + str(self.config.XOAP_PARTNER_ID) + "&key=" + self.config.XOAP_LICENCE_KEY + "&unit=m"
- #url = "http://xoap.weather.com/weather/local/" + location + "?cc=*&dayf=10&link=xoap&par=" + str(self.config.XOAP_PARTNER_ID) + "&key=" + self.config.XOAP_LICENCE_KEY + "&unit=m"
- #url = "http://xml.weather.com/weather/local/" + location + "?cc=*&unit=m&dayf=10&link=xoap&prod=xoap&par=" + str(self.config.XOAP_PARTNER_ID) + "&key=" + self.config.XOAP_LICENCE_KEY + "&unit=m"
-
- url = self.config.BASE_XOAP_URL.replace("<LOCATION>",location).replace("<XOAP_PARTNER_ID>",str(self.config.XOAP_PARTNER_ID)).replace("<XOAP_LICENCE_KEY>",self.config.XOAP_LICENCE_KEY)
-
- self.logInfo("Fetching weather data from " + url)
-
- usock = urllib2.urlopen(url)
- xml = usock.read()
- usock.close()
-
- except Exception, e:
- self.logError("Server connection error: " + e.__str__())
- return False
-
- else:
- # interrogate weather data
- try:
- # parse the XML
- self.weatherxmldoc = minidom.parseString(xml)
-
- weather_n = self.weatherxmldoc.documentElement
-
- # check for an error and raise an exception
- if len(weather_n.getElementsByTagName('err')) > 0:
- raise Exception, self.getText(weather_n, 'err')
-
- #head_n = self.getChild(weather_n, 'head')
- #visibility_unit = self.getText(head_n, 'ud')
-
- location_n = self.getChild(weather_n, 'loc')
- city, country = self.getText(location_n, 'dnam').split(',')
- country = country.strip()
-
- # current conditions data
- day_of_week = _(u"Today")
- precip = _(u"N/A")
- sunrise = self.getText(location_n, 'sunr')
- sunset = self.getText(location_n, 'suns')
- timezone = self.getText(location_n, 'zone')
-
- current_condition_n = self.getChild(weather_n, 'cc')
- last_update = self.getText(current_condition_n, 'lsup')
- observatory = self.getText(current_condition_n, 'obst')
- # remove the ", country" from the string (the string is in form "location_name, country")
- observatory = observatory[:observatory.rfind(',')]
- current_desc = self.getText(current_condition_n, 't')
- current_code = self.getText(current_condition_n, 'icon')
- current_temp = self.getText(current_condition_n, 'tmp')
- current_temp_feels = self.getText(current_condition_n, 'flik')
-
- bar_n = self.getChild(current_condition_n, 'bar')
- bar_read = self.getText(bar_n, 'r')
- bar_desc = self.getText(bar_n, 'd')
-
- wind_n = self.getChild(current_condition_n, 'wind')
- wind_speed = self.getText(wind_n, 's')
- wind_gusts = self.getText(wind_n, 'gust')
- wind_direction_numeric = self.getText(wind_n, 'd')
- wind_direction = self.getText(wind_n, 't')
-
- humidity = self.getText(current_condition_n, 'hmid')
- visibility = self.getText(current_condition_n, 'vis')
- #if self.isNumeric(visibility):
- # visibility = visibility + visibility_unit
-
- uv_n = self.getChild(current_condition_n, 'uv')
- uv_index = self.getText(uv_n, 'i')
- uv_text = self.getText(uv_n, 't')
-
- dew_point = self.getText(current_condition_n, 'dewp')
-
- moon_n = self.getChild(current_condition_n, 'moon')
- moon_icon = self.getText(moon_n, 'icon')
- moon_phase = self.getText(moon_n, 't')
-
- # only fetch this map image if requested via the WM datatype, this is very costly...
- if self.options.datatype == "WM":
- weathermap = self.getImageSrcForWeatherMap(location)
- else:
- weathermap = None
-
- current_forecast_data = ForecastDataset(last_update, day_of_week, current_temp_feels, current_temp, current_code, current_desc, precip, humidity, wind_direction, wind_direction_numeric, wind_speed, wind_gusts, timezone, sunrise, sunset, moon_phase, moon_icon, bar_read, bar_desc, uv_index, uv_text, dew_point, observatory, visibility, city, country, weathermap)
-
- # collect forecast data
- observatory = _(u"N/A")
- bar_read = _(u"N/A")
- bar_desc = _(u"N/A")
- visibility = _(u"N/A")
- uv_index = _(u"N/A")
- uv_text = _(u"N/A")
- dew_point = _(u"N/A")
- moon_phase = _(u"N/A")
- moon_icon = _(u"N/A")
-
- forecast_n = self.getChild(weather_n, 'dayf')
- last_update = self.getText(forecast_n, 'lsup')
-
- day_nodes = forecast_n.getElementsByTagName('day')
-
- day_forecast_data_list = []
- night_forecast_data_list = []
-
- for day in day_nodes:
- day_of_week = day.getAttribute('t')
-
- high_temp = self.getText(day