本文整理汇总了PHP中Track::update_play_count方法的典型用法代码示例。如果您正苦于以下问题:PHP Track::update_play_count方法的具体用法?PHP Track::update_play_count怎么用?PHP Track::update_play_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Track
的用法示例。
在下文中一共展示了Track::update_play_count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: web_track_start
/**
* (Web service method) Submit track start event
* @param mixed[] $args time_utc (YYYY-MM-DD); stream_title
* @return mixed[] status; error_message; output (what to announce in IRC chat room)
*/
private function web_track_start($args)
{
$time_utc = $args['time_utc'];
// YYYY-MM-DD HH:MM:SS
$stream_title = $args['stream_title'];
$track_id = Track::create_or_get_id($stream_title);
Play::new_play($time_utc, $track_id, $stream_title);
Track::update_play_count($track_id);
file_put_contents(PLUGIN_DIR . 'now_playing.txt', $stream_title);
$six = Play::recent_six();
$out = array();
$out[] = "<p><em>Now Playing:</em> " . esc_html($stream_title) . "</p>\n";
$out[] = "<p>Previously...<br />";
$i = 0;
foreach ($six as $play) {
if ($i > 0) {
//$out[] = date( 'H:i:s', $play->time_utc ) . ' UTC: ' .
$out[] = $play->time_utc . ' UTC: ' . esc_html($play->stream_title) . "<br />\n";
}
$i++;
}
$out[] = "</p>";
file_put_contents(PLUGIN_DIR . 'recent_tracks.html', implode($out));
$out = array();
$i = 0;
foreach ($six as $play) {
if ($i > 0) {
$out[] = date('c', strtotime($play->time_utc . " UTC")) . "\t" . $play->stream_title;
}
$i++;
}
file_put_contents(PLUGIN_DIR . 'recent_tracks.txt', implode("\n", $out));
return array('status' => 'ok', 'error_message' => '', 'output' => str_ireplace('${stream_title}', $args['stream_title'], Options::get_instance()->txt_now_playing));
}