woof/main.py

46 lines
945 B
Python
Raw Normal View History

2022-01-30 23:52:17 +00:00
import os, sys
2021-10-07 04:02:16 +00:00
import logging
2022-01-30 23:52:17 +00:00
logging.basicConfig(stream=sys.stdout,
2021-10-07 04:02:16 +00:00
format='[%(asctime)s] %(levelname)s %(module)s/%(funcName)s - %(message)s',
level=logging.DEBUG if os.environ.get('DEBUG') else logging.INFO)
2021-10-06 09:04:07 +00:00
import time
2021-10-07 04:02:16 +00:00
import json
2021-10-06 09:04:07 +00:00
import pygame
2021-10-07 04:02:16 +00:00
import secrets
2021-10-06 09:04:07 +00:00
CHIME = 'chime.ogg'
FRONTDOOR = 'frontdoor.ogg'
BACKDOOR = 'backdoor.ogg'
def play_sound(filename):
pygame.mixer.music.load(filename)
pygame.mixer.music.play()
2021-10-07 04:02:16 +00:00
logging.info('Playing sound %s', filename)
2021-10-06 09:04:07 +00:00
while pygame.mixer.music.get_busy():
pygame.time.Clock().tick(10)
def backdoor():
play_sound(CHIME)
play_sound(BACKDOOR)
2021-10-07 04:02:16 +00:00
time.sleep(0.75)
2021-10-06 09:04:07 +00:00
play_sound(CHIME)
play_sound(BACKDOOR)
2021-10-07 04:02:16 +00:00
if __name__ == '__main__':
logging.info('')
logging.info('==========================')
logging.info('Booting up...')
pygame.init()
2022-01-30 23:52:17 +00:00
pygame.mixer.pre_init(buffer=4096)
pygame.mixer.init(buffer=4096)
2021-10-06 09:04:07 +00:00
2022-01-31 00:05:24 +00:00
backdoor()