mirror of
https://github.com/p2p-ld/numpydantic.git
synced 2025-01-10 13:54:26 +00:00
better video file not found position
This commit is contained in:
parent
7b0c64a7f6
commit
2f453f1d03
1 changed files with 3 additions and 3 deletions
|
@ -69,6 +69,9 @@ class VideoProxy:
|
||||||
"and it cant be reopened since source path cant be gotten "
|
"and it cant be reopened since source path cant be gotten "
|
||||||
"from VideoCapture objects"
|
"from VideoCapture objects"
|
||||||
)
|
)
|
||||||
|
if not self.path.exists():
|
||||||
|
raise FileNotFoundError(f"Video file {self.path} does not exist!")
|
||||||
|
|
||||||
self._video = VideoCapture(str(self.path))
|
self._video = VideoCapture(str(self.path))
|
||||||
return self._video
|
return self._video
|
||||||
|
|
||||||
|
@ -159,9 +162,6 @@ class VideoProxy:
|
||||||
return self[:]
|
return self[:]
|
||||||
|
|
||||||
def __getitem__(self, item: Union[int, slice, tuple]) -> np.ndarray:
|
def __getitem__(self, item: Union[int, slice, tuple]) -> np.ndarray:
|
||||||
if not self.path.exists():
|
|
||||||
raise FileNotFoundError(f"Video file {self.path} does not exist!")
|
|
||||||
|
|
||||||
if isinstance(item, int):
|
if isinstance(item, int):
|
||||||
# want a single frame
|
# want a single frame
|
||||||
return self._get_frame(item)
|
return self._get_frame(item)
|
||||||
|
|
Loading…
Reference in a new issue