Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 1.47 KB

File metadata and controls

36 lines (29 loc) · 1.47 KB

scrobblerlog_parser

Audioscrobbler .scrobbler.log Parser, written in PHP and licensed under the MIT license (see LICENSE.txt)

A very simple parser that can handle v1.0 and v1.1 audioscrobbler log files as defined on the audioscrobbler wiki.

Usage

$parser = new ScrobblerLog\Parser('path/to/scrobbler.log');
$parsedData = $parser->parse();

If the device that has generated the log file is not timezone aware then the timezone must be specified before executing a parse:

$parser = new ScrobblerLog\Parser('path/to/scrobbler.log');
$parsedData = $parser->setTimezone('Europe/London')->parse();

The timezone can be any of the timezone strings listed in the PHP docs.

The parsed data is returned as an array of LoggedTrack objects.

Other Features

Some log file information is available after a parse has been executed:

$parser->getClient(); //get the name of the device that generated the scrobbler.log
$parser->getVersion(); //get the version of the scrobbler.log format that has been parsed (1.0 or 1.1)

and also some very basic stats...

$parser->getTotalTracksLogged(); //get total number of tracks logged
$parser->getTotalTracksPlayed(); //get total number of tracks listend to
$parser->getTotalTracksSkipped(); //get total number of tracks skipped
$parser->getTotalPlayTime(); //get total length (in seconds) or tracks played