import logging
import os
from typing import List, Optional


class Config(object):
    AUDACITY_COMMAND = "/usr/bin/audacity"
    AUDIO_SEGMENT_CHUNK_SIZE = 10
    CHECK_AUDACITY_AT_STARTUP = True
    COLOUR_CURRENT_HEADER = "#d4edda"
    COLOUR_CURRENT_PLAYLIST = "#7eca8f"
    COLOUR_CURRENT_TAB = "#248f24"
    COLOUR_ENDING_TIMER = "#dc3545"
    COLOUR_LONG_START = "#dc3545"
    COLOUR_NEXT_HEADER = "#fff3cd"
    COLOUR_NEXT_PLAYLIST = "#ffc107"
    COLOUR_NEXT_TAB = "#b38600"
    COLOUR_NORMAL_TAB = "#000000"
    COLOUR_NOTES_PLAYLIST = "#b8daff"
    COLOUR_PREVIOUS_HEADER = "#f8d7da"
    COLOUR_UNREADABLE = "#dc3545"
    COLOUR_WARNING_TIMER = "#ffc107"
    COLUMN_NAME_ARTIST = "Artist"
    COLUMN_NAME_AUTOPLAY = "A"
    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_FADE = -12
    DBFS_SILENCE = -50
    DEBUG_FUNCTIONS: List[Optional[str]] = []
    DEBUG_MODULES: List[Optional[str]] = ['dbconfig']
    DEFAULT_COLUMN_WIDTH = 200
    DEFAULT_IMPORT_DIRECTORY = "/home/kae/Nextcloud/tmp"
    DEFAULT_OUTPUT_DIRECTORY = "/home/kae/music/Singles"
    DISPLAY_SQL = False
    ERRORS_TO = ['kae@midnighthax.com']
    FADE_STEPS = 20
    FADE_TIME = 3000
    INFO_TAB_TITLE_LENGTH = 15
    INFO_TAB_URL = "https://www.wikipedia.org/w/index.php?search=%s"
    LAST_PLAYED_TODAY_STRING = "Today"
    LOG_LEVEL_STDERR = logging.DEBUG
    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_INFO_TABS = 3
    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
    NORMALISE_ON_IMPORT = True
    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
    TESTMODE = True
    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.4


config = Config
