pynintendoparental 0.6.8__tar.gz → 0.6.9__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.
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/PKG-INFO +1 -1
- pynintendoparental-0.6.9/pynintendoparental/_version.py +1 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental/device.py +45 -11
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental.egg-info/PKG-INFO +1 -1
- pynintendoparental-0.6.8/pynintendoparental/_version.py +0 -1
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/LICENSE +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/README.md +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental/__init__.py +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental/api.py +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental/application.py +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental/authenticator/__init__.py +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental/authenticator/const.py +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental/const.py +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental/enum.py +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental/exceptions.py +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental/player.py +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental/py.typed +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental/utils.py +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental.egg-info/SOURCES.txt +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental.egg-info/dependency_links.txt +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental.egg-info/requires.txt +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental.egg-info/top_level.txt +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pyproject.toml +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/setup.cfg +0 -0
- {pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.6.9"
|
|
@@ -27,13 +27,14 @@ class Device:
|
|
|
27
27
|
self.daily_summaries: dict = {}
|
|
28
28
|
self.parental_control_settings: dict = {}
|
|
29
29
|
self.players: list[Player] = []
|
|
30
|
-
self.limit_time: int = 0
|
|
30
|
+
self.limit_time: int | float | None = 0
|
|
31
31
|
self.timer_mode: str = ""
|
|
32
|
-
self.today_playing_time: int = 0
|
|
33
|
-
self.
|
|
34
|
-
self.
|
|
35
|
-
self.
|
|
36
|
-
self.
|
|
32
|
+
self.today_playing_time: int | float = 0
|
|
33
|
+
self.today_time_remaining: int | float = 0
|
|
34
|
+
self.bedtime_alarm: time | None = None
|
|
35
|
+
self.month_playing_time: int | float = 0
|
|
36
|
+
self.today_disabled_time: int | float = 0
|
|
37
|
+
self.today_exceeded_time: int | float = 0
|
|
37
38
|
self.today_notices: list = []
|
|
38
39
|
self.today_important_info: list = []
|
|
39
40
|
self.today_observations: list = []
|
|
@@ -183,9 +184,10 @@ class Device:
|
|
|
183
184
|
current_day = day_of_week_regs.get(DAYS_OF_WEEK[datetime.now().weekday()], {})
|
|
184
185
|
self.timer_mode = self.parental_control_settings["playTimerRegulations"]["timerMode"]
|
|
185
186
|
if self.timer_mode == "EACH_DAY_OF_THE_WEEK":
|
|
186
|
-
self.limit_time = current_day
|
|
187
|
+
self.limit_time = current_day.get("timeToPlayInOneDay", {}).get("limitTime", None)
|
|
187
188
|
else:
|
|
188
|
-
self.limit_time = self.parental_control_settings
|
|
189
|
+
self.limit_time = self.parental_control_settings.get("playTimerRegulations", {}).get(
|
|
190
|
+
"dailyRegulations", {}).get("timeToPlayInOneDay", {}).get("limitTime", None)
|
|
189
191
|
|
|
190
192
|
if self.timer_mode == "EACH_DAY_OF_THE_WEEK":
|
|
191
193
|
if current_day["bedtime"]["enabled"]:
|
|
@@ -241,14 +243,46 @@ class Device:
|
|
|
241
243
|
_LOGGER.debug("New daily summary %s", self.daily_summaries)
|
|
242
244
|
try:
|
|
243
245
|
today_playing_time = self.get_date_summary()[0].get("playingTime", 0)
|
|
244
|
-
self.today_playing_time =
|
|
246
|
+
self.today_playing_time = 0 if today_playing_time is None else today_playing_time/60
|
|
245
247
|
today_disabled_time = self.get_date_summary()[0].get("disabledTime", 0)
|
|
246
|
-
self.today_disabled_time =
|
|
248
|
+
self.today_disabled_time = 0 if today_disabled_time is None else today_disabled_time/60
|
|
247
249
|
today_exceeded_time = self.get_date_summary()[0].get("exceededTime", 0)
|
|
248
|
-
self.today_exceeded_time =
|
|
250
|
+
self.today_exceeded_time = 0 if today_exceeded_time is None else today_exceeded_time/60
|
|
249
251
|
_LOGGER.debug("Cached playing, disabled and exceeded time for today for device %s",
|
|
250
252
|
self.device_id)
|
|
253
|
+
now = datetime.now()
|
|
254
|
+
current_minutes_past_midnight = now.hour * 60 + now.minute
|
|
255
|
+
minutes_in_day = 1440 # 24 * 60
|
|
256
|
+
|
|
257
|
+
# 1. Calculate remaining time based on play limit
|
|
258
|
+
|
|
259
|
+
time_remaining_by_play_limit = 0.0
|
|
260
|
+
if self.limit_time is None:
|
|
261
|
+
# No specific play limit, effectively limited by end of day for this calculation step.
|
|
262
|
+
time_remaining_by_play_limit = float(minutes_in_day - current_minutes_past_midnight)
|
|
263
|
+
elif self.limit_time == 0:
|
|
264
|
+
time_remaining_by_play_limit = 0.0
|
|
265
|
+
else:
|
|
266
|
+
time_remaining_by_play_limit = float(self.limit_time - self.today_playing_time)
|
|
267
|
+
|
|
268
|
+
time_remaining_by_play_limit = max(0.0, time_remaining_by_play_limit)
|
|
269
|
+
|
|
270
|
+
# Initialize overall remaining time with play limit constraint
|
|
271
|
+
effective_remaining_time = time_remaining_by_play_limit
|
|
272
|
+
|
|
273
|
+
# 2. Factor in bedtime alarm, if any, to further constrain remaining time
|
|
274
|
+
if self.bedtime_alarm is not None:
|
|
275
|
+
bedtime_dt = datetime.combine(now.date(), self.bedtime_alarm)
|
|
276
|
+
time_remaining_by_bedtime = 0.0
|
|
277
|
+
if bedtime_dt > now: # Bedtime is in the future today
|
|
278
|
+
time_remaining_by_bedtime = (bedtime_dt - now).total_seconds() / 60
|
|
279
|
+
time_remaining_by_bedtime = max(0.0, time_remaining_by_bedtime)
|
|
280
|
+
# else: Bedtime has passed for today or is now, so time_remaining_by_bedtime remains 0.0
|
|
281
|
+
|
|
282
|
+
effective_remaining_time = min(effective_remaining_time, time_remaining_by_bedtime)
|
|
251
283
|
|
|
284
|
+
self.today_time_remaining = int(max(0.0, effective_remaining_time)) # Ensure non-negative and integer
|
|
285
|
+
_LOGGER.debug("Calculated and updated the amount of time remaining for today: %s", self.today_time_remaining)
|
|
252
286
|
self.today_important_info = self.get_date_summary()[0].get("importantInfos", [])
|
|
253
287
|
self.today_notices = self.get_date_summary()[0].get("notices", [])
|
|
254
288
|
self.today_observations = self.get_date_summary()[0].get("observations", [])
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.6.8"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental/authenticator/__init__.py
RENAMED
|
File without changes
|
{pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental/authenticator/const.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental.egg-info/requires.txt
RENAMED
|
File without changes
|
{pynintendoparental-0.6.8 → pynintendoparental-0.6.9}/pynintendoparental.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|