PHP Class App\services\Media

Afficher le fichier Open project: phanan/koel Class Usage Examples

Protected Properties

Свойство Type Description
$allTags array Note that each isn't necessarily a valid ID3 tag name.
$tags array Tags to be synced.

Méthodes publiques

Méthode Description
__construct ( )
gatherFiles ( string $path ) : array Gather all applicable files in a given directory.
getHash ( $path ) : string Generate a unique hash for a file path.
setTags ( array $tags = [] ) Construct an array of tags to be synced into the database from an input array of tags.
sync ( string | null $path = null, array $tags = [], boolean $force = false, SyncMedia $syncCommand = null ) Sync the media. Oh sync the media.
syncByWatchRecord ( App\Libraries\WatchRecord\WatchRecordInterface $record, SyncMedia $syncCommand = null ) Sync media using a watch record.
tidy ( ) Tidy up the library by deleting empty albums and artists.

Method Details

__construct() public méthode

public __construct ( )

gatherFiles() public méthode

Gather all applicable files in a given directory.
public gatherFiles ( string $path ) : array
$path string The directory's full path
Résultat array An array of SplFileInfo objects

getHash() public méthode

Generate a unique hash for a file path.
public getHash ( $path ) : string
$path
Résultat string

setTags() public méthode

If the input array is empty or contains only invalid items, we use all tags. Otherwise, we only use the valid items in it.
public setTags ( array $tags = [] )
$tags array

sync() public méthode

Sync the media. Oh sync the media.
public sync ( string | null $path = null, array $tags = [], boolean $force = false, SyncMedia $syncCommand = null )
$path string | null
$tags array The tags to sync. Only taken into account for existing records. New records will have all tags synced in regardless.
$force boolean Whether to force syncing even unchanged files
$syncCommand App\Console\Commands\SyncMedia The SyncMedia command object, to log to console if executed by artisan.

syncByWatchRecord() public méthode

Sync media using a watch record.
public syncByWatchRecord ( App\Libraries\WatchRecord\WatchRecordInterface $record, SyncMedia $syncCommand = null )
$record App\Libraries\WatchRecord\WatchRecordInterface The watch record.
$syncCommand App\Console\Commands\SyncMedia The SyncMedia command object, to log to console if executed by artisan.

tidy() public méthode

Tidy up the library by deleting empty albums and artists.
public tidy ( )

Property Details

$allTags protected_oe property

Note that each isn't necessarily a valid ID3 tag name.
protected array $allTags
Résultat array

$tags protected_oe property

Tags to be synced.
protected array $tags
Résultat array