2015-10-05 08:36:06 +02:00
|
|
|
"""
|
2016-01-08 23:49:06 +01:00
|
|
|
The video module contains the :class:`Video` class, which represents video
|
|
|
|
objects (AVI, MOV, etc.).
|
|
|
|
|
|
|
|
.. moduleauthor:: Jaisen Mathai <jaisen@jmathai.com>
|
2015-10-05 08:36:06 +02:00
|
|
|
"""
|
2015-10-02 09:20:27 +02:00
|
|
|
|
2015-10-05 08:36:06 +02:00
|
|
|
# load modules
|
2015-10-12 09:37:57 +02:00
|
|
|
from datetime import datetime
|
|
|
|
|
2015-10-02 09:20:27 +02:00
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import time
|
|
|
|
|
2016-03-12 20:09:28 +01:00
|
|
|
from .media import Media
|
2015-10-02 09:20:27 +02:00
|
|
|
|
2016-01-02 08:23:06 +01:00
|
|
|
|
2015-10-07 08:47:51 +02:00
|
|
|
class Video(Media):
|
2016-01-08 23:49:06 +01:00
|
|
|
|
|
|
|
"""A video object.
|
|
|
|
|
|
|
|
:param str source: The fully qualified path to the video file.
|
|
|
|
"""
|
|
|
|
|
2015-11-19 11:31:32 +01:00
|
|
|
__name__ = 'Video'
|
2016-01-08 23:49:06 +01:00
|
|
|
|
|
|
|
#: Valid extensions for video files.
|
2019-01-24 03:04:02 +01:00
|
|
|
extensions = ('avi', 'm4v', 'mov', 'mp4', 'mpg', 'mpeg', '3gp', 'mts')
|
2015-10-05 08:10:46 +02:00
|
|
|
|
2015-10-02 09:20:27 +02:00
|
|
|
def __init__(self, source=None):
|
2021-06-20 19:51:21 +02:00
|
|
|
super().__init__(source)
|
|
|
|
# self.set_gps_ref = False
|
|
|
|
|
|
|
|
|
|
|
|
def is_valid(self):
|
2021-06-27 07:18:35 +02:00
|
|
|
"""Check the file extension against valid file extensions.
|
|
|
|
|
|
|
|
The list of valid file extensions come from self.extensions.
|
|
|
|
|
|
|
|
:returns: bool
|
|
|
|
"""
|
|
|
|
source = self.source
|
|
|
|
return os.path.splitext(source)[1][1:].lower() in self.extensions
|