import logging

#width
ScreenX = 80
#height
ScreenY = 40

DefaultBrightness = 0.6

Serial = "/dev/ttyACM0"

# kills app after some seconds if it sends no data
NoDataTimeout = 40

LogLevel = logging.DEBUG

UseGui = True
GuiFPS = 20
GuiScaleFactor = 15

WebHost = "0.0.0.0"
WebPort = 8000

# first app is always running as default    
Apps = [

    {"name": "backlight", "cmd": "apps/backlight.py", "white": True},

    {"guiname": "Lines", "name": "lines", "cmd": "./lines.py", "persistent": False, "path": "./apps/"},
    {"guiname": "Wolfram", "name": "wolfram", "cmd": "./wolfram.py", "persistent": False, "path": "./apps/"},
    {"guiname": "Digi Clock", "name": "digiclock", "cmd": "./digi_clock.py", "persistent": False, "path": "./apps/"},
    {"guiname": "Text Scroller MQTT", "name": "textscroll", "cmd": "./textscroll.py", "persistent": False, "path": "./apps/"},
    {"guiname": "Flicker", "name": "flicker", "cmd": "apps/flicker"},

    {"guiname": "Pixelflut", "name": "pixelflut", "cmd": "apps/pixelflut", "persistent": True},
    # {"guiname": "Pong", "name": "pong", "cmd": "apps/pong.py"},
    {"guiname": "YoutubeDL", "name": "youtubedl", "cmd": "apps/youtubedl.sh", "persistent": False},
    # {"guiname": "Show Framebuffer", "name": "fbcp", "cmd": ["apps/fbcp", "/dev/fb0"]},
    {"guiname": "Strobo", "name": "strobo", "cmd": "apps/strobo.py"},
    # {"guiname": "Beispiel", "name": "example", "cmd": "apps/example.py"},
    # {"guiname": "Beispiel2", "name": "example2", "cmd": "apps/example2.py", "white": True},
    {"guiname": "Fibonacci Clock", "name": "fibonacci-clock", "cmd": "apps/fibonacci-clock.py"},
    {"guiname": "Wget Video/Gif/Images", "name": "wget", "cmd": "apps/wget.sh", "persistent": False},


    # juergen/pixelfoo
    {"guiname": "Congress noise", "name": "cnoise", "cmd": "pixelfoo/target/release/cnoise", "persistent": False},
    {"guiname": "Game of Life", "name": "life", "cmd": "pixelfoo/target/release/life", "persistent": False},
    {"guiname": "Matrix Code", "name": "matrix-code", "cmd": "pixelfoo/target/release/matrix-code", "persistent": False},
    {"guiname": "Lorenz Attractor", "name": "lorenz", "cmd": "pixelfoo/target/release/lorenz", "persistent": False},
    {"guiname": "Dual Moodlight", "name": "bimood", "cmd": "pixelfoo/target/release/bimood", "persistent": False},
    {"guiname": "Maze", "name": "maze", "cmd": "pixelfoo/target/release/maze", "persistent": False},
    {"guiname": "Dual Maze", "name": "dualmaze", "cmd": "pixelfoo/target/release/dualmaze", "persistent": False, "persistent": False},
    {"guiname": "Predator & Prey", "name": "predprey", "cmd": "pixelfoo/target/release/predprey", "persistent": False},

    # { "guiname": "Beat Saber Ceiling", "name": "beatsaberceiling", "cmd": "./beatsaberceiling.py", "path": "apps/beatsaberceiling" },

    # mathpixel
    {"guiname": "Structure formation", "name": "swifthohenberg", "cmd": "apps/swifthohenberg.py", "persistent": False},
    {"guiname": "Quadratisch", "name": "quadratic", "cmd": "apps/quadratic.py"},
    {"guiname": "Pendel", "name": "pendulum", "cmd": "apps/pendlum.py"},
    {"guiname": "Konvergenz", "name": "convergence", "cmd": "apps/convergence.py"},
    {"guiname": "Sinic", "name": "sinic", "cmd": "apps/sinic.py"},
    {"guiname": "Sinic 2", "name": "sinic2", "cmd": "apps/sinic2.py"},

    # pixelthud
    {"guiname": "Fading Pixels", "name": "fadingpxls", "cmd": "apps/fading_pixels.py", "persistent": False},
    {"guiname": "Plane Wave", "name": "planewave", "cmd": "apps/plane_wave.py", "persistent": False},
    {"guiname": "Rock-paper-scissors-spock-lizard", "name": "rps", "cmd": "apps/rps.py", "persistent": False},
    {"guiname": "Doom Fire", "name": "doomfire", "cmd": "apps/doom_fire_psx2.py", "persistent": False},
    # {"guiname": "Maxwell FDTD", "name": "fdtd", "cmd": "apps/fdtd.py", "persistent": False},

    #{"guiname": "Stream", "name": "stream", "cmd": "apps/stream.sh", "persistent": False},
    #{"guiname": "Wget Video/Gif/Images", "name": "wget", "cmd": "apps/wget.sh", "persistent": False},
    #{"guiname": "Tetris", "name": "tetris", "cmd": "apps/deckentetris/deckentetris.py", "persistent": False},
    #{"guiname": "SkyScrapper", "name": "sky", "cmd": "apps/weather/main.py"},
    #{"guiname": "Strobo", "name": "strobo", "cmd": "apps/strobo.py", "persistent": False},
    #{"guiname": "Snake", "name": "snake", "cmd": "apps/snake.py", "persistent": False},
    #{"name": "gif", "cmd": "apps/gif.sh"},
    #{"name": "colormap", "cmd": "apps/colormap.py"},
]   

# load additional apps from config/
# import os
# import os.path
# configs = os.listdir("configs/")
# import importlib
# for config in configs:
#     file, ext = os.path.splitext(os.path.basename(config))
#     if ext != ".py" or file[0] == "_":
#         continue
#     modname = "configs."+file
#     lib = importlib.import_module(modname)
#     Apps += lib.Apps
