samsecke

Q: mdls command returns null for ringtone duration

All,

When I run the mdls command on a ringtone file to fetch its duration, the output is always null. For e.g running

mdls -raw -name kMDItemDurationSeconds SomeTone.m4r   on the terminal returns (null) as the output. When I check the info for the ringtone in iTunes, I see that it's 14s long. Same issue when I try to fetch the total bitrate for the ringtone using mdls. It also returns null. Why does mdls fail ?

Mac Pro, Mac OS X (10.7.3)

Posted on Apr 18, 2012 5:06 PM

Close

Q: mdls command returns null for ringtone duration

  • All replies
  • Helpful answers

  • by red_menace,

    red_menace red_menace Apr 18, 2012 6:38 PM in response to samsecke
    Level 6 (15,546 points)
    Desktops
    Apr 18, 2012 6:38 PM in response to samsecke

    Itunes would be the application that imports the metadata - are those metadata keys in the database at all?  Is the file in a folder that is indexed by Spotlight? 

  • by samsecke,

    samsecke samsecke Apr 18, 2012 9:43 PM in response to red_menace
    Level 1 (0 points)
    Apr 18, 2012 9:43 PM in response to red_menace

    @red_menace. I force Spotlight to index the folder before running the mdls command on the ringtone.

    I do mdimport "$folderName" before running the

    "mdls -raw -name kMDItemDurationSeconds SomeTone.m4r"

    statement. Inspite of that i get the "null" output. I ran the afinfo command on the ringtone and I was able to extract the duration. I have no idea why afinfo works and mdls doesnt