Xattr

From kJams Wiki
Revision as of 20:50, 6 March 2007 by Dave (talk | contribs)
Jump to navigation Jump to search

Xattr tags are "eXtended Attribute" tags, which is a feature of system 10.4 or later. They're like "spotlight comments" in that they are a type of meta tagging facility built into the file system when seen thru the lense of the Mac OS. (they also work on FAT32 volumes with the "._" prefixed sidecar file). For the most fantastic explanation ever, see the Ars Techica article on it.

Anyway I use xattr tags currently on all QuickTime compatible files that do not have the ".mov" extension, and also on zip files so i do not need to open the zip to get at the tagging info. Here is what my xattr looks like:

[oxford:kj/media/bin] davec% xattr --list "Rave On.bin"
Rave On.bin
        com.meta.albm   Unknown Album
        com.meta.arts   Buddy Holly
        com.meta.crdt   2006
        com.meta.genr   Rock
        com.meta.name   Rave On
        com.meta.soft   kJams Pro 1.0d45r21
        com.meta.trak   1
[oxford:kj/media/bin] davec%

Note: It's a very simple format, I'm just using QuickTime “Common Key Format” tag names (from Movies.h) as the keys (prepended with "com.meta."). I've added a few others:

enum {
	kQTMetaDataCommonKeyTrack		=	'trak',
	kQTMetaDataCommonKeyCreationDate	=	'crdt',
	kQTMetaDataCommonKeyDuration		=	'drtn'
};

enum {
	CM_Key_KEYWORDS			= kQTMetaDataCommonKeyKeywords,	//	string
	CM_Key_INDEX			= 'INDX',	//	check
	CM_Key_DUET			= 'duet',	//	check
	CM_Key_KEY			= 'keyc',	//	popup
	CM_Key_VOCAL_CHANNEL		= 'vocl',	//	popup
	CM_Key_SUNG			= 'tsng',	//	integer, times sung
	CM_Key_VOLUME			= 'volm',	//	float
	CM_Key_LAST_SUNG		= 'lsng',	//	date
	CM_Key_RATING			= 'rtng'	//	well, obviously
};