App::APOTD

Download Today's Astronomy Picture of the Day

class Str :d(:$dir) is copy = Code.new

What directory should the image be saved to?

class Str :f(:$filename) is copy

What filename should it be saved under? [default: the caption of the image]

class Bool :p(:$prepend-count) = Bool::False

Add a count to the start of the filename.

sub mail-me

sub mail-me(
    Str $body
) returns Mu

#TODO Get this working

When using Pod::To::Markdown2 or Pod::To::HTML2, # use these instead of =head1 NAME

TITLE

Astronomy Picture of the Day

SUBTITLE

Download Today's Astronomy Picture of the Day

VERSION

This documentation refers to App::APOTD version 1.0.0

SYNOPSIS

Usage:

apotd [-d|--dir=<Str>] [-f|--filename=<Str>] [-a|--prepend-count]

  -d|--dir=<Str>         What directory should the image be saved to? [default: '$*HOME/Pictures/apotd']
  -f|--filename=<Str>    What filename should it be saved under? [default: the caption of the image]
  -a|--prepend-count     Add a count to the start of the filename. [default: False]

To downloand and save using the default behavior, simply:

$ apotd

DESCRIPTION

NASA provides a website (Astronomy Picture of the Day) which displays a different astronomy picture every day.

"Each day a different image or photograph of our fascinating universe is featured, along with a brief explanation written by a professional astronomer."

apotd will download today's image. Use it for wallpaper, screen savers, etc.

By default, apotd will save to

~/Pictures/apotd/

with the filename taken from the caption of the photo e.g.

Dark Nebulae and Star Formation in Taurus.jpg

and will optionally prepend a number which increments with each new image, e.g.

2483-Dark Nebulae and Star Formation in Taurus.jpg

Macintosh allows a comment to be associated with each file. So on Macs, apodt will copy the alt text and the permalink for the image into the file's comment. e.g.

A star field strewn with bunches of brown dust is pictured. In the center
is a bright area of light brown dust, and in the  center of that is
a bright region of star formation.

https://apod.nasa.gov/apod/ap230321.html

OPTIONS

# Save to directory "foo"
$ apotd --dir=foo
$ apotd    -d=foo

# Save with the filename "bar"
# The image's extension, e.g. ".jpg", will be automatically added.
$ apotd --file=bar
$ apotd     -f=bar

# Prepend a count to the filename
$ apotd --prepend-count
$ apotd  -p

DIAGNOSTICS

General problems

Failed to get the directory contents of directory: Failed to open dir: No such file or directory

Failed to create directory directory: Failed to mkdir: No such file or directory

Failed to resolve host name 'apod.nasa.gov'

Problems specific to apotd:

Couldn't find an image on the site. It's probably a video today.

The image has already been saved as filename.

Couldn't write the alt-text to path.

Success

Successfully wrote Pictures/apotd/ 2483-Dark Nebulae and Star Formation in Taurus.jpg

Successfully wrote the alt-text and permanent link as a comment to the file.

DEPENDENCIES

CLI::Version
LWP::Simple;
Filetype::Magic;
Digest::SHA1::Native;

ASSUMPTIONS

apotd assumes that the caption of the photo is the first <b> ... </b> line in the HTML code.

And that the image is the first <IMG SRC= html tag.

And that tag has an alt= attribute.

BUGS AND LIMITATIONS

There are no known bugs in this module.

Please report problems to Shimon Bollinger [email protected]

AUTHOR

Shimon Bollinger [email protected]

Source can be located at: https://github.com/deoac/apotd.git

Comments, suggestions, and pull requests are welcome.

COPYRIGHT AND LICENSE

Copyright 2023 Shimon Bollinger

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

App::APOTD v1.0.0

Download Today's Astronomy Picture of the Day

Authors

  • deoac

License

Artistic-2.0

Dependencies

Digest::SHA1::NativeFiletype::MagicLWP::Simple

Test Dependencies

Provides

  • App::APOTD

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.