SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#476 2012-11-22 22:08:45

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

If I understand correctly....:
FILE: test

Paikallissää Turku</h1>
 </span>
 <td colspan="1" class="first-day odd-day">
to</span>
<td colspan="6" class="even-day">
pe</span>
<td colspan="4" class="odd-day">
la</span>
<td colspan="2" class="even-day">
su</span>
<td colspan="2" class="odd-day">
ma</span>
<td colspan="2" class="even-day">
ti</span>
<td colspan="1" class="last-day odd-day">
ke</span>
23</span> <-- from here onwards it's times! (second line n the web page) 
02</span>
05</span>
08</span>
11</span>
14</span>
20</span>
02</span>
08</span>

FILE: script

#!/bin/bash
sed -i -e 's/^.*colspan=\"//g' -e 's/\" class=.*$//g' test
extra=0
for i in $(grep -n ^[1-9]$ test)
do
    x=$(echo $i|sed 's/:.*//')
    y=$(echo $i|sed 's/.*://')
    pos=$(( x+extra ))
    for (( j=0; j<y-1; j++ ))
    do
        sed -i "${pos}s/^${y}/${y}\n/" test
    done
    extra=$(( extra+y-1 ))
done

After running the script, the test file becomes thus:

Paikallissää Turku</h1>
 </span>
1
to</span>
6





pe</span>
4



la</span>
2

su</span>
2

ma</span>
2

ti</span>
1
ke</span>
23</span> <-- from here onwards it's times! (second line n the web page) 
02</span>
05</span>
08</span>
11</span>
14</span>
20</span>
02</span>
08</span>

It removes all redundant text in the colspan lines, leaving only the numbers, and then adds number-1 end lines after each one of them.
I hope that it is what you wanted...
(the extra variable exists to account for grep's non recursive behaviour)

EDIT: This could be a one liner. Please humiliate me mercilessly.

Last edited by TeoBigusGeekus (2012-11-22 23:47:39)


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

Be excellent to each other!

#477 2012-11-22 22:22:13

ohnonot
...again
Registered: 2012-05-22
Posts: 2,205

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

thanks a lot, the master himself!
ops

this is close, but the empty lines have to come after the weekday (e.g. to</span>), so if it says colspan=2 before the weekday, it should have 1 empty line after the weekday. (2 columns altogether)

i will start working on it immediately, maybe i can come up with sth...

Offline

#478 2012-11-22 22:44:42

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

This then?

#!/bin/bash
sed -i -e 's/^.*colspan=\"//g' -e 's/\" class=.*$//g' test
extra=0
for i in $(grep -n ^[1-9]$ test)
do
    x=$(echo $i|sed 's/:.*//')
    y=$(echo $i|sed 's/.*://')
    pos=$(( x+extra+2 ))
    echo $x $y $pos
    for (( j=0; j<y-1; j++ ))
    do
        sed -i "${pos}s/$/\n/" test
    done
    extra=$(( extra+y-1 ))
done

Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#479 2012-11-22 23:03:41

ohnonot
...again
Registered: 2012-05-22
Posts: 2,205

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

bingo!
i added one more line to remove all lines that have only 1 digit in it (which isn't needed anymore) andnow the logic is right:

#!/bin/bash
sed -i -e 's/^.*colspan=\"//g' -e 's/\" class=.*$//g' test
extra=0
for i in $(grep -n ^[1-9]$ test)
do
    x=$(echo $i|sed 's/:.*//')
    y=$(echo $i|sed 's/.*://')
    pos=$(( x+extra+1 ))
    echo $x $y $pos
    for (( j=0; j<y-1; j++ ))
    do
        sed -i "${pos}s/$/\n/" test
    done
    extra=$(( extra+y-1 ))
done
sed -i -e '/^[1-9]$/d' test

thank you and good night!

Last edited by ohnonot (2012-11-23 20:44:21)

Offline

#480 2012-11-22 23:06:30

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

You're welcome mate; goodnight!


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#481 2012-11-23 01:16:55

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Always a pleasure to see you in action Teo ...

problem ...
--- click
fixed....

That's gotta be good!

Offline

#482 2012-11-23 08:17:50

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Oh hi there Sector11, long time no see!!!
Nice to hear from you...


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#483 2012-11-23 14:50:59

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Yea, too long ... I'm doing this and that and then "life" ... Every time I look at you directories (here) I keep saying, I gotta make a few more.

Before the end of the year.  big_smile

Last edited by Sector11 (2012-11-23 14:55:56)

Offline

#484 2012-11-23 15:07:22

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Take your time mate...


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#485 2012-11-23 20:44:00

ohnonot
...again
Registered: 2012-05-22
Posts: 2,205

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Offline

#486 2012-11-23 20:49:34

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

The crunchbang forums are going to collect all the conky weather scripts out there...  cool

Last edited by TeoBigusGeekus (2012-11-23 20:49:48)


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#487 2012-11-24 09:15:49

ohnonot
...again
Registered: 2012-05-22
Posts: 2,205

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

hey TBG and all others!
i wanted to draw your attention to one more thing - in your scripts you are always using

kill -STOP $(pidof conky)

but when i have several conkies running that stops all of them so i replaced it with

pkill -STOP -f '.config/conky/itl/conky-itl' 

(the last bit is the weather conky config, which i'm autostarting with "conky -c /home/<yourusername>/.config...... i can't get placeholders or $HOME or ~ to work here. but supposing other people store their conkies in the same way, this is perfectly portable)
(and of course the same with -CONT in the end)

unless there's something else i've missed...

Offline

#488 2012-11-24 11:23:23

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

You can remove this bit if you want to.
It is added as a means to give the script some time to collect the necessary info before conky updates; it is quite important for the more complicated/info rich scripts (especially the weather.com one), but it's not that essential for the lighter ones.


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#489 2012-11-24 12:49:04

ohnonot
...again
Registered: 2012-05-22
Posts: 2,205

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

^it can get in the way when the internet connection is slow.
wget has a default timeout of 900s...

Offline

#490 2012-11-27 02:56:25

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

#address="http://www.weather.com/weather/5-day/Buenos+Aires+Argentina+ARBA0009"
address="http://www.weather.com/weather/5-day/Buenos+Aires+ARBA0009:1:AR"

Offline

#491 2012-11-27 12:19:24

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

address10="http://www.b.weather.com/weather/tenday/Buenos+Aires+ARBA0009:1:AR"

Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#492 2012-11-27 15:59:07

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

address10="http://www.b.weather.com/weather/tenday/Buenos+Aires+ARBA0009:1:AR"

Last edited by Sector11 (2012-11-27 15:59:40)

Offline

#493 2012-11-27 17:10:25

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

killall conky && conky -c /home/sector11/Conky_WeatherCom_metric/conkyrc_weather_com_metric &

Offline

#494 2012-11-27 20:34:36

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Yeap, it's the transition to the tonight only forecast. After a certain time, weather.com doesn't provide info for today, only for tonight.
If you run the script again, you'll see that only the tonight's forecast is filled with info.
You must have run it at exactly the time when the page was about to change...


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#495 2012-11-27 20:55:00

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

cp: omitting directory ‘/home/sector11/Conky_WeatherCom_metric/weather_com_images/’
cp: omitting directory ‘/home/sector11/Conky_WeatherCom_metric/weather_com_images/’
Conky: Unable to load image '/home/sector11/Conky_WeatherCom_metric/TD.png'
Conky: Unable to load image '/home/sector11/Conky_WeatherCom_metric/TD.png'
Conky: Unable to load image '/home/sector11/Conky_WeatherCom_metric/TD.png'
Conky: Unable to load image '/home/sector11/Conky_WeatherCom_metric/TD.png'

Last edited by Sector11 (2012-11-27 20:55:39)

Offline

#496 2012-11-27 21:02:09

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#497 2012-11-28 13:22:18

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

wget: no process found

Last edited by Sector11 (2012-11-28 13:23:55)

Offline

#498 2012-11-28 14:01:00

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#499 2012-11-28 15:04:47

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Offline

Be excellent to each other!

#500 2012-11-28 18:03:50

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Do you have the cookie?
Are you using the correct conkyrc? (not the one intended for the C version)
Can you post your whole script and your whole conkyrc?

EDIT: The wget message is nothing.

Last edited by TeoBigusGeekus (2012-11-28 18:04:15)


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: bleh

Debian Logo