PHP Class HistoryReader, sslscrobbler

Author: Ben XO ([email protected]) @copyright Copyright (c) 2010 Ben XO @license MIT License (http://www.opensource.org/licenses/mit-license.html) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Inheritance: implements SSLPluggable, implements SSLFilenameSource
Mostrar archivo Open project: ben-xo/sslscrobbler Class Usage Examples

Protected Properties

Property Type Description
$appname
$cli_plugins Plugins that can return SSLPlugins, configured from the command line
$csv
$dir_provided
$dump_and_exit command line switches
$dump_type
$filename
$help
$historydir
$log_file
$logger Logger
$manual_tick
$override_verbosity
$plugin_manager PluginManager
$post_process
$sleep
$verbosity
$wait_for_file

Public Methods

Method Description
__construct ( )
addCLIPlugin ( CLIPlugin $plugin ) Enable a CLI plugin.
addPlugin ( SSLPlugin $plugin )
getNewFilename ( )
main ( $argc, array $argv ) The main entry point to the application. Start here! When this returns, the program is done.
setVerbosityOverride ( array $override ) Takes an array of class names => log levels. Mainly you can use this to shut certain classes up that are too noisy at a particular log level, e.g. TickSource (which normally sends a L::DEBUG message every 2 seconds).
usage ( $appname, array $argv )

Protected Methods

Method Description
getDefaultHistoryDir ( )
getMostRecentFile ( $from_dir, $type )
monitor ( $filename ) Sets up and couples the event-driven history monitoring components, and then starts the clock.
parseOptions ( array $argv )
post_process ( $filename )
setupLogging ( )

Method Details

__construct() public method

public __construct ( )

addCLIPlugin() public method

Enable a CLI plugin.
public addCLIPlugin ( CLIPlugin $plugin )
$plugin CLIPlugin

addPlugin() public method

public addPlugin ( SSLPlugin $plugin )
$plugin SSLPlugin

getDefaultHistoryDir() protected method

protected getDefaultHistoryDir ( )

getMostRecentFile() protected method

protected getMostRecentFile ( $from_dir, $type )

getNewFilename() public method

public getNewFilename ( )

main() public method

Program flow: * Parse options * Set up logging, if requested * Ask plugins to do any early setup - this is where Last.fm / Twitter do OAuth etc * If no filename was supplied, either wait for a new one to be created in the default ScratchLive history folder (polls every 2 seconds), or go for the most recent (when --immediate is specified). * If --dump was specified, display the structure of the file and exit. (Very useful for probing ScratchLive files). * Otherwise, start monitoring the file.
public main ( $argc, array $argv )
$argc (from GLOBAL)
$argv array (from GLOBAL)

monitor() protected method

A signal handler is installed to catch Ctrl-C, although it's still safer to shutdown ScratchLive! first if you want everything scrobbled correctly. --post-process can be used to replay a file. --manual to ticks on user input (for debugging. Overrides --post-process for ticks). --csv can be used to replay from a CSV fake-file. These options can be combined.
protected monitor ( $filename )

parseOptions() protected method

protected parseOptions ( array $argv )
$argv array

post_process() protected method

protected post_process ( $filename )

setVerbosityOverride() public method

Takes an array of class names => log levels. Mainly you can use this to shut certain classes up that are too noisy at a particular log level, e.g. TickSource (which normally sends a L::DEBUG message every 2 seconds).
public setVerbosityOverride ( array $override )
$override array

setupLogging() protected method

protected setupLogging ( )

usage() public method

public usage ( $appname, array $argv )
$argv array

Property Details

$appname protected_oe property

protected $appname

$cli_plugins protected_oe property

Plugins that can return SSLPlugins, configured from the command line
protected $cli_plugins

$csv protected_oe property

protected $csv

$dir_provided protected_oe property

protected $dir_provided

$dump_and_exit protected_oe property

command line switches
protected $dump_and_exit

$dump_type protected_oe property

protected $dump_type

$filename protected_oe property

protected $filename

$help protected_oe property

protected $help

$historydir protected_oe property

protected $historydir

$log_file protected_oe property

protected $log_file

$logger protected_oe property

protected Logger $logger
return Logger

$manual_tick protected_oe property

protected $manual_tick

$override_verbosity protected_oe property

protected $override_verbosity

$plugin_manager protected_oe property

protected PluginManager $plugin_manager
return PluginManager

$post_process protected_oe property

protected $post_process

$sleep protected_oe property

protected $sleep

$verbosity protected_oe property

protected $verbosity

$wait_for_file protected_oe property

protected $wait_for_file