Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #function: test_image
- test_image () {
- case $1 in
- c|d|f)
- echo e
- ;;
- fl|sn)
- echo q
- ;;
- cl)
- echo A
- ;;
- pc)
- echo C
- ;;
- co)
- echo E
- ;;
- fr|r)
- echo i
- ;;
- h|ic)
- echo b
- ;;
- ho)
- echo 5
- ;;
- i)
- echo r
- ;;
- mcl)
- echo B
- ;;
- mc)
- echo c
- ;;
- mcfl|mcsn|psfl)
- echo o
- ;;
- mcs)
- echo g
- ;;
- pcs)
- echo G
- ;;
- mct|psut)
- echo k
- ;;
- pct)
- echo K
- ;;
- msu|psu)
- echo b
- ;;
- psus)
- echo g
- ;;
- s)
- echo h
- ;;
- rsn|sl)
- echo x
- ;;
- su)
- echo a
- ;;
- t)
- echo m
- ;;
- w)
- echo 6
- ;;
- esac
- }
- wget -O ~/accuweather_conky_USA/raw http://www.accuweather.com/us/va/virginia-beach/23451/forecast-details.asp
- sed -i '/feed-tabs/,/\/.feed-tabs/!d' ~/accuweather_conky_USA/raw
- #file: days
- grep '#' ~/accuweather_conky_USA/raw > ~/accuweather_conky_USA/days
- sed -i 's/<\|>/\n/g' ~/accuweather_conky_USA/days
- sed -i '/Today\|Tonight\|Overnight\|Tomorrow\|Monday\|Tuesday\|Wednesday\|Thursday\|Friday\|Saturday\|Sunday/!d' ~/accuweather_conky_USA/days
- #file: messages
- grep 'cond' ~/accuweather_conky_USA/raw > ~/accuweather_conky_USA/messages
- sed -i 's/<\|>/\n/g' ~/accuweather_conky_USA/messages
- sed -i '/span class="cond"\|\/span/d' ~/accuweather_conky_USA/messages
- #file: temperatures
- grep 'temp' ~/accuweather_conky_USA/raw > ~/accuweather_conky_USA/temperatures
- sed -i 's/"temp">\|<span>&\|&\|<\/span>\ /\n/g' ~/accuweather_conky_USA/temperatures
- sed -i '/<strong class=\|deg;<\/span><\/strong><span class="low"><span>Lo\|deg;<\/span>/d' ~/accuweather_conky_USA/temperatures
- day1=$(sed -n '1p' ~/accuweather_conky_USA/days)
- if [[ $day1 == Overnight || $day1 == Tonight ]]; then
- sed -i 1i"-" ~/accuweather_conky_USA/temperatures
- fi
- #file: images
- grep 'icon' ~/accuweather_conky_USA/raw > ~/accuweather_conky_USA/images
- sed -i 's/\ i-alarm//g' ~/accuweather_conky_USA/images
- sed -i 's/\ i-\|"></\n/g' ~/accuweather_conky_USA/images
- sed -i '/<div class="icon\|\/div>/d' ~/accuweather_conky_USA/images
- for (( i=1; i<=5; i++ ))
- do
- test_number=$(sed -n "${i}p" ~/accuweather_conky_USA/images)
- test_image $test_number >> ~/accuweather_conky_USA/images
- done
- messag1=$(sed -n '1p' ~/accuweather_conky_USA/days)
- if [[ $messag1 == Tonight || $messag1 == Overnight ]]; then
- imag1=$(sed -n '1p' ~/accuweather_conky_USA/images)
- case $imag1 in
- h|ic)
- sed -i '6s/b/B/' ~/accuweather_conky_USA/images
- ;;
- mc)
- sed -i '6s/c/C/' ~/accuweather_conky_USA/images
- ;;
- mcfl|mcsn)
- sed -i '6s/o/O/' ~/accuweather_conky_USA/images
- ;;
- mcs)
- sed -i '6s/g/G/' ~/accuweather_conky_USA/images
- ;;
- mct)
- sed -i '6s/k/K/' ~/accuweather_conky_USA/images
- ;;
- esac
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement