Find the answer to your Linux question:
Results 1 to 8 of 8
I'm trying to decode an Ogg Vorbis file and show the progress through KDialog. I couldn't get it to work and thought it was something wrong with what I did ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Engineer
    Join Date
    Jan 2005
    Location
    Chicago (USA)
    Posts
    1,028

    Too fat to get through a pipe...?


    I'm trying to decode an Ogg Vorbis file and show the progress through KDialog. I couldn't get it to work and thought it was something wrong with what I did with KDialog. But then I tried piping it to echo instead of the progress function and nothing came out. The command to get the percentage decoded is:

    oggdec ~/testing.ogg -o ~/testing.wav 2>&1|awk -vRS='\r' '(NR>1){gsub(/%/," ");print $2; fflush();}'

    No matter what I pipe that to nothing comes out.

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Does it work when you don't pipe it anywhere?

  3. #3
    Linux Engineer
    Join Date
    Jan 2005
    Location
    Chicago (USA)
    Posts
    1,028
    Yes. It also works when I redirect it to /dev/stdout or any other file.

  4. #4
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Try piping it to 'cat'

  5. #5
    Linux Engineer
    Join Date
    Jan 2005
    Location
    Chicago (USA)
    Posts
    1,028
    That worked. But that just help me realize another problem that I fixed which still didn't solve my original problem. I'm trying to create a progress dialog for decoding an Ogg Vorbis file with kdialog. The code right now is:
    Code:
    repeat="1"
    
    progress_dialog ()
    {
    	progress="`cut -d: -f$repeat $2`"
    	echo "$repeat"
    	echo "$progress"
    	dcop "$1" setProgress "$progress"
    	if [ $progress > 90 ]; then
    		dcop "$1" close
    	fi
    	repeat="`expr $repeat + 1`"
    }
    Code:
    ogg_decode ()
    {
    	dialog="`kdialog --title="$title" --progressbar $conversion 100`"
    	temp_file="`echo "$1"|sed 's/\.\w*$/'.wav'/'`"
    	oggdec "$1" -o "$temp_file" 2>&1|awk -vRS='\r' '(NR>1){sub(/%]/,":");printf $2; fflush();}'|progress_dialog $dialog
    }
    ogg_decode's first argument is the file being decoded.

    That creates the dialog but nothing happens.

  6. #6
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    But then I tried piping it to echo
    echo(1) echoes its command line arguments to stdout. It doesn't read stdin, which might explain why it didn't do what you expected. If you really must use echo, do it like:
    Code:
    echo "$(command | pipeline | here)"
    The quotes are needed to preserve the whitespace and newlines that the command pipeline contains.

  7. #7
    Linux Engineer
    Join Date
    Jan 2005
    Location
    Chicago (USA)
    Posts
    1,028
    Read the thread.

  8. #8
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Quote Originally Posted by a thing
    Read the thread.
    I did. Any particular reason for your comment?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •