PHP Class SSLTrack, sslscrobbler

SSL puts a lot of useful information into the history file, including the full path to the MP3, bpm, key, etc., as well as history-oriented data such as start and end time, which deck the track was played on, played or skipped, manually added, etc. There is also an incrementing integer primary key (which I've called 'row'). History file Tracks also have a concept of their own 'status', in the sense of 'NEW', 'PLAYING', 'PLAYED' or 'SKIPPED'. (@see SSLRealtimeModel for more detail). These states are derived from a combination of the 'played' field, which is either 0 or 1 corresponding to whether or not the row is 'green' in the SSL interface, and whether or not an 'endtime' is present.
Author: ben
Inheritance: extends SSLStruct
Show file Open project: ben-xo/sslscrobbler Class Usage Examples

Protected Properties

Property Type Description
$added
$album
$artist
$deck
$end_time
$fields
$filename
$fullpath
$length
$played
$playtime
$row
$start_time
$title
$updated_at

Public Methods

Method Description
__toString ( )
getAlbum ( )
getArtist ( )
getDeck ( )
getEndTime ( )
getFilename ( )
getFullEndTime ( )
getFullStartTime ( )
getFullTitle ( )
getFullpath ( )
getLength ( $flags ) Get the length of the file, as a string (e.g. "1:23.45" for 1 minute 23.45 seconds). This is how Serato returns it from the file.
getLengthInSeconds ( $flags ) Get the length of the file, as an integer number of seconds.
getPlayTime ( )
getPlayed ( )
getRow ( )
getStartTime ( )
getStatus ( )
getTitle ( )
getUnpacker ( )
getUpdatedAt ( )
isPlayed ( )
populateFrom ( array $fields )
toArray ( )

Protected Methods

Method Description
file_exists ( $filename )
guessLengthFromFile ( ) Sometimes ScratchLive doesn't supply the length, even when it knows the file.
renderTime ( $timestamp )
setLengthIfUnknown ( ) This will attempt to set the length via guess work, if it's not already set.

Method Details

__toString() public method

public __toString ( )

file_exists() protected method

protected file_exists ( $filename )

getAlbum() public method

public getAlbum ( )

getArtist() public method

public getArtist ( )

getDeck() public method

public getDeck ( )

getEndTime() public method

public getEndTime ( )

getFilename() public method

public getFilename ( )

getFullEndTime() public method

public getFullEndTime ( )

getFullStartTime() public method

public getFullStartTime ( )

getFullTitle() public method

public getFullTitle ( )

getFullpath() public method

public getFullpath ( )

getLength() public method

Pass SSLTrack::TRY_HARD if you would like the file length to be guessed from the file itself, if possible, and don't mind that this is possibly an expensive operation.
public getLength ( $flags )
$flags

getLengthInSeconds() public method

Pass SSLTrack::TRY_HARD if you would like the file length to be guessed from the file itself, if possible, and don't mind that this is possibly an expensive operation.
public getLengthInSeconds ( $flags )
$flags

getPlayTime() public method

public getPlayTime ( )

getPlayed() public method

public getPlayed ( )

getRow() public method

public getRow ( )

getStartTime() public method

public getStartTime ( )

getStatus() public method

public getStatus ( )

getTitle() public method

public getTitle ( )

getUnpacker() public method

public getUnpacker ( )

getUpdatedAt() public method

public getUpdatedAt ( )

guessLengthFromFile() protected method

Not sure why; perhaps files that have never been analysed. So, let's attempt to guess it by analysing the full file.
protected guessLengthFromFile ( )

isPlayed() public method

public isPlayed ( )

populateFrom() public method

public populateFrom ( array $fields )
$fields array

renderTime() protected method

protected renderTime ( $timestamp )

setLengthIfUnknown() protected method

This will attempt to set the length via guess work, if it's not already set.
protected setLengthIfUnknown ( )

toArray() public method

public toArray ( )

Property Details

$added protected property

protected $added

$album protected property

protected $album

$artist protected property

protected $artist

$deck protected property

protected $deck

$end_time protected property

protected $end_time

$fields protected property

protected $fields

$filename protected property

protected $filename

$fullpath protected property

protected $fullpath

$length protected property

protected $length

$played protected property

protected $played

$playtime protected property

protected $playtime

$row protected property

protected $row

$start_time protected property

protected $start_time

$title protected property

protected $title

$updated_at protected property

protected $updated_at