Bånder

Id3v1
in package

This class represents a file containing ID3v1 tags.

ID3v1 is a simple tagging format that stores metadata at the end of the audio file. It has fixed-length fields for title, artist, album, year, comment, and genre.

Table of Contents

Properties

$genres  : array<string|int, mixed>
The genre list.
$album  : string
$artist  : string
$comment  : string
$filePath  : string
$genre  : int
$title  : string
$track  : int
$year  : string

Methods

__construct()  : mixed
Constructs the Id3v1 class with given file.
getAlbum()  : string
Returns the album.
getArtist()  : string
Returns the artist.
getComment()  : string
Returns the comment.
getGenre()  : string
Returns the genre.
getGenreId()  : int
Returns the genre ID.
getTitle()  : string
Returns the title.
getTrack()  : int
Returns the track number.
getYear()  : string
Returns the year.
setAlbum()  : self
Sets the album.
setArtist()  : self
Sets the artist.
setComment()  : self
Sets the comment.
setGenre()  : self
Sets the genre by name.
setGenreId()  : self
Sets the genre ID.
setTitle()  : self
Sets the title.
setTrack()  : self
Sets the track number.
setYear()  : self
Sets the year.
write()  : void
Writes the ID3v1 tag to the file.
parse()  : void
Parses the ID3v1 tag from the file.

Properties

$genres

The genre list.

public static array<string|int, mixed> $genres = ['Blues', 'Classic Rock', 'Country', 'Dance', 'Disco', 'Funk', 'Grunge', 'Hip-Hop', 'Jazz', 'Metal', 'New Age', 'Oldies', 'Other', 'Pop', 'R&B', 'Rap', 'Reggae', 'Rock', 'Techno', 'Industrial', 'Alternative', 'Ska', 'Death Metal', 'Pranks', 'Soundtrack', 'Euro-Techno', 'Ambient', 'Trip-Hop', 'Vocal', 'Jazz+Funk', 'Fusion', 'Trance', 'Classical', 'Instrumental', 'Acid', 'House', 'Game', 'Sound Clip', 'Gospel', 'Noise', 'AlternRock', 'Bass', 'Soul', 'Punk', 'Space', 'Meditative', 'Instrumental Pop', 'Instrumental Rock', 'Ethnic', 'Gothic', 'Darkwave', 'Techno-Industrial', 'Electronic', 'Pop-Folk', 'Eurodance', 'Dream', 'Southern Rock', 'Comedy', 'Cult', 'Gangsta', 'Top 40', 'Christian Rap', 'Pop/Funk', 'Jungle', 'Native American', 'Cabaret', 'New Wave', 'Psychadelic', 'Rave', 'Showtunes', 'Trailer', 'Lo-Fi', 'Tribal', 'Acid Punk', 'Acid Jazz', 'Polka', 'Retro', 'Musical', 'Rock & Roll', 'Hard Rock', 'Folk', 'Folk-Rock', 'National Folk', 'Swing', 'Fast Fusion', 'Bebob', 'Latin', 'Revival', 'Celtic', 'Bluegrass', 'Avantgarde', 'Gothic Rock', 'Progressive Rock', 'Psychedelic Rock', 'Symphonic Rock', 'Slow Rock', 'Big Band', 'Chorus', 'Easy Listening', 'Acoustic', 'Humour', 'Speech', 'Chanson', 'Opera', 'Chamber Music', 'Sonata', 'Symphony', 'Booty Bass', 'Primus', 'Porn Groove', 'Satire', 'Slow Jam', 'Club', 'Tango', 'Samba', 'Folklore', 'Ballad', 'Power Ballad', 'Rhythmic Soul', 'Freestyle', 'Duet', 'Punk Rock', 'Drum Solo', 'A capella', 'Euro-House', 'Dance Hall', 255 => 'Unknown']

$album

private string $album = ''

$artist

private string $artist = ''

$comment

private string $comment = ''

$filePath

private string $filePath

$genre

private int $genre = 255

$title

private string $title = ''

$track

private int $track = 0

$year

private string $year = ''

Methods

__construct()

Constructs the Id3v1 class with given file.

public __construct(string $filePath) : mixed
Parameters
$filePath : string

The path to the audio file

Tags
throws
Exception

if the file cannot be read or does not contain ID3v1 tags

getAlbum()

Returns the album.

public getAlbum() : string
Return values
string

getArtist()

Returns the artist.

public getArtist() : string
Return values
string

getComment()

Returns the comment.

public getComment() : string
Return values
string

getGenre()

Returns the genre.

public getGenre() : string
Return values
string

getGenreId()

Returns the genre ID.

public getGenreId() : int
Return values
int

getTitle()

Returns the title.

public getTitle() : string
Return values
string

getTrack()

Returns the track number.

public getTrack() : int
Return values
int

getYear()

Returns the year.

public getYear() : string
Return values
string

setAlbum()

Sets the album.

public setAlbum(string $album) : self
Parameters
$album : string

The album

Return values
self

setArtist()

Sets the artist.

public setArtist(string $artist) : self
Parameters
$artist : string

The artist

Return values
self

setComment()

Sets the comment.

public setComment(string $comment) : self
Parameters
$comment : string

The comment

Return values
self

setGenre()

Sets the genre by name.

public setGenre(string $genre) : self
Parameters
$genre : string

The genre name

Return values
self

setGenreId()

Sets the genre ID.

public setGenreId(int $genreId) : self
Parameters
$genreId : int

The genre ID

Return values
self

setTitle()

Sets the title.

public setTitle(string $title) : self
Parameters
$title : string

The title

Return values
self

setTrack()

Sets the track number.

public setTrack(int $track) : self
Parameters
$track : int

The track number

Return values
self

setYear()

Sets the year.

public setYear(string $year) : self
Parameters
$year : string

The year

Return values
self

write()

Writes the ID3v1 tag to the file.

public write() : void
Tags
throws
Exception

if the file cannot be written

parse()

Parses the ID3v1 tag from the file.

private parse() : void
Tags
throws
Exception

if the file cannot be read or does not contain ID3v1 tags


        
On this page

Search results