|
Jala 1.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--jala.Mp3
This is a class representing an MP3 file
providing methods to access its metadata.
Defined in Mp3.js
Nested Class Summary | |
<static class> |
jala.Mp3.Id3v1 |
<static class> |
jala.Mp3.Id3v2 |
Field Summary | |
Object |
album
|
Object |
artist
|
Object |
comment
|
Object |
genre
|
Object |
title
|
Object |
trackNumber
|
Object |
year
|
<static> <final> Array |
GENRES
Array defining valid genres in ID3v1 |
<static> <final> Array |
MODES
Array defining mp3 modes. |
<static> <final> Array |
PICTURE_TYPES
Array defining valid picture types. |
<static> <final> Array |
TEXT_ENCODINGS
Array defining valid text encodings. |
Constructor Summary | |
jala.Mp3
(<String|File> file)
Constructs a new jala.Mp3 wrapper and parses the header data of the MP3 file. |
Method Summary | |
Object
|
createTag(<Object> tagClass, <Object> tagObject)
This method creates a new tag object, attaches it to the file (thereby replacing an existing tag of this type) and returns it. |
jala.Mp3.Id3v1
|
createV1Tag(<Object> tagObject)
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. |
jala.Mp3.Id3v2
|
createV2Tag(<Object> tagObject)
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. |
Number
|
getBitRate()
Returns the bit rate the file was encoded with. |
String
|
getChannelMode()
Returns the channel mode the file was encoded with. |
Number
|
getDuration()
The audio length of the file in seconds at best estimate from the file info (method returns immediately). |
helma.File
|
getFile()
Returns a helma.File reference to the wrapped file. |
Number
|
getFrequency()
Returns the frequency the file was encoded with. |
org.farng.mp3.MP3File
|
getJavaObject()
Returns the underlying java object |
Object
|
getMetadata()
Returns a plain JavaScript object containing the values of all fields stored in either the Id3 V1 or V2 tag |
Number
|
getSize()
Returns the file size in bytes. |
Object
|
getTag(tagClass)
Returns a tag object, type is specified using the class name in jala.Mp3.*. |
jala.Mp3.Id3v1
|
getV1Tag()
|
jala.Mp3.Id3v2
|
getV2Tag()
|
Object
|
hasTag(tagClass)
Tells if the file contains a certain tag, type is specified using the class name in jala.Mp3. |
Boolean
|
hasV1Tag()
Returns true if the file contains a ID3v1 tag. |
Boolean
|
hasV2Tag()
Returns true if the file contains a ID3v2 tag. |
Boolean
|
isVariableBitRate()
Returns true if the file is (or seems to be) encoded with variable bit rate. |
Number
|
parseDuration()
Parses the audio file to extract the precise duration of the audio. |
void
|
removeTag(tagClass)
Removes a tag from the file, type is specified using the class name in jala.Mp3.* |
void
|
removeV1Tag()
Removes the ID3v1 tag from the file. |
Object
|
removeV2Tag()
Removes the ID3v2 tag from the file. |
Boolean
|
save(<String|helma.File> outFile)
Writes changed metadata back to the source file or to a new file. |
void
|
setMetadata(<Object> metadata)
Stores the metadata passed as argument in the ID2 v1 and v2 tags of the wrapped MP3 file. |
Field Detail |
Object album
Object artist
Object comment
Object genre
Object title
Object trackNumber
Object year
<static> <final> Array GENRES
<static> <final> Array MODES
<static> <final> Array PICTURE_TYPES
<static> <final> Array TEXT_ENCODINGS
Constructor Detail |
jala.Mp3(<String|File> file)
file
- The mp3 file to be parsed, either as path string or as any kind of file object
Method Detail |
Object createTag(<Object> tagClass, <Object> tagObject)
tagClass
-
tagObject
- optional tag whose standard properties are copied to the new tag.
jala.Mp3.Id3v1 createV1Tag(<Object> tagObject)
tagObject
- optional tag whose standard properties are copied to the new tag.
jala.Mp3.Id3v2 createV2Tag(<Object> tagObject)
tagObject
- optional tag whose standard properties are copied to the new tag.
Number getBitRate()
String getChannelMode()
Number getDuration()
helma.File getFile()
Number getFrequency()
org.farng.mp3.MP3File getJavaObject()
Object getMetadata()
Number getSize()
Object getTag(tagClass)
jala.Mp3.Id3v1 getV1Tag()
jala.Mp3.Id3v2 getV2Tag()
Object hasTag(tagClass)
Boolean hasV1Tag()
Boolean hasV2Tag()
Boolean isVariableBitRate()
Number parseDuration()
void removeTag(tagClass)
void removeV1Tag()
Object removeV2Tag()
Boolean save(<String|helma.File> outFile)
outFile
- (optional) save the modified file to a different file
void setMetadata(<Object> metadata)
metadata
- An object containing the fields to set and their values.
|
Jala 1.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |