B4J Question jshell help

I want to execute the following command in linux

mediainfo --Output="Video;%Duration%" /Agenda/18.mp4

to obtain the duration of a video file, its works in the command line, but in B4J I cannot find how to. I have tryed

B4X:
Dim params As List
                    params.Initialize
                    params.Add("--Output=""Video;%Duration%""")
                    params.Add("/home/cmojica/ServidorChunche/Files/1/Agenda/18.mp4")
                    she.InitializeDoNotHandleQuotes("she", "mediainfo ", params)

B4X:
she.InitializeDoNotHandleQuotes("she", "mediainfo ", "--Output=""Video;%Duration%""", "/home/cmojica/ServidorChunche/Files/1/Agenda/18.mp4")

but nothing, How should I pass the parameters?
 
I want to execute the following command in linux

mediainfo --Output="Video;%Duration%" /Agenda/18.mp4

to obtain the duration of a video file, its works in the command line, but in B4J I cannot find how to. I have tryed

B4X:
Dim params As List
                    params.Initialize
                    params.Add("--Output=""Video;%Duration%""")
                    params.Add("/home/cmojica/ServidorChunche/Files/1/Agenda/18.mp4")
                    she.InitializeDoNotHandleQuotes("she", "mediainfo ", params)

B4X:
she.InitializeDoNotHandleQuotes("she", "mediainfo ", Array("--Output=""Video;%Duration%""", "/home/cmojica/ServidorChunche/Files/1/Agenda/18.mp4"))

but nothing, How should I pass the parameters?

Let me clarify the problem, the sentences (jshell) execute mediainfo but without the first parameter. The 1st parameter is just to obtain the duration of the video, without it we get a lot of information of the 2nd parameter, the file, and that is I am obtaning from jshell.
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
I would suggest first trying without the space after the program name
B4X:
she.InitializeDoNotHandleQuotes("she", "mediainfo", params) ' remove the space from this line

Are you checking success in the Shell_Completed(…) sub ?

also use SmartStrings it makes quoting things much easier SmartString $" …. "$
eg,
B4X:
someString = $"now this string can have " and ' in it without using """$

One final stupid sounding question - You are calling she.Run(-1) after the Initialize?
 
Last edited:
Upvote 0
I would suggest first trying without the space after the program name
B4X:
she.InitializeDoNotHandleQuotes("she", "mediainfo", params) ' remove the space from this line

Are you checking success in the Shell_Completed(…) sub ?

also use SmartStrings it makes quoting things much easier SmartString $" …. "$
eg,
B4X:
someString = $"now this string can have " and ' in it without using """$

One final stupid sounding question - You are calling she.Run(-1) after the Initialize?


This is the code in my program
B4X:
Dim she As Shell
Dim Result As ShellSyncResult

Dim params As List
params.Initialize
params.Add($"--Output="Video;%Duration%""$)
params.Add("/home/cmojica/ServidorChunche/Files/1/Agenda/18.mp4")
she.InitializeDoNotHandleQuotes("she", "mediainfo", params)
For i = 0 To she.Arguments.Length - 1 '<--just to verify the params, they are OK
     Log(she.Arguments(i))                           
Next
Log(she.Executable)               
Result = she.RunSynchronous(2000)
Log("resultado2: " & Result.StdOut)

the execution is not taking the first parameter, in the file attached you can see the execution, directly in the command line, of the mediainfo, with and without the first parameter. In B4J, my code, mediainfo is not taking the first parameter.
 

Attachments

  • screen1.PNG
    screen1.PNG
    17.6 KB · Views: 230
Upvote 0
Top