def __init__(self):
		MPServerAPI.__init__(self)

		self.audio_routes = []

		def sort_by_num(file_name):
			return [int(n) if n.isdigit() else n for n in re.split('(\d+)', file_name)]

		for r, _, files in os.walk(os.path.join(self.conf['media_dir'], "prompts")):
			files = [f for f in files if f not in UNPLAYABLE_FILES]
			files.sort(key=sort_by_num)

			for i, prompt in enumerate(files):
				if re.match(r'\d+\.Question.*\.wav$', prompt) or prompt == "1.IsHeCheatingMenu.wav":
					self.audio_routes.append({
						'wav' : os.path.join(r, prompt),
						'gather' : [CONTROL_KEY, ENTER_KEY] if i not in ANY_BUTTON else ALL_BUTTONS
					})
			
			break

		self.conf['d_files']['vid'] = {
			'log' : self.conf['d_files']['module']['log'],
			'pid' : os.path.join(BASE_DIR, ".monitor", "video_pad.pid.txt")
		}

		MPVideoPad.__init__(self)

		logging.basicConfig(filename=self.conf['d_files']['module']['log'], level=logging.DEBUG)
Example #2
0
	def __init__(self):
		MPServerAPI.__init__(self)
		self.conf['d_files'].update({
			'vid' : {
				'log' : os.path.join(BASE_DIR, ".monitor", "%s.log.txt" % self.conf['rpi_id'])
			},
			'video_listener_callback' : {
				'log' : os.path.join(BASE_DIR, ".monitor", "%s.log.txt" % self.conf['rpi_id']),
				'pid' : os.path.join(BASE_DIR, ".monitor", "video_listener_callback.pid.txt")
			}
		})

		MPVideoPad.__init__(self)
		logging.basicConfig(filename=self.conf['d_files']['module']['log'], level=logging.DEBUG)
    def __init__(self):
        MPServerAPI.__init__(self)

        for r, _, files in os.walk(os.path.join(self.conf["media_dir"], "key_sounds")):
            self.key_sounds = [os.path.join(r, f) for f in files if f not in UNPLAYABLE_FILES]
            shuffle(self.key_sounds)
            break

        self.main_video = "splendid_isolation.mp4"
        self.conf["d_files"].update(
            {
                "vid": {"log": os.path.join(BASE_DIR, ".monitor", "%s.log.txt" % self.conf["rpi_id"])},
                "video_listener_callback": {
                    "log": os.path.join(BASE_DIR, ".monitor", "%s.log.txt" % self.conf["rpi_id"]),
                    "pid": os.path.join(BASE_DIR, ".monitor", "video_listener_callback.pid.txt"),
                },
            }
        )

        MPVideoPad.__init__(self)
        logging.basicConfig(filename=self.conf["d_files"]["module"]["log"], level=logging.DEBUG)