Splatlogger 1.3.1__tar.gz → 1.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {splatlogger-1.3.1/src/Splatlogger.egg-info → splatlogger-1.3.2}/PKG-INFO +24 -2
  2. {splatlogger-1.3.1 → splatlogger-1.3.2}/README.md +22 -0
  3. {splatlogger-1.3.1 → splatlogger-1.3.2}/pyproject.toml +2 -2
  4. {splatlogger-1.3.1 → splatlogger-1.3.2/src/Splatlogger.egg-info}/PKG-INFO +24 -2
  5. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/Splatlogger.egg-info/requires.txt +1 -1
  6. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/splatlogger/__init__.py +1 -1
  7. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/splatlogger/cemu_gecko.py +11 -2
  8. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/splatlogger/match_logger.py +4 -5
  9. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/splatlogger/splatlogger.py +13 -23
  10. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/splatlogger/tuples.py +0 -5
  11. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/splatlogger/utility_functions.py +6 -7
  12. {splatlogger-1.3.1 → splatlogger-1.3.2}/LICENSE +0 -0
  13. {splatlogger-1.3.1 → splatlogger-1.3.2}/setup.cfg +0 -0
  14. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/Splatlogger.egg-info/SOURCES.txt +0 -0
  15. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/Splatlogger.egg-info/dependency_links.txt +0 -0
  16. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/Splatlogger.egg-info/entry_points.txt +0 -0
  17. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/Splatlogger.egg-info/top_level.txt +0 -0
  18. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/splatlogger/__main__.py +0 -0
  19. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/splatlogger/cli.py +0 -0
  20. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/splatlogger/enums.py +0 -0
  21. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/splatlogger/errors.py +0 -0
  22. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/splatlogger/resources/names.json +0 -0
  23. {splatlogger-1.3.1 → splatlogger-1.3.2}/src/splatlogger/tcpgecko.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Splatlogger
3
- Version: 1.3.1
3
+ Version: 1.3.2
4
4
  Summary: PID Grabber and player/match information logging tool for Splatoon
5
5
  Author-email: Shadow Doggo <shadowdoggo@protonmail.com>
6
6
  License-Expression: MIT
@@ -14,7 +14,7 @@ Requires-Dist: tomli>=1.1.0; python_version < "3.11"
14
14
  Requires-Dist: userpaths>=0.1.3
15
15
  Requires-Dist: requests>=2.28.0
16
16
  Requires-Dist: colorama>=0.4.6
17
- Requires-Dist: clean-text>=0.7.1
17
+ Requires-Dist: ftfy<7.0,>=6.0
18
18
  Requires-Dist: prompt_toolkit>=3.0.0
19
19
  Provides-Extra: cemu
20
20
  Requires-Dist: psutil>=5.9.0; extra == "cemu"
@@ -28,6 +28,8 @@ A PID Grabber and player/match information logging tool for Splatoon, supporting
28
28
 
29
29
  <sub>*Cemu support has only been tested on Windows and Linux, though macOS should work as well.</sub>
30
30
 
31
+ <sub>*Check out [SpoonPIDGrabber](https://codeberg.org/ShadowDoggo/SpoonPIDGrabber) for a native Aroma plugin.*</sub>
32
+
31
33
  - [Prerequisites (Wii U)](#prerequisites-wii-u)
32
34
  - [Usage](#usage)
33
35
  - [Running the executable](#running-the-executable)
@@ -69,6 +71,26 @@ Drag the executable into the terminal window to automatically get the path.
69
71
 
70
72
  On Linux and macOS, you might need to make the file executable first with `chmod +x path/to/Splatlogger-executable`
71
73
 
74
+ ### Unsigned executable warning
75
+
76
+ Windows and macOS may display security warnings when you try to run Splatlogger. This is expected and does not necessarily mean that the application is malicious.
77
+
78
+ **Windows**
79
+
80
+ If Windows SmartScreen displays a warning saying *"Windows protected your PC"*:
81
+
82
+ - Click **More info**.
83
+ - Click **Run anyway**.
84
+
85
+ **macOS**
86
+
87
+ If macOS blocks the application because it cannot verify the developer:
88
+
89
+ - Open **System Settings → Privacy & Security**.
90
+ - Scroll down and click **Open Anyway** next to the warning about Splatlogger.
91
+
92
+ These warnings occur because the executables have not been signed with a trusted developer certificate. Only bypass these warnings if you downloaded Splatlogger from a trusted source.
93
+
72
94
  ### Running with Python
73
95
  You can install Splatlogger as a package from PyPI:
74
96
  ```
@@ -3,6 +3,8 @@ A PID Grabber and player/match information logging tool for Splatoon, supporting
3
3
 
4
4
  <sub>*Cemu support has only been tested on Windows and Linux, though macOS should work as well.</sub>
5
5
 
6
+ <sub>*Check out [SpoonPIDGrabber](https://codeberg.org/ShadowDoggo/SpoonPIDGrabber) for a native Aroma plugin.*</sub>
7
+
6
8
  - [Prerequisites (Wii U)](#prerequisites-wii-u)
7
9
  - [Usage](#usage)
8
10
  - [Running the executable](#running-the-executable)
@@ -44,6 +46,26 @@ Drag the executable into the terminal window to automatically get the path.
44
46
 
45
47
  On Linux and macOS, you might need to make the file executable first with `chmod +x path/to/Splatlogger-executable`
46
48
 
49
+ ### Unsigned executable warning
50
+
51
+ Windows and macOS may display security warnings when you try to run Splatlogger. This is expected and does not necessarily mean that the application is malicious.
52
+
53
+ **Windows**
54
+
55
+ If Windows SmartScreen displays a warning saying *"Windows protected your PC"*:
56
+
57
+ - Click **More info**.
58
+ - Click **Run anyway**.
59
+
60
+ **macOS**
61
+
62
+ If macOS blocks the application because it cannot verify the developer:
63
+
64
+ - Open **System Settings → Privacy & Security**.
65
+ - Scroll down and click **Open Anyway** next to the warning about Splatlogger.
66
+
67
+ These warnings occur because the executables have not been signed with a trusted developer certificate. Only bypass these warnings if you downloaded Splatlogger from a trusted source.
68
+
47
69
  ### Running with Python
48
70
  You can install Splatlogger as a package from PyPI:
49
71
  ```
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "Splatlogger"
7
- version = "1.3.1"
7
+ version = "1.3.2"
8
8
  authors = [
9
9
  { name="Shadow Doggo", email="shadowdoggo@protonmail.com" }
10
10
  ]
@@ -16,7 +16,7 @@ dependencies = [
16
16
  "userpaths>=0.1.3",
17
17
  "requests>=2.28.0",
18
18
  "colorama>=0.4.6",
19
- "clean-text>=0.7.1",
19
+ "ftfy>=6.0,<7.0",
20
20
  "prompt_toolkit>=3.0.0"
21
21
  ]
22
22
  classifiers = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Splatlogger
3
- Version: 1.3.1
3
+ Version: 1.3.2
4
4
  Summary: PID Grabber and player/match information logging tool for Splatoon
5
5
  Author-email: Shadow Doggo <shadowdoggo@protonmail.com>
6
6
  License-Expression: MIT
@@ -14,7 +14,7 @@ Requires-Dist: tomli>=1.1.0; python_version < "3.11"
14
14
  Requires-Dist: userpaths>=0.1.3
15
15
  Requires-Dist: requests>=2.28.0
16
16
  Requires-Dist: colorama>=0.4.6
17
- Requires-Dist: clean-text>=0.7.1
17
+ Requires-Dist: ftfy<7.0,>=6.0
18
18
  Requires-Dist: prompt_toolkit>=3.0.0
19
19
  Provides-Extra: cemu
20
20
  Requires-Dist: psutil>=5.9.0; extra == "cemu"
@@ -28,6 +28,8 @@ A PID Grabber and player/match information logging tool for Splatoon, supporting
28
28
 
29
29
  <sub>*Cemu support has only been tested on Windows and Linux, though macOS should work as well.</sub>
30
30
 
31
+ <sub>*Check out [SpoonPIDGrabber](https://codeberg.org/ShadowDoggo/SpoonPIDGrabber) for a native Aroma plugin.*</sub>
32
+
31
33
  - [Prerequisites (Wii U)](#prerequisites-wii-u)
32
34
  - [Usage](#usage)
33
35
  - [Running the executable](#running-the-executable)
@@ -69,6 +71,26 @@ Drag the executable into the terminal window to automatically get the path.
69
71
 
70
72
  On Linux and macOS, you might need to make the file executable first with `chmod +x path/to/Splatlogger-executable`
71
73
 
74
+ ### Unsigned executable warning
75
+
76
+ Windows and macOS may display security warnings when you try to run Splatlogger. This is expected and does not necessarily mean that the application is malicious.
77
+
78
+ **Windows**
79
+
80
+ If Windows SmartScreen displays a warning saying *"Windows protected your PC"*:
81
+
82
+ - Click **More info**.
83
+ - Click **Run anyway**.
84
+
85
+ **macOS**
86
+
87
+ If macOS blocks the application because it cannot verify the developer:
88
+
89
+ - Open **System Settings → Privacy & Security**.
90
+ - Scroll down and click **Open Anyway** next to the warning about Splatlogger.
91
+
92
+ These warnings occur because the executables have not been signed with a trusted developer certificate. Only bypass these warnings if you downloaded Splatlogger from a trusted source.
93
+
72
94
  ### Running with Python
73
95
  You can install Splatlogger as a package from PyPI:
74
96
  ```
@@ -1,7 +1,7 @@
1
1
  userpaths>=0.1.3
2
2
  requests>=2.28.0
3
3
  colorama>=0.4.6
4
- clean-text>=0.7.1
4
+ ftfy<7.0,>=6.0
5
5
  prompt_toolkit>=3.0.0
6
6
 
7
7
  [:python_version < "3.11"]
@@ -1,2 +1,2 @@
1
- __version__ = "1.3.1"
1
+ __version__ = "1.3.2"
2
2
  __author__ = "Shadow Doggo"
@@ -28,8 +28,14 @@ class CemuGecko:
28
28
  except ProcessIDNotExistsError as e:
29
29
  raise CemuGeckoError("Invalid process ID.") from e
30
30
 
31
- self._base_address = self._get_base_address()
31
+ try:
32
+ self._base_address = self._get_base_address()
33
+ except ProcessIDNotExistsError as e:
34
+ self.close()
35
+ raise CemuGeckoError("Cemu process was closed.") from e
36
+
32
37
  if self._base_address == 0:
38
+ self.close()
33
39
  raise CemuGeckoError("Could not find Cemu's Wii U memory space.")
34
40
 
35
41
  def __enter__(self) -> CemuGecko:
@@ -50,7 +56,10 @@ class CemuGecko:
50
56
  if length <= 0:
51
57
  raise ValueError("Reading memory requires a positive length (# of bytes).")
52
58
 
53
- return self._process.read_process_memory(self._base_address + address, bytes, length)
59
+ try:
60
+ return self._process.read_process_memory(self._base_address + address, bytes, length)
61
+ except ProcessIDNotExistsError as e:
62
+ raise ProcessLookupError(str(e)) from e
54
63
 
55
64
  def peek8(self, address: int, *, signed: bool = False) -> int:
56
65
  """Get an 8-bit integer value stored at the specified address."""
@@ -12,7 +12,7 @@ import userpaths # type: ignore[import-untyped]
12
12
 
13
13
  from . import utility_functions as uf
14
14
  from .enums import OffsetChains, Offsets, Pointers, VSMode, VSRule
15
- from .tuples import AccountInfo, AppContext, CommonAddresses, PlayerInfo, PlayerStats, MatchResults
15
+ from .tuples import AccountInfo, AppContext, PlayerInfo, PlayerStats, MatchResults
16
16
 
17
17
 
18
18
  def get_resource_path(relative_path: str | Path) -> Path:
@@ -66,8 +66,7 @@ class MatchLogger:
66
66
 
67
67
  return log_dir / f"{self._date.strftime('%Y-%m-%d')}"
68
68
 
69
- def log_match(self, date: datetime, session_id: int, match_count: int, player_info_list: list[PlayerInfo],
70
- adrs: CommonAddresses) -> None:
69
+ def log_match(self, date: datetime, session_id: int, match_count: int, player_info_list: list[PlayerInfo]) -> None:
71
70
  """Write player and match data to the log file.
72
71
  A log file must be initialized before calling this method."""
73
72
  disconnect = False
@@ -87,7 +86,7 @@ class MatchLogger:
87
86
  stats: list[PlayerStats] = []
88
87
  match_results: MatchResults | None = None
89
88
  if self._ctx.options.log_level == "full":
90
- if self._wait_for_results(adrs, dcd_players):
89
+ if self._wait_for_results(dcd_players):
91
90
  stats = self._get_player_stats()
92
91
  match_results = self._get_match_results(versus_rule)
93
92
  else:
@@ -226,7 +225,7 @@ class MatchLogger:
226
225
  f"{indent}Bravo points: {match_results.bravo_points}\n"
227
226
  )
228
227
 
229
- def _wait_for_results(self, adrs: CommonAddresses, dcd_players: set[int]) -> bool:
228
+ def _wait_for_results(self, dcd_players: set[int]) -> bool:
230
229
  id_mgr_adr = self._ctx.gecko.resolve_pointer_chain(
231
230
  Pointers.FRAMEWORK.convert(self._ctx.options.platform),
232
231
  OffsetChains.ID_MANAGER.offsets
@@ -4,7 +4,6 @@ from __future__ import annotations
4
4
 
5
5
  import binascii
6
6
  import ipaddress
7
- import logging
8
7
  import threading
9
8
  import time
10
9
  from base64 import b64decode
@@ -20,16 +19,11 @@ from .enums import Offsets, Pointers
20
19
  from .errors import SplatloggerError
21
20
  from .match_logger import MatchLogger
22
21
  from .tcpgecko import GeckoConnectionFailedError, TCPGecko
23
- from .tuples import AccountInfo, AppContext, CommonAddresses, Options, PlayerInfo
22
+ from .tuples import AccountInfo, AppContext, Options, PlayerInfo
24
23
 
25
24
  if TYPE_CHECKING:
26
25
  from .cemu_gecko import CemuGecko
27
26
 
28
- # Hack to remove the unidecode warning from clean-text
29
- logging.disable(logging.CRITICAL)
30
- from cleantext import clean # type: ignore[import-untyped]
31
- logging.disable(logging.NOTSET)
32
-
33
27
 
34
28
  def main(options: Options, listener: Callable[[AppContext], None] | None = None) -> None:
35
29
  with create_tcpgecko_instance(options) as gecko:
@@ -202,14 +196,14 @@ def splatlog(ctx: AppContext, match_logger: MatchLogger | None, match_count: int
202
196
  match_date = date or datetime.now()
203
197
  adrs = get_common_addresses(ctx)
204
198
  session_id = get_session_id(ctx)
205
- player_count = get_player_count(ctx, adrs.main_mgr_base_adr)
199
+ player_count = get_player_count(ctx, main_mgr_base_adr=adrs[0])
206
200
 
207
201
  print_if_not_silent(ctx, uf.player_table_header(ctx.options.service == "altendo"))
208
202
 
209
203
  player_info_list: list[PlayerInfo] = []
210
204
  request_errors: list[str] = []
211
205
 
212
- for player_info, act_info in collect_player_info(ctx, player_count, adrs.player_info_ary_adr):
206
+ for player_info, act_info in collect_player_info(ctx, player_count, player_info_ary_adr=adrs[1]):
213
207
  if act_info.request_error and act_info.request_error not in request_errors:
214
208
  request_errors.append(act_info.request_error)
215
209
 
@@ -225,13 +219,15 @@ def splatlog(ctx: AppContext, match_logger: MatchLogger | None, match_count: int
225
219
  f"Fetched at: {match_date.strftime('%Y-%m-%d %H:%M:%S')} (UTC {uf.get_utc_offset(match_date):+})")
226
220
 
227
221
  if match_logger:
228
- match_logger.log_match(match_date, session_id, match_count, player_info_list, adrs)
222
+ match_logger.log_match(match_date, session_id, match_count, player_info_list)
229
223
 
230
224
 
231
225
  @uf.handle_gecko_errors
232
- def get_common_addresses(ctx: AppContext) -> CommonAddresses:
233
- return CommonAddresses(ctx.gecko.peek32(Pointers.MAIN_MGR_BASE.convert(ctx.options.platform)),
234
- ctx.gecko.peek32(ctx.static_mem_adr + Offsets.STATICMEM_PLAYER_INFO_ARY_PTR))
226
+ def get_common_addresses(ctx: AppContext) -> tuple[int, int]:
227
+ return (
228
+ ctx.gecko.peek32(Pointers.MAIN_MGR_BASE.convert(ctx.options.platform)),
229
+ ctx.gecko.peek32(ctx.static_mem_adr + Offsets.STATICMEM_PLAYER_INFO_ARY_PTR)
230
+ )
235
231
 
236
232
 
237
233
  @uf.handle_gecko_errors
@@ -295,13 +291,10 @@ def get_player_info(ctx: AppContext, player_idx: int,
295
291
 
296
292
 
297
293
  def decode_player_name(player_info_raw: bytes) -> str:
298
- return clean(
294
+ return uf.clean_text(
299
295
  player_info_raw[Offsets.PLAYER_INFO_NAME:Offsets.PLAYER_INFO_NAME + Offsets.PLAYER_INFO_NAME_LENGTH]
300
296
  .decode("utf-16-be", errors="replace")
301
- .split("\u0000")[0],
302
- to_ascii=False,
303
- lower=False,
304
- no_line_breaks=True
297
+ .split("\u0000")[0]
305
298
  )
306
299
 
307
300
 
@@ -462,13 +455,10 @@ def get_altendo_account_info(player_pid: int) -> AccountInfo:
462
455
 
463
456
  try:
464
457
  mii_data = b64decode(mii_data_response.text.replace("\\n", "").replace("\\r", ""))
465
- mii_name = clean(
458
+ mii_name = uf.clean_text(
466
459
  mii_data[26:46]
467
460
  .decode("utf-16", errors="replace")
468
- .split("\u0000")[0],
469
- to_ascii=False,
470
- lower=False,
471
- no_line_breaks=True
461
+ .split("\u0000")[0]
472
462
  )
473
463
  except (binascii.Error, UnicodeDecodeError):
474
464
  request_error = "Failed to decode Mii name."
@@ -35,11 +35,6 @@ class AppContext:
35
35
  prompt_session: PromptSession | None = None
36
36
 
37
37
 
38
- class CommonAddresses(NamedTuple):
39
- main_mgr_base_adr: int
40
- player_info_ary_adr: int
41
-
42
-
43
38
  class AccountInfo(NamedTuple):
44
39
  network_id: str
45
40
  mii_name: str
@@ -2,7 +2,6 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- import logging
6
5
  import re
7
6
  import time
8
7
  from datetime import datetime
@@ -12,6 +11,7 @@ from xml.etree import ElementTree
12
11
 
13
12
  import requests
14
13
  from colorama import Fore, Style
14
+ from ftfy import fix_text
15
15
 
16
16
  from .errors import SplatloggerError
17
17
  from .tcpgecko import GeckoConnectionClosedError, GeckoReadMemError, TCPGecko, TCPGeckoError
@@ -20,10 +20,9 @@ from .tuples import AccountInfo, PlayerInfo
20
20
  if TYPE_CHECKING:
21
21
  from .match_logger import MatchLogger
22
22
 
23
- # Hack to remove the unidecode warning from clean-text
24
- logging.disable(logging.CRITICAL)
25
- from cleantext import clean # type: ignore[import-untyped]
26
- logging.disable(logging.NOTSET)
23
+
24
+ def clean_text(text: str) -> str:
25
+ return " ".join(fix_text(text).split())
27
26
 
28
27
 
29
28
  def player_table_header(altendo: bool) -> str:
@@ -117,13 +116,13 @@ def process_response(response: requests.Response, altendo: bool) -> tuple[str, s
117
116
  name = root[0].find("name")
118
117
  assert isinstance(name, ElementTree.Element) and name.text is not None
119
118
 
120
- return user_id.text, clean(name.text, to_ascii=False, lower=False, no_line_breaks=True)
119
+ return user_id.text, clean_text(name.text)
121
120
  except (ElementTree.ParseError, AssertionError):
122
121
  return None
123
122
 
124
123
 
125
124
  def compare_names(name1: str, name2: str) -> bool:
126
- return clean(name1) == clean(name2)
125
+ return clean_text(name1).casefold() == clean_text(name2).casefold()
127
126
 
128
127
 
129
128
  def get_last_match_count(match_logger: MatchLogger) -> int:
File without changes
File without changes