Himawaripy是一个Python3脚本,它获取Himawari8拍摄的地球的近实时(延迟10分钟)照片(__8号),并将其设置为桌面背景。
himawarip的Python项目详细描述
希马瓦里皮
将地球的近实时图片作为桌面背景
himawaripy是一个python 3脚本,它几乎可以实时获取(延迟10分钟) 地球照片 Himawari 8 (ひまわり8号)并设置它 作为你的桌面背景。
设置每10分钟运行一次的cronjob(或systemd服务)以自动获取 地球的近实时图像。
支持的桌面环境
测试
- 统一7
- 配合1.8.1
- 万神殿
- lxde
- 操作系统X
- GNOME 3
- 肉桂2.8.8
- kde
不支持
- 上面没有提到的任何其他桌面环境。
配置
usage: [-h] [--version] [--auto-offset | -o OFFSET] [-l {4,8,16,20}]
[-d DEADLINE] [--save-battery] [--output-dir OUTPUT_DIR]
set (near-realtime) picture of Earth as your desktop background
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--auto-offset determine offset automatically
-o OFFSET, --offset OFFSET
UTC time offset in hours, must be less than or equal
to +10
-l {4,8,16,20}, --level {4,8,16,20}
increases the quality (and the size) of each tile.
possible values are 4, 8, 16, 20
-d DEADLINE, --deadline DEADLINE
deadline in minutes to download all the tiles, set 0
to cancel
--save-battery stop updating on battery
--output-dir OUTPUT_DIR
directory to save the temporary background image
大多数情况下,如果你通过标志--auto-offset
,himawaripy可以准确地检测到你的时区,尽管你可以
也可以通过-o
(或--offset
)标志手动设置。如果您的时区超过GMT超过10小时,请使用最近的
一个(或者+10
或者-12
)。
提高级别将提高图像的质量以及下载所有平铺和 内存消耗。例如,选择20将使himawaripy在其峰值使用~700 mib的内存,而图像将 大约200 MB。
您应该设置一个与cronjob(或timer)设置兼容的截止日期,以确保脚本在x中终止 再启动几分钟。
您可以使用--save-battery
在使用电池供电时禁用刷新。
氮
如果您使用氮气设置壁纸,您必须在
~/.config/nitrogen/bg-saved.cfg
。
[:0.0]
file=/home/USERNAME/.himawari/himawari-latest.png
mode=4
bgcolor=#000000
安装
- 您需要有效的python3安装,包括python3 setuptools包
cd ~
git clone https://github.com/boramalper/himawaripy.git
# install
sudo python3 setup.py install
# test whether it's working
himawaripy --auto-offset
# Get the installation path of himawaripy by running the command
which -- himawaripy
# Set himawaripy to be called periodically
## Either set up a cronjob
crontab -e
### Add the line:
*/10 * * * * <INSTALLATION_PATH> # command line arguments here
## OR, alternatively use the provided systemd timer
### Configure
vi systemd/himawaripy.service
# Replace "<INSTALLATION_PATH>" with the output of the aforementioned command and command line arguments
### Copy systemd configuration
cp systemd/himawaripy.{service,timer} ~/.config/systemd/user/
### Enable and start the timer
systemctl --user enable --now himawaripy.timer
对于kde用户
kde 5.7+
要在kde 5.7+中更改墙纸,必须解锁桌面小部件。如果你不想让他们开锁, 仍然可以使用kde 5.7之前的方法。
解锁桌面小部件(from the KDE userbase):
Open the Desktop Toolbox or the Panel Toolbox or right click on the Desktop - if you see an item labeled Unlock Widgets then select that, and then proceed to add widgets to your Desktop or your Panel.
在kde 5.7之前
So the issue here is that KDE does not support changing the desktop wallpaper
from the commandline, but it does support polling a directory for file changes
through the "Slideshow" desktop background option, whereby you can point KDE
to a folder and have it load a new picture at a certain interval.
The idea here is to:
- Set the cron for some interval (say 9 minutes)
- Open Desktop Settings -> Wallpaper -> Wallpaper Type -> Slideshow
- Add the
~/.himawari
dir to the slideshow list - Set the interval check to 10 minutes (one minute after the cron, also
depending on your download speed)
So the issue here is that KDE does not support changing the desktop wallpaper from the commandline, but it does support polling a directory for file changes through the "Slideshow" desktop background option, whereby you can point KDE to a folder and have it load a new picture at a certain interval.
The idea here is to:
- Set the cron for some interval (say 9 minutes)
- Open Desktop Settings -> Wallpaper -> Wallpaper Type -> Slideshow
- Add the
~/.himawari
dir to the slideshow list - Set the interval check to 10 minutes (one minute after the cron, also depending on your download speed)
非常感谢xenithorbfor the solution!
对于Mac OSX用户
osx已经弃用crontab,并将其替换为launchd
。要设置启动代理,请复制提供的示例plist
在osx/org.boramalper.himawaripy.plist
到~/Library/LaunchAgents
中归档,并根据需要编辑以下条目
mkdir -p ~/Library/LaunchAgents/
cp osx/org.boramalper.himawaripy.plist ~/Library/LaunchAgents/
ProgrammingArguments
需要成为himawaripy安装的路径。这个应该是/usr/local/bin/himawaripy
默认情况下,但Himawaripy可能安装在其他地方。StartInterval
控制连续运行之间的间隔,默认设置为10分钟(600秒)。 根据需要编辑。
最后,要启动它,请将其输入控制台:
launchctl load ~/Library/LaunchAgents/org.boramalper.himawaripy.plist
卸载
# Remove the cronjob
crontab -e
# Remove the line
*/10 * * * * <INSTALLATION_PATH>
# OR if you used the systemd timer
systemctl --user disable --now himawaripy.timer
rm $HOME/.config/systemd/user/himawaripy.{timer,service}
# Uninstall the binary
sudo rm -f <INSTALLATION_PATH>
# Uninstall the package
sudo pip3 uninstall himawaripy
<INSTALLATION_PATH>
可以使用命令which -- himawaripy
找到。
如果您想分享原因,可以通过github或 send an e-mail。
属性
感谢MichaelPote使用initial implementation powershell脚本。
感谢图像处理逻辑的Charlie Loyd (hi8-fetch.py)。
很明显,感谢日本气象厅打开这些照片 对公众。