从 LAME 和 FLAC 获取输出以显示在 bash 对话框中

发布于 2024-12-23 04:09:44 字数 425 浏览 4 评论 0原文

我正在对话框(ncurses)中编写 .ogg 和 .flac 到 .mp3 转换器,我想知道是否可以将 flac 和 ogg123 的输出显示在对话框内?现在我有一个很好的界面,但是当转换开始时它只是打印到终端。

这是现在的 flac2mp3 函数:

   function ConvertFromFlac {
       old_IFS=$IFS             
       IFS=$'\n'                
       for line in `cat ./flacsongs`        
       do
           flac -cd "$line" | lame -h - "$line.mp3" 
       done
       IFS=$old_IFS                 
   }

I'm writing a .ogg and .flac to .mp3 converter in dialog (ncurses) and I wonder if it's possible to get the output from flac and ogg123 to be shown inside of dialog? Right now I have a good interface, but when the converting starts it just prints to terminal.

This is the flac2mp3 function right now:

   function ConvertFromFlac {
       old_IFS=$IFS             
       IFS=
\n'                
       for line in `cat ./flacsongs`        
       do
           flac -cd "$line" | lame -h - "$line.mp3" 
       done
       IFS=$old_IFS                 
   }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

话少心凉 2024-12-30 04:09:44

尝试这种方式

ConvertFromFlac() {
    pipe=/tmp/$.err
    mkfifo "$pipe"
    while IFS= read -r line ; do 
    do
        flac -cd "$line" 2>>"$pipe" | lame -h - "$line.mp3" 2>>"$pipe"
    done < ./flacsongs
}

,稍后如果您想要从 $pipe 读取输出。完成后不要忘记rm

Try it this way

ConvertFromFlac() {
    pipe=/tmp/$.err
    mkfifo "$pipe"
    while IFS= read -r line ; do 
    do
        flac -cd "$line" 2>>"$pipe" | lame -h - "$line.mp3" 2>>"$pipe"
    done < ./flacsongs
}

And later if you want the output just read from $pipe. Don't forget to rm it when you're done.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文