winipedia-utils 0.1.40__py3-none-any.whl → 0.1.42__py3-none-any.whl

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.
@@ -18,11 +18,12 @@ class Player(BasePage):
18
18
  """Player page for the VideoVault application."""
19
19
 
20
20
  @abstractmethod
21
- def start_playback(self, path: Path) -> None:
21
+ def start_playback(self, path: Path, position: int = 0) -> None:
22
22
  """Start the playback.
23
23
 
24
24
  Args:
25
25
  path: The file path to start playback for.
26
+ position: The position to start playback from in milliseconds.
26
27
  """
27
28
 
28
29
  @final
@@ -35,7 +36,11 @@ class Player(BasePage):
35
36
 
36
37
  @final
37
38
  def play_file_from_func(
38
- self, play_func: Callable[..., Any], path: Path, **kwargs: Any
39
+ self,
40
+ play_func: Callable[..., Any],
41
+ path: Path,
42
+ position: int = 0,
43
+ **kwargs: Any,
39
44
  ) -> None:
40
45
  """Play a file using the specified function.
41
46
 
@@ -45,30 +50,40 @@ class Player(BasePage):
45
50
  Args:
46
51
  play_func: The function to call for playing the file.
47
52
  path: The file path to play.
53
+ position: The position to start playback from in milliseconds.
48
54
  **kwargs: Additional keyword arguments to pass to the play function.
49
55
  """
50
56
  # set current page to player
51
57
  self.set_current_page(self.__class__)
52
58
  # Stop current playback and clean up resources
53
- play_func(path, **kwargs)
59
+ play_func(path=path, position=position, **kwargs)
54
60
 
55
61
  @final
56
- def play_file(self, path: Path) -> None:
62
+ def play_file(self, path: Path, position: int = 0) -> None:
57
63
  """Play a regular video file.
58
64
 
59
65
  Args:
60
66
  path: The file path to play.
67
+ position: The position to start playback from in milliseconds.
61
68
  """
62
- self.play_file_from_func(self.media_player.play_file, path)
69
+ self.play_file_from_func(
70
+ self.media_player.play_file, path=path, position=position
71
+ )
63
72
 
64
73
  @final
65
- def play_encrypted_file(self, path: Path, aes_gcm: AESGCM) -> None:
74
+ def play_encrypted_file(
75
+ self, path: Path, aes_gcm: AESGCM, position: int = 0
76
+ ) -> None:
66
77
  """Play an encrypted video file.
67
78
 
68
79
  Args:
69
80
  path: The encrypted file path to play.
70
81
  aes_gcm: The AES-GCM cipher instance for decryption.
82
+ position: The position to start playback from in milliseconds.
71
83
  """
72
84
  self.play_file_from_func(
73
- self.media_player.play_encrypted_file, path, aes_gcm=aes_gcm
85
+ self.media_player.play_encrypted_file,
86
+ path=path,
87
+ position=position,
88
+ aes_gcm=aes_gcm,
74
89
  )
@@ -4,7 +4,6 @@ This module contains the media player class.
4
4
  """
5
5
 
6
6
  import time
7
- from collections.abc import Callable
8
7
  from functools import partial
9
8
  from pathlib import Path
10
9
  from typing import Any
@@ -328,7 +327,10 @@ class MediaPlayer(QMediaPlayer):
328
327
  self.setPosition(self.progress_slider.value())
329
328
 
330
329
  def play_video(
331
- self, set_source_func: Callable[..., Any], *args: Any, **kwargs: Any
330
+ self,
331
+ io_device: PyQIODevice,
332
+ source_url: QUrl,
333
+ position: int = 0,
332
334
  ) -> None:
333
335
  """Play the video.
334
336
 
@@ -336,28 +338,48 @@ class MediaPlayer(QMediaPlayer):
336
338
  source function with a delay to prevent freezing.
337
339
 
338
340
  Args:
339
- set_source_func: Function to call for setting the video source.
340
- *args: Additional positional arguments for the source function.
341
- **kwargs: Additional keyword arguments for the source function.
341
+ io_device: The PyQIODevice to use as the media source.
342
+ source_url: The QUrl representing the source location.
343
+ position: The position to start playback from in milliseconds.
342
344
  """
343
345
  self.stop()
344
346
 
347
+ self.resume_func = partial(self.resume_to_position, position=position)
348
+ self.mediaStatusChanged.connect(self.resume_func)
349
+
345
350
  # prevents freezing when starting a new video while another is playing
346
351
  QTimer.singleShot(
347
- 100, partial(self.set_source_and_play, set_source_func, *args, **kwargs)
352
+ 100,
353
+ partial(
354
+ self.set_source_and_play, io_device=io_device, source_url=source_url
355
+ ),
348
356
  )
349
357
 
358
+ def resume_to_position(
359
+ self, status: QMediaPlayer.MediaStatus, position: int
360
+ ) -> None:
361
+ """Resume playback to a position.
362
+
363
+ Args:
364
+ status: The current media status.
365
+ position: The position to resume playback from in milliseconds.
366
+ """
367
+ if status == QMediaPlayer.MediaStatus.BufferedMedia:
368
+ self.setPosition(position)
369
+ self.mediaStatusChanged.disconnect(self.resume_func)
370
+
350
371
  def set_source_and_play(
351
- self, set_source_func: Callable[..., Any], *args: Any, **kwargs: Any
372
+ self,
373
+ io_device: PyQIODevice,
374
+ source_url: QUrl,
352
375
  ) -> None:
353
376
  """Set the source and play the video.
354
377
 
355
378
  Args:
356
- set_source_func: Function to call for setting the video source.
357
- *args: Additional positional arguments for the source function.
358
- **kwargs: Additional keyword arguments for the source function.
379
+ io_device: The PyQIODevice to use as the media source.
380
+ source_url: The QUrl representing the source location.
359
381
  """
360
- set_source_func(*args, **kwargs)
382
+ self.set_source_device(io_device, source_url)
361
383
  self.play()
362
384
 
363
385
  def set_source_device(self, io_device: PyQIODevice, source_url: QUrl) -> None:
@@ -371,27 +393,31 @@ class MediaPlayer(QMediaPlayer):
371
393
  self.io_device = io_device
372
394
  self.setSourceDevice(self.io_device, self.source_url)
373
395
 
374
- def play_file(self, path: Path) -> None:
396
+ def play_file(self, path: Path, position: int = 0) -> None:
375
397
  """Play a regular video file.
376
398
 
377
399
  Args:
378
400
  path: The file path to the video file to play.
401
+ position: The position to start playback from in milliseconds.
379
402
  """
380
403
  self.play_video(
381
- self.set_source_device,
404
+ position=position,
382
405
  io_device=PyQFile(path),
383
406
  source_url=QUrl.fromLocalFile(path),
384
407
  )
385
408
 
386
- def play_encrypted_file(self, path: Path, aes_gcm: AESGCM) -> None:
409
+ def play_encrypted_file(
410
+ self, path: Path, aes_gcm: AESGCM, position: int = 0
411
+ ) -> None:
387
412
  """Play an encrypted video file.
388
413
 
389
414
  Args:
390
415
  path: The file path to the encrypted video file to play.
391
416
  aes_gcm: The AES-GCM cipher instance for decryption.
417
+ position: The position to start playback from in milliseconds.
392
418
  """
393
419
  self.play_video(
394
- self.set_source_device,
420
+ position=position,
395
421
  io_device=EncryptedPyQFile(path, aes_gcm),
396
422
  source_url=QUrl.fromLocalFile(path),
397
423
  )
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
2
+ <svg xmlns="http://www.w3.org/2000/svg" fill="#000000" width="800px" height="800px" viewBox="0 0 24 24"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg>
@@ -1,8 +1,13 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 330 330" width="24" height="24">
2
- <path d="M37.728,328.12c2.266,1.256,4.77,1.88,7.272,1.88
3
- c2.763,0,5.522-0.763,7.95-2.28l240-149.999
4
- c4.386-2.741,7.05-7.548,7.05-12.72c0-5.172-2.664-9.979-7.05-12.72
5
- L52.95,2.28c-4.625-2.891-10.453-3.043-15.222-0.4
6
- C32.959,4.524,30,9.547,30,15v300
7
- C30,320.453,32.959,325.476,37.728,328.12z"/>
8
- </svg>
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
3
+ <svg fill="#000000" height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
4
+ viewBox="0 0 512 512" xml:space="preserve">
5
+ <g>
6
+ <g>
7
+ <path d="M256,0C114.511,0,0,114.497,0,256c0,141.49,114.495,256,256,256c141.49,0,256-114.497,256-256C512,114.51,397.503,0,256,0
8
+ z M348.238,284.418l-120.294,69.507c-10.148,5.864-22.661,5.874-32.826,0.009c-10.158-5.862-16.415-16.699-16.415-28.426V186.493
9
+ c0-11.728,6.258-22.564,16.415-28.426c5.076-2.93,10.741-4.395,16.406-4.395c5.67,0,11.341,1.468,16.42,4.402l120.295,69.507
10
+ c10.149,5.864,16.4,16.696,16.4,28.418C364.639,267.722,358.387,278.553,348.238,284.418z"/>
11
+ </g>
12
+ </g>
13
+ </svg>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: winipedia-utils
3
- Version: 0.1.40
3
+ Version: 0.1.42
4
4
  Summary: A package with many utility functions
5
5
  License: MIT
6
6
  Author: Winipedia
@@ -50,22 +50,23 @@ winipedia_utils/pyside/ui/pages/__init__.py,sha256=p-maJQh7gYbXwhkqKU4wL6UNGzRAy
50
50
  winipedia_utils/pyside/ui/pages/base/__init__.py,sha256=p-maJQh7gYbXwhkqKU4wL6UNGzRAy988JP8_qLoTZDk,24
51
51
  winipedia_utils/pyside/ui/pages/base/base.py,sha256=-bn9rLc9hc98SZxlR7ohKZ1RU4GhccHG96462aqZ0CE,2624
52
52
  winipedia_utils/pyside/ui/pages/browser.py,sha256=bAk3WYcn_4oRTQtkKIbf9_aJUZnRU9ZF9QkvhLVG7Nc,886
53
- winipedia_utils/pyside/ui/pages/player.py,sha256=V5gfWzQSfnm-853y_psgIZCrakYedzn2TCs8HAI6IHY,2292
53
+ winipedia_utils/pyside/ui/pages/player.py,sha256=pE_DmOpiaFRnrtdxlSidg7eEo89pFwaOfLjpZqpu2OE,2861
54
54
  winipedia_utils/pyside/ui/widgets/__init__.py,sha256=p-maJQh7gYbXwhkqKU4wL6UNGzRAy988JP8_qLoTZDk,24
55
55
  winipedia_utils/pyside/ui/widgets/browser.py,sha256=0wZ13XE_i2HV3fT6YZqjE7U_VcNv-jYPgifFCMvHQB0,8411
56
56
  winipedia_utils/pyside/ui/widgets/clickable_widget.py,sha256=TIQsLYnzgo7hyVjq_mKxo7IoSdwb20qt6JgkJj59ZVE,1779
57
- winipedia_utils/pyside/ui/widgets/media_player.py,sha256=rpgfR6e6Y1aYGb5l4Ioyb9OfnOTy7OifJlf3pwBa4RQ,15173
57
+ winipedia_utils/pyside/ui/widgets/media_player.py,sha256=09PM6XamO_NivAqLW4ZhXnbFSs8vSVGtQkERqeEkwjs,15924
58
58
  winipedia_utils/pyside/ui/widgets/notification.py,sha256=vtD3KZvQoFWYat_poDZCywsVNciScFeA8dGC1Bih2so,2532
59
59
  winipedia_utils/pyside/ui/windows/__init__.py,sha256=p-maJQh7gYbXwhkqKU4wL6UNGzRAy988JP8_qLoTZDk,24
60
60
  winipedia_utils/pyside/ui/windows/base/__init__.py,sha256=p-maJQh7gYbXwhkqKU4wL6UNGzRAy988JP8_qLoTZDk,24
61
61
  winipedia_utils/pyside/ui/windows/base/base.py,sha256=httMbYu5QiHevD_2SrUTLnFat9nsvSNAtjTL84tRUao,1496
62
62
  winipedia_utils/resources/__init__.py,sha256=p-maJQh7gYbXwhkqKU4wL6UNGzRAy988JP8_qLoTZDk,24
63
63
  winipedia_utils/resources/svgs/__init__.py,sha256=p-maJQh7gYbXwhkqKU4wL6UNGzRAy988JP8_qLoTZDk,24
64
+ winipedia_utils/resources/svgs/delete_garbage_can.svg,sha256=UxEEh46w1JD4VViUBx-Ahaq5_ZR4zOjfeJn5_aM8114,318
64
65
  winipedia_utils/resources/svgs/download_arrow.svg,sha256=R5WNz0JOxkRi5LOuDtc_eZESZN4W0JAuvr-5_ZRqeks,244
65
66
  winipedia_utils/resources/svgs/exit_fullscreen_icon.svg,sha256=4wpP-pWg7z4c62c9MGUcU-rWcRVUEBSl1fGiJ1HDR3g,528
66
67
  winipedia_utils/resources/svgs/fullscreen_icon.svg,sha256=nN4Y5CA7AuwOvyhgtJWZtBT5uSzO7NFJivVRFNqooe0,408
67
68
  winipedia_utils/resources/svgs/pause_icon.svg,sha256=mNrEoAOhbvxsJmBg4xZ08kdahAG6gA4LqmHXYNOOKB0,182
68
- winipedia_utils/resources/svgs/play_icon.svg,sha256=U0RQ-S_WbcyyjeWC55BkcOtG64GfXALXlnB683foZUY,416
69
+ winipedia_utils/resources/svgs/play_icon.svg,sha256=hYzn2VI5t2llJ2TerEbDdqIvMUSFt9EJgSqRaS9oF1E,838
69
70
  winipedia_utils/resources/svgs/svg.py,sha256=-Dw6m7cm9CHT2076oZIMx7kTQw0v_ifJajXzWcpUtI0,430
70
71
  winipedia_utils/security/__init__.py,sha256=ZBa72J6MNtYumBFMoVc0ia4jsoS7oNgjaTCW0xDb6EI,53
71
72
  winipedia_utils/security/cryptography.py,sha256=zfxSDo7aE9ecmZNC6URMSEUYRpOuJ1iESg-WCSS5HP0,822
@@ -91,7 +92,7 @@ winipedia_utils/testing/tests/base/utils/utils.py,sha256=dUPDrgAxlfREQb33zz23Mfz
91
92
  winipedia_utils/testing/tests/conftest.py,sha256=8RounBlI8Jq1aLaLNpv84MW4ne8Qq0aavQextDOp5ng,920
92
93
  winipedia_utils/text/__init__.py,sha256=j2bwtK6kyeHI6SnoBjpRju0C1W2n2paXBDlNjNtaUxA,48
93
94
  winipedia_utils/text/string.py,sha256=1jbBftlgxffGgSlPnQh3aRPIr8XekEwpSenjFCW6JyM,3478
94
- winipedia_utils-0.1.40.dist-info/LICENSE,sha256=3PrKJ2CWNrnyyHaC_r0wPDSukVWgmjOxHr__eQVH7cw,1087
95
- winipedia_utils-0.1.40.dist-info/METADATA,sha256=vM1ZXS5qwL4E6__FLH-s55h95x6OhVw219Jz8p1SKus,12576
96
- winipedia_utils-0.1.40.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
97
- winipedia_utils-0.1.40.dist-info/RECORD,,
95
+ winipedia_utils-0.1.42.dist-info/LICENSE,sha256=3PrKJ2CWNrnyyHaC_r0wPDSukVWgmjOxHr__eQVH7cw,1087
96
+ winipedia_utils-0.1.42.dist-info/METADATA,sha256=xHnebx3zQCIu_lo6Ojsgjm7FlRH03_KEYMyTyIBkLMU,12576
97
+ winipedia_utils-0.1.42.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
98
+ winipedia_utils-0.1.42.dist-info/RECORD,,