"""Programa para que el movil envie el mensaje que tu le digas en codigo morse mediante mms... Programa creado por m8ax""" import appuifw import e32 from random import randint import mmsmodule import graphics import math, time def _raw_input( txt ): return appuifw.query( unicode( txt ), "text" ) def lerele(n): HOR=n/3600 MIN=(n /60)%60 SEG= n % 60 return (str(HOR)+"h:"+str(MIN)+"m:"+str(SEG))+"s" appuifw.app.title=u"^MvIiIaX^ TextoMorse" appuifw.note(u"Bienvenid@ Al Programa ^MvIiIaX^ TextoMorse Programado Por Marcos Ochoa Diez.", "info" ) appuifw.app.screen='full' morse=[""] * 255 morse[97]=".-" morse[98]="-..." morse[99]="-.-." morse[100]="-.." morse[101]="." morse[102]="..-." morse[103]="--." morse[104]="...." morse[105]=".." morse[106]=".---" morse[107]="-.-" morse[108]=".-.." morse[109]="--" morse[110]="-." morse[111]="---" morse[112]=".--." morse[113]="--.-" morse[114]=".-." morse[115]="..." morse[116]="-" morse[117]="..-" morse[118]="...-" morse[119]=".--" morse[120]="-..-" morse[121]="-.--" morse[122]="--.." morse[48]="-----" morse[49]=".----" morse[50]="..---" morse[51]="...--" morse[52]="....-" morse[53]="....." morse[54]="-...." morse[55]="--..." morse[56]="---.." morse[57]="----." morse[32]=" " morse[192]=".-" morse[193]=".-" morse[200]="." morse[201]="." morse[204]=".." morse[205]=".." morse[210]="---" morse[211]="---" morse[217]="..-" morse[218]="..-" morse[224]=".-" morse[225]=".-" morse[232]="." morse[233]="." morse[236]=".." morse[237]=".." morse[242]="---" morse[243]="---" morse[249]="..-" morse[250]="..-" totales="" mandate=int( _raw_input("1-MMS Personal 2-Frase De Un Texto 3-Fichero A Morse") ) if mandate<>3: telf=int( _raw_input("Movil A Enviar MMS En Morse") ) if mandate==3: appuifw.note(u"Se Creara Un Fichero En MORSE Del Fichero Que Le Indiquemos Pero No Lo Mandara Por MMS", "info" ) lola="e:\\system\\apps\\python\\" fichero=_raw_input("Introduce Nombre De Fichero De Texto Debe Estar En e:\system\apps\python") elfinalesta=lola+fichero archivo=open(elfinalesta,'r') contenido=archivo.readlines() totallineas=len(contenido) comienza=time.time() sumatorio=0 points=0 rays=0 espacio=0 f = open( "e:\\FicheroEnMorse.TxT", "w" ) f.write( "((((( TEXTO EN MORSE DEL FICHERO "+str(fichero)+" PROGRAMADO POR M8AX )))))\n" ) f.write("--------------------------------------------------------------------------------------\n") for k in xrange(0,totallineas,1): totales="" msg2="" enmorse="" if k % 25==0: print"\nPor.Completado. "+str((k*100)/totallineas) acaba=time.time()-comienza if acaba<>0: print"\nCarac.Seg "+str(sumatorio/acaba) totales=contenido[k].lower() sumatorio+=len(totales) for jj in xrange (0,len(totales),1): e32.ao_yield() msg2+=totales[jj]+" " for kk in xrange (0,len(msg2),1): e32.ao_yield() enmorse+= unicode(morse[ord(msg2[kk])],'iso-8859-1') for ll in xrange(0,len(enmorse),1): if enmorse[ll]==".": points+=1 if enmorse[ll]=="-": rays+=1 if enmorse[ll]==" ": espacio+=1 f.write(enmorse+"\n") f.write("--------------------------------------------------------------------------------------\n") f.write("Texto Compuesto De "+str(points)+" Puntos "+str(rays)+" Rayas Y "+str(espacio)+" Espacios, "+" Lo Que Hace Un Total De "+str(rays+espacio+points)+" Caracteres...\n") f.write("----------------------------------------------------------------------------------------") f.close() acaba=time.time()-comienza print"\nTrabajo Completado. En "+lerele(int(acaba)) print"\nCaracteres Por Segundo Convertidos A Morse. "+str(sumatorio/acaba) print"\n^MvIiIaX^ Corp. 2006" if mandate==1: msg=appuifw.query(u'Introduce Un Mensaje Para Pasar A Morse', 'text',u'').lower() totales+=msg msg="" msg2="" enmorse="" pregunta=int( _raw_input("Continuar Mensaje 1-SI 2-NO") ) while pregunta==1: msg=appuifw.query(u'Sigue Escribiendo El Mensaje', 'text',u'').lower() pregunta=int( _raw_input("Continuar Mensaje 1-SI 2-NO") ) totales+=msg msg="" for k in xrange (0,len(totales),1): e32.ao_yield() msg2+=totales[k]+" " for k in xrange (0,len(msg2),1): e32.ao_yield() enmorse+= unicode(morse[ord(msg2[k])],'iso-8859-1') f = open( "d:\\MorseM8ax.htm", "w" ) f.write( "((((( MENSAJE ENVIADO POR MARCOS OCHOA DIEZ. !! DESCIFRALO !! )))))" ) f.write(enmorse) f.close() mmsmodule.mms_send(unicode(str(telf)), unicode("!! Descifralo !!",'iso-8859-1'),unicode("d:\\MorseM8ax.HTM")) if mandate==2: totales="" msg2="" enmorse="" lola="e:\\system\\apps\\python\\" fichero=_raw_input("Introduce Nombre De Fichero De Texto Debe Estar En e:\system\apps\python") cuan=int( _raw_input("Cuantas Frases Aleatorias Del Texto Seleccionamos Para Mandar") ) elfinalesta=lola+fichero archivo=open(elfinalesta,'r') contenido=archivo.readlines() totallineas=len(contenido) for tensa in xrange(0,cuan,1): e32.ao_yield() totales+=contenido[randint(0,totallineas-5)].lower() for k in xrange (0,len(totales),1): e32.ao_yield() msg2+=totales[k]+" " for k in xrange (0,len(msg2),1): e32.ao_yield() enmorse+= unicode(morse[ord(msg2[k])],'iso-8859-1') f = open( "d:\\MorseM8ax.HTM", "w" ) f.write( "((((( MENSAJE ENVIADO POR MARCOS OCHOA DIEZ. !! DESCIFRALO !! )))))" ) f.write(enmorse) f.close() mmsmodule.mms_send(unicode(str(telf)), unicode("!! Descifralo !!",'iso-8859-1'),unicode("d:\\MorseM8ax.HTM")) if mandate<>3: app=appuifw.app app.screen='full' c = appuifw.Canvas() appuifw.app.body=c draw = graphics.Draw(c) if mandate==1: print "\n"+totales+" Caracteres Totales. "+str(len(totales)) else: print unicode("\n"+totales+" Caracteres Totales. "+str(len(totales)),'iso-8859-1') print "\n"+enmorse+ " Caracteres Totales. "+str(len(enmorse)) print "\nMMS Enviado A. "+str(telf) print "\n^MvIiIaX^ Corp. 2006" c.rectangle((0,0,176,208), fill = 0x000000) for i in xrange(0,100,1): e32.ao_yield() color=(randint(0,255),randint(0,255),randint(0,255)) if i%2==0: c.rectangle((0,0,176,208), fill = 0xffffff) c.text([7, 190-5], u"Enviando MMS A "+str(telf) , color) e32.ao_sleep(0.1) else: c.rectangle((0,0,176,208), fill = 0x000000) c.text([7, 190-5], u"Enviando MMS A "+str(telf) , color) e32.ao_sleep(0.1)