[![Pypi](https://img.shields.io/pypi/v/eorzeaenv.svg?style=flat-square)](https://pypi.org/project/EorzeaEnv/)
[![Pypi](https://img.shields.io/pypi/pyversions/eorzeaenv.svg?style=flat-square)](https://pypi.org/project/EorzeaEnv/)
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FEltonChou%2FEorzeaEnv%2Fbadge&style=flat-square)](https://github.com/EltonChou/EorzeaEnv/actions)
![PyPI - Downloads](https://img.shields.io/pypi/dm/EorzeaEnv?style=flat-square)
[![codecov](https://codecov.io/gh/EltonChou/EorzeaEnv/branch/master/graph/badge.svg?token=U9US0CQUTI)](https://codecov.io/gh/EltonChou/EorzeaEnv)
# EorzeaEnv
+ [CHANGELOG](https://github.com/EltonChou/EorzeaEnv/blob/master/CHANGELOG.md)
## Installation
```
pip install eorzeaenv
```
## Usage
```py
from EorzeaEnv import EorzeaLang, EorzeaTime, EorzeaWeather, EorzeaPlaceName
```
### Eorzea Language enum
```py
support_langs = [
EorzeaLang.EN,
EorzeaLang.JA,
EorzeaLang.DE,
EorzeaLang.FR,
EorzeaLang.ZH_SC,
EorzeaLang.KO,
]
```
### Eorzea Time
```sh
>>> EorzeaTime.now()
'EorzeaTime(Sixth Embral Moon, 11, 21, 56, Phase:0.50, Althyk)'
>>> EorzeaTime.now().moon
'Sixth Embral Moon'
>>> EorzeaTime.now().sun
11
>>> EorzeaTime.now().hour
21
>>> EorzeaTime.now().minute
56
>>> EorzeaTime.now().phase
0.50
>>> EorzeaTime.now().guardian
'Althyk'
```
+ Get the unix timestamp (int not float)
```sh
>>> EorzeaTime.now().get_unix_time()
1661114514
```
+ Get the eorzea timestamp (int not float)
```sh
>>> EorzeaTime.now().get_eorzea_time()
34177649220
```
### Weather Forecast
+ Using period as tuple or list
```python
# defalut step value is 5
# This method return a generator if you need to re-use it save the values as `tuple` or `list`.
t = tuple(EorzeaTime.weather_period(step=3))
# Use EorzeaPlaceName to ensure the place is valid or
# you can directly pass the place string to forecast.
place_name = EorzeaPlaceName('Eureka Pyros')
# Defalut lang is 'en'
# Defalut strict is `True` for strict mode `False` for fuzzy mode.
# eg. `eurekaa puros` is valid in fuzzy mode.
# In fuzzy mode, you can set the cutoff score to prevent unexpected place name to be passed.
# default value is 80. (100 >= value >= 0)
EorzeaWeather.set_fuzzy_cutoff(95)
weather_en = EorzeaWeather.forecast(place_name, t, strict=True)
weather_ja = EorzeaWeather.forecast(place_name, t, lang=EorzeaLang.JA, strict=True)
weather_de = EorzeaWeather.forecast(place_name, t, lang=EorzeaLang.DE, strict=True)
weather_fr = EorzeaWeather.forecast(place_name, t, lang=EorzeaLang.FR, strict=True)
```
```sh
>>> print(weather_en)
['Thunder', 'Snow', 'Blizzards']
>>> print(weather_ja)
['雷', '雪', '吹雪']
>>> print(weather_de)
['Gewittrig', 'Schnee', 'Schneesturm']
>>> print(weather_fr)
['Orages', 'Neige', 'Blizzard']
```
+ Using period in for-loop
```py
weather_en = []
for t in EorzeaTime.weather_period(step=3):
w = EorzeaWeather.forecast('Eureka Pyros', t)
weather_en.append(w)
```
```sh
>>> print(weather_en)
['Thunder', 'Snow', 'Blizzards']
```
+ Provide a desired base time to calculate.
```py
for t in EorzeaTime.weather_period(step=3, from_=datetime(2025, 10, 25).timestamp()):
w = EorzeaWeather.forecast('Eureka Pyros', t)
print(w)
```
+ Using period generator directly
```py
weathers = EorzeaWeather.forecast('Eureka Pyros', EorzeaTime.weather_period(step=3))
```
```sh
>>> print(weathers)
['Thunder', 'Snow', 'Blizzards']
```
### Eorzea place name
An instance of EorzeaPlaceName would be always a valid place name in this pacakge.
An invalid place name will raises `InvalidEorzeaPlaceName` error.
```py
place_name = EorzeaPlaceName(
'The Ruby Sea',
# `False` to fuzzy mode, default is `True`
strict=True,
# Stricted scope for validation of place name.
# default is all supports locale.
locale_scopes=[
EorzeaLang.EN,
EorzeaLang.JA,
EorzeaLang.FR,
EorzeaLang.DE],
# Used in fuzzy mode to cut-off the result under the score.
# default is `80`.
fuzzy_cutoff=80
)
```
```sh
>>> place_name
EorrzeaPlaceName('The Ruby Sea')
>>> print(place_name)
'The Ruby Sea`
```
Belowings are valid place names in strict mode with full locale scopes (default settings).
```py
EorzeaPlaceName('The Ruby Sea') # valid `The Ruby Sea`
EorzeaPlaceName('the ruby sea') # valid `The Ruby Sea`
EorzeaPlaceName('ruby sea') # valid `The Ruby Sea`
EorzeaPlaceName('rubinsee') # valid `Rubinsee`
EorzeaPlaceName('紅玉海') # valid `紅玉海`
```
With stricted scopes.
```py
scopes = [EorzeaLang.JA, EorzeaLang.DE]
EorzeaPlaceName('The Ruby Sea', locale_scopes=scopes) # raises error
EorzeaPlaceName('the ruby sea', locale_scopes=scopes) # raises error
EorzeaPlaceName('ruby sea', locale_scopes=scopes) # raises error
EorzeaPlaceName('rubinsee', locale_scopes=scopes) # valid `Rubinsee`
EorzeaPlaceName('紅玉海', locale_scopes=scopes) # valid `紅玉海`
```
In fuzzy mode.
```py
EorzeaPlaceName('the ruby see', strict=False) # valid `The Ruby Sea`
EorzeaPlaceName('ruby see', strict=False) # valid `The Ruby Sea`
EorzeaPlaceName('rubisee', strict=False) # valid `Rubinsee`
EorzeaPlaceName('紅玉貝', strict=False) # raises error
EorzeaPlaceName('紅玉貝', strict=False, fuzzy_cutoff=66) # valid `紅玉海`
```
### Eorzea rainbow predict
Use EorzeaRainbow to predict when will the rainbow appears.
```py
from datetime import datetime
from EorzeaEnv import EorzeaPlaceName, EorzeaRainbow, EorzeaTime, EorzeaWeather
rainbow_times: list[datetime] = []
place = EorzeaPlaceName("東ラノシア")
the_rainbow = EorzeaRainbow(place_name=place)
for t in EorzeaTime.weather_period(step='inf'):
the_rainbow.append(t, EorzeaWeather.forecast(place, t, raw=True))
if the_rainbow.is_appear:
rainbow_times.append(datetime.fromtimestamp(t))
if len(rainbow_times) == 20:
break
print(rainbow_times)
```
### Errors
```py
from EorzeaEnv.errors import \
EorzeaEnvError, \
InvalidEorzeaPlaceName, \
WeatherRateDataError
```
```
Exception
|- EorzeaEnvError
|- InvalidEorzeaPlaceName
|- WeatherRateDataError
```
## Thanks
- [Rogueadyn-SaintCoinach](https://github.com/Rogueadyn/SaintCoinach)
Raw data
{
"_id": null,
"home_page": "https://github.com/EltonChou/EorzeaEnv",
"name": "EorzeaEnv",
"maintainer": "Elton Chou",
"docs_url": null,
"requires_python": "<=3.13,>=3.8",
"maintainer_email": "plscd748@gmail.com",
"keywords": "eorzea, ffxiv, ff14, final fantasy",
"author": "Elton Chou",
"author_email": "plscd748@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/64/d9/50a2d01d38e1f235f4d06fd86a8dea000d2ac599fc3c29ba48ab5c704a4b/eorzeaenv-2.2.11.tar.gz",
"platform": null,
"description": "[![Pypi](https://img.shields.io/pypi/v/eorzeaenv.svg?style=flat-square)](https://pypi.org/project/EorzeaEnv/)\n[![Pypi](https://img.shields.io/pypi/pyversions/eorzeaenv.svg?style=flat-square)](https://pypi.org/project/EorzeaEnv/)\n[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FEltonChou%2FEorzeaEnv%2Fbadge&style=flat-square)](https://github.com/EltonChou/EorzeaEnv/actions)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/EorzeaEnv?style=flat-square)\n[![codecov](https://codecov.io/gh/EltonChou/EorzeaEnv/branch/master/graph/badge.svg?token=U9US0CQUTI)](https://codecov.io/gh/EltonChou/EorzeaEnv)\n\n# EorzeaEnv\n\n+ [CHANGELOG](https://github.com/EltonChou/EorzeaEnv/blob/master/CHANGELOG.md)\n\n## Installation\n```\npip install eorzeaenv\n```\n\n## Usage\n```py\nfrom EorzeaEnv import EorzeaLang, EorzeaTime, EorzeaWeather, EorzeaPlaceName\n```\n\n### Eorzea Language enum\n```py\nsupport_langs = [\n EorzeaLang.EN,\n EorzeaLang.JA,\n EorzeaLang.DE,\n EorzeaLang.FR,\n EorzeaLang.ZH_SC,\n EorzeaLang.KO,\n]\n```\n\n### Eorzea Time\n\n```sh\n>>> EorzeaTime.now()\n'EorzeaTime(Sixth Embral Moon, 11, 21, 56, Phase:0.50, Althyk)'\n\n>>> EorzeaTime.now().moon\n'Sixth Embral Moon'\n\n>>> EorzeaTime.now().sun\n11\n\n>>> EorzeaTime.now().hour\n21\n\n>>> EorzeaTime.now().minute\n56\n\n>>> EorzeaTime.now().phase\n0.50\n\n>>> EorzeaTime.now().guardian\n'Althyk'\n```\n+ Get the unix timestamp (int not float)\n```sh\n>>> EorzeaTime.now().get_unix_time()\n1661114514\n```\n+ Get the eorzea timestamp (int not float)\n```sh\n>>> EorzeaTime.now().get_eorzea_time()\n34177649220\n```\n\n### Weather Forecast\n+ Using period as tuple or list\n```python\n# defalut step value is 5\n# This method return a generator if you need to re-use it save the values as `tuple` or `list`.\nt = tuple(EorzeaTime.weather_period(step=3))\n\n# Use EorzeaPlaceName to ensure the place is valid or\n# you can directly pass the place string to forecast.\nplace_name = EorzeaPlaceName('Eureka Pyros')\n\n# Defalut lang is 'en'\n# Defalut strict is `True` for strict mode `False` for fuzzy mode.\n# eg. `eurekaa puros` is valid in fuzzy mode.\n\n# In fuzzy mode, you can set the cutoff score to prevent unexpected place name to be passed.\n# default value is 80. (100 >= value >= 0)\nEorzeaWeather.set_fuzzy_cutoff(95)\n\nweather_en = EorzeaWeather.forecast(place_name, t, strict=True)\nweather_ja = EorzeaWeather.forecast(place_name, t, lang=EorzeaLang.JA, strict=True)\nweather_de = EorzeaWeather.forecast(place_name, t, lang=EorzeaLang.DE, strict=True)\nweather_fr = EorzeaWeather.forecast(place_name, t, lang=EorzeaLang.FR, strict=True)\n```\n```sh\n>>> print(weather_en)\n['Thunder', 'Snow', 'Blizzards']\n\n>>> print(weather_ja)\n['\u96f7', '\u96ea', '\u5439\u96ea']\n\n>>> print(weather_de)\n['Gewittrig', 'Schnee', 'Schneesturm']\n\n>>> print(weather_fr)\n['Orages', 'Neige', 'Blizzard']\n```\n+ Using period in for-loop\n```py\nweather_en = []\nfor t in EorzeaTime.weather_period(step=3):\n w = EorzeaWeather.forecast('Eureka Pyros', t)\n weather_en.append(w)\n```\n```sh\n>>> print(weather_en)\n['Thunder', 'Snow', 'Blizzards']\n```\n+ Provide a desired base time to calculate.\n```py\nfor t in EorzeaTime.weather_period(step=3, from_=datetime(2025, 10, 25).timestamp()):\n w = EorzeaWeather.forecast('Eureka Pyros', t)\n print(w)\n```\n+ Using period generator directly\n```py\nweathers = EorzeaWeather.forecast('Eureka Pyros', EorzeaTime.weather_period(step=3))\n```\n```sh\n>>> print(weathers)\n['Thunder', 'Snow', 'Blizzards']\n```\n\n### Eorzea place name\n\nAn instance of EorzeaPlaceName would be always a valid place name in this pacakge.\n\nAn invalid place name will raises `InvalidEorzeaPlaceName` error.\n\n```py\nplace_name = EorzeaPlaceName(\n 'The Ruby Sea',\n # `False` to fuzzy mode, default is `True`\n strict=True,\n # Stricted scope for validation of place name.\n # default is all supports locale.\n locale_scopes=[\n EorzeaLang.EN,\n EorzeaLang.JA,\n EorzeaLang.FR,\n EorzeaLang.DE],\n # Used in fuzzy mode to cut-off the result under the score.\n # default is `80`.\n fuzzy_cutoff=80\n)\n```\n```sh\n>>> place_name\nEorrzeaPlaceName('The Ruby Sea')\n\n>>> print(place_name)\n'The Ruby Sea`\n```\n\nBelowings are valid place names in strict mode with full locale scopes (default settings).\n```py\nEorzeaPlaceName('The Ruby Sea') # valid `The Ruby Sea`\nEorzeaPlaceName('the ruby sea') # valid `The Ruby Sea`\nEorzeaPlaceName('ruby sea') # valid `The Ruby Sea`\nEorzeaPlaceName('rubinsee') # valid `Rubinsee`\nEorzeaPlaceName('\u7d05\u7389\u6d77') # valid `\u7d05\u7389\u6d77`\n```\n\nWith stricted scopes.\n```py\nscopes = [EorzeaLang.JA, EorzeaLang.DE]\n\nEorzeaPlaceName('The Ruby Sea', locale_scopes=scopes) # raises error\nEorzeaPlaceName('the ruby sea', locale_scopes=scopes) # raises error\nEorzeaPlaceName('ruby sea', locale_scopes=scopes) # raises error\nEorzeaPlaceName('rubinsee', locale_scopes=scopes) # valid `Rubinsee`\nEorzeaPlaceName('\u7d05\u7389\u6d77', locale_scopes=scopes) # valid `\u7d05\u7389\u6d77`\n```\n\nIn fuzzy mode.\n```py\nEorzeaPlaceName('the ruby see', strict=False) # valid `The Ruby Sea`\nEorzeaPlaceName('ruby see', strict=False) # valid `The Ruby Sea`\nEorzeaPlaceName('rubisee', strict=False) # valid `Rubinsee`\nEorzeaPlaceName('\u7d05\u7389\u8c9d', strict=False) # raises error\nEorzeaPlaceName('\u7d05\u7389\u8c9d', strict=False, fuzzy_cutoff=66) # valid `\u7d05\u7389\u6d77`\n```\n\n### Eorzea rainbow predict\n\nUse EorzeaRainbow to predict when will the rainbow appears.\n\n```py\nfrom datetime import datetime\n\nfrom EorzeaEnv import EorzeaPlaceName, EorzeaRainbow, EorzeaTime, EorzeaWeather\n\nrainbow_times: list[datetime] = []\n\nplace = EorzeaPlaceName(\"\u6771\u30e9\u30ce\u30b7\u30a2\")\nthe_rainbow = EorzeaRainbow(place_name=place)\n\n\nfor t in EorzeaTime.weather_period(step='inf'):\n the_rainbow.append(t, EorzeaWeather.forecast(place, t, raw=True))\n if the_rainbow.is_appear:\n rainbow_times.append(datetime.fromtimestamp(t))\n if len(rainbow_times) == 20:\n break\n\nprint(rainbow_times)\n```\n\n### Errors\n```py\nfrom EorzeaEnv.errors import \\\n EorzeaEnvError, \\\n InvalidEorzeaPlaceName, \\\n WeatherRateDataError\n```\n\n```\nException\n |- EorzeaEnvError\n |- InvalidEorzeaPlaceName\n |- WeatherRateDataError\n```\n\n## Thanks\n- [Rogueadyn-SaintCoinach](https://github.com/Rogueadyn/SaintCoinach)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Final Fantasy XIV weather & time tools.",
"version": "2.2.11",
"project_urls": {
"Bug Reports": "https://github.com/EltonChou/EorzeaEnv/issues",
"Homepage": "https://github.com/EltonChou/EorzeaEnv",
"Repository": "https://github.com/EltonChou/EorzeaEnv"
},
"split_keywords": [
"eorzea",
" ffxiv",
" ff14",
" final fantasy"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "99e07d39871fe59aefca43f59f1206959f803842d76e4b12174f59cdfa86df95",
"md5": "1fb47590bc4c3c1548f632995fd4b78d",
"sha256": "7c55b07b0a08588e24f546b978adb0e918958d7639a931b43cbc8a2cb622ddc0"
},
"downloads": -1,
"filename": "eorzeaenv-2.2.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1fb47590bc4c3c1548f632995fd4b78d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<=3.13,>=3.8",
"size": 72850,
"upload_time": "2024-09-11T14:06:55",
"upload_time_iso_8601": "2024-09-11T14:06:55.637264Z",
"url": "https://files.pythonhosted.org/packages/99/e0/7d39871fe59aefca43f59f1206959f803842d76e4b12174f59cdfa86df95/eorzeaenv-2.2.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "64d950a2d01d38e1f235f4d06fd86a8dea000d2ac599fc3c29ba48ab5c704a4b",
"md5": "32ada5e2ff667f6a2129db2635187030",
"sha256": "8c7502ecbe14568c7fb6ce6d7f8dbdad20e5d8e2807c1bd6a795557d00f27c5b"
},
"downloads": -1,
"filename": "eorzeaenv-2.2.11.tar.gz",
"has_sig": false,
"md5_digest": "32ada5e2ff667f6a2129db2635187030",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<=3.13,>=3.8",
"size": 67526,
"upload_time": "2024-09-11T14:06:57",
"upload_time_iso_8601": "2024-09-11T14:06:57.311388Z",
"url": "https://files.pythonhosted.org/packages/64/d9/50a2d01d38e1f235f4d06fd86a8dea000d2ac599fc3c29ba48ab5c704a4b/eorzeaenv-2.2.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-11 14:06:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "EltonChou",
"github_project": "EorzeaEnv",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "eorzeaenv"
}