mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
feat: astrological info script
This commit is contained in:
@@ -157,6 +157,7 @@ in {
|
|||||||
scripts.wttr
|
scripts.wttr
|
||||||
scripts.sanskrit-dictionary
|
scripts.sanskrit-dictionary
|
||||||
scripts.unicodmenu
|
scripts.unicodmenu
|
||||||
|
scripts.horoscope
|
||||||
scripts.closest
|
scripts.closest
|
||||||
scripts.trans
|
scripts.trans
|
||||||
scripts.liddel-scott-jones
|
scripts.liddel-scott-jones
|
||||||
|
|||||||
@@ -92,6 +92,11 @@ in {
|
|||||||
units = "metric";
|
units = "metric";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
block = "custom";
|
||||||
|
interval = 60 * 60;
|
||||||
|
command = let inherit (import <niveum/configs/spacetime.nix>) location; in "${pkgs.scripts.horoscope}/bin/horoscope --latitude=${toString location.latitude} --longitude=${toString location.longitude}";
|
||||||
|
}
|
||||||
{
|
{
|
||||||
block = "custom";
|
block = "custom";
|
||||||
interval = 60 * 60;
|
interval = 60 * 60;
|
||||||
|
|||||||
@@ -184,6 +184,8 @@ in rec {
|
|||||||
}} "$@"
|
}} "$@"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
horoscope = pkgs.callPackage ./horoscope {};
|
||||||
|
|
||||||
genius = wrapScript {
|
genius = wrapScript {
|
||||||
packages = [ pkgs.curl pkgs.gnused pkgs.pandoc ];
|
packages = [ pkgs.curl pkgs.gnused pkgs.pandoc ];
|
||||||
name = "genius";
|
name = "genius";
|
||||||
|
|||||||
4
packages/scripts/horoscope/default.nix
Normal file
4
packages/scripts/horoscope/default.nix
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{ poetry2nix }:
|
||||||
|
poetry2nix.mkPoetryApplication {
|
||||||
|
projectDir = ./.;
|
||||||
|
}
|
||||||
54
packages/scripts/horoscope/horoscope.py
Normal file
54
packages/scripts/horoscope/horoscope.py
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
from datetime import datetime
|
||||||
|
import click
|
||||||
|
from flatlib.datetime import Datetime
|
||||||
|
from flatlib.geopos import GeoPos
|
||||||
|
from flatlib.chart import Chart
|
||||||
|
import flatlib.const
|
||||||
|
|
||||||
|
sign_symbols = {
|
||||||
|
flatlib.const.ARIES: "♈",
|
||||||
|
flatlib.const.TAURUS: "♉",
|
||||||
|
flatlib.const.GEMINI: "♊",
|
||||||
|
flatlib.const.CANCER: "♋",
|
||||||
|
flatlib.const.LEO: "♌",
|
||||||
|
flatlib.const.VIRGO: "♍",
|
||||||
|
flatlib.const.LIBRA: "♎",
|
||||||
|
flatlib.const.SCORPIO: "♏",
|
||||||
|
flatlib.const.SAGITTARIUS: "♐",
|
||||||
|
flatlib.const.CAPRICORN: "♑",
|
||||||
|
flatlib.const.AQUARIUS: "♒",
|
||||||
|
flatlib.const.PISCES: "♓",
|
||||||
|
}
|
||||||
|
|
||||||
|
planet_symbols = {
|
||||||
|
flatlib.const.SUN: "☉",
|
||||||
|
flatlib.const.MOON: "☽",
|
||||||
|
flatlib.const.MERCURY: "☿",
|
||||||
|
flatlib.const.VENUS: "♀",
|
||||||
|
flatlib.const.MARS: "♂",
|
||||||
|
flatlib.const.JUPITER: "♃",
|
||||||
|
flatlib.const.SATURN: "♄",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def convert_into_stupid_flatlib_format(dt):
|
||||||
|
return Datetime(dt.strftime("%Y/%m/%d"), dt.strftime("%H:%M"))
|
||||||
|
|
||||||
|
|
||||||
|
@click.command()
|
||||||
|
@click.option("--latitude", type=click.FLOAT, required=True)
|
||||||
|
@click.option("--longitude", type=click.FLOAT, required=True)
|
||||||
|
@click.option("--date", type=click.DateTime(), default=datetime.now())
|
||||||
|
def main(latitude: float, longitude: float, date: datetime):
|
||||||
|
flatlib_datetime = convert_into_stupid_flatlib_format(date)
|
||||||
|
position = GeoPos(latitude, longitude)
|
||||||
|
chart = Chart(flatlib_datetime, position)
|
||||||
|
for planet in planet_symbols.keys():
|
||||||
|
planet_position = chart.getObject(planet)
|
||||||
|
print(
|
||||||
|
planet_symbols[planet],
|
||||||
|
sign_symbols[planet_position.sign],
|
||||||
|
"℞" if planet_position.movement() == flatlib.const.RETROGRADE else "",
|
||||||
|
end="",
|
||||||
|
)
|
||||||
|
print()
|
||||||
59
packages/scripts/horoscope/poetry.lock
generated
Normal file
59
packages/scripts/horoscope/poetry.lock
generated
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
[[package]]
|
||||||
|
name = "click"
|
||||||
|
version = "8.0.3"
|
||||||
|
description = "Composable command line interface toolkit"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.6"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
colorama = {version = "*", markers = "platform_system == \"Windows\""}
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorama"
|
||||||
|
version = "0.4.4"
|
||||||
|
description = "Cross-platform colored terminal text."
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "flatlib"
|
||||||
|
version = "0.2.3"
|
||||||
|
description = "Python library for Traditional Astrology"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
pyswisseph = "2.08.00-1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pyswisseph"
|
||||||
|
version = "2.08.00-1"
|
||||||
|
description = "Python extension to the Swiss Ephemeris"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
|
||||||
|
[metadata]
|
||||||
|
lock-version = "1.1"
|
||||||
|
python-versions = "^3.8"
|
||||||
|
content-hash = "2f40aecf583ff9e4f7b2dcc090fee27915e64ff1f8a450fbe5e6f95e8c487d75"
|
||||||
|
|
||||||
|
[metadata.files]
|
||||||
|
click = [
|
||||||
|
{file = "click-8.0.3-py3-none-any.whl", hash = "sha256:353f466495adaeb40b6b5f592f9f91cb22372351c84caeb068132442a4518ef3"},
|
||||||
|
{file = "click-8.0.3.tar.gz", hash = "sha256:410e932b050f5eed773c4cda94de75971c89cdb3155a72a0831139a79e5ecb5b"},
|
||||||
|
]
|
||||||
|
colorama = [
|
||||||
|
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
|
||||||
|
{file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"},
|
||||||
|
]
|
||||||
|
flatlib = [
|
||||||
|
{file = "flatlib-0.2.3-py3-none-any.whl", hash = "sha256:c846d83c965db7588581bb65ac9a6668b9a190afcad5027269f7e9c75f467bcd"},
|
||||||
|
{file = "flatlib-0.2.3.tar.gz", hash = "sha256:46cc956b936aa31a96082cff23448a5c27dd6e5e434a6293bc9265336c00dd5d"},
|
||||||
|
]
|
||||||
|
pyswisseph = [
|
||||||
|
{file = "pyswisseph-2.08.00-1.tar.gz", hash = "sha256:6b4818c0224d309c0b01f3c52df2432900dddcde345364408d99eafc9cdd1e71"},
|
||||||
|
]
|
||||||
17
packages/scripts/horoscope/pyproject.toml
Normal file
17
packages/scripts/horoscope/pyproject.toml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
[tool.poetry]
|
||||||
|
name = "horoscope"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = ""
|
||||||
|
authors = ["Kierán Meinhardt <kmein@posteo.de>"]
|
||||||
|
|
||||||
|
[tool.poetry.dependencies]
|
||||||
|
python = "^3.8"
|
||||||
|
flatlib = "^0.2.3"
|
||||||
|
click = "^8.0.3"
|
||||||
|
|
||||||
|
[tool.poetry.scripts]
|
||||||
|
horoscope = "horoscope:main"
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
build-backend = "poetry.core.masonry.api"
|
||||||
Reference in New Issue
Block a user