PHP Class app\models\Album

Inheritance: extends Illuminate\Database\Eloquent\Model
Show file Open project: phanan/koel Class Usage Examples

Protected Properties

Property Type Description
$casts
$guarded
$hidden

Public Methods

Method Description
artist ( )
copyCoverFile ( string $srcPath ) Copy a cover file from an existing image on the system.
generateCover ( array $cover ) Generate a cover from provided data.
get ( Artist $artist, string $name, boolean $isCompilation = false ) : self Get an album using some provided information.
getCoverAttribute ( $value )
getHasCoverAttribute ( ) : boolean Determine if the current album has a cover.
getInfo ( ) : array | false Get extra information about the album from Last.fm.
getIsCompilationAttribute ( ) : boolean Determine if the album is a compilation.
getNameAttribute ( $value ) : string Sometimes the tags extracted from getID3 are HTML entity encoded.
isUnknown ( )
setCoverAttribute ( $value )
songs ( )
writeCoverFile ( string $binaryData, string $extension ) Write a cover image file with binary data and update the Album with the new cover file.

Private Methods

Method Description
generateRandomCoverPath ( string $extension ) : string Generate a random path for the cover image.

Method Details

artist() public method

public artist ( )

copyCoverFile() public method

Copy a cover file from an existing image on the system.
public copyCoverFile ( string $srcPath )
$srcPath string The original image's full path.

generateCover() public method

Generate a cover from provided data.
public generateCover ( array $cover )
$cover array The cover data in array format, extracted by getID3. For example: [ 'data' => '', 'image_mime' => 'image/png', 'image_width' => 512, 'image_height' => 512, 'imagetype' => 'PNG', // not always present 'picturetype' => 'Other', 'description' => '', 'datalength' => 7627, ]

get() public static method

Get an album using some provided information.
public static get ( Artist $artist, string $name, boolean $isCompilation = false ) : self
$artist Artist
$name string
$isCompilation boolean
return self

getCoverAttribute() public method

public getCoverAttribute ( $value )

getHasCoverAttribute() public method

Determine if the current album has a cover.
public getHasCoverAttribute ( ) : boolean
return boolean

getInfo() public method

Get extra information about the album from Last.fm.
public getInfo ( ) : array | false
return array | false

getIsCompilationAttribute() public method

Determine if the album is a compilation.

getNameAttribute() public method

This makes sure they are always sane.
public getNameAttribute ( $value ) : string
$value
return string

isUnknown() public method

public isUnknown ( )

setCoverAttribute() public method

public setCoverAttribute ( $value )

songs() public method

public songs ( )

writeCoverFile() public method

Write a cover image file with binary data and update the Album with the new cover file.
public writeCoverFile ( string $binaryData, string $extension )
$binaryData string
$extension string The file extension

Property Details

$casts protected property

protected $casts

$guarded protected property

protected $guarded

$hidden protected property

protected $hidden