From 85e40b97f43d8239f5f97b8bd55349950601f483 Mon Sep 17 00:00:00 2001
From: Firq-ow <firelp42@gmail.com>
Date: Sat, 29 Mar 2025 13:20:43 +0100
Subject: [PATCH] Bugfix for issue reported by Mitsu

---
 README.md                  | 2 ++
 pyproject.toml             | 2 +-
 skyeweave/cli/cli.py       | 4 ++--
 skyeweave/service/atlas.py | 9 +++++++--
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index 2837b37..0b20ed7 100644
--- a/README.md
+++ b/README.md
@@ -41,6 +41,8 @@ skyeweave --output out --id 70
 
 This would generate the expressions for Scathach (Servant Id 70) in the folder out, using subfolders to better separate the outputs of multiple runs.
 
+For generating sprite sheets of only a singular ascension, use the `charaId` of the given sprite sheet collection. This is NOT to be confused with the `baseSvtId`, which is similar, but one digit short.
+
 ### python scripts [EXPERIMENTAL]
 
 `skyeweave` can also be used in other Python scripts.
diff --git a/pyproject.toml b/pyproject.toml
index 5bdc627..fb0f77f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
 [project]
 name = "skyeweave"
-version = "1.0.0-c.3"
+version = "1.0.0-c.4"
 requires-python = ">= 3.10"
 authors = [{name = "Firq", email = "firelp42@gmail.com"}]
 maintainers = [{name = "Firq", email = "firelp42@gmail.com"}]
diff --git a/skyeweave/cli/cli.py b/skyeweave/cli/cli.py
index a6ce9b1..4a18431 100644
--- a/skyeweave/cli/cli.py
+++ b/skyeweave/cli/cli.py
@@ -36,8 +36,8 @@ def parse_arguments(arguments):
 
     parser.add_argument("--version", action="version", version=f"skyeweave {__version__}")
     parser.add_argument("--output", action="store", type=str, default=None, dest="output", help="Set the output location. This can be an absolute or relative path")
-    parser.add_argument("--id", action="store", type=int, default=None, dest="id", help="Set the servantId/charaId - Skips user prompt when provided")
-    parser.add_argument("--filter", action="extend", nargs="+", dest="filter", help='SSpecify which spritesheets will actually be used (one or more charaIds)')
+    parser.add_argument("--id", action="store", type=int, default=None, dest="id", help="Set the servantId (collectionNumber)/charaId (based on baseSvtId) - Skips user prompt when provided")
+    parser.add_argument("--filter", action="extend", nargs="+", dest="filter", help='Specify which spritesheets will actually be used (one or more charaIds)')
     parser.add_argument("--timeout", action="store", type=int, default=None, dest="timeout", help="Set the timeout for all requests towards AtlasAcademy (default: 10s)")
     parser.add_argument("--no-cache", action="store_true", default=False, dest="nocache", help="Clear cache for this id, keeping all other files")
     parser.add_argument("--reset", action="store_true", default=False, dest="reset", help="Delete any already downloaded assets")
diff --git a/skyeweave/service/atlas.py b/skyeweave/service/atlas.py
index 3b232da..5038c7e 100644
--- a/skyeweave/service/atlas.py
+++ b/skyeweave/service/atlas.py
@@ -22,9 +22,12 @@ def fetch_config(chara_id: int) -> SpritesheetData:
     response = requests.get(url, timeout=AtlasAPIConfig.TIMEOUT)
     LOGGER.debug(f"{response.status_code} - {response.text}")
     if not response.ok:
-        raise ValueError()
+        raise ValueError(f"Failed to fetch data for charaId {chara_id}")
 
-    resp_data = response.json()[0]
+    resp_json = response.json()
+    if len(resp_json) == 0:
+        raise ValueError(f"No data was returned for get given charaId {chara_id}. Please ensure that this is a valid charaId and not the baseSvtId")
+    resp_data = resp_json[0]
     extend_data: ExtendData = resp_data["extendData"]
 
     if "faceSizeRect" in extend_data:
@@ -92,6 +95,8 @@ def fetch_expression_sheets(tempfolder: pathlib.Path, imageid: int):
             response = requests.get(atlasurl, stream=True, timeout=AtlasAPIConfig.TIMEOUT)
             status = response.status_code
             LOGGER.debug(f"{response.status_code} - {response.text}")
+            if status != 200 and postfix == "":
+                LOGGER.warning(f"There was no expression sheet for the given charaId {imageid} - please ensure that this charaId is valid.")
             if status != 200:
                 continue
             for block in response.iter_content(1024):