-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
abaed35
commit 0d8587f
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,51 @@ | ||
# APOD with python | ||
|
||
![](.readme/apod_2022627.jpeg) | ||
|
||
*Image by [Wang Jin]([email protected])* | ||
|
||
![Tests](https://github.com/Juanki0396/APOD_wallpaper/actions/workflows/tests.yml/badge.svg) | ||
![LICENSE](https://img.shields.io/github/license/juanki0396/APOD_wallpaper?) | ||
![commit](https://img.shields.io/github/last-commit/juanki0396/APOD_wallpaper) | ||
|
||
Do you love APOD images? This repo give you an easy interface to obtain this images from the source with python. Also, if you run an Ubuntu OS with Gnome 3, a python script can be used to automatically change your wallpaper to your favourite apod. | ||
|
||
---- | ||
|
||
Obtain the APOD with python using a simple script. | ||
## Instalation | ||
|
||
The package is already public in PyPi. You can easily install with pip: | ||
|
||
python3 -m pip install apod | ||
|
||
--- | ||
|
||
## APOD package | ||
|
||
The apod package is based in two objects: ApodExplorer and ApodImageDownloader. The ApodExplorer make requests for apod server and obtain the image url. | ||
|
||
import apod | ||
|
||
explorer = apod.ApodExplorer() | ||
http_status = explorer.make_http_request(year=2022, month=6, day=27) | ||
image_url = explorer.check_for_images() | ||
|
||
The other object is responsible to download the image and save it: | ||
|
||
downloader = apod.ApodImageDownloader(image_url) | ||
# Obtain PIL image | ||
image = downloader.get_image() | ||
# Download and save | ||
downloader.save_image(path=<DIRPATH>, name=<FILENAME>) | ||
|
||
--- | ||
|
||
## Wallpaper script | ||
|
||
If you want to use the automatic apod wallpaper script you must [install the apod package](#apod-package) and clone the repo: | ||
|
||
git clone https://github.com/Juanki0396/APOD_wallpaper.git | ||
|
||
The script is very easy to use. The ussual operation will be: | ||
|
||
python3 apod_wallpaper.py --date <YEAR> <MONTH> <DAY> --dirpath <DOWNLOAD DIR> |