pypetkitapi 1.10.1__tar.gz → 1.10.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pypetkitapi
3
- Version: 1.10.1
3
+ Version: 1.10.2
4
4
  Summary: Python client for PetKit API
5
5
  License: MIT
6
6
  Author: Jezza34000
@@ -51,7 +51,7 @@ from .media import DownloadDecryptMedia, MediaCloud, MediaFile, MediaManager
51
51
  from .purifier_container import Purifier
52
52
  from .water_fountain_container import WaterFountain
53
53
 
54
- __version__ = "1.10.1"
54
+ __version__ = "1.10.2"
55
55
 
56
56
  __all__ = [
57
57
  "CTW3",
@@ -451,7 +451,7 @@ class Litter(BaseModel):
451
451
  service_status: int | None = Field(None, alias="serviceStatus")
452
452
  total_time: int | None = Field(None, alias="totalTime")
453
453
  with_k3: int | None = Field(None, alias="withK3")
454
- User: UserDevice | None = None
454
+ user: UserDevice | None = None
455
455
  device_records: list[LitterRecord] | None = None
456
456
  device_stats: LitterStats | None = None
457
457
  device_pet_graph_out: list[PetOutGraph] | None = None
@@ -102,7 +102,6 @@ class MediaManager:
102
102
  self, storage_path: Path, device_id: int
103
103
  ) -> None:
104
104
  """Construct the media file table for disk storage."""
105
-
106
105
  self.media_table.clear()
107
106
 
108
107
  today_str = datetime.now().strftime("%Y%m%d")
@@ -114,7 +113,7 @@ class MediaManager:
114
113
  video_path = record_path / "video"
115
114
 
116
115
  # Regex pattern to match valid filenames
117
- valid_pattern = re.compile(rf"^{device_id}_\d+\.(jpg|avi)$")
116
+ valid_pattern = re.compile(rf"^(?:\d+_)?{device_id}_\d+\.(jpg|avi)$")
118
117
 
119
118
  # Populate the media table with event_id from filenames
120
119
  for subdir in [snapshot_path, video_path]:
@@ -130,7 +129,7 @@ class MediaManager:
130
129
  if entry.is_file() and valid_pattern.match(entry.name):
131
130
  _LOGGER.debug("Entries found: %s", entry.name)
132
131
  event_id = Path(entry.name).stem
133
- timestamp = Path(entry.name).stem.split("_", 1)[1]
132
+ timestamp = self._extraire_timestamp(str(entry.name))
134
133
  media_type_str = Path(entry.name).suffix.lstrip(".")
135
134
  try:
136
135
  media_type = MediaType(media_type_str)
@@ -148,6 +147,13 @@ class MediaManager:
148
147
  )
149
148
  )
150
149
 
150
+ @staticmethod
151
+ def _extraire_timestamp(nom_fichier: str) -> int:
152
+ match = re.search(r"_(\d+)\.[a-zA-Z0-9]+$", nom_fichier)
153
+ if match:
154
+ return int(match.group(1))
155
+ return 0
156
+
151
157
  async def prepare_missing_files(
152
158
  self,
153
159
  media_cloud_list: list[MediaCloud],
@@ -187,7 +187,7 @@ build-backend = "poetry.core.masonry.api"
187
187
 
188
188
  [tool.poetry]
189
189
  name = "pypetkitapi"
190
- version = "1.10.1"
190
+ version = "1.10.2"
191
191
  description = "Python client for PetKit API"
192
192
  authors = ["Jezza34000 <info@mail.com>"]
193
193
  readme = "README.md"
@@ -209,7 +209,7 @@ ruff = "^0.8.1"
209
209
  types-aiofiles = "^24.1.0.20240626"
210
210
 
211
211
  [tool.bumpver]
212
- current_version = "1.10.1"
212
+ current_version = "1.10.2"
213
213
  version_pattern = "MAJOR.MINOR.PATCH"
214
214
  commit_message = "bump version {old_version} -> {new_version}"
215
215
  tag_message = "{new_version}"
File without changes
File without changes