本文整理汇总了PHP中Track类的典型用法代码示例。如果您正苦于以下问题:PHP Track类的具体用法?PHP Track怎么用?PHP Track使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Track类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: transform
/**
* @param \SimpleXMLElement $xml
* @return Track
*/
public function transform(\SimpleXMLElement $xml)
{
$track = new Track();
$track->setArtist((string) $xml->artist);
$track->setTitle((string) $xml->title);
return $track;
}
示例2: addtrackAction
public function addtrackAction()
{
$form = new App_Form_NewTrack();
if (!empty($_POST) && $form->isValid($_POST)) {
$artists = new App_Table_Artist();
//--------------------------------
// Check the file info, and save
//--------------------------------
$track = new Track();
$track->title = $form->getValue('title');
$track->artistId = $this->_artist->id;
$track->releaseId = $form->getValue('releaseId');
$track->single = true;
$track->publishDate = $form->getValue('publishDate');
$track->save();
$this->_flash->addMessage('Your track info has been saved.');
$file = new TrackFile();
$file->trackId = $track->id;
$file->fileName = $form->audioFile->getFileName();
$file->mimeType = mime_content_type($file->fileName);
$file->save();
$track->originalFileId = $file->id;
$track->save();
$this->_flash->addMessage('The audio file for your track has been scheduled for injestion. Once the file has been injested, it will be available on the site.');
$form = new App_Form_NewTrack();
}
$form->setDefault('releaseId', $this->_request->getParam('releaseId'));
$form->setMethod('post');
$form->setAction('/dashboard/catalog/addtrack');
$this->view->form = $form;
}
示例3: showHistoryGetEntry
function showHistoryGetEntry()
{
require_once "track.php";
$track = new Track("", "", "");
$entry = $track->getEntry(loadvar("trid"));
return $entry["value"];
exit;
}
示例4: removeTrack
public function removeTrack(Track $track)
{
foreach ($this->tracks as $k => $v) {
if ($v->getNumber() == $track->getNumber()) {
array_splice($this->tracks, $k, 1);
}
}
$track->clear();
}
示例5: track
/**
* store in db action
*
* @return array
*/
protected function track($action, $model, $id)
{
$track = new Track();
$track->auth_id = Auth::user()->id;
$track->date = new Datetime();
$track->action = $action;
$track->trackable_id = $id;
$track->trackable_type = $model;
return $track->save();
}
示例6: scanFile
/**
* scan a file for music
*
* @param string $path
* @return boolean
*/
public function scanFile($path)
{
$mimeType = \OC\Files\Filesystem::getMimeType($path);
if ($mimeType === 'application/ogg' or substr($mimeType, 0, 5) === 'audio') {
$track = new Track($path);
$data = $track->getTags();
if (!empty($data)) {
$artistId = $this->collection->addArtist($data['artist']);
$albumId = $this->collection->addAlbum($data['album'], $artistId);
$this->collection->addSong($data['title'], $path, $artistId, $albumId, $data['length'], $data['track'], $data['size']);
}
}
return true;
}
示例7: testRemoveTrackFromAlbum
public function testRemoveTrackFromAlbum()
{
$album = Album::create('id', 'Album name');
$album->addTrack(Track::create('id', 'Track name'));
$album->removeTrack(Track::create('id', 'Track name'));
$this->assertCount(0, $album->getTracks());
}
示例8: admin
private function admin()
{
$today = strtotime('today');
$month = strtotime('first day of this month');
$last30 = strtotime('-30 days');
// Users statistics
$users['today'] = number_format(User::whereGt('reg_date', $today)->count());
$users['month'] = number_format(User::whereGt('reg_date', $month)->count());
$users['last30'] = number_format(User::whereGt('reg_date', $last30)->count());
$users['total'] = number_format(User::count());
View::set('users', $users);
// Playlists statistics
$playlists['today'] = number_format(Playlist::whereGt('date', $today)->count());
$playlists['month'] = number_format(Playlist::whereGt('date', $month)->count());
$playlists['last30'] = number_format(Playlist::whereGt('date', $last30)->count());
$playlists['total'] = number_format(Playlist::count());
View::set('playlists', $playlists);
// Tracks statistics
$tracks = number_format(Track::count());
View::set('tracks', $tracks);
// Tags statistics
$tags = number_format(Tag::count());
View::set('tags', $tags);
// Comments statistics
$comments = number_format(Comment::count());
View::set('comments', $comments);
// Likes
$likes = number_format(PlaylistLike::count());
View::set('likes', $likes);
// Reports
$reports = number_format(Report::count());
View::set('reports', $reports);
View::show('admin/admin');
}
示例9: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$latitud = Input::get('latitud', 0);
$longitud = Input::get('longitud', 0);
// DB::table('tracks')->insert( array(
// 'latitud' => $latitud,
// 'longitud' => $longitud
// ));
$track = new Track();
$track->latitud = $latitud;
$track->longitud = $longitud;
$track->save();
$respuesta = array("state" => "ok", "message" => "todo ok");
// $personas = Persona::all();
return json_encode($respuesta);
}
示例10: onArticleSaveComplete
public static function onArticleSaveComplete($article, $user, $revision, $status)
{
wfProfileIn(__METHOD__);
$insertedImages = Wikia::getVar('imageInserts');
$imageDeletes = Wikia::getVar('imageDeletes');
$changedImages = $imageDeletes;
foreach ($insertedImages as $img) {
$changedImages[$img['il_to']] = true;
}
$sendTrackEvent = false;
foreach ($changedImages as $imageDBName => $dummy) {
$title = Title::newFromDBkey($imageDBName);
if (!empty($title)) {
$mq = new self($title);
$mq->unsetCache();
$sendTrackEvent = true;
}
}
// send track event if embed change
if ($sendTrackEvent) {
Track::event('embed_change');
}
wfProfileOut(__METHOD__);
return true;
}
示例11: update_schema
/**
* Create/update schema in database.
*/
public static function update_schema()
{
global $wpdb;
$sql = "\n\n CREATE TABLE " . Track::table_name() . " (\n id int(11) NOT NULL AUTO_INCREMENT,\n stream_title varchar(200) NOT NULL,\n track_key varchar(200) NOT NULL,\n artist varchar(100) NOT NULL,\n title varchar(100) NOT NULL,\n play_count int(11) NOT NULL,\n vote_count int(11) NOT NULL,\n vote_total int(11) DEFAULT NULL,\n vote_average double DEFAULT NULL,\n PRIMARY KEY (id),\n UNIQUE KEY (track_key),\n KEY (vote_average),\n KEY (play_count),\n KEY (vote_count),\n KEY (vote_total)\n ) CHARACTER SET utf8;\n\n CREATE TABLE " . Play::table_name() . " (\n id int(11) NOT NULL AUTO_INCREMENT,\n time_utc datetime NOT NULL,\n track_id int(11) NOT NULL,\n stream_title varchar(200) NOT NULL,\n PRIMARY KEY (id),\n KEY (track_id),\n KEY (time_utc),\n CONSTRAINT " . Play::table_name() . "_ibfk_1 FOREIGN KEY (track_id) REFERENCES " . Track::table_name() . " (id)\n ) CHARACTER SET utf8;\n\n CREATE TABLE " . Vote::table_name() . " (\n id int(11) NOT NULL AUTO_INCREMENT,\n time_utc datetime NOT NULL,\n track_id int(11) NOT NULL,\n stream_title varchar(200) NOT NULL,\n value tinyint(4) NOT NULL,\n nick varchar(30) NOT NULL,\n user_id varchar(150) NOT NULL,\n is_authed bit(1) NOT NULL,\n deleted tinyint(4) NOT NULL DEFAULT '0',\n comment varchar(200) NULL,\n PRIMARY KEY (id),\n KEY (track_id),\n KEY (time_utc),\n KEY (nick),\n CONSTRAINT " . Vote::table_name() . "_ibfk_1 FOREIGN KEY (track_id) REFERENCES " . Track::table_name() . " (id)\n ) CHARACTER SET utf8;\n\n ";
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
dbDelta($sql);
}
示例12: buyTrack
public function buyTrack($trackid, $albumid)
{
$userid = $this->session->userdata('userid');
$result = array("error" => FALSE);
if (!$userid) {
$result["error"] = "You must login!";
echo json_encode($result);
}
$user = new User($userid);
$track = Track::loadTrack($trackid);
if ($user->getCredit() < $track->getCost()) {
//The user can't afford the track!
$result["error"] = "You have insufficient funds to buy the track as it costs £" . sprintf("%01.2f", $track->getCost() / 100) . ", please top up your account";
echo json_encode($result);
} else {
//Buy the rights to the track
if ($user->aquireRightsToTrack($trackid, $albumid)) {
//The track was bought successfully
$result["bought"] = TRUE;
} else {
$result["error"] = "Sorry, there was a problem buying the track. Please try again later";
}
echo json_encode($result);
}
}
示例13: getTopTracks
/** Get the most popular tracks on last.fm by country.
*
* @param string country A country name, as defined by the ISO 3166-1 country names standard. (Required)
* @param string location A metro name, to fetch the charts for (must be within the country specified). (Optional)
* @return array An array of Track objects.
*
* @static
* @access public
* @throws Error
*/
public static function getTopTracks($country, $location = null)
{
$xml = CallerFactory::getDefaultCaller()->call('geo.getTopTracks', array('country' => $country, 'location' => $location));
$tracks = array();
foreach ($xml->children() as $track) {
$tracks[] = Track::fromSimpleXMLElement($track);
}
return $tracks;
}
示例14: __construct
public function __construct($url, $arguments, $accept)
{
parent::__construct($url, $arguments, $accept);
// set the queryTrackId and queryTrackExternal_Key Values
$this->queryFileExternal_Key = $this->queryParameterId;
$this->queryFileId = $this->getIDfromExternalKey($this->queryFileExternal_Key);
$this->queryFileGUID = $this->getGUIDfromID($this->queryFileId);
// always include external_key Values in the Result
$this->external_keys = true;
}
示例15: index
function index()
{
$this->load->static_model('Track');
//$this->load->view('welcome_message');
$search_res = Track::searchByGenre("opera");
//$data = array('search_res' => $search_res);
//$this->load->view('search', $data);
$t = $search_res[0];
print_r($t->getArtist()->getTracks());
/*foreach( as $t){
echo $t->getName().", artist: ".$t->getArtist()->getName().", album: ".$t->getAlbum()->getName().", genres: ";
print_r($t->getGenres());
echo ", videos: ";
print_r($t->getVideos())."<br />";
}*/
}