Dedicado a mis proyectos en Gambas ,un lenguaje de programación parecido al Visual Basic + Java pero ampliamente mejorado y...¡¡para gnu/linux!!.La potencia del gnu/linux sumada a la facilidad del Basic



Consultas, Desarrollo de programas y petición de presupuestos:



lunes, 13 de diciembre de 2010

Front-end: Converter. ogv . Avi 2 º version

The advantage of a program that is GPL licensed free software is that anyone with knowledge and located anywhere in the world, can improve the program, and everyone will benefit.


This is a clear example:



Then I comment further improvement of the "converter .ogv . Avi", was produced by a forum member razaAztk gambas-es.org.

It's about putting a bar indicating the status of the conversion, which is useful to know how much time remains to complete the conversion.




Comment a bit as it has managed to:

Has created a process as follows:



hproc = EXEC ["mencoder", TextBoxentrada.text, "-ovc", "xvid", "-oac", "mp3lame", "-xvidencopts", "pass=1", "-o", TextBoxsalida.text] FOR READ AS "Mencorder"

So each time you send something to the process standard output, the event is thrown Mencorder_Read ()

With this subroutine, read every time there is an exit in the terminal:
 



PUBLIC SUB Mencorder_Read()

  DIM sLine AS String
  DIM sCad AS String[]
  DIM vx AS Float

  READ #LAST, sLine, -50
  'PRINT sLine
  sLine = Trim(sLine)
  IF sLine LIKE "*[0-9]*%*" THEN
    sCad = Split(sLine, " ", "'", TRUE)
    TRY vx = Val(Replace$(Replace$(Replace$(sCad[3], "%", ""), "(", ""), ")", "")) / 100
    IF vx > 0 THEN
      pb.Value = vx
    ENDIF
  ENDIF
END  
And analyzing the output is generated by the terminal EXEC (READ #LAST, slin, -50). read a few characters (in this case 50)
Each line is launching the Read event, the lines that interest us for the progress bar are of the type:




Pos:   1.3s     22f (84%)  0.00fps Trem:   0min   0mb  A-V:0.140 [1705:7]
 So when you find a number with percentage in the line being analyzed (  IF sLine LIKE "*[0-9]*%*" THEN).

 
vx = Val(Replace$(Replace$(Replace$(sCad[3], "%", ""), "(", ""), ")", "")) / 100

A
nd take the field 4 (scad [3] (remember that arrays start with 0, so there is 4), which is the (84%). We remove the excess characters (%) and we had a number.This number is going to pb.value (the progress bar), and so he shows how it is developing the process.

This code is very useful as knowing the output terminal generating a command executed by the EXEC command, may be essential for the successful implementation of our program.
 

Imagine for example that mencoder is not installed on your computer, we can alert the user that has that "we found that mencoder is not installed" ... something that no doubt will be very useful.
 

Download links: 
http://proyectojulio.googlecode.com/files/ogvavi-0.0.2.tar.gz
 http://proyectojulio.googlecode.com/files/ogvavi_0.0.2.deb
 

Greetings and thanks to cooperate with your knowledge of this project razaAztk