Xattr: Difference between revisions

From kJams Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
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 [http://arstechnica.com/reviews/os/macosx-10.4.ars/7 Ars Techica] article on it.
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 [http://arstechnica.com/reviews/os/macosx-10.4.ars/7 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:
Anyway I use xattr tags currently on all QuickTime compatible files <strike>that do not have the ".mov" extension</strike>, 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"
  [oxford:kj/media/bin] davec% xattr --list "Rave On.bin"

Revision as of 03:50, 23 April 2008

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'
 
	CM_Key_NAME			= kQTMetaDataCommonKeyDisplayName,	//	'name',
	CM_Key_ARTIST			= kQTMetaDataCommonKeyArtist,		//	'arts',
	CM_Key_ALBUM			= kQTMetaDataCommonKeyAlbum,		//	'albm',
	CM_Key_GENRE			= kQTMetaDataCommonKeyGenre,		//	'genr',
	CM_Key_COMMENT			= kQTMetaDataCommonKeyComment,		//	'cmmt',
	CM_Key_KEYWORDS			= kQTMetaDataCommonKeyKeywords,	//	string
	CM_Key_SOFTWARE			= kQTMetaDataCommonKeySoftware,	//	string
	
	CM_Key_AlbumDict		= 'LDct',	//	list of albums for popup menu, including default index value
	CM_Key_PLI_INDEX		= 'piIx',	//	int
	CM_Key_SORT_INDEX		= 'stIx',	//	int
	CM_Key_DUET			= 'Duet',	//	bool
	CM_Key_TWIRLED			= 'Twrl',	//	bool
	CM_Key_KEY			= 'Keyc',	//	integer
	CM_Key_VOCAL_CHANNEL		= 'vChn',	//	integer
	CM_Key_VOLUME			= 'volm',	//	float
	CM_Key_COLOR			= 'colr',	//	color
	CM_Key_RATING			= 'rtng',	//	integer
	CM_Key_GRAPHIC_CHANNELS		= 'gChn',	//	integer

	CM_Key_COOP_THREAD		= 'Coop',	//	bool, must be extracted on a cooperative thread
	CM_Key_DEMUX_MPEG		= 'Muxd',	//	bool, must be demuxed

	CM_Key_PIPE_TYPE		= 'mPip',	//	int MetaPipeType
	CM_Key_PUSH_LEVEL		= 'mPsh',	//	int meta push level
	CM_Key_BLOCK_PUSHING		= 'mBlp',	//bool, should i block pushing when meta is set? (normally NULL (false))

	CM_Key_SONG_ID			= 'soID',	//	int
	CM_Key_SINGER_ID		= 'siID',	//	int
	CM_Key_PLAYLIST_ID		= 'plID',	//	int

	CM_Key_FORMAT 			= 'Frmt',	//	string
	CM_Key_SOURCE			= 'SRCE',

	CM_Key_TRACK			= 'trak',		//	int
	CM_Key_YEAR			= 'cryr',		//	int (NOT date)
	CM_Key_DURATION			= 'drtn',		//	int
	CM_Key_START			= 'strt',		//	int
	
	CM_Key_TIMES_SUNG		= 'tsng',	//	integer, times sung
	CM_Key_SIZE			= 'SIZE',							//	int
	CM_Key_DATE_LAST_SUNG		= 'Date',							//	date
	CM_Key_PLAY_ME			= 'PLME',							//	bool
	CM_Key_SINGER			= 'SNGR', 							//	string
	CM_Key_BIO			= 'Bio ', 							//	string
	CM_Key_PITCH			= 'PICH',						//	int
	CM_Key_TEMPO			= 'TMPO',						//	float 
	CM_Key_PRESENT			= 'PSNT', 						//	bool
	CM_Key_MISSING			= 'Msng', 						//	bool
	CM_Key_SINGER_PASS		= 'Spas', 						//	string
	CM_Key_PRODUCER_DICT		= 'prod', 							//	dictinary
	CM_Key_PULLED_META		= 'plmt', 						//	bool

	CM_Key_CAVS_TYPE		= 'cavT', 						//	int
	CM_Key_CAVS_DATA		= 'cavD', 						//	cfdata

	CM_Key_FSRef_0_AUDIO		= 'Sfs0', 	//	CData::ValType_FILEREF
	CM_Key_FSRef_1_VIDEO		= 'Sfs1',
	CM_Key_FSRef_2_ZIP		= 'Sfs2',
	CM_Key_FSRef_3_AUD_CACHE	= 'Sfs3',
	CM_Key_FSRef_4_VID_CACHE	= 'Sfs4',
	CM_Key_FSRef_5_META		= 'Sfs5',
	CM_Key_FSRef_6_AUD_CD		= 'Sfs6',
	CM_Key_FSRef_7_VID_CD		= 'Sfs7',
	CM_Key_FSRef_8_UNPACK		= 'Sfs8',
	CM_Key_FSRef_9_TEMP_ZIP		= 'Sfs9',
};

For compatibility with 10.3 I'm using a standard plist sidecar file (XML) with the ".xattr" extension, which can be easily edited with any text editor, XML editor, or plist editor.