Bånder

Song extends BaseModel
in package
implements DirectStreamableFile, Recommendable uses HasFactory, HasLibraryAccess, HasNanoPublicId, HasRecommendation, HasContentSimilarity, HasMusicMetadata

Table of Contents

Interfaces

DirectStreamableFile
Recommendable

Properties

$filterRelations  : array<string|int, mixed>
$librarySlug  : string
$dateFormat  : mixed
$fillable  : mixed
$perPage  : mixed
$with  : mixed

Methods

album()  : mixed
artists()  : mixed
bootHasNanoPublicId()  : mixed
clearRecommendationCache()  : void
Clear recommendation cache for all models of this class
createRadioStation()  : mixed
Create a radio station based on this song
findContentSimilar()  : Collection
Advanced content similarity using PostgreSQL functions
findSimilarByArtists()  : Collection
Find songs by similar artists or collaborating artists
findSimilarByContent()  : Collection
Find songs with similar musical content (genre, artists, tempo, etc.)
findSimilarByDuration()  : Collection
Find songs with similar duration (±20%)
findSimilarByGenres()  : Collection
Find songs with similar genres using PostgreSQL function
formatForException()  : string
generateRecommendations()  : int
Generate recommendations for all models of this class
generateRecommendationsForSelf()  : int
Generate recommendations for this specific model instance
genres()  : mixed
getMimeType()  : string
Get the mime type of the file
getMusicallySimilar()  : mixed
Get songs that are musically similar to this one
getPath()  : string
Get the path of the file
getRecommendationConfig()  : array<string|int, mixed>
Returns the array of configuration for the model.
getRecommendations()  : mixed
Get recommended songs based on this song's musical characteristics
getRecommendationsByListeningHistory()  : Collection
Get content-based recommendations using user listening patterns
getRecommendationsWithRelations()  : Collection
Get recommendations with specified relationships loaded
getRouteKeyName()  : string
getSimilarByMetadata()  : Collection
Get songs with similar musical characteristics
getSize()  : int
Get the size of the file in bytes
newEloquentBuilder()  : mixed
scheduleRecommendationGeneration()  : void
Schedule recommendation generation as a background job
update()  : mixed
userHasAccessToLibrary()  : bool
Determine if a user has access to the library.
userMediaActivies()  : mixed
scopeWhereGenreNames()  : mixed
scopeWhereGenreSlugs()  : mixed

Properties

$filterRelations

public static array<string|int, mixed> $filterRelations = ['album', 'album.cover', 'artists', 'genres']

$librarySlug

public string $librarySlug

Available in SongController

$dateFormat

protected mixed $dateFormat = 'Y-m-d H:i:sO'

$fillable

protected mixed $fillable = ['album_id', 'title', 'path', 'size', 'mime_type', 'length', 'lyrics', 'track', 'disc', 'modified_time', 'year', 'comment', 'hash', 'librarySlug', 'mbid', 'discogs_id', 'position']

$perPage

protected mixed $perPage = 30

$with

protected mixed $with = ['album']

Methods

album()

public album() : mixed

artists()

public artists() : mixed

clearRecommendationCache()

Clear recommendation cache for all models of this class

public static clearRecommendationCache(string $recommendationName) : void
Parameters
$recommendationName : string

createRadioStation()

Create a radio station based on this song

public createRadioStation([int $songCount = 50 ]) : mixed
Parameters
$songCount : int = 50

findContentSimilar()

Advanced content similarity using PostgreSQL functions

public static findContentSimilar([array<string|int, mixed> $genreIds = [] ][, array<string|int, mixed> $artistIds = [] ][, int|null $duration = null ][, int|null $year = null ][, int $limit = 50 ]) : Collection
Parameters
$genreIds : array<string|int, mixed> = []
$artistIds : array<string|int, mixed> = []
$duration : int|null = null
$year : int|null = null
$limit : int = 50
Return values
Collection

findSimilarByArtists()

Find songs by similar artists or collaborating artists

public findSimilarByArtists([int $limit = 20 ]) : Collection
Parameters
$limit : int = 20
Return values
Collection

findSimilarByContent()

Find songs with similar musical content (genre, artists, tempo, etc.)

public findSimilarByContent([int $limit = 10 ]) : Collection
Parameters
$limit : int = 10
Return values
Collection

findSimilarByDuration()

Find songs with similar duration (±20%)

public findSimilarByDuration([int $limit = 20 ]) : Collection
Parameters
$limit : int = 20
Return values
Collection

findSimilarByGenres()

Find songs with similar genres using PostgreSQL function

public findSimilarByGenres([int $limit = 20 ]) : Collection
Parameters
$limit : int = 20
Return values
Collection

formatForException()

public formatForException() : string
Return values
string

generateRecommendations()

Generate recommendations for all models of this class

public static generateRecommendations(string $recommendationName[, array<string|int, mixed> $options = [] ]) : int
Parameters
$recommendationName : string
$options : array<string|int, mixed> = []
Return values
int

Number of recommendations generated

generateRecommendationsForSelf()

Generate recommendations for this specific model instance

public generateRecommendationsForSelf(string $recommendationName) : int
Parameters
$recommendationName : string
Return values
int

Number of recommendations generated

genres()

public genres() : mixed

getMimeType()

Get the mime type of the file

public getMimeType() : string
Return values
string

getMusicallySimilar()

Get songs that are musically similar to this one

public getMusicallySimilar([int $limit = 10 ]) : mixed
Parameters
$limit : int = 10

getPath()

Get the path of the file

public getPath() : string
Return values
string

getRecommendationConfig()

Returns the array of configuration for the model.

public static getRecommendationConfig() : array<string|int, mixed>

[ 'recommendation_name_1' => [ 'recommendation_algorithm' => 'db_relation', // db_relation, similarity 'recommendation_data_table' => 'recommendation_data_table', 'recommendation_data_table_filter' => [ 'field' => 'value' ], 'recommendation_data_field' => 'recommendation_data_field', 'recommendation_data_field_type' => 'recommendation_data_field_type', 'recommendation_group_field' => 'recommendation_group_field', 'recommendation_count' => 5, 'recommendation_order' => 'desc' ], 'recommendation_name_2' => [ 'recommendation_algorithm' => 'similarity', // db_relation, similarity 'similarity_feature_weight' => 1, 'similarity_numeric_value_weight' => 1, 'similarity_numeric_value_high_range' => 1, 'similarity_taxonomy_weight' => 1, 'similarity_feature_attributes' => [ 'attribute1', 'attribute2' ], 'similarity_numeric_value_attributes' => [ 'attribute1', 'attribute2' ], 'similarity_taxonomy_attributes' => [ [ 'relation' => 'attribute' ] ], 'recommendation_count' => 5, 'recommendation_order' => 'desc' ] ]

Return values
array<string|int, mixed>

getRecommendations()

Get recommended songs based on this song's musical characteristics

public getRecommendations([int $limit = 20 ]) : mixed
Parameters
$limit : int = 20

getRecommendationsByListeningHistory()

Get content-based recommendations using user listening patterns

public getRecommendationsByListeningHistory(int $userId[, int $limit = 20 ]) : Collection
Parameters
$userId : int
$limit : int = 20
Return values
Collection

getRecommendationsWithRelations()

Get recommendations with specified relationships loaded

public getRecommendationsWithRelations(string $recommendationName, array<string|int, mixed> $relationships) : Collection
Parameters
$recommendationName : string
$relationships : array<string|int, mixed>
Return values
Collection

getRouteKeyName()

public getRouteKeyName() : string
Return values
string

getSimilarByMetadata()

Get songs with similar musical characteristics

public getSimilarByMetadata([array<string|int, mixed> $criteria = [] ][, int $limit = 20 ]) : Collection
Parameters
$criteria : array<string|int, mixed> = []
$limit : int = 20
Return values
Collection

getSize()

Get the size of the file in bytes

public getSize() : int
Return values
int

newEloquentBuilder()

public newEloquentBuilder(mixed $query) : mixed
Parameters
$query : mixed

scheduleRecommendationGeneration()

Schedule recommendation generation as a background job

public static scheduleRecommendationGeneration(string $recommendationName) : void
Parameters
$recommendationName : string

update()

public update([array<string|int, mixed> $attributes = [] ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$attributes : array<string|int, mixed> = []
$options : array<string|int, mixed> = []

userHasAccessToLibrary()

Determine if a user has access to the library.

public userHasAccessToLibrary(int $userId, int $libraryId) : bool
Parameters
$userId : int
$libraryId : int
Return values
bool

userMediaActivies()

public userMediaActivies() : mixed

scopeWhereGenreNames()

protected scopeWhereGenreNames(BaseBuilder $q, array<string|int, mixed> $names) : mixed
Parameters
$q : BaseBuilder
$names : array<string|int, mixed>

scopeWhereGenreSlugs()

protected scopeWhereGenreSlugs(BaseBuilder $q, array<string|int, mixed> $slugs) : mixed
Parameters
$q : BaseBuilder
$slugs : array<string|int, mixed>

        
On this page

Search results