Recent

Author Topic: [Solved] Process pipe error  (Read 277 times)

nikel

  • Full Member
  • ***
  • Posts: 123
[Solved] Process pipe error
« on: September 22, 2020, 03:16:30 pm »
Hello, I'm trying to get some tags from mp3's, here's my code:

Code: Pascal  [Select][+][-]
  1. Path:=P;
  2.  
  3. TempStringlist:=TStringList.Create;
  4.  
  5. AProcess := TProcess.Create(nil);
  6. AProcess.Executable:= '/bin/sh'; // /bin/bash
  7. AProcess.Parameters.Add('-c');
  8. AProcess.Parameters.Add('ffprobe -loglevel error -show_entries format_tags=' + Request + ' -of default=noprint_wrappers=1:nokey=1 ' + Path);
  9. AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
  10. AProcess.Execute;

I'm getting pipe error on some songs. Why does it happen?
« Last Edit: September 22, 2020, 05:15:36 pm by nikel »

winni

  • Hero Member
  • *****
  • Posts: 1992
Re: Process pipe error
« Reply #1 on: September 22, 2020, 03:38:19 pm »
Hi!

I have just no Lazarus at hand.
But as I remember  the size of the pipe is 1024 bytes.

Do some tags break this limit?

Winni

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8892
  • FPC developer.
Re: Process pipe error
« Reply #2 on: September 22, 2020, 03:40:30 pm »
Do you implement the so called long output scenario? This is always recommended when there are problems.

Or use runcommand, which implements this scenario.

nikel

  • Full Member
  • ***
  • Posts: 123
Re: Process pipe error
« Reply #3 on: September 22, 2020, 04:55:58 pm »
Thanks for the replies. How can I implement scenario, it's a console application.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8892
  • FPC developer.

nikel

  • Full Member
  • ***
  • Posts: 123
Re: Process pipe error
« Reply #5 on: September 22, 2020, 05:15:19 pm »
This worked fine

Code: Pascal  [Select][+][-]
  1. Path:=P;
  2.  
  3. if RunCommand('/bin/bash',['-c','ffprobe -loglevel error -show_entries format_tags=' + Request + ' -of default=noprint_wrappers=1:nokey=1 ' + '"' + Path + '"'], Str) then
  4.    writeln(Str);
  5.  
  6. Result:=Str;

 

TinyPortal © 2005-2018