import logging
import os
from typing import List, Optional


class Config(object):
    AUDIO_SEGMENT_CHUNK_SIZE = 10
    BITRATE_LOW_THRESHOLD = 192
    BITRATE_OK_THRESHOLD = 300
    CART_DIRECTORY = "/home/kae/radio/CartTracks"
    CARTS_COUNT = 10
    CARTS_HIDE = True
    COLON_IN_PATH_FIX = True
    COLOUR_BITRATE_LOW = "#ffcdd2"
    COLOUR_BITRATE_MEDIUM = "#ffeb6f"
    COLOUR_BITRATE_OK = "#dcedc8"
    COLOUR_CART_ERROR = "#dc3545"
    COLOUR_CART_PLAYING = "#248f24"
    COLOUR_CART_PROGRESSBAR = "#000000"
    COLOUR_CART_READY = "#ffc107"
    COLOUR_CART_UNCONFIGURED = "#f2f2f2"
    COLOUR_CURRENT_PLAYLIST = "#7eca8f"
    COLOUR_CURRENT_TAB = "#248f24"
    COLOUR_ENDING_TIMER = "#dc3545"
    COLOUR_EVEN_PLAYLIST = "#d9d9d9"
    COLOUR_LONG_START = "#dc3545"
    COLOUR_NEXT_PLAYLIST = "#ffc107"
    COLOUR_NEXT_TAB = "#b38600"
    COLOUR_NORMAL_TAB = "#000000"
    COLOUR_NOTES_PLAYLIST = "#b8daff"
    COLOUR_ODD_PLAYLIST = "#f2f2f2"
    COLOUR_UNREADABLE = "#dc3545"
    COLOUR_WARNING_TIMER = "#ffc107"
    COLUMN_NAME_ARTIST = "Artist"
    COLUMN_NAME_AUTOPLAY = "A"
    COLUMN_NAME_BITRATE = "bps"
    COLUMN_NAME_END_TIME = "End"
    COLUMN_NAME_LAST_PLAYED = "Last played"
    COLUMN_NAME_LEADING_SILENCE = "Gap"
    COLUMN_NAME_LENGTH = "Length"
    COLUMN_NAME_NOTES = "Notes"
    COLUMN_NAME_START_TIME = "Start"
    COLUMN_NAME_TITLE = "Title"
    DBFS_SILENCE = -50
    DEBUG_FUNCTIONS: List[Optional[str]] = []
    DEBUG_MODULES: List[Optional[str]] = ['dbconfig']
    DEFAULT_COLUMN_WIDTH = 200
    DISPLAY_SQL = False
    ERRORS_FROM = ['noreply@midnighthax.com']
    ERRORS_TO = ['kae@midnighthax.com']
    FADE_STEPS = 20
    FADE_TIME = 3000
    INFO_TAB_TITLE_LENGTH = 15
    LAST_PLAYED_TODAY_STRING = "Today"
    LOG_LEVEL_STDERR = logging.ERROR
    LOG_LEVEL_SYSLOG = logging.DEBUG
    LOG_NAME = "musicmuster"
    MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
    MAIL_PORT = int(os.environ.get('MAIL_PORT') or 25)
    MAIL_SERVER = os.environ.get('MAIL_SERVER') or "woodlands.midnighthax.com"
    MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
    MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS') is not None
    MAX_IMPORT_MATCHES = 5
    MAX_INFO_TABS = 5
    MAX_MISSING_FILES_TO_REPORT = 10
    MILLISECOND_SIGFIGS = 0
    MYSQL_CONNECT = os.environ.get('MYSQL_CONNECT') or "mysql+mysqldb://musicmuster:musicmuster@localhost/musicmuster_v2"  # noqa E501
    NOTE_TIME_FORMAT = "%H:%M:%S"
    ROOT = os.environ.get('ROOT') or "/home/kae/music"
    IMPORT_DESTINATION = os.path.join(ROOT, "Singles")
    SCROLL_TOP_MARGIN = 3
    TEXT_NO_TRACK_NO_NOTE = "[Section header]"
    TOD_TIME_FORMAT = "%H:%M:%S"
    TIMER_MS = 500
    TRACK_TIME_FORMAT = "%H:%M:%S"
    VOLUME_VLC_DEFAULT = 75
    VOLUME_VLC_DROP3db = 65
    WEB_ZOOM_FACTOR = 1.2
