<commit_before>#!/usr/bin/python

import commands
import time

from core.irlp import Irlp
from core.pushtotalk import PushToTalk
from core.voice import Voice

class VoiceMail(object):

    def __init__(self, voicesynthetizer):

        self.irlp = Irlp()
        self.pushtotalk = PushToTalk()
        self.voice = Voice()

	self.status = False
        self.audiofilewav = "voicemail.wav"
        self.voicesynthetizer = voicesynthetizer

    def __del__(self):
        pass
        #status, output = commands.getstatusoutput("rm " + self.audiofilewav)

    def status(self):
	return self.status

    def record(self):
        print '[Cancun] Voice Mail Record'
	self.voicesynthetizer.speechit("Graba el mensaje")
        time.sleep(1)
        while self.irlp.cosenabled() is 256:
            pass
        while self.irlp.cosenabled() is 0:
            pass
        proc = self.voice.recordstart()
        while self.irlp.cosenabled() is 256:
            pass
        self.voice.recordstop(proc)

    def play(self):
        print '[Cancun] Voice Mail Play'
        self.pushtotalk.openport()
        self.voice.play()
        self.pushtotalk.closeport()

    def erase(self):
        print '[Cancun] Voice Mail Erase'
	self.voicesynthetizer.speechit("Borrando el mensaje")
        self.voice.erase()

    def run(self):
        print '[Cancun] Voice Mail Run'
        self.record()
        self.play()
        self.erase()

if __name__ == '__main__':

    mytest = VoiceMail()
    mytest.record()
    mytest.play()
<commit_msg>Modules: VoiceMail Voice Fuctions<commit_after>#!/usr/bin/python

import commands
import time

from core.irlp import Irlp
from core.pushtotalk import PushToTalk
from core.voice import Voice

class VoiceMail(object):

    def __init__(self, voicesynthetizer):

        self.irlp = Irlp()
        self.pushtotalk = PushToTalk()
        self.voice = Voice()

        self.voicesynthetizer = voicesynthetizer

    def __del__(self):
        pass
        #status, output = commands.getstatusoutput("rm " + self.audiofilewav)

    def record(self):
        print '[Cancun] Voice Mail Record'
        time.sleep(1)
        while self.irlp.cosenabled() is 256:
            pass
        while self.irlp.cosenabled() is 0:
            pass
        proc = self.voice.record_start()
        while self.irlp.cosenabled() is 256:
            pass
        self.voice.record_stop(proc)

    def play(self):
        print '[Cancun] Voice Mail Play'
        self.pushtotalk.openport()
        self.voice.play()
        self.pushtotalk.closeport()

    def erase(self):
        print '[Cancun] Voice Mail Erase'
        self.voice.erase()

    def run(self, dtmf):
        print '[Cancun] Voice Mail Run'

        self.voicesynthetizer.speechit("Codigo recibido " + dtmf)
        self.voicesynthetizer.speechit("Identificate por favor")
        self.voice.record_filename('user.wav')
        self.record()

        self.voicesynthetizer.speechit("Deja tu mensaje")
        self.voice.record_filename('message.wav')
        self.record()

        self.voicesynthetizer.speechit("Mensaje de")
        self.voice.record_filename('user.wav')
        self.play()
        self.voice.record_filename('message.wav')
        self.play()
        
        #self.voicesynthetizer.speechit("Borrando el mensaje")
        #self.erase()

if __name__ == '__main__':

    mytest = VoiceMail()
    mytest.record()
    mytest.play()

{'fraction_non_alphanumeric': 0.10809231668127374, 'fraction_numerical': 0.004674262342973999, 'mean_word_length': 2.3634577603143416, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '312031', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1085, 'n_words': 234}