Media_SetMetadata ( containerOrFile ; informationListOrTag1 { ; value1 { ; tag2; value2 { ; tag3; value3... } } } )
Media_SetMetadata allows you to modify the ID3 metadata stored in an MP3 sound file.
Parameter | Description |
---|---|
containerOrFile | The container name or external location of the sound file. |
informationListOrTag1 |
|
value1 | Optional parameter. The value to be set for tag1 (defined in the previous parameter). |
tag2; value2; … | … |
To give you the greatest possible flexibility, Media_SetMetadata can work in several possible ways:
Clear All Metadata
Set Field [ MyTable::Result ;
Media_SetMetadata (
filePath ;
""
) ]
In this case MediaManager will remove all metadata from the sound file.
Clear a Single Tag
Set Field [ MyTable::Result ;
Media_SetMetadata (
filePath ;
tag
) ]
In this format, you list a valid tag name (such as “Name,” “Artist,” “Year,” etc.) but do not follow with a new value, MediaManager will removes the specified tag from the sound file’s metadata.
Set a Metadata Information List
Set Field [ MyTable::Result ;
Media_SetMetadata (
filePath ;
information list
) ]
When the second parameter is not recognized as a valid tag that already exists in the file’s metadata, then MediaManager will overwrite the old metadata with this value. The assumption is that this parameter contains a completely new set of metadata with both tag names and values.
Modify a Single Tag
Set Field [ MyTable::Result ;
Media_SetMetadata (
filePath ;
tag1 ;
value1
) ]
Set Field [ MyTable::Result ;
Media_SetMetadata (
".D/riu.mp3" ;
"Year" ;
"1993"
) ]
If you want to modify only a specific tag in the metadata, you can easily do this by giving the tag name as the second parameter (such as “Year”) and the value it should hold immediately following it (such as “1993”).
Modify a Single Tag using ID3 Tags
Set Field [ MyTable::Result ;
Media_SetMetadata (
filePath ;
tag1 ;
value1
) ]
Set Field [ MyTable::Result ;
Media_SetMetadata (
".D/riu.mp3" ;
"@TYER" ;
"1993"
) ]
The parameter structure is the same as above, but the second parameter uses the “@” prefix followed by one of the standard ID3 tags. (See documentation on the Media_GetMetadata function for more information on ID3 tags. Visit http://id3lib.sourceforge.net/id3/id3v2.3.0.html#sec4 for a list of supported tags.)
Modify a Series of Tags
Set Field [ MyTable::Result ; Media_SetMetadata( filePath ; tag1; value1 ; tag2; value2 ; tag3; value3; etc. )
Set Field [ MyTable::Result ;
Media_SetMetadata (
filePath ;
tag1 ;
value1 ;
tag2 ;
value2 ;
... ;
... ;
) ]
This works the same as with modifying a single tag, but you can also define an entire series of tags to be individual modified.
File Metadata vs. Container Metadata
MediaManager distinguishes between the metadata of the external source sound file and the metadata of sound within the FileMaker Pro container field. If the first parameter (“containerOrFile”) is a container field name, only the container’s metadata will be affected. If the first parameter is a file name (or file path and file name) then only the external file’s metadata will be modified. To affect both, you must call the function twice, once for the file and once for the container.
Examples
To add a “Comment” tag to the metadata in a container field:
Set Field [ MyTable::Response ;
Media_SetMetadata (
MyTable::SoundContainer ;
"Comment" ;
"Great audio take!"
) ]
To add the same “Comment” tag to the metadata the external source file:
Set Field [ MyTable::Response ;
Media_SetMetadata (
".A/audio/take13.mp3" ;
"Comment" ;
"Great audio take!"
) ]
To change the “Artist” tag of an external file to read “The Flying Mozart Quartet”:
Set Field [ MyTable::Response ;
Media_SetMetadata (
"Aria.mp3" ;
"Artist" ;
"The Flying Mozart Quartet"
) ]
To completely replace the metadata in a container with your own list:
Set Field [ MyTable::Response ;
Media_SetMetadata (
MyTable::SoundContainer ;
"Name: Sevilla/Seville
Artist: Albeniz
Album: Spanish Nights
Track: 2/13"
) ]
To modify a series of tags and also check for errors:
Set Field [ MyTable::Response ;
Media_SetMetadata (
".D/scatological.mp3" ;
"Artist" ; "Trashcan Jeff"
"Date" ; "Late last night"
"Description" ; "You don’t want to know."
) ]
If [ not IsEmpty ( Media_GetLastError ) ]
Beep
Show Custom Dialog [ "Metadata Error" ;
"The metadata could not be set." ]
End If
To clear all metadata in a container:
Set Field [ MyTable::Response ;
Media_SetMetadata (
MyTable::SoundContainer ;
""
) ]