本文整理汇总了PHP中Track类的典型用法代码示例。如果您正苦于以下问题:PHP Track类的具体用法?PHP Track怎么用?PHP Track使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Track类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:samwalshnz,项目名称:nexgen-api,代码行数:11,代码来源:FetcherTrackTransformer.php
示例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;
}
开发者ID:ajbrown,项目名称:bitnotion,代码行数:31,代码来源:CatalogController.php
示例3: showHistoryGetEntry
function showHistoryGetEntry()
{
require_once "track.php";
$track = new Track("", "", "");
$entry = $track->getEntry(loadvar("trid"));
return $entry["value"];
exit;
}
开发者ID:nubissurveying,项目名称:nubis,代码行数:8,代码来源:smsajax.php
示例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();
}
开发者ID:stdtabs,项目名称:phptabs,代码行数:9,代码来源:Song.php
示例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();
}
开发者ID:Metrakit,项目名称:dynamix,代码行数:15,代码来源:BaseController.php
示例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;
}
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:20,代码来源:scanner.php
示例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());
}
开发者ID:alexgt9,项目名称:PlayCool,代码行数:7,代码来源:AlbumTest.php
示例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');
}
开发者ID:nytr0gen,项目名称:plur-music-explorer,代码行数:34,代码来源:admin.php
示例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);
}
开发者ID:keloxers,项目名称:urbano,代码行数:21,代码来源:TrakingsController.php
示例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;
}
开发者ID:yusufchang,项目名称:app,代码行数:25,代码来源:ArticlesUsingMediaQuery.class.php
示例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);
}
开发者ID:loonix,项目名称:music-stream-vote,代码行数:10,代码来源:Db.php
示例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);
}
}
开发者ID:bennetimo,项目名称:comp3013,代码行数:25,代码来源:accountmanager.php
示例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;
}
开发者ID:niczak,项目名称:php-last.fm-api,代码行数:19,代码来源:Geo.php
示例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;
}
开发者ID:EQ4,项目名称:smafe,代码行数:10,代码来源:TrackExternalKey.php
示例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 />";
}*/
}
开发者ID:bennetimo,项目名称:comp3013,代码行数:16,代码来源:welcome.php
示例16: actionInject
public function actionInject()
{
header('Content-type:application/json');
$post = Yii::app()->getRequest()->getPost('chart');
$weeks = $post['weeks'];
$artists = array();
$tracks = array();
$chart_entries = array();
// traverse $week
/* weeks : [
* {
* week : 1,
* year : 2008,
* tracks : [{
* start : 0,
* mark : 1,
* position : 32,
* track : "Sexual Eruption",
* artist : "Snoop Dogg"
* }]
* }
* ]
*/
foreach ($weeks as $week) {
foreach ($week['tracks'] as $chart_entry) {
// populate artists
$artist_name = $chart_entry['artist'];
$artist_hash = md5($artist_name);
if (!isset($artists[$artist_hash])) {
$artists[$artist_hash] = $artist_name;
}
// populate tracks
$track_title = $chart_entry['track'];
$track_hash = md5("{$track_title}\\%charty\\%{$artist_name}");
if (!isset($tracks[$track_hash])) {
$tracks[$track_hash] = array('title' => $track_title, 'artist_hash' => $artist_hash);
}
// populate chart_entry_data
$chart_entries[] = array('year' => $week['year'], 'week' => $week['week'], 'position' => $chart_entry['position'], 'track_hash' => $track_hash);
}
}
$inserted_artists = Artist::insertMultiple($artists);
$inserted_tracks = Track::insertMultiple($tracks);
$inserted_chart_entries = ChartEntry::insertMultiple($chart_entries);
echo json_encode(array('inserted_artists' => $inserted_artists, 'inserted_tracks' => $inserted_tracks, 'inserted_chart_entries' => $inserted_chart_entries));
}
开发者ID:passport90,项目名称:charty,代码行数:46,代码来源:FactoryController.php
示例17: search
/**
* Gets track by url
* @param string $url
* @return string
*/
public static function search($query)
{
// create a client object with your app credentials
$client = new Services_Soundcloud(Base::$g['soundcloud_client'], '');
// find all sounds
$tracks = $client->get('tracks', array('q' => $query, 'limit' => 40));
$tracks = json_decode($tracks);
$ret = array();
foreach ($tracks as $track) {
$table = Track::create();
$table->scid = $track->id;
$table->name = $track->title;
$table->scurl = $track->permalink_url;
$table->duration = round($track->duration / 1000);
$table->save();
$ret[] = $table->orm->asArray();
}
return $ret;
}
开发者ID:nytr0gen,项目名称:plur-music-explorer,代码行数:24,代码来源:Soundcloud.php
示例18: Exception
public function &getTracks($userid, $start = 0, $display = 30)
{
if ($this->id == NULL) {
throw new Exception("Missing playlist ID when getting playlist's tracks");
}
if ($this->tracks == NULL) {
$this->load->static_model('Track');
$query = "SELECT SQL_CALC_FOUND_ROWS a.name AS `album_name`, a.id AS `album_id`, t.*, art.id AS `artist_id`, art.name AS `artist_name`, ut.bought\n\t FROM `track` t, `artist` art,`album` a, `album_track` at, `playlist_track` pt\n\t LEFT JOIN `user_track` ut ON(ut.trackid = pt.trackid AND ut.userid = " . $this->db->escape($userid) . ")\n\t WHERE pt.playlistid = " . $this->db->escape($this->id) . " AND pt.albumid = a.id AND pt.trackid = t.id \n\t AND t.main_artistid = art.id AND t.id = at.`trackid` AND a.id = at.`albumid` ORDER BY pt.`play_order`";
if ($display > 0) {
$query .= " LIMIT {$start}, {$display}";
}
$this->tracks = Track::getTrackList($query);
}
$result = array("tracks" => NULL, "rows" => NULL);
$result["tracks"] = $this->tracks;
$res = $this->db->query("SELECT FOUND_ROWS() AS num_rows")->first_row();
$result["rows"] = $res->num_rows;
return $result;
}
开发者ID:bennetimo,项目名称:comp3013,代码行数:19,代码来源:playlist.php
示例19: getTracks
/**
* get the tracks where this
* artist is the main
* @return array of Track
*/
public function getTracks()
{
if ($this->artistid == NULL) {
throw new Exception("Missing track ID when requesting artist' track");
}
//find the track id
$query = "SELECT trackid FROM artist_track WHERE artistid = " . $this->db->escape($this->artistid);
$tids = $this->db->query($query)->result();
if (count($tids) > 0) {
$track_ids = "";
foreach ($tids as $tid) {
$track_ids .= $tid->trackid . ",";
}
//remove the last comma
$track_ids = substr($track_ids, 0, -1);
$query = "SELECT a.`year`, a.name AS `album_name`, a.id AS `album_id`, t.*, art.id AS `artist_id`, art.name AS `artist_name`\n FROM `album_track` at, `track` t, `artist` art,`album` a, `track_genre` tg, `genre` g\n \n WHERE t.main_artistid = art.id AND t.id in ({$track_ids}) \n AND t.id = at.`trackid` AND a.id = at.`albumid` AND g.id = tg.genreid AND t.id = tg.trackid \n ORDER BY a.`year`";
return Track::getTrackList($query);
}
return array();
}
开发者ID:bennetimo,项目名称:comp3013,代码行数:25,代码来源:artist.php
示例20: fromObject
/**
* {@inheritDoc}
*/
public static function fromObject($object)
{
$retval = new Album();
$retval->ids = (array) $object->ids;
$retval->title = $object->title;
$retval->primaryArtists = Artist::fromObjectArray((array) $object->primaryArtists);
$retval->guestArtists = Artist::fromObjectArray((array) $object->guestArtists);
$retval->flags = $object->flags;
$retval->duration = $object->duration;
$retval->originalReleaseDate = $object->originalReleaseDate;
$retval->rating = $object->rating;
$retval->isPick = $object->isPick;
$retval->genres = Genre::fromObjectArray((array) $object->genres);
$retval->headlineReview = $object->headlineReview;
$retval->classicalReview = ClassicalReview::fromObject($object->classicalReview);
$retval->credits = Credit::fromObjectArray((array) $object->credits);
$retval->tracks = Track::fromObjectArray((array) $object->tracks);
$retval->styles = Style::fromObjectArray((array) $object->styles);
return $retval;
}
开发者ID:lovek323,项目名称:rovi-tagger,代码行数:23,代码来源:Album.php
注:本文中的Track类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论