Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top