You are not logged in.

#4241 2023-04-03 09:41:56

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,641

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

@KairiTech,

Thanks for sharing your work/ideas with us.

The problem you describe was made clear to me by Teo back in the context of the Wunderground script. It is quite simple to solve by executing the script already BEFORE the start of conky once.

TBG wrote:

As you can see, before I start conky, I execute the weather.com script once (WITHOUT an ambersand, so that it first finishes its job and then control is passed to the next command) and I now have fresh data, even on first launch.

You can do something similar with whatever window manager/deskop environment you have.

https://forums.bunsenlabs.org/viewtopic … 959#p98959

I use this for years and it works fine (also with aacuweather). wink

bash /home/teo/Weather_com_conky_script/weather_com

That's all.

Offline

#4242 2023-04-03 12:52:02

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

@KairiTech

unklar wrote:

Thanks for sharing your work/ideas with us.

I agree.

As @unklar said,first open a terminal and run the accuweather script once.

$ bash $HOME/Accuweather_conky_script/accuweather

Then just start conky.

KairiTech wrote:

...that would have the weather data available when I first log into my desktop and promptly displayed thereafter.

If you always use accuweather conky and want to update the data immediately after logging in,maybe this is interesting for you?

https://forums.bunsenlabs.org/viewtopic … 71#p125971


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4243 2023-04-03 15:48:24

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,641

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

marens wrote:

As @unklar said,first open a terminal and run the accuweather script once.

$ bash $HOME/Accuweather_conky_script/accuweather

Then just start conky.

Contradict.
@unklar did not say that!  dsfgo1o.png

You have not read the link to Teo. There it says that the script is executed once BEFORE the start of conky. And, Teo shows in addition his autostart, which clarifies this   wink
Still questions?

Last edited by unklar (2023-04-03 15:49:43)

Offline

#4244 2023-04-03 16:42:15

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

unklar wrote:

You have not read the link to Teo. There it says that the script is executed once BEFORE the start of conky. And, Teo shows in addition his autostart, which clarifies this.
Still questions?

Hahaha...
I admit,I didn't read the link,just TBG wrote from your post.
I didn't know that @Teo explained it in such detail.
Sorry.

However, it is not bad to have several solutions for the same problem.


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4245 2023-04-04 00:09:23

KairiTech
Member
Registered: 2021-02-08
Posts: 7

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

unklar wrote:

@KairiTech,

Thanks for sharing your work/ideas with us.

The problem you describe was made clear to me by Teo back in the context of the Wunderground script. It is quite simple to solve by executing the script already BEFORE the start of conky once.

TBG wrote:

As you can see, before I start conky, I execute the weather.com script once (WITHOUT an ambersand, so that it first finishes its job and then control is passed to the next command) and I now have fresh data, even on first launch.

You can do something similar with whatever window manager/deskop environment you have.

https://forums.bunsenlabs.org/viewtopic … 959#p98959

I use this for years and it works fine (also with aacuweather). wink

bash /home/teo/Weather_com_conky_script/weather_com

That's all.

Yes I do run the script before I run conky.  Thing is, it's my window manager that does it but only once.  So conky has to be configured to run it too if I want the weather to be updated periodically.

The window manager runs the script and then it starts conky and conky will run the script again.  The modification to the script prevents that from happening the first time I log into the window manager but allows conky to run the script at the next and all future scheduled times.

I want to eat my cake and have it too...LOL. I want the weather data available as soon as I log in and I want it updated periodically.  The window manager makes the weather available immediately and conky refreshes it after that.

Offline

#4246 2023-05-16 23:52:13

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

Similar error ('connatix') happened before but for my location there was no problem.

Those who have problems now:

Replace:

sed -i -e '/<\|>\|fill=\|^[ ]*$\|Further Ahead/d' $HOME/Accuweather_conky_script/daily_forecast

With:

sed -i -e '/<\|>\|fill=\|^[ ]*$\|Further Ahead/d' -e '/connatix/d' -e '/}/d' $HOME/Accuweather_conky_script/daily_forecast

Save and restart Conky or just wait next update accuweather script.


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4247 2023-06-07 13:46:03

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

Moongiant conky script  -  Illumination Angle and Visibility in Real Time

marens wrote:

I know that it is an 'impossible mission' (for us) to calculate the exact illumination angle.
Astronomy is a serious science with many variable dependencies.

Yes, but some know better than us.
We need an illumination angle and visibility in real time.
I decided to investigate it, and found site timeanddate.com.

Good News
After many days I managed to find a solution for illumination angle.
I only need two variables, from timeanddate.com.
But at the last moment I saw:

timeanddate.com wrote:

Scripts and programs that download content transparent to the user are not allowed without permission.

"Houston, we have a problem!"
What to do now?

Bad News
I contacted the timeanddate.com team and sent the part of my script relates to them, but:

timeanddate.com wrote:

Please do not run this script on our site. We have an Astronomy API available for you to access information from our databases; you can read about our APIs here:
https://dev.timeanddate.com/astro/pricing

I visited the link.
Of course, they want money - a lot of money per the year($499).
I had to thank them and wish luck in their future work and:

marens wrote:

My script will not be published anywhere.
I will try to get those two necessary data elsewhere.

Questions for discussion and @mods

  • Are curl, wget commands legal and when?

  • If it is the same as Save Page As from browser, what is the problem?

  • What is commercial use?

But, does not matter.

I never didn't give up.
And month later, I found:
https://github.com/cosinekitty/astronomy.

Nothing was clear to me, but I decided to see what was there a little better.
The best way is to look at the closed issues and I found this:
https://github.com/cosinekitty/astronomy/issues/292

I thought, this might be useful, let's give it a try.

Downloaded the astronomy ZIP file from GitHub and extract astronomy-master folder in Moongiant_conky_script.

Then, I had to make changes to the moongiant file.
*If someone uses my old changes delete this:
https://forums.bunsenlabs.org/viewtopic … 17#p126817

Add my new script before last line (#Resume weather conky):

#### Marens - Moon Illumination Angle and VisibilitY

#Example: Paris, France
#Replace to your city latitude, longitude
latitude=48.864716
longitude=2.349014

#Convert Time to Zulu (UTC)
#My current Time is CEST with daylight saving time - UTC+2
#Missing correction -2 hours to UTC
#More details: www.techtarget.com/whatis/definition/Zulu-Zulu-time
#It's important to note that these will change in regions that observe daylight saving time in the summertime.

#Correction -2 hours (without daylight saving time -1 hour)
date=$(date -d '-2 hour' '+%Y-%m-%dT%H:%M:%SZ')

#Start python script
python3 $HOME/Moongiant_conky_script/astronomy-master/demo/python/camera.py $latitude $longitude $date > $HOME/Moongiant_conky_script/illumination_angle 

#Moon Illumination Angle and Moon Visibility (Visible/Under Horizon)
rotation=$(cat $HOME/Moongiant_conky_script/illumination_angle | grep -oP '(?<=Moon = )[^ ]*' | awk -F'.' '{print $1}')
altitude=$(cat $HOME/Moongiant_conky_script/illumination_angle | grep -oP '(?<=altitude = )[^ ]*' | awk -F'.' '{print $1}')

#Illumination Angle
if [[ $rotation -ge 0 ]]; then
  illumination_angle=$(echo 90-$rotation | bc)
else
  #rotation absolute value 
  illumination_angle=$(echo ${rotation#-}-90 | bc)
fi
  
#Control
#echo $rotation
#echo $altitude
#echo $illumination_angle 

#Visibility
if [[ $altitude -ge 0 ]]; then
  echo 'Visible' > $HOME/Moongiant_conky_script/visibility
else
  echo 'Under Horizon' > $HOME/Moongiant_conky_script/visibility
fi
 
#Images 
for szFile in $HOME/Moongiant_conky_script/*.png
do 
    convert "$szFile" -background 'none' -virtual-pixel 'none' -distort SRT $illumination_angle $HOME/Moongiant_conky_script/"$(basename "$szFile")" ; 

done

#Resume weather conky
pkill -CONT -xf "$weather_conky_launch_command"

Save text editor and restart moongiant conky.

Now, we have two new files in the Moongiant_conky_script folder.
Illumination_angle with additional data and visibility - indicating when the moon is visible/under on horizon.
You can add new lines in moongiant conky (if you wish).

I only interested if the moon is Under Horizon.
From my conky:

${if_match "${texeci 600 sed -n '1p' $HOME/Moongiant_conky_script/visibility}" == "Under Horizon"}${texeci 600 sed -n '1p' $HOME/Moongiant_conky_script/visibility}${else}${endif}

moongiant.png

Now, moon in conky looks same as on my 'favorite' site timeanddate.com and in the sky.

timeanddata.png

You will be surprised to see how much the moon changes during the day depending on the position of the sun and the earth.
Now this conky isn't 'boring' (same all day).

P.S.
I don't have a GitHub account, but many thanks @cosinekitty (author of astronomy) user.
Also, many thanks timeanddate.com team for 'helping' me learn a lot about moon and his orbit around the sun and earth.


EDIT
New script version:
https://forums.bunsenlabs.org/viewtopic … 46#p128546

Last edited by marens (2023-07-22 02:42:19)


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4248 2023-06-09 13:16:27

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

Accuweather

It doesn't work again daily forecast.
Missing <div class="phrase"> section in daily_forecast.
I managed to put it at the end of the file.
Open accuweather file in Accuweather_conky_script and add after this line:

sed -i '85,$d' $HOME/Accuweather_conky_script/daily_forecast

It should look like this:

               sed -i '85,$d' $HOME/Accuweather_conky_script/daily_forecast		
	       cat $HOME/Accuweather_conky_script/daily_forecast_raw | grep '<div class="phrase">' | sed -e 's/^.*">\///' -e 's/^.*">//' -e '/^$/d' | sed -r 's/.{6}$//' >> $HOME/Accuweather_conky_script/daily_forecast
		

Restart conky.
Open daily_forecast file.
See lines 85+.
We need that.
Make a copy of your conky and then rearrange all the sections.
Example: Friday,Saturday,Sunday... are now at '1p','7p',13p' instead of '1p','8p',15p'.

Accuweather.png

It may not be elegant, but it works.
When I have time I will try to put the 85+ lines in the right place.


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4249 2023-06-09 14:02:04

weatherman
Member
Registered: 2023-01-09
Posts: 6

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

thanks for taking the time to fix the script once again smile
I made the adjustments in the accuweather script but unfortunately it does not download the images properly:

LANG=EN ./accuweather -f2015
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 33769  100 33769    0     0  81561      0 --:--:-- --:--:-- --:--:-- 81765
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 37024  100 37024    0     0  83144      0 --:--:-- --:--:-- --:--:-- 83200
cp: cannot stat '/home/username/Accuweather_conky_script/Forecast_Images_2015/0%.png': No such file or directory
cp: cannot stat '/home/username/Accuweather_conky_script/Forecast_Images_2015/Wed.png': No such file or directory
cp: cannot stat '/home/username/Accuweather_conky_script/Forecast_Images_2015/6/15.png': No such file or directory
cp: cannot stat '/home/username/Accuweather_conky_script/Forecast_Images_2015/1%.png': No such file or directory
cp: cannot stat '/home/username/Accuweather_conky_script/Forecast_Images_2015/Wed.png': No such file or directory
cp: cannot stat '/home/username/Accuweather_conky_script/Forecast_Images_2015/6/22.png': No such file or directory

any idea?

Offline

#4250 2023-06-09 17:34:38

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

@weatherman

Yes, I see.

Make daily_images folder in Accuweather_conky_script.
Make daily_images.sh in Accuweather_conky_script:

#!/bin/bash

rm $HOME/Accuweather_conky_script/daily_images/*.png

forecast_1=$(sed -n '3p' $HOME/Accuweather_conky_script/daily_forecast)
forecast_2=$(sed -n '9p' $HOME/Accuweather_conky_script/daily_forecast)
forecast_3=$(sed -n '15p' $HOME/Accuweather_conky_script/daily_forecast)
forecast_4=$(sed -n '21p' $HOME/Accuweather_conky_script/daily_forecast)
forecast_5=$(sed -n '27p' $HOME/Accuweather_conky_script/daily_forecast)
forecast_6=$(sed -n '33p' $HOME/Accuweather_conky_script/daily_forecast)
forecast_7=$(sed -n '39p' $HOME/Accuweather_conky_script/daily_forecast)
forecast_8=$(sed -n '45p' $HOME/Accuweather_conky_script/daily_forecast)

cp $HOME/Accuweather_conky_script/Forecast_Images_2015/"$forecast_1".png $HOME/Accuweather_conky_script/daily_images/forecast_1.png
cp $HOME/Accuweather_conky_script/Forecast_Images_2015/"$forecast_2".png $HOME/Accuweather_conky_script/daily_images/forecast_2.png
cp $HOME/Accuweather_conky_script/Forecast_Images_2015/"$forecast_3".png $HOME/Accuweather_conky_script/daily_images/forecast_3.png
cp $HOME/Accuweather_conky_script/Forecast_Images_2015/"$forecast_4".png $HOME/Accuweather_conky_script/daily_images/forecast_4.png
cp $HOME/Accuweather_conky_script/Forecast_Images_2015/"$forecast_5".png $HOME/Accuweather_conky_script/daily_images/forecast_5.png
cp $HOME/Accuweather_conky_script/Forecast_Images_2015/"$forecast_6".png $HOME/Accuweather_conky_script/daily_images/forecast_6.png
cp $HOME/Accuweather_conky_script/Forecast_Images_2015/"$forecast_7".png $HOME/Accuweather_conky_script/daily_images/forecast_7.png
cp $HOME/Accuweather_conky_script/Forecast_Images_2015/"$forecast_8".png $HOME/Accuweather_conky_script/daily_images/forecast_8.png

Make script executable.
Test from terminal:

bash $HOME/Accuweather_conky_script/daily_images.sh

The first time an error will appear (rm command will not find anything).
Just run terminal again.
Now check new daily_images folder in Accuweather_conky_script.
If OK, add in conky first line:

${texeci 500 bash $HOME/Accuweather_conky_script/daily_images.sh}

Now images forecast_1.png,forecast_2.png... will be in daily_images folder.


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4251 2023-06-09 18:09:02

weatherman
Member
Registered: 2023-01-09
Posts: 6

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

Thank you! Works fine now smile

Offline

#4252 2023-06-10 07:34:26

il.harun
Member
Registered: 2020-06-04
Posts: 54

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

@marens
See Block Daily Forecast.gz

Offline

#4253 2023-06-10 11:47:03

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

il.harun wrote:

@marens
See Block Daily Forecast.gz

Many thanks.
Your solutions are always elegant and you try to keep the script in its original state.

From @il.harun script:

Find line:

sed -i '85,$d' $HOME/Accuweather_conky_script/daily_forecast

Replace the entire #Daily forecast section above.
It should look like this:

#Daily forecast
	if [[ -s $HOME/Accuweather_conky_script/daily_forecast_raw ]]; then

		sed '/<div class="daily-wrapper" data-qa="dailyCard0">/,/Further Ahead/!d' $HOME/Accuweather_conky_script/daily_forecast_raw > $HOME/Accuweather_conky_script/daily_forecast
# удаляем блок  WinterCast
		sed -i '/<div class="daily-wintercast-cta">/,/div class="daily-wrapper"/d' $HOME/Accuweather_conky_script/daily_forecast

# удалить строки между  collapseConnatix   и   connatix" class (delete alert)
	sed -i '/collapseConnatix/,/connatix" class/d' $HOME/Accuweather_conky_script/daily_forecast
	sed -i '/script>/d' $HOME/Accuweather_conky_script/daily_forecast

# удалить строки между  alert-banners   и  alert-description  (delete alert)
	sed -i '/alert-banners/,/alert-description/d' $HOME/Accuweather_conky_script/daily_forecast

		sed -i -e 's/\.svg.*$//g' -e 's/&#xB0;<\/span>//g' -e 's/<\/span>//g' $HOME/Accuweather_conky_script/daily_forecast
# сохранить состояние погоды в файле daily_phrase 
		sed '/class="phrase/!d' $HOME/Accuweather_conky_script/daily_forecast > $HOME/Accuweather_conky_script/daily_phrase
		sed -i -e 's/<\/div>//g' -e 's/.*>//g' $HOME/Accuweather_conky_script/daily_phrase

		sed -i -e 's/^.*">\///' -e 's/^.*">//' -e 's/.*weathericons\///g' -e 's/^[\t]*//g' -e '/^$/d' $HOME/Accuweather_conky_script/daily_forecast

		sed -i -e '/<\|>\|fill=\|^[ ]*$\|Further Ahead/d' $HOME/Accuweather_conky_script/daily_forecast

#### вставка строк из файла phrase  в файл daily_phrase ####
			j=6
	   for (( i=1; i<=20; i+=1 ))
	 	do

	phrase=$(sed -n ${i}p $HOME/Accuweather_conky_script/daily_phrase)

	sed -i "${j}s/^/$phrase\n/" $HOME/Accuweather_conky_script/daily_forecast

			((j+=7))

		  done


		sed -i '85,$d' $HOME/Accuweather_conky_script/daily_forecast

March 2022:

il.harun wrote:

github gitlab - i do not plan.

It is not necessary.
Please,post here once your basic accuweather script if you wish.
Afterwards, only you can edit it.
Just tell us when you make changes.
It would mean a lot to anyone who likes accuweather script.

Last edited by marens (2023-06-10 12:00:54)


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4254 2023-06-10 12:55:42

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

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

1. Are curl, wget commands legal and when?

They are programs and yes they are legal.  It isn't a question of their legality or not so much as how and where you are using them.  If you have a site that is allowing you to freely download programs or  data; no problem.  The second there is a ©, ® , ™ and some kind of licensing agreements, or similar restrictions added because of those then it becomes a legal issue.

2. If it is the same as Save Page As from browser, what is the problem?

Basically the same as above.

3. What is commercial use?

If you charge for your services or information it is commercial use.

Answering as a person not a mod or admin.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#4255 2023-06-10 13:49:08

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

Sector11 wrote:

The second there is a ©, ® , ™ and some kind of licensing agreements, or similar restrictions added because of those then it becomes a legal issue.

I respect the work of developers and their desire to protect it.
That's why I didn't public post, but i still used my script until I found a solution in a different way.

Fortunately, there are people who selflessly share their knowledge.
The Linux world is the best example.


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4256 2023-06-10 14:39:06

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

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

agreed.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#4257 2023-06-10 15:34:29

il.harun
Member
Registered: 2020-06-04
Posts: 54

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

@marens
You maintain the accuweather script, I sometimes help you a little.

Offline

#4258 2023-06-10 16:46:02

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

il.harun wrote:

@marens
You maintain the accuweather script, I sometimes help you a little.

Little?
You saved my time today.
I was planning to put the 'phrase' class where it should be in the daily_forecat file, but that wouldn't be as elegant as you're doing.
I would still use the cut command.
That's exactly 12 times.
Honestly, I don't understand why the accuweather developers are now giving a detailed forecast description for 45 days?
It is not even certain whether it will be correct for tomorrow.
However, they are trying to provide users with the best possible experience and we have to respect that.


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4259 2023-06-12 11:08:26

seatommyboy
Member
Registered: 2016-09-12
Posts: 63

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

I updated github if anyone is interested
commit e14237a

Offline

#4260 2023-06-13 18:36:12

morfik
Member
From: Europe/Poland
Registered: 2016-09-08
Posts: 169
Website

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

seatommyboy wrote:

I updated github if anyone is interested
commit e14237a


It looks like that the current conditions and the hourly scripts need fixing.

Offline

Board footer

Powered by FluxBB