PHP Класс App\services\Media

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$allTags array Note that each isn't necessarily a valid ID3 tag name.
$tags array Tags to be synced.

Открытые методы

Метод Описание
__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.

Описание методов

__construct() публичный метод

public __construct ( )

gatherFiles() публичный метод

Gather all applicable files in a given directory.
public gatherFiles ( string $path ) : array
$path string The directory's full path
Результат array An array of SplFileInfo objects

getHash() публичный метод

Generate a unique hash for a file path.
public getHash ( $path ) : string
$path
Результат string

setTags() публичный метод

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() публичный метод

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() публичный метод

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() публичный метод

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

Описание свойств

$allTags защищенное свойство

Note that each isn't necessarily a valid ID3 tag name.
protected array $allTags
Результат array

$tags защищенное свойство

Tags to be synced.
protected array $tags
Результат array