1

How to edit the metadata information displayed by mdls from CLI?

[-zsh] sarbbo@rushpress-lm:~  吽 mdls ~/Music/BANGLA\ BAND/MOHINER\ GHORAGULI/MAYA/BHALOBASI.mp3
kMDItemAlbum                   = "Maya"
kMDItemAudioBitRate            = 128000
kMDItemAudioChannelCount       = 2
kMDItemAudioSampleRate         = 44100
kMDItemAudioTrackNumber        = 1
kMDItemAuthors                 = (
    "Mohiner Ghoraguli"
)
kMDItemContentCreationDate     = 2009-02-17 00:35:48 +0000
kMDItemContentModificationDate = 2009-02-17 00:35:48 +0000
kMDItemContentType             = "public.mp3"
kMDItemContentTypeTree         = (
    "public.mp3",
    "public.audio",
    "public.audiovisual-content",
    "public.data",
    "public.item",
    "public.content"
)
kMDItemDateAdded               = 2013-05-31 06:57:37 +0000
kMDItemDisplayName             = "BHALOBASI.mp3"
kMDItemDurationSeconds         = 284.8210625
kMDItemFSContentChangeDate     = 2009-02-17 00:35:48 +0000
kMDItemFSCreationDate          = 2009-02-17 00:35:48 +0000
kMDItemFSCreatorCode           = ""
kMDItemFSFinderFlags           = 0
kMDItemFSHasCustomIcon         = 0
kMDItemFSInvisible             = 0
kMDItemFSIsExtensionHidden     = 0
kMDItemFSIsStationery          = 0
kMDItemFSLabel                 = 0
kMDItemFSName                  = "BHALOBASI.mp3"
kMDItemFSNodeCount             = 4558848
kMDItemFSOwnerGroupID          = 285597778
kMDItemFSOwnerUserID           = 69664
kMDItemFSSize                  = 4558848
kMDItemFSTypeCode              = ""
kMDItemKind                    = "MP3 audio"
kMDItemLogicalSize             = 4558848
kMDItemMediaTypes              = (
    Sound
)
kMDItemMusicalGenre            = "genre"
kMDItemPhysicalSize            = 4558848
kMDItemTitle                   = "Track 01"
kMDItemTotalBitRate            = 128000

Thanks,
Sarbbottam

1

The Spotlight metadata attributes are not stored in the files, but they are based on other metadata values or properties of the files.

  • ID3 tags can be edited from iTunes or with for example mid3v2 from mutagen
  • Modification times and creation times can be changed with touch or SetFileInfo
  • File flags like kMDItemFSIsExtensionHidden can be edited with chflags
  • kMDItemContentTypeTree depends on the filename extension
  • kMDItemLogicalSize depends on the size of the file

Changes to files are usually reflected in mdls output within a few seconds, but if they are not, try using mdimport.

  • Thanks Lauri, please excuse my ignorance. Could you please let me know how can I edit kMDItemTitle = "Track 01" from command line. – Sarbbottam Bandyopadhyay Jul 6 '13 at 13:51
  • It's the same as the track name shown in iTunes, but you can also use something like sudo easy_install pip; sudo pip install mutagen; mid3v2 --song 'New Title' file.mp3. – Lri Jul 6 '13 at 15:15
  • Was going through the man page documentation at github.com/enginous/mutagen/blob/master/man/mid3v2.1. Could not figure out how do I edit the followings kMDItemAudioEncodingApplication = "xxx", kMDItemLyricist = "xxx", kMDItemCopyright = "xxx" – Sarbbottam Bandyopadhyay Jul 6 '13 at 16:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .