本文整理匯總了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));
}