NASA APOD

So you have written that new, must have program. Let us see it here.
User avatar
cogier
Site Admin
Posts: 1125
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

NASA APOD

Post by cogier »

NASA APOD (Astronomy Picture Of the Day)

IMPORTANT: - If you want to try this program you will need to get a NASA API key. It's VERY easy and free and will be issued on line. The program will guide you.

NASA has some fantastic photos and videos which have been put online daily since 1995. This program creates an easy way to locate, access and store these images.

As usual please let me know how you get on and if there are any issues.

Image
NASA_APOD.tar.gz
(1.53 MiB) Downloaded 438 times
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: NASA APOD

Post by stevedee »

cogier wrote: Sunday 15th December 2019 2:55pm ...As usual please let me know how you get on and if there are any issues...
Hi Cogier, I just had 10mins over breakfast to download and start looking at this project.

When I "Click here to get your key" it returns:-

Code: Select all

/home/steve/https://api.nasa.gov/#signUp
I couldn't quickly see why this was appending my home path to the URL.

I hope to find some time to look at this again next week (in 2020).

Happy New Year to one and all!
User avatar
cogier
Site Admin
Posts: 1125
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: NASA APOD

Post by cogier »

Hi Steve,

Thanks for testing the program. I am at a loss as to why you are getting this problem as the code couldn't be much simpler.

Image

AND a Happy New Year to you all!
User avatar
Got2BeFree
Posts: 91
Joined: Saturday 26th November 2016 2:52am
Location: Lost

Re: NASA APOD

Post by Got2BeFree »

I had no issues when clicking the "get your key" button.

One issue I did run into though is the cache. Because I run a small /Home partition, most everything goes to a large "storage" partition and I then create links in /Home to those. When I seen where the cache was building up, I deleted the /NASA_APOD folder. When clicking the cache button again, an explosion occurred and my monitor melted into a pile of goo. :lol:

A nice fix would be to check for that /NASA_APOD folder and recreate again if needed. Another nice fix would be to give the user an option to change the location where that folder calls home since downloading HD images could chew up a lot of disk space quickly.

Something I felt was odd, is using a single click to view the image full screen. A double click would be much better and not prone to erroneous clicks inside the image viewing area.

Other than those two things, I think your app is great and I plan on using it to build up my wallpaper collection. :D
sholzy

I'm wondering around lost in the past, not knowing where the present is.
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: NASA APOD

Post by stevedee »

cogier wrote: Sunday 29th December 2019 11:39am ... I am at a loss as to why you are getting this problem as the code couldn't be much simpler...
I've just worked out that my problem is with the URLLabel, a control I'd never looked at or even noticed before.

I think there is a Linux command/dependancy that is missing from PeppermintOS, so when this control is clicked, I just get my home path appended to the web link.

I managed to hack the code by using the MouseDown event on a regular Label control:-
Public Sub getKeyLabel_MouseDown()

  FMain.OpenFilePatched("https: //api.nasa.gov/#signUp")

End
{note: the gap bewteen ":" & "//" is just to stop the forum from creating HTML code}

...and adding this Subroutine:-
Public Sub OpenFilePatched(path As String) 
  
  Shell "xdg-open " & path
  
End
As my Linux distribution has the command "xdg-open" it now works fine.


Many thanks to my son Matt for his valuable help with this issue.
User avatar
cogier
Site Admin
Posts: 1125
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: NASA APOD

Post by cogier »

Sholzy
One issue I did run into though is the cache. Because I run a small /Home partition, most everything goes to a large "storage" partition and I then create links in /Home to those. When I seen where the cache was building up, I deleted the /NASA_APOD folder. When clicking the cache button again, an explosion occurred and my monitor melted into a pile of goo. :lol:
OK sorry about that. :o I have removed the explosives and the monitor melting fluid and the program will now not crash if you delete the folder.
A nice fix would be to check for that /NASA_APOD folder and recreate again if needed.
Fixed in this version.
Another nice fix would be to give the user an option to change the location where that folder calls home since downloading HD images could chew up a lot of disk space quickly.
This looks like quite a bit of work and I have not found a way to access other Partitions/Drives from within Gambas. (Not fixed)
Something I felt was odd, is using a single click to view the image full screen. A double click would be much better and not prone to erroneous clicks inside the image viewing area.
I like the single click but you are right to bring this up so I have added an option in the attached version.


Steve
I think there is a Linux command/dependency that is missing from PeppermintOS
I can't fix that one, it's just too much I can't cope any more!.... :arrow:
Public Sub getKeyLabel_MouseDown()
 
  FMain.OpenFilePatched("https: //api.nasa.gov/#signUp")
 
End
{note: the gap between ":" & "//" is just to stop the forum from creating HTML code}
Use the 'Do not automatically parse URLs' check box and all will be OK
Public Sub getKeyLabel_MouseDown()
 
  FMain.OpenFilePatched("https://api.nasa.gov/#signUp")
 
End
As my Linux distribution has the command "xdg-open" it now works fine.
I use the Gambas Desktop.Open() command, saves having to shell commands.

Well done Matt and thank you all for the input! :D
NASA_APOD.tar.gz
(793.29 KiB) Downloaded 402 times
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: NASA APOD

Post by stevedee »

stevedee wrote: Sunday 29th December 2019 8:46am ...I hope to find some time to look at this again next week (in 2020)...
Great program cogier! I "lost" a big chunk of my morning just clicking from one image to another.

My only additional problems/comments:-

I think you should be able to load the program and view the Help before you get the api screen (this relates to my previous problem).

When I copy/paste the api key, the text changes to: <meta http-equiv="content-type" content="text/html; charset=utf-8"><code class="signup-key">eR5Pdmbrc6f8PcuyEyRzrxUoxnz66eKDgIVjeyjC</code>
...maybe I was doing something wrong, but it wasn't obvious.

When I clicked on image/video 22v (2019 Dec) the program crashed. So I think you need to add more error handlers, especially for DisplayPicture, and probably a few others including CreateFolder, GetData, videos & so on.

I got some clipped text:-
cogierNASAtext.png
cogierNASAtext.png (88.05 KiB) Viewed 10413 times
In Detailed Help you have a typo "...bottom o0f the form..."

Note: All testing done in the IDE using the 1st zipped file.

I hope this helps.
User avatar
cogier
Site Admin
Posts: 1125
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: NASA APOD

Post by cogier »

Hi Steve,

Thanks for pointing out these issues. I have loaded up Xubuntu on my laptop and all these issues are showing up. I'm on it :geek:

You missed another error, it's in your photo. Both the buttons have a shortcut key of "C". Opps! :o
User avatar
cogier
Site Admin
Posts: 1125
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: NASA APOD

Post by cogier »

I think you should be able to load the program and view the Help before you get the api screen (this relates to my previous problem).
I had thought about that and decided against it, I have now added a 'Help' button to the 'api' Form that takes you straight to the correct 'Help' tab.
When I copy/paste the api key, the text changes to: <meta http-equiv="content-type" content="text/html; charset=utf-8"><code class="signup-key">eR5Pdmbrc6f8PcuyEyRzrxUoxnz66eKDgIVjeyjC</code>
...maybe I was doing something wrong, but it wasn't obvious.
I have just tried this on an Xubuntu installation and I got the same problem. Fixed. Changed Clipboard.Paste() to Clipboard.Paste("text/plain").
When I clicked on image/video 22v (2019 Dec) the program crashed.
Sloppy programming on my part. I was relying in the video being on YouTube and this one wasn't! I am using the correct data now.
I got some clipped text:-
Fixed. Added 'Picture' to the buttons and changed the shortcut keys.
In Detailed Help you have a typo "...bottom o0f the form..."
Fixed.

Update attached

Thanks again for this.
NASA_APOD.tar.gz
(1.53 MiB) Downloaded 443 times
User avatar
Got2BeFree
Posts: 91
Joined: Saturday 26th November 2016 2:52am
Location: Lost

Re: NASA APOD

Post by Got2BeFree »

They say a picture is worth a thousand words...
Here's three-thousand words... :lol:
apod_basics.png
apod_basics.png (671.24 KiB) Viewed 10396 times
apod_more.png
apod_more.png (657.09 KiB) Viewed 10396 times
apod_license.png
apod_license.png (586.72 KiB) Viewed 10396 times
Let's see if you can find the fourth problem common with all three images. Here's a hint... It's not what's written. Here's another hint... They say size matters. ;)

The screen shots are full screen, not cut off.
sholzy

I'm wondering around lost in the past, not knowing where the present is.
Post Reply