本文整理汇总了PHP中UI::check_ticker方法的典型用法代码示例。如果您正苦于以下问题:PHP UI::check_ticker方法的具体用法?PHP UI::check_ticker怎么用?PHP UI::check_ticker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UI
的用法示例。
在下文中一共展示了UI::check_ticker方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gather_art
/**
* gather_art
*
* This runs through all of the albums and finds art for them
* This runs through all of the needs art albums and trys
* to find the art for them from the mp3s
*/
public function gather_art()
{
// Make sure they've actually got methods
$art_order = AmpConfig::get('art_order');
if (!count($art_order)) {
debug_event('gather_art', 'art_order not set, Catalog::gather_art aborting', 3);
return true;
}
// Prevent the script from timing out
set_time_limit(0);
$search_count = 0;
$albums = $this->get_album_ids();
// Run through them and get the art!
foreach ($albums as $album_id) {
$art = new Art($album_id, 'album');
$album = new Album($album_id);
// We're going to need the name here
$album->format();
debug_event('gather_art', 'Gathering art for ' . $album->name, 5);
$options = array('album_name' => $album->full_name, 'artist' => $album->artist_name, 'keyword' => $album->artist_name . ' ' . $album->full_name);
$results = $art->gather($options, 1);
if (count($results)) {
// Pull the string representation from the source
$image = Art::get_from_source($results[0], 'album');
if (strlen($image) > '5') {
$art->insert($image, $results[0]['mime']);
// If they've enabled resizing of images generate a thumbnail
if (AmpConfig::get('resize_images')) {
$thumb = $art->generate_thumb($image, array('width' => 275, 'height' => 275), $results[0]['mime']);
if (is_array($thumb)) {
$art->save_thumb($thumb['thumb'], $thumb['thumb_mime'], '275x275');
}
}
} else {
debug_event('gather_art', 'Image less than 5 chars, not inserting', 3);
}
}
// Stupid little cutesie thing
$search_count++;
if (UI::check_ticker()) {
UI::update_text('count_art_' . $this->id, $search_count);
UI::update_text('read_art_' . $this->id, scrub_out($album->name));
}
unset($found);
}
// foreach albums
// One last time for good measure
UI::update_text('count_art_' . $this->id, $search_count);
}
示例2: _clean_chunk
/**
* _clean_chunk
* This is the clean function, its broken into
* said chunks to try to save a little memory
*/
private function _clean_chunk($media_type, $chunk, $chunk_size)
{
debug_event('clean', "Starting chunk {$chunk}", 5);
$dead = array();
$count = $chunk * $chunk_size;
$sql = "SELECT `id`, `file` FROM `{$media_type}` " . "WHERE `catalog`='{$this->id}' LIMIT {$count},{$chunk_size}";
$db_results = Dba::read($sql);
while ($results = Dba::fetch_assoc($db_results)) {
debug_event('clean', 'Starting work on ' . $results['file'] . '(' . $results['id'] . ')', 5);
$count++;
if (UI::check_ticker()) {
$file = str_replace(array('(', ')', '\''), '', $results['file']);
UI::update_text('clean_count_' . $this->id, $count);
UI::update_text('clean_dir_' . $this->id, scrub_out($file));
}
$file_info = Core::get_filesize(Core::conv_lc_file($results['file']));
if (!file_exists(Core::conv_lc_file($results['file'])) || $file_info < 1) {
debug_event('clean', 'File not found or empty: ' . $results['file'], 5);
AmpError::add('general', sprintf(T_('Error File Not Found or 0 Bytes: %s'), $results['file']));
// Store it in an array we'll delete it later...
$dead[] = $results['id'];
} else {
if (!Core::is_readable(Core::conv_lc_file($results['file']))) {
debug_event('clean', $results['file'] . ' is not readable, but does exist', 1);
}
}
}
return $dead;
}
示例3: gather_art
/**
* gather_art
*
* This runs through all of the albums and finds art for them
* This runs through all of the needs art albums and trys
* to find the art for them from the mp3s
* @param int[]|null $songs
* @param int[]|null $videos
*/
public function gather_art($songs = null, $videos = null)
{
// Make sure they've actually got methods
$art_order = AmpConfig::get('art_order');
if (!count($art_order)) {
debug_event('gather_art', 'art_order not set, Catalog::gather_art aborting', 3);
return true;
}
// Prevent the script from timing out
set_time_limit(0);
$search_count = 0;
$searches = array();
if ($songs == null) {
$searches['album'] = $this->get_album_ids();
$searches['artist'] = $this->get_artist_ids();
} else {
$searches['album'] = array();
$searches['artist'] = array();
foreach ($songs as $song_id) {
$song = new Song($song_id);
if ($song->id) {
if (!in_array($song->album, $searches['album'])) {
$searches['album'][] = $song->album;
}
if (!in_array($song->artist, $searches['artist'])) {
$searches['artist'][] = $song->artist;
}
}
}
}
if ($videos == null) {
$searches['video'] = $this->get_video_ids();
} else {
$searches['video'] = $videos;
}
// Run through items and get the art!
foreach ($searches as $key => $values) {
foreach ($values as $id) {
$this->gather_art_item($key, $id);
// Stupid little cutesie thing
$search_count++;
if (UI::check_ticker()) {
UI::update_text('count_art_' . $this->id, $search_count);
}
}
}
// One last time for good measure
UI::update_text('count_art_' . $this->id, $search_count);
}