#697 Variables Appear to not work

closed-works-for-me
5
2012-07-09
2012-07-09
Guhak
No

When using the mediainfo CLI for mac OSX 10.7.3 I encountered a bug where mediainfo will not be able to parse a variable. For example, I declare a variable FOO as "~/desktop/song.mp3" and then use a basic mediainfo command of `mediainfo "$FOO"`. However, this returns a blank line. Doing the same exact command, but with the variable replaced with its value does return a value though. So the command `mediainfo ~/desktop/song.mp3` will return the regular mediainfo information.

Discussion

  • Jerome Martinez

    Jerome Martinez - 2012-07-09

    I tried:
    > mediainfo ~/Destop/a.wav
    Complete name: /Users/Zenitram/Desktop/a.wav
    (...)

    > export FOO=~/Destop/a.wav
    > mediainfo $FOO
    Complete name: /Users/Zenitram/Desktop/a.wav
    (...)

    It is working pretty well.

    Are you sure it is an issue for MediaInfo? Is $FOO well expanded in your script? MediaInfo does not expand itself file names, so your shell must absolutely provide the totally expanded file name$FOO --> ~/desktop/song.mp3 --> /Users/UserName/desktop/song.mp3
    No output is a (bad) info saying the file name is not found (I will try to indicate later what is the provided file name)

    Please provide a sample script.

     
  • Jerome Martinez

    Jerome Martinez - 2012-07-09
    • status: open --> pending-works-for-me
     
  • Guhak

    Guhak - 2012-07-09

    I am sure the variable is expanding, as echo "$FOO" gives the file name perfectly.
    Upon trying that example, I see that variables are working for me, except when piping the output into more commands (I need the info to determine bit rates and info from flv files) Here is the command in question.
    `for f in ./*.flv; do
    echo "$f"
    if [[ -n `mediainfo "$f" | awk '"$1"=="Audio", "$1"=="Bit"' | awk '"$1"=="Format"' | awk '{ print "$3" }' | grep "AAC"` ]]
    then
    echo "test"
    fi
    Even when outside of that if statement that command doesn't work with the variable, but does with the file name itself.

     
  • Guhak

    Guhak - 2012-07-09
    • status: pending-works-for-me --> open-works-for-me
     
  • Guhak

    Guhak - 2012-07-09

    Wait, I just retried the script after removing some changes I made in an attempt to fix this, and it works perfectly now... I'm not sure why it didn't work for me when I tried this the first time. Sorry for the trouble.

     
  • Jerome Martinez

    Jerome Martinez - 2012-07-09

    No problem :).
    Not MediaInfo related, closed.

     
  • Jerome Martinez

    Jerome Martinez - 2012-07-09
    • status: open-works-for-me --> closed-works-for-me
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks