# Standard library imports
import datetime as dt
import logging
import os

# PyQt imports

# Third party imports

# App imports


class Config(object):
    AUDACITY_TEST_COMMAND = "Message"
    AUDACITY_TEST_RESPONSE = "Some message"
    AUDACITY_TIMEOUT_SECONDS = 20
    AUDIO_SEGMENT_CHUNK_SIZE = 10
    BITRATE_LOW_THRESHOLD = 192
    BITRATE_OK_THRESHOLD = 300
    COLOUR_BITRATE_LOW = "#ffcdd2"
    COLOUR_BITRATE_MEDIUM = "#ffeb6f"
    COLOUR_BITRATE_OK = "#dcedc8"
    COLOUR_CURRENT_PLAYLIST = "#7eca8f"
    COLOUR_CURRENT_TAB = "#248f24"
    COLOUR_ENDING_TIMER = "#dc3545"
    COLOUR_EVEN_PLAYLIST = "#d9d9d9"
    COLOUR_LABEL_TEXT = "#000000"
    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_QUERYLIST_SELECTED = "#d3ffd3"
    COLOUR_UNREADABLE = "#dc3545"
    COLOUR_WARNING_TIMER = "#ffc107"
    DBFS_SILENCE = -50
    DEFAULT_COLUMN_WIDTH = 200
    DISPLAY_SQL = False
    DO_NOT_IMPORT = "Do not import"
    ENGINE_OPTIONS = dict(pool_pre_ping=True)
    # ENGINE_OPTIONS = dict(pool_pre_ping=True, echo=True)
    EPOCH = dt.datetime(1970, 1, 1)
    ERRORS_FROM = ["noreply@midnighthax.com"]
    ERRORS_TO = ["kae@midnighthax.com"]
    EXTERNAL_BROWSER_PATH = "/usr/bin/vivaldi"
    FADE_CURVE_BACKGROUND = "lightyellow"
    FADE_CURVE_FOREGROUND = "blue"
    FADE_CURVE_MS_BEFORE_FADE = 5000
    FADEOUT_DB = -10
    FADEOUT_SECONDS = 5
    FADEOUT_STEPS_PER_SECOND = 5
    FILTER_DURATION_LONGER = "longer than"
    FILTER_DURATION_MINUTES = "minutes"
    FILTER_DURATION_SECONDS = "seconds"
    FILTER_DURATION_SHORTER = "shorter than"
    FILTER_PATH_CONTAINS = "contains"
    FILTER_PATH_EXCLUDING = "excluding"
    FILTER_PLAYED_COMPARATOR_ANYTIME = "Any time"
    FILTER_PLAYED_COMPARATOR_BEFORE = "before"
    FILTER_PLAYED_COMPARATOR_NEVER = "never"
    FILTER_PLAYED_DAYS = "days"
    FILTER_PLAYED_MONTHS = "months"
    FILTER_PLAYED_WEEKS = "weeks"
    FILTER_PLAYED_YEARS = "years"
    FUZZYMATCH_MINIMUM_LIST = 60.0
    FUZZYMATCH_MINIMUM_SELECT_ARTIST = 80.0
    FUZZYMATCH_MINIMUM_SELECT_TITLE = 80.0
    FUZZYMATCH_SHOW_SCORES = True
    HEADER_ARTIST = "Artist"
    HEADER_BITRATE = "bps"
    HEADER_DURATION = "Length"
    HEADER_END_TIME = "End"
    HEADER_INTRO = "Intro"
    HEADER_LAST_PLAYED = "Last played"
    HEADER_NOTE = "Notes"
    HEADER_START_GAP = "Gap"
    HEADER_START_TIME = "Start"
    HEADER_TITLE = "Title"
    HIDE_AFTER_PLAYING_OFFSET = 5000
    HIDE_PLAYED_MODE_SECTIONS = "SECTIONS"
    HIDE_PLAYED_MODE_TRACKS = "TRACKS"
    IMPORT_AS_NEW = "Import as new track"
    INFO_TAB_TITLE_LENGTH = 15
    INTRO_SECONDS_FORMAT = ".1f"
    INTRO_SECONDS_WARNING_MS = 3000
    LAST_PLAYED_TODAY_STRING = "Today"
    LAST_PLAYED_TOOLTIP_DATE_FORMAT = "%a, %d %b %Y"
    LOG_LEVEL_STDERR = logging.INFO
    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
    MAIN_WINDOW_TITLE = "MusicMuster"
    MAX_IMPORT_MATCHES = 5
    MAX_IMPORT_THREADS = 3
    MAX_INFO_TABS = 5
    MAX_MISSING_FILES_TO_REPORT = 10
    MILLISECOND_SIGFIGS = 0
    MINIMUM_ROW_HEIGHT = 30
    NO_QUERY_NAME = "Select query"
    NO_TEMPLATE_NAME = "None"
    NOTE_TIME_FORMAT = "%H:%M"
    OBS_HOST = "localhost"
    OBS_PASSWORD = "auster"
    OBS_PORT = 4455
    PLAY_NEXT_GUARD_MS = 10000
    PLAY_SETTLE = 500000
    PLAYLIST_ICON_CURRENT = ":/icons/green-circle.png"
    PLAYLIST_ICON_NEXT = ":/icons/yellow-circle.png"
    PLAYLIST_ICON_TEMPLATE = ":/icons/redstar.png"
    PREVIEW_ADVANCE_MS = 5000
    PREVIEW_BACK_MS = 5000
    PREVIEW_END_BUFFER_MS = 1000
    REPLACE_FILES_DEFAULT_SOURCE = "/home/kae/music/Singles/tmp"
    RESIZE_ROW_CHUNK_SIZE = 40
    RETURN_KEY_DEBOUNCE_MS = 1000
    ROOT = os.environ.get("ROOT") or "/home/kae/music"
    ROW_PADDING = 4
    ROWS_FROM_ZERO = True
    SCROLL_TOP_MARGIN = 3
    SECTION_ENDINGS = ("-", "+-", "-+")
    SECTION_HEADER = "[Section header]"
    SECTION_STARTS = ("+", "+-", "-+")
    SONGFACTS_ON_NEXT = False
    START_GAP_WARNING_THRESHOLD = 300
    SUBTOTAL_ON_ROW_ZERO = "[No subtotal on first row]"
    TOD_TIME_FORMAT = "%H:%M:%S"
    TRACK_TIME_FORMAT = "%H:%M:%S"
    VLC_MAIN_PLAYER_NAME = "MusicMuster Main Player"
    VLC_PREVIEW_PLAYER_NAME = "MusicMuster Preview Player"
    VLC_VOLUME_DEFAULT = 75
    VLC_VOLUME_DROP3db = 65
    WARNING_MS_BEFORE_FADE = 5500
    WARNING_MS_BEFORE_SILENCE = 5500
    WEB_ZOOM_FACTOR = 1.2
    WIKIPEDIA_ON_NEXT = False

    # These rely on earlier definitions
    HIDE_PLAYED_MODE = HIDE_PLAYED_MODE_SECTIONS
    IMPORT_DESTINATION = os.path.join(ROOT, "Singles")
    REPLACE_FILES_DEFAULT_DESTINATION = os.path.dirname(REPLACE_FILES_DEFAULT_SOURCE)
