winipedia-utils 0.1.40__py3-none-any.whl → 0.1.41__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.
- winipedia_utils/pyside/ui/pages/player.py +22 -7
- winipedia_utils/pyside/ui/widgets/media_player.py +41 -15
- {winipedia_utils-0.1.40.dist-info → winipedia_utils-0.1.41.dist-info}/METADATA +1 -1
- {winipedia_utils-0.1.40.dist-info → winipedia_utils-0.1.41.dist-info}/RECORD +6 -6
- {winipedia_utils-0.1.40.dist-info → winipedia_utils-0.1.41.dist-info}/LICENSE +0 -0
- {winipedia_utils-0.1.40.dist-info → winipedia_utils-0.1.41.dist-info}/WHEEL +0 -0
@@ -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,
|
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(
|
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(
|
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,
|
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,
|
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
|
-
|
340
|
-
|
341
|
-
|
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,
|
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,
|
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
|
-
|
357
|
-
|
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
|
-
|
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
|
-
|
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(
|
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
|
-
|
420
|
+
position=position,
|
395
421
|
io_device=EncryptedPyQFile(path, aes_gcm),
|
396
422
|
source_url=QUrl.fromLocalFile(path),
|
397
423
|
)
|
@@ -50,11 +50,11 @@ 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=
|
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=
|
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
|
@@ -91,7 +91,7 @@ winipedia_utils/testing/tests/base/utils/utils.py,sha256=dUPDrgAxlfREQb33zz23Mfz
|
|
91
91
|
winipedia_utils/testing/tests/conftest.py,sha256=8RounBlI8Jq1aLaLNpv84MW4ne8Qq0aavQextDOp5ng,920
|
92
92
|
winipedia_utils/text/__init__.py,sha256=j2bwtK6kyeHI6SnoBjpRju0C1W2n2paXBDlNjNtaUxA,48
|
93
93
|
winipedia_utils/text/string.py,sha256=1jbBftlgxffGgSlPnQh3aRPIr8XekEwpSenjFCW6JyM,3478
|
94
|
-
winipedia_utils-0.1.
|
95
|
-
winipedia_utils-0.1.
|
96
|
-
winipedia_utils-0.1.
|
97
|
-
winipedia_utils-0.1.
|
94
|
+
winipedia_utils-0.1.41.dist-info/LICENSE,sha256=3PrKJ2CWNrnyyHaC_r0wPDSukVWgmjOxHr__eQVH7cw,1087
|
95
|
+
winipedia_utils-0.1.41.dist-info/METADATA,sha256=jPd3kqsgclQyiazoqQv2bcs25VFA7_chKzQrwtTFAF4,12576
|
96
|
+
winipedia_utils-0.1.41.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
97
|
+
winipedia_utils-0.1.41.dist-info/RECORD,,
|
File without changes
|
File without changes
|