from redis import Redis

redisCred = {"host": "192.168.0.27", "port": 30036, "password": "bignigga123"}

def connect_redis():
    try:
        client = Redis(host=redisCred["host"], port=redisCred["port"], password=redisCred["password"])

        response = client.ping()
        if response:
            print("Connected to Redis successfully!")
            return client
        else:
            print("Failed to connect to Redis!")
            return None
    except Exception as e:
        print(f"An error occurred: {e}")
        return None
    
def get_local_db_connection():
    import psycopg2
    from psycopg2.extras import RealDictCursor
    conn = psycopg2.connect(
        host='192.168.0.27',
        port=5432,
        dbname='streamaster',
        user='oscar',
        password='j0cy8c311024x3'
    )
    cursor = conn.cursor(cursor_factory=RealDictCursor)
    return conn, cursor

VIDEOS_PER_PAGE    = 40
DASHBOARD_PER_PAGE = 100
THUMB_DIR          = "static/thumbnails"
THUMB_WIDTH        = 640
FF_QUALITY         = "80"

VIDEO_DIRS = [
    "U:/encoded",
    "U:/count_sorted",
    "E:/streamaster/downloaded"
]