diff --git a/README.md b/README.md
index 870eb0e..bce89f2 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ An asynchronous module and API that allows you to connect to your bot the genera
:white_medium_square: [Generation results](https://github.com/DEViantUA/EnkaCard/wiki/Resultate)
:white_medium_square: [StarRailCard](https://github.com/DEViantUA/StarRailCard)
:white_medium_square: [Additional module](https://github.com/DEViantUA/ENCard)
-:white_medium_square: [Assets](https://github.com/DEViantUA/EnkaCardData)
+:white_medium_square: [Assets](https://github.com/DEViantUA/EnkaCard)
## Installation:
```
pip install enkacard
@@ -76,6 +76,7 @@ result = asyncio.run(main())
print(result)
```
> _**Aliternative method: [Tools](https://github.com/DEViantUA/EnkaCard/wiki/Tools)**_
+
## Languages Supported
diff --git a/enkacard/encbanner.py b/enkacard/encbanner.py
index b2b1140..43f792b 100644
--- a/enkacard/encbanner.py
+++ b/enkacard/encbanner.py
@@ -180,7 +180,10 @@ async def creat(self, template = 1, akasha = False, snow = False):
if not generator.get(key.id,None) is None:
gen_tools.append(generator.get(key.id))
continue
-
+ if str(key.id) == "10000092":
+ key.image.banner.url = "https://api.ambr.top/assets/UI/UI_Gacha_AvatarImg_Gaming.png"
+ elif str(key.id) == "10000093":
+ key.image.banner.url = "https://api.ambr.top/assets/UI/UI_Gacha_AvatarImg_Liuyun.png"
art = None
if self.character_art:
if str(key.id) in self.character_art:
diff --git a/enkacard/enkatools.py b/enkacard/enkatools.py
index 41e1e91..c6acd98 100644
--- a/enkacard/enkatools.py
+++ b/enkacard/enkatools.py
@@ -5,7 +5,14 @@
from io import BytesIO
import aiohttp
from contextlib import AsyncExitStack
-import magic
+
+import_magic = False
+
+try:
+ import magic
+except ImportError:
+ import_magic = True
+ import imghdr
IMAGE_TYPES = {
'image/jpeg',
@@ -58,7 +65,14 @@ async def download_image(session, url, headers=None, allow_redirects=True, use_r
async def get_mimetype(session, url, size=2048, allow_redirects=True, **kwargs):
async with session:
data = await download_image(session, url, size=size, allow_redirects=allow_redirects, **kwargs)
- return magic.Magic(mime=True).from_buffer(data)
+ if import_magic:
+ mime_type = imghdr.what(None, h=data)
+ if mime_type:
+ return mime_type
+ else:
+ return "application/octet-stream"
+ else:
+ return magic.Magic(mime=True).from_buffer(data)
async def is_valid(session, url, allow_redirects=True, **kwargs):
async with session:
diff --git a/enkacard/src/assets/font/GSEnochian.ttf b/enkacard/src/assets/font/GSEnochian.ttf
new file mode 100644
index 0000000..7e58217
Binary files /dev/null and b/enkacard/src/assets/font/GSEnochian.ttf differ
diff --git a/enkacard/src/assets/font/Genshin_Impact.ttf b/enkacard/src/assets/font/Genshin_Impact.ttf
new file mode 100644
index 0000000..78f39a6
Binary files /dev/null and b/enkacard/src/assets/font/Genshin_Impact.ttf differ
diff --git a/enkacard/src/generator/akasha_rank.py b/enkacard/src/generator/akasha_rank.py
index 0c10450..b7555d6 100644
--- a/enkacard/src/generator/akasha_rank.py
+++ b/enkacard/src/generator/akasha_rank.py
@@ -1,4 +1,5 @@
import aiohttp
+import random
from ..utils import pill, git
from PIL import ImageDraw,Image
@@ -7,6 +8,10 @@
api_url = "https://akasha.cv/api/getCalculationsForUser/{uid}"
api_update = "https://akasha.cv/api/user/refresh/{uid}"
+#https://akasha.cv/api/leaderboards/{uid}/{hash}?variant=profilePage - ПОЛУЧИТЬ ХАШ ОБЩИЙ И ДЛЯ ПЕРСОНАЖЕЙ
+#https://akasha.cv/api/substatPriority/{uid}/{hash} - ПОЛУЧИТЬ ИНФОРМАЦИЮ О СТАТАХ ПЕРСОНАЖА
+
+
data_akasha = {}
class AkashaCreat:
@@ -15,15 +20,23 @@ def __init__(self,card = None,teample= None,rank= None,uid= None) -> None:
self.teample = teample
self.rank = rank
self.uid = uid
-
+
+ async def get_hash(self, charter_id):
+ async with aiohttp.ClientSession() as session:
+ async with session.get(api_url.format(uid = self.uid)) as response:
+ data = await response.json()
+ for key in data["data"]:
+ if str(charter_id) == str(key["characterId"]):
+ return key["md5"]
+
async def update(self):
async with aiohttp.ClientSession() as session:
async with session.get(api_update.format(uid = self.uid)) as response:
return await response.json()
async def get_info_character(self, id):
- url = f'https://akasha.cv/api/leaderboards/qusoleum/{id}?type=current'
-
+ hash = await self.get_hash(id)
+ url = f'https://akasha.cv/api/leaderboards/{self.uid}/{hash}?variant=profilePage'
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
if response.status == 200:
diff --git a/enkacard/src/generator/profile_teample_one.py b/enkacard/src/generator/profile_teample_one.py
index 6488131..1110832 100644
--- a/enkacard/src/generator/profile_teample_one.py
+++ b/enkacard/src/generator/profile_teample_one.py
@@ -81,6 +81,8 @@ async def creat_avatar_info(self):
async def creat_charter(self,key):
background = Image.new("RGBA", (180, 263), (0,0,0,0))
+ if self.img is None:
+ self.img = {}
if str(key.id) in self.img:
url = self.img[str(key.id)]
else:
diff --git a/enkacard/src/generator/teample_two.py b/enkacard/src/generator/teample_two.py
index dc77fd3..7e93bef 100644
--- a/enkacard/src/generator/teample_two.py
+++ b/enkacard/src/generator/teample_two.py
@@ -102,7 +102,9 @@ async def creat_diagram(self):
akashaElement = False
data_user = []
- dataAkasha = await AkashaCreat().get_info_character(self.character.id)
+ dataAkasha = await AkashaCreat(uid = self.uid).get_info_character(self.character.id)
+ if dataAkasha == []:
+ dataAkasha = {}
if dataAkasha != {}:
dataAkasha = dataAkasha[random.choice(list(dataAkasha.keys()))]['stats']
dataAkasha_new = []
diff --git a/enkacard/src/pickle_cashe/data_characters.pkz b/enkacard/src/pickle_cashe/data_characters.pkz
new file mode 100644
index 0000000..ab3668b
Binary files /dev/null and b/enkacard/src/pickle_cashe/data_characters.pkz differ
diff --git a/enkacard/src/pickle_cashe/data_characters.pkz~ b/enkacard/src/pickle_cashe/data_characters.pkz~
new file mode 100644
index 0000000..e69de29
diff --git a/enkacard/src/utils/diagram.py b/enkacard/src/utils/diagram.py
index 9f7cf02..c70eb76 100644
--- a/enkacard/src/utils/diagram.py
+++ b/enkacard/src/utils/diagram.py
@@ -6,8 +6,11 @@
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import font_manager
+from pathlib import Path
-font_path = 'enkacard\\src\\assets\\total\\font\\Genshin_Impact.ttf'
+assets = assets = Path(__file__).parent.parent / 'assets'
+
+font_path = str(assets / 'font' / 'Genshin_Impact.ttf')
custom_font = font_manager.FontProperties(fname=font_path)
plt.rcParams['font.family'] = custom_font.get_name()
diff --git a/enkacard/src/utils/enkanetwork_update/pathfinding.py b/enkacard/src/utils/enkanetwork_update/pathfinding.py
index 53d1431..e6b3679 100644
--- a/enkacard/src/utils/enkanetwork_update/pathfinding.py
+++ b/enkacard/src/utils/enkanetwork_update/pathfinding.py
@@ -1,6 +1,5 @@
import sys
import os
-import json
async def search():
python_paths = sys.path
diff --git a/enkacard/src/utils/git.py b/enkacard/src/utils/git.py
index c6816c8..3ab729b 100644
--- a/enkacard/src/utils/git.py
+++ b/enkacard/src/utils/git.py
@@ -10,19 +10,19 @@
_cache = TTLCache(maxsize=1000, ttl=300)
-assets = Path(__file__).parent.parent / 'assets'
_BASE_URL = 'https://raw.githubusercontent.com/DEViantUA/EnkaCardData/main/assets/'
-font = str(assets /'total'/'font' / 'Genshin_Impact.ttf')
-fontKH = str(assets /'total'/ 'font' / 'GSEnochian.ttf')
+assets = Path(__file__).parent.parent / 'assets'
+
+font = str(assets / 'font' / 'Genshin_Impact.ttf')
+fontKH = str(assets / 'font' / 'GSEnochian.ttf')
async def change_Font(x):
global font
if x == 0:
- font = str(assets /'total' / 'font' / 'Genshin_Impact.ttf')
+ font = str(assets / 'font' / 'Genshin_Impact.ttf')
else:
- font = str(assets /'total' / 'font' / 'GSEnochian.ttf')
-
+ font = str(assets / 'font' / 'GSEnochian.ttf')
mapping = {
"artifact_bg": "one/artifact_bg.png",
"artifact_bg_none": "one/artifact_bg_none.png",
diff --git a/pyproject.toml b/pyproject.toml
index b5a2773..82903d6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "enkacard"
-version = "3.1.2"
+version = "3.2.9"
description = "An asynchronous module and API that allows you to connect to your bot the generation of Genshin character cards from the Enka.Network website."
authors = ["None"]
@@ -12,16 +12,15 @@ homepage = "https://github.com/DEViantUA/EnkaCard"
[tool.poetry.dependencies]
python = "^3.10"
Pillow = "^10.0.1"
-"enkanetwork.py" = "^1.4.5"
+"enkanetworkv2.py" = "^2.0.0"
cachetools = "^5.2.0"
asyncache = "^0.3.1"
numpy = "^1.24.2"
more-itertools = "^10.1.0"
aiofiles = "^23.2.1"
-pydantic = "1.10.13"
matplotlib = "^3.8.2"
-python-magic = "^0.4.27"
-python-magic-bin = "^0.4.14"
+python-magic = { platform = "windows", version = "^0.4.27" }
+python-magic-bin = { platform = "windows", version = "^0.4.14" }
[build-system]
requires = ["poetry-core>=1.0.0"]
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..6218f00
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,13 @@
+aiofiles
+aiohttp
+asyncio
+cachetools
+cloudpickle
+enkanetworkv2.py
+python-magic
+python-magic-bin
+matplotlib
+more-itertools
+numpy
+Pillow
+pydantic