control_env.py 1.42 KB
Newer Older
Gregory Martin committed
1
#!/usr/bin/env python
2 3 4 5
"""
VEDA Environment variables

"""
Gregory Martin committed
6 7 8 9 10 11 12 13 14 15 16

import os
import sys
import django
from django.utils.timezone import utc
from django.db import reset_queries

project_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if project_path not in sys.path:
    sys.path.append(project_path)

17
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'VEDA.settings.local')
Gregory Martin committed
18 19 20

django.setup()

Gregory Martin committed
21 22 23 24 25 26 27
from VEDA_OS01.models import Institution
from VEDA_OS01.models import Course
from VEDA_OS01.models import Video
from VEDA_OS01.models import Destination
from VEDA_OS01.models import Encode
from VEDA_OS01.models import URL
from VEDA_OS01.models import VedaUpload
muhammad-ammar committed
28
from VEDA.utils import get_config
Gregory Martin committed
29 30 31 32

"""
Central Config
"""
muhammad-ammar committed
33 34 35
CONFIG = get_config()

DEFAULT_WORK_DIRECTORY = os.path.join(
Gregory Martin committed
36 37 38
    os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
    'VEDA_WORKING'
)
muhammad-ammar committed
39
WORK_DIRECTORY = CONFIG.get('VEDA_WORKING', DEFAULT_WORK_DIRECTORY)
Gregory Martin committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

if not os.path.exists(WORK_DIRECTORY):
    os.mkdir(WORK_DIRECTORY)

"""
Occasionally this throws an error in the env,
but on EC2 with v_videocompile it's no biggie

"""
FFPROBE = "ffprobe"
FFMPEG = "ffmpeg"

"""
Generalized display and such

"""

"""
TERM COLORS
"""
NODE_COLORS_BLUE = '\033[94m'
NODE_COLORS_GREEN = '\033[92m'
NODE_COLORS_RED = '\033[91m'
NODE_COLORS_END = '\033[0m'
64 65 66 67 68 69

"""
Heal process start and end query times for 'video_trans_start' in hours
"""
HEAL_START = 6
HEAL_END = 144