Compare commits
5
Commits
c8f12b26c1
..
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef919284ae | ||
|
|
6de406787c | ||
|
|
8aa2e63998 | ||
|
|
81f190b936 | ||
|
|
6f678ec0a4 |
+1
-1
@@ -8,8 +8,8 @@ env/
|
|||||||
venv/
|
venv/
|
||||||
.venv/
|
.venv/
|
||||||
build/
|
build/
|
||||||
develop-eggs/
|
|
||||||
dist/
|
dist/
|
||||||
|
release/
|
||||||
downloads/
|
downloads/
|
||||||
eggs/
|
eggs/
|
||||||
.eggs/
|
.eggs/
|
||||||
|
|||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
a = Analysis(
|
||||||
|
['run_catser.py'],
|
||||||
|
pathex=[],
|
||||||
|
binaries=[],
|
||||||
|
datas=[('catser/assets', 'catser/assets')],
|
||||||
|
hiddenimports=[],
|
||||||
|
hookspath=[],
|
||||||
|
hooksconfig={},
|
||||||
|
runtime_hooks=[],
|
||||||
|
excludes=[],
|
||||||
|
noarchive=False,
|
||||||
|
optimize=0,
|
||||||
|
)
|
||||||
|
pyz = PYZ(a.pure)
|
||||||
|
|
||||||
|
exe = EXE(
|
||||||
|
pyz,
|
||||||
|
a.scripts,
|
||||||
|
a.binaries,
|
||||||
|
a.datas,
|
||||||
|
[],
|
||||||
|
name='Catser',
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
upx_exclude=[],
|
||||||
|
runtime_tmpdir=None,
|
||||||
|
console=True,
|
||||||
|
disable_windowed_traceback=False,
|
||||||
|
argv_emulation=False,
|
||||||
|
target_arch=None,
|
||||||
|
codesign_identity=None,
|
||||||
|
entitlements_file=None,
|
||||||
|
icon=['catser.ico'],
|
||||||
|
)
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 Catser Contributors
|
||||||
|
Sprite assets courtesy of Workcat (https://workcat.app)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -14,6 +14,7 @@ Assets managed:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
import math
|
import math
|
||||||
@@ -48,9 +49,12 @@ def _download_file(url: str, dest_path: Path) -> bool:
|
|||||||
Downloads a file with custom User-Agent to avoid Cloudflare 403 blocks.
|
Downloads a file with custom User-Agent to avoid Cloudflare 403 blocks.
|
||||||
Returns True on success, False otherwise.
|
Returns True on success, False otherwise.
|
||||||
"""
|
"""
|
||||||
dest_path.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
if dest_path.exists() and dest_path.stat().st_size > 0:
|
if dest_path.exists() and dest_path.stat().st_size > 0:
|
||||||
return True
|
return True
|
||||||
|
try:
|
||||||
|
dest_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
req = urllib.request.Request(url, headers={"User-Agent": USER_AGENT})
|
req = urllib.request.Request(url, headers={"User-Agent": USER_AGENT})
|
||||||
@@ -84,7 +88,14 @@ class AssetsManager:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, assets_dir: Optional[Path] = None, cat_width: int = 144, config: Optional[Config] = None):
|
def __init__(self, assets_dir: Optional[Path] = None, cat_width: int = 144, config: Optional[Config] = None):
|
||||||
self.assets_dir = assets_dir or (Path(__file__).parent / "assets")
|
if assets_dir:
|
||||||
|
self.assets_dir = assets_dir
|
||||||
|
elif getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
|
||||||
|
mei_catser = Path(sys._MEIPASS) / "catser" / "assets"
|
||||||
|
self.assets_dir = mei_catser if mei_catser.exists() else (Path(sys._MEIPASS) / "assets")
|
||||||
|
else:
|
||||||
|
self.assets_dir = Path(__file__).parent / "assets"
|
||||||
|
|
||||||
self.config = config or Config(cat_width=cat_width)
|
self.config = config or Config(cat_width=cat_width)
|
||||||
self.cat_width = self.config.cat_width
|
self.cat_width = self.config.cat_width
|
||||||
self.cat_height = self.config.cat_height
|
self.cat_height = self.config.cat_height
|
||||||
@@ -106,7 +117,10 @@ class AssetsManager:
|
|||||||
|
|
||||||
def initialize(self) -> None:
|
def initialize(self) -> None:
|
||||||
"""Downloads all missing assets and prepares raw frames."""
|
"""Downloads all missing assets and prepares raw frames."""
|
||||||
|
try:
|
||||||
self.assets_dir.mkdir(parents=True, exist_ok=True)
|
self.assets_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
self._ensure_assets_downloaded()
|
self._ensure_assets_downloaded()
|
||||||
self._load_raw_assets()
|
self._load_raw_assets()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user