Fields and methods of the jala.audio package.
Constructs a new jala.Mp3 wrapper and
parses the header data of the MP3 file.
The standard fields for a tag are accessible
as properties of the new object.
parameters
String, File | file | The mp3 file to be parsed, either as path string or as any kind of file object |
methods
- getFile()
- createTag(tagClass, tagObject)
- getTag(tagClass)
- hasTag(tagClass)
- removeTag(tagClass)
- save(outFile)
- getSize()
- createV1Tag(tagObject)
- createV2Tag(tagObject)
- getV1Tag()
- getV2Tag()
- hasV1Tag()
- hasV2Tag()
- setMetadata(metadata)
Constructs a new Id3v1 tag from an Mp3 file
parameters
jala.Mp3 | mp3File |
methods
- getAudio()
- copyFrom(src)
- getAlbum()
- getTitle()
- getGenre()
- getYear()
- getTextContent(id)
- setAlbum(album)
- setArtist(artist)
- setComment(comment)
- setTitle(title)
- setTrackNumber(trackNumber)
- setGenre(genre)
- setYear(year)
- setTextContent(id, value)
Constructs a new Id3v2 tag from an Mp3 file
parameters
jala.Mp3 | mp3File |
methods
- getAudio()
- setTextEncoding(encType)
- copyFrom(src)
- getTextContent(id)
- setTextContent(id, value)
- getAlbum()
- getTitle()
- getGenre()
- getYear()
- getUrl()
- setAlbum(album)
- setArtist(artist)
- setComment(comment)
- setTitle(title)
- setSubtitle(title)
- setTrackNumber(trackNumber)
- setGenre(genre)
- setYear(year)
- setAuthor(author)
- setCopyright(copyright)
- setUrl(url, desc)
- getImage(pictureType)
- setImage(pictureType, mimeType, byteArray, desc)
Array defining valid genres in ID3v1
Array defining mp3 modes.
Array defining valid text encodings. Note: UTF-8 is valid for v2.4 only.
UTF-16 with BOM doesn't work with Winamp etc - use UTF-16BE instead!
The index position within the array defines the number used in the mp3 file.
Array defining valid picture types. Note: Most image tagged files come with
one picture of picture type null!
The index position within the array defines the number used in the mp3 file.
Methods
Returns a helma.File reference to the wrapped file.
Returns the underlying java object
This method creates a new tag object, attaches it
to the file (thereby replacing an existing tag of
this type) and returns it. Type is specified using
the class name in jala.Mp3.*. If a second
argument is provided, its values are copied into
the new tag.
parameters
Object | tagClass | |
Object | tagObject | optional tag whose standard properties are copied to the new tag. |
Returns a tag object, type is specified using the class name
in jala.Mp3.*.
parameters
tagClass |
Tells if the file contains a certain tag, type is specified
using the class name in jala.Mp3.*
parameters
tagClass |
Removes a tag from the file, type is specified using the
class name in jala.Mp3.*
parameters
tagClass |
Writes changed metadata back to the source file or to a new file.
parameters
String, helma.File | outFile | (optional) save the modified file to a different file |
returns
true on success, false if the file contains tags that cannot be saved (Id3v2_2). |
The audio length of the file in seconds at best estimate
from the file info (method returns immediately).
This method calculates based on the bitrate. Therefore it
has to produce wrong results for files encoded with variable
bitrate (vbr). For these files parseDuration() can be used.
returns
length in seconds |
see
Parses the audio file to extract the precise duration of the audio.
The upside is that it works fine for files with variable bitrates.
The downside is that this action may take a few seconds depending on
the size of the audio file.
returns
length in seconds |
see
Returns the file size in bytes.
Returns the bit rate the file was encoded with.
Returns the channel mode the file was encoded with.
Returns the frequency the file was encoded with.
Returns true if the file is (or seems to be) encoded with
variable bit rate. FIXME: The current implementation returned
true for all test files.
If the file doesn't contain an ID3v1 tag, this method
creates a new ID3v1 tag object, attaches it to the file
and returns it. If a second argument is provided, its
values are copied into the new tag.
parameters
Object | tagObject | optional tag whose standard properties are copied to the new tag. |
If the file doesn't contain an ID3v2 tag, this method
creates a new ID3v2 tag object, attaches it to the file
and returns it. If a second argument is provided, its
values are copied into the new tag.
parameters
Object | tagObject | optional tag whose standard properties are copied to the new tag. |
Returns true if the file contains a ID3v1 tag.
Returns true if the file contains a ID3v2 tag.
Removes the ID3v1 tag from the file.
Removes the ID3v2 tag from the file.
Returns a plain JavaScript object containing the values of
all fields stored in either the Id3 V1 or V2 tag
returns
An object containing the values of all fields |
Stores the metadata passed as argument in the ID2 v1 and v2 tags
of the wrapped MP3 file.
parameters
Object | metadata | An object containing the fields to set and their values. |
Returns the wrapper for the underlying audio file.
Returns the java representation of the tag,
class depends on the actual library used.
Copies standard fields from another tag.
parameters
Object | src | object with getter methods for fields album, artist, comment, title, trackNumber, genre and year. |
Returns the album information of the tag.
returns
string containing album name |
Returns the artist information of the tag.
returns
string containing artist name |
Returns the comment information of the tag.
returns
string containing comment |
Returns the title information of the tag.
returns
string containing title |
Returns the track number information of the tag.
returns
string representing track number or null if tag doesn't contain a track number. |
Returns the genre information of the tag.
returns
string containing genre name |
This method could be used to retrieve an arbitrary field
of the underlying tag. For Id3v1 tags all information
is available through getter and setter methods, so this
implementation always returns null.
parameters
String | id |
returns
null |
Sets the track number information.
parameters
Number | trackNumber |
Sets the genre information. A list of genre names that are valid
for ID3v1 tags is located in jala.Mp3.GENRES.
parameters
String | genre |
This method could be used to set an arbitrary field
of the underlying tag. For Id3v1 tags all information
is available through getter and setter methods, so this
implementation does nothing.
parameters
String | id | |
String | value |
Returns the wrapper for the underlying audio file.
returns the java representation of the tag,
class depends on the actual library used.
Removes the tag from the audio file and
nulls out the wrapper.
sets the text encoding used when creating new frames
(the encoding type of old frames can't be changed with
JavaMusicTag)
parameters
Number, String | encType | the new encoding type as number or string |
see
Returns the text encoding used when setting values.
returns
The text encoding |
Copies standard fields from another tag.
parameters
Object | src | object with getter methods for fields album, artist, comment, title, trackNumber, genre and year. |
This method can be used to retrieve an arbitrary text frame
of the underlying tag. For the list of valid identifiers
and their meaning see http://www.id3.org/
The identifiers vary across the sub versions of id3v2 tags,
use getSubtype to make sure you use the correct version.
parameters
String | id | Frame identifier according to Id3v2 specification or shortcut as defined in jala.Mp3.FIELD_MAPPING. |
returns
String contained in the frame |
see
This method can be used to set an arbitrary field
of the underlying tag. For the list of valid identifiers
and their meaning see http://www.id3.org/
The identifiers vary across the sub versions of id3v2 tags,
use getSubtype to make sure you use the correct version.
parameters
String | id | Frame identifier according to Id3v2 specification |
String | value |
see
Returns the version number of this id3v2 (values 2 to 4 for id3v2.2 to id3v2.4)
returns
The version number of this Id3v2 tag |
Returns the album information of the tag.
returns
string containing album name |
Returns the artist information of the tag.
returns
string containing artist name |
Returns the comment information of the tag.
returns
string containing comment |
Returns the title information of the tag.
returns
string containing title |
Returns the subtitle information of the tag.
returns
string containing subtitle |
Returns the track number information of the tag.
returns
string representing track number |
Returns the genre information of the tag.
returns
string containing genre name |
Returns the author information of the tag.
returns
string containing author information |
Returns the copyright information of the tag.
returns
The copyright information of the tag |
Sets the track number information.
parameters
Number | trackNumber |
Sets the genre information. A list of genre names that are compatible
with ID3v1 tags is located in jala.Mp3.GENRES.
parameters
String | genre |
Sets the author information in this tag
parameters
String | author | The author information to set |
Sets the copyright information in this tag
parameters
String | copyright | The copyright information to set |
Stores the Url passed as argument in this tag.
parameters
String | url | The url to store in this tag |
String | desc | An optiona description of the Url |
Extracts the image from the tag
parameters
String | pictureType | number describing picture type (default is 3, describing a front cover). |
returns
image as mime object |
adds an image to the file.
parameters
Number | pictureType | number determining picture type |
String | mimeType | mime type of image |
Array | byteArray | image binary data |
String | desc | optional description |
see