proton-director/lib/audio_plugin.py

38 lines
968 B
Python

from debuggable import Debuggable
from random import randint, choice
from math import sqrt
from datetime import datetime, timedelta
from planning import Planning
from schedule import Schedule
class audioPlugin(Debuggable):
"""Planner for general slots allocations"""
name = "audioPlugin"
def __init__(self):
super(MyPlugin, self).__init__()
def sensor_base(self, blackboard):
# redis.get("redilysis.key")
# blackboard["audio_analysis"] = redilysis
pass
def planner_base(self, blackboard, planning: Planning):
interesting_list = []
for schedule in planning.schedules:
start_at = schedule.start_at
now = datetime.now()
if (now - start_at).total_seconds() < 3 :
continue
interesting_list.append(schedule)
mood = get_mood_from_audio()
for schedule in interesting_list:
schedule.content["mood"] = mood