Ejemplo n.º 1
0
def has_new_movie_format_support():
    binary, version = find_motion()
    if not binary:
        return False

    return version.lower().count('git') or update.compare_versions(
        version, '3.4') >= 0
Ejemplo n.º 2
0
def has_new_movie_format_support():
    try:
        binary, version = find_motion()  # @UnusedVariable

        return version.lower().count('git') or update.compare_versions(
            version, '3.4') >= 0

    except:
        return False
Ejemplo n.º 3
0
def needs_ffvb_quirks():
    # versions below 4.0 require a value range of 1..32767
    # for the ffmpeg_variable_bitrate parameter;
    # also the quality is non-linear in this range
    
    binary, version = find_motion()
    if not binary:
        return False

    return update.compare_versions(version, '4.0') < 0 
Ejemplo n.º 4
0
def needs_ffvb_quirks():
    # versions below 4.0 require a value range of 1..32767
    # for the ffmpeg_variable_bitrate parameter;
    # also the quality is non-linear in this range

    binary, version = find_motion()
    if not binary:
        return False

    return update.compare_versions(version, '4.0') < 0
Ejemplo n.º 5
0
def has_old_config_format():
    binary, version = find_motion()
    if not binary:
        return False

    if version.startswith('trunkREV'):  # e.g. "trunkREV599"
        version = int(version[8:])
        return version <= _LAST_OLD_CONFIG_VERSIONS[0]

    elif version.lower().count('git'):  # e.g. "Unofficial-Git-a5b5f13" or "3.2.12+git20150927mrdave"
        return False  # all git versions are assumed to be new

    else:  # stable release, should have the format "x.y.z"
        return update.compare_versions(version, _LAST_OLD_CONFIG_VERSIONS[1]) <= 0
Ejemplo n.º 6
0
def has_old_config_format():
    binary, version = find_motion()
    if not binary:
        return False

    if version.startswith('trunkREV'): # e.g. "trunkREV599"
        version = int(version[8:])
        return version <= _LAST_OLD_CONFIG_VERSIONS[0]

    elif version.lower().count('git'): # e.g. "Unofficial-Git-a5b5f13" or "3.2.12+git20150927mrdave"
        return False # all git versions are assumed to be new

    else: # stable release, should have the format "x.y.z"
        return update.compare_versions(version, _LAST_OLD_CONFIG_VERSIONS[1]) <= 0
Ejemplo n.º 7
0
def get_rtsp_support():
    binary, version = find_motion()
    if not binary:
        return []

    if version.startswith('trunkREV'):  # e.g. trunkREV599
        version = int(version[8:])
        if version > _LAST_OLD_CONFIG_VERSIONS[0]:
            return ['tcp']

    elif version.lower().count('git') or update.compare_versions(version, '3.4') >= 0:
        return ['tcp', 'udp']  # all git versions are assumed to support both transport protocols
    
    else:  # stable release, should be in the format x.y.z
        return []
Ejemplo n.º 8
0
def get_rtsp_support():
    binary, version = find_motion()
    if not binary:
        return []

    if version.startswith('trunkREV'): # e.g. trunkREV599
        version = int(version[8:])
        if version > _LAST_OLD_CONFIG_VERSIONS[0]:
            return ['tcp']

    elif version.lower().count('git') or update.compare_versions(version, '3.4') >= 0:
        return ['tcp', 'udp'] # all git versions are assumed to support both transport protocols
    
    else: # stable release, should be in the format x.y.z
        return []
Ejemplo n.º 9
0
def resolution_is_valid(width, height):
    # versions below 3.4 require width and height to be modulo 16;
    # newer versions require them to be modulo 8

    modulo = 8
    binary, version = find_motion()  # @UnusedVariable
    if version and not version.lower().count('git') and update.compare_versions(version, '3.4') < 0:
        modulo = 16
    
    if width % modulo:
        return False
    
    if height % modulo:
        return False

    return True
Ejemplo n.º 10
0
def resolution_is_valid(width, height):
    # versions below 3.4 require width and height to be modulo 16;
    # newer versions require them to be modulo 8

    modulo = 8
    binary, version = find_motion()  # @UnusedVariable
    if version and not version.lower().count('git') and update.compare_versions(version, '3.4') < 0:
        modulo = 16
    
    if width % modulo:
        return False
    
    if height % modulo:
        return False

    return True
Ejemplo n.º 11
0
def is_motion_pre42():
    binary, version = find_motion()
    if not binary:
        return False

    return update.compare_versions(version, '4.2') < 0
Ejemplo n.º 12
0
def has_new_movie_format_support():
    binary, version = find_motion()
    if not binary:
        return False

    return version.lower().count('git') or update.compare_versions(version, '3.4') >= 0 
Ejemplo n.º 13
0
def _test_requirements():
    if os.geteuid() != 0:
        if settings.SMB_SHARES:
            print("SMB_SHARES require root privileges")
            return False

        if settings.ENABLE_REBOOT:
            print("reboot requires root privileges")
            return False

    try:
        import tornado  # @UnusedImport

        has_tornado = True

    except ImportError:
        has_tornado = False

    if update.compare_versions(tornado.version, "3.1") < 0:
        has_tornado = False

    try:
        import jinja2  # @UnusedImport

        has_jinja2 = True

    except ImportError:
        has_jinja2 = False

    try:
        import PIL.Image  # @UnusedImport

        has_pil = True

    except ImportError:
        has_pil = False

    try:
        import pycurl  # @UnusedImport

        has_pycurl = True

    except ImportError:
        has_pycurl = False

    import mediafiles

    has_ffmpeg = mediafiles.find_ffmpeg() is not None

    import motionctl

    has_motion = motionctl.find_motion() is not None

    import v4l2ctl

    has_v4lutils = v4l2ctl.find_v4l2_ctl() is not None

    has_mount_cifs = smbctl.find_mount_cifs() is not None

    ok = True
    if not has_tornado:
        print("please install tornado (python-tornado), version 3.1 or greater")
        ok = False

    if not has_jinja2:
        print("please install jinja2 (python-jinja2)")
        ok = False

    if not has_pil:
        print("please install PIL (python-imaging)")
        ok = False

    if not has_pycurl:
        print("please install pycurl (python-pycurl)")
        ok = False

    if not has_ffmpeg:
        print("please install ffmpeg")
        ok = False

    if not has_motion:
        print("please install motion")
        ok = False

    if not has_v4lutils:
        print("please install v4l-utils")
        ok = False

    if settings.SMB_SHARES and not has_mount_cifs:
        print("please install cifs-utils")
        ok = False

    return ok