本文整理汇总了PHP中Playlist类的典型用法代码示例。如果您正苦于以下问题:PHP Playlist类的具体用法?PHP Playlist怎么用?PHP Playlist使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Playlist类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: addVideo
/**
* Adds video to database.
*/
function addVideo()
{
$id = checkVideoExists();
$addVideo = new addVideo();
$playlistClass = new Playlist();
$playlist = $playlistClass->getMatchedPlaylist($id);
$addVideo->addVideoByID($id, $playlist);
}
开发者ID:rolandoislas,项目名称:rolandoislas.com-php,代码行数:11,代码来源:addVideoViaCron.php
示例2: executeCreate
public function executeCreate(sfWebRequest $request)
{
$playlist = Doctrine::getTable('Playlist')->findOneByTitle($request->getPostParameter("title"));
if ($playlist == NULL) {
$playlist = new Playlist();
$playlist->title = $request->getPostParameter("title");
$playlist->save();
echo $playlist->getId();
} else {
echo 'error';
}
exit;
}
开发者ID:nass600,项目名称:homeCENTER,代码行数:13,代码来源:actions.class.php
示例3: run
public function run()
{
$model = new Playlist();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Playlist'])) {
$model->attributes = $_POST['Playlist'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
开发者ID:robebeye,项目名称:MusicDream,代码行数:13,代码来源:CreateAction.php
示例4: parse
public function parse($content)
{
$data = $this->content2Data($content);
$version = 3;
$mediaSequence = 0;
extract($data);
// to $version, $mediaSequence, $targetDuration
$playlist = new Playlist();
foreach ($data['playlist'] as $index => $row) {
$mediaSegment = new Segment($row['uri'], $row['duration'], $mediaSequence + $index, !empty($row['isDiscontinuity']));
$playlist->add($mediaSegment);
}
return new M3U8($playlist, $version, $targetDuration, null, $allowCache, $hasEndlist);
}
开发者ID:codeages,项目名称:m3u8-toolkit,代码行数:14,代码来源:Parser.php
示例5: 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
示例6: testAddAndRemovePlaylist
function testAddAndRemovePlaylist()
{
// Create a playlist
$playlist = new Playlist();
$playlist->create("Scheduler Unit Test " . uniqid());
$result = $playlist->addAudioClip($this->storedFile->getId());
$result = $playlist->addAudioClip($this->storedFile2->getId());
$result = $playlist->addAudioClip($this->storedFile2->getId());
$i = new ScheduleGroup();
$this->groupIdCreated = $i->add('2010-11-11 01:30:23', null, $playlist->getId());
if (PEAR::isError($this->groupIdCreated)) {
$this->fail("Failed to create scheduled item: " . $this->groupIdCreated->getMessage());
}
$group = new ScheduleGroup($this->groupIdCreated);
if ($group->count() != 3) {
$this->fail("Wrong number of items added.");
}
$items = $group->getItems();
if (!is_array($items) || $items[1]["starts"] != "2010-11-11 01:30:34.231") {
$this->fail("Wrong start time for 2nd item.");
}
$result = $group->remove();
if ($result != 1) {
$this->fail("Did not remove item.");
}
Playlist::Delete($playlist->getId());
}
开发者ID:romansavrulin,项目名称:Airtime,代码行数:27,代码来源:SchedulerTests.php
示例7: showPlaylistItem
private function showPlaylistItem(Playlist $item)
{
$donwloadLink = 'index.php?web&action=' . ViewPlaylistWebPageAction::getActionName() . '&subaction=' . ViewPlaylistWebPageAction::SUBACTION_PLAYLIST_DOWNLOAD . '&download=' . base64_encode($item->getFilename()) . '&PHPSESID=' . session_id();
$itemLink = 'index.php?web&action=' . ViewPlaylistWebPageAction::getActionName() . '&subaction=' . ViewPlaylistWebPageAction::SUBACTION_PLAYLIST_OPEN . '&playlist=' . base64_encode($item->getFilename()) . '&PHPSESID=' . session_id();
$deleteLink = 'index.php?web&action=' . ViewPlaylistWebPageAction::getActionName() . '&subaction=' . ViewPlaylistWebPageAction::SUBACTION_PLAYLIST_DELETE . '&path=' . base64_encode($item->getFilename()) . '&PHPSESID=' . session_id();
$itemName = $item->getName() != null ? $item->getName() . " (" . utf8_decode($item->getFilename()) . ")" : utf8_decode($item->getFilename());
echo ' <td width="24px"><img width="22px" height="22px" src="../resources/playlist/video.png" style="border:0px;" /></td>' . "\n";
echo ' <td><a href="' . $itemLink . '">' . htmlentities($itemName) . '</a></td>' . "\n";
echo ' <td width="24px"><a href="' . $donwloadLink . '" target="_blank"><img width="22px" height="22px" src="../resources/playlist/video_down.png" style="border:0px;" alt="Donwload Playlist" title="Donwload Playlist" /></a></td>' . "\n";
echo ' <td width="24px"><a href="' . $itemLink . '"><img width="22px" height="22px" src="../resources/playlist/view.png" style="border:0px;" alt="Open Playlist" title="Open Playlist" /></a></td>' . "\n";
echo ' <td width="24px"><img width="22px" height="22px" src="../resources/playlist/edit.png" style="border:0px;" alt="Edit Playlist" title="Edit Playlist" /></td>' . "\n";
echo ' <td width="24px"><a href="' . $deleteLink . '"><img width="22px" height="22px" src="../resources/playlist/remove.png" style="border:0px;" alt="Remove Playlist" title="Remove Playlist"
onclick="return confirm(\'Are you sure to delete playlist ' . htmlentities(utf8_decode($item->getFilename())) . '?\');" /></a></td>' . "\n";
}
开发者ID:johnymarek,项目名称:eboda-hd-for-all-500,代码行数:14,代码来源:PlaylistExploreWebTemplate.php
示例8: add
/**
* Add a music clip or playlist to the schedule.
*
* @param int $p_showInstance
* ID of the show.
* @param $p_datetime
* In the format YYYY-MM-DD HH:MM:SS.mmmmmm
* @param $p_audioFileId
* (optional, either this or $p_playlistId must be set) DB ID of the audio file
* @param $p_playlistId
* (optional, either this of $p_audioFileId must be set) DB ID of the playlist
* @param $p_options
* Does nothing at the moment.
*
* @return int|PEAR_Error
* Return PEAR_Error if the item could not be added.
* Error code 555 is a scheduling conflict.
*/
public function add($p_showInstance, $p_datetime, $p_audioFileId = null, $p_playlistId = null, $p_options = null)
{
global $CC_CONFIG, $CC_DBC;
if (!is_null($p_audioFileId)) {
// Schedule a single audio track
// Load existing track
$track = StoredFile::Recall($p_audioFileId);
if (is_null($track)) {
return new PEAR_Error("Could not find audio track.");
}
// Check if there are any conflicts with existing entries
$metadata = $track->getMetadata();
$length = $metadata['MDATA_KEY_DURATION'];
if (empty($length)) {
return new PEAR_Error("Length is empty.");
}
// Insert into the table
$this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')");
$sql = "INSERT INTO " . $CC_CONFIG["scheduleTable"] . " (instance_id, starts, ends, clip_length, group_id, file_id, cue_out)" . " VALUES ({$p_showInstance}, TIMESTAMP '{$p_datetime}', " . " (TIMESTAMP '{$p_datetime}' + INTERVAL '{$length}')," . " '{$length}'," . " {$this->groupId}, {$p_audioFileId}, '{$length}')";
$result = $CC_DBC->query($sql);
if (PEAR::isError($result)) {
//var_dump($sql);
return $result;
}
} elseif (!is_null($p_playlistId)) {
// Schedule a whole playlist
// Load existing playlist
$playlist = Playlist::Recall($p_playlistId);
if (is_null($playlist)) {
return new PEAR_Error("Could not find playlist.");
}
// Check if there are any conflicts with existing entries
$length = trim($playlist->getLength());
//var_dump($length);
if (empty($length)) {
return new PEAR_Error("Length is empty.");
}
// Insert all items into the schedule
$this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')");
$itemStartTime = $p_datetime;
$plItems = $playlist->getContents();
//var_dump($plItems);
foreach ($plItems as $row) {
$trackLength = $row["cliplength"];
//var_dump($trackLength);
$sql = "INSERT INTO " . $CC_CONFIG["scheduleTable"] . " (instance_id, playlist_id, starts, ends, group_id, file_id," . " clip_length, cue_in, cue_out, fade_in, fade_out)" . " VALUES ({$p_showInstance}, {$p_playlistId}, TIMESTAMP '{$itemStartTime}', " . " (TIMESTAMP '{$itemStartTime}' + INTERVAL '{$trackLength}')," . " '{$this->groupId}', '{$row['file_id']}', '{$trackLength}', '{$row['cuein']}'," . " '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')";
$result = $CC_DBC->query($sql);
if (PEAR::isError($result)) {
//var_dump($sql);
return $result;
}
$itemStartTime = $CC_DBC->getOne("SELECT TIMESTAMP '{$itemStartTime}' + INTERVAL '{$trackLength}'");
}
}
RabbitMq::PushSchedule();
return $this->groupId;
}
开发者ID:romansavrulin,项目名称:Airtime,代码行数:75,代码来源:Schedule.php
示例9: index
function index()
{
$userid = $this->session->userdata('userid');
$this->load->static_model('Playlist');
$playlists = Playlist::getUsersPlaylists($userid);
$data = array('userid' => $userid, 'user' => $userid ? new User($userid) : NULL, 'playlists' => $playlists, 'page_title' => "Register");
$this->load->view("common/header.php", $data);
$this->load->view("register/register_view.php");
$this->load->view("common/footer.php");
}
开发者ID:bennetimo,项目名称:comp3013,代码行数:10,代码来源:register.php
示例10: is_logged
public function is_logged()
{
$user = Session::get('user');
if (isset($user)) {
$playlist = Playlist::get_for_display($user->get_id_user_lif());
Session::put('playlist', $playlist);
return $user;
} else {
return false;
}
}
开发者ID:laiello,项目名称:atm-music,代码行数:11,代码来源:base.php
示例11: addPlaylist
/**
* Add a playlist
*
* @param playlist_name str: new playlist name
* @param scan_id int: the scan id for a service scanner
* @param service_name str: the name of the service this playlist comes from eg.itunes
* @param service_unique_id str: any metadata key string to make the playlist more unique
* @return int: insert row id
*/
public function addPlaylist($playlist_name, $scan_id = 0, $service_name = null, $service_unique_id = null)
{
$playlist = new Playlist();
if ($scan_id > 0) {
$playlist->scan_id = (int) $scan_id;
}
if (strlen($service_name) > 0) {
$playlist->service_name = $service_name;
}
if (strlen($service_unique_id) > 0) {
$playlist->service_unique_id = $service_unique_id;
}
$playlist->name = $playlist_name;
$playlist->mtime = time();
$playlist->save();
$id = $playlist->getId();
$playlist->free();
unset($playlist);
return (int) $id;
}
开发者ID:Alenpiera,项目名称:streeme,代码行数:29,代码来源:PlaylistTable.class.php
示例12: loadModel
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
*/
public function loadModel()
{
if ($this->_model === null) {
if (isset($_GET['id'])) {
$this->_model = Playlist::model()->findbyPk($_GET['id']);
}
if ($this->_model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
}
return $this->_model;
}
开发者ID:robebeye,项目名称:MusicDream,代码行数:16,代码来源:PlaylistController.php
示例13: setup
function setup()
{
global $CC_CONFIG, $CC_DBC;
// Clear the files table
$sql = "DELETE FROM " . $CC_CONFIG["filesTable"];
$CC_DBC->query($sql);
// Add a file
$values = array("filepath" => dirname(__FILE__) . "/test10001.mp3");
$this->storedFile = StoredFile::Insert($values, false);
// Add a file
$values = array("filepath" => dirname(__FILE__) . "/test10002.mp3");
$this->storedFile2 = StoredFile::Insert($values, false);
// Clear the schedule table
$sql = "DELETE FROM " . $CC_CONFIG["scheduleTable"];
$CC_DBC->query($sql);
// Create a playlist
$playlist = new Playlist();
$playlist->create("Scheduler Unit Test");
$result = $playlist->addAudioClip($this->storedFile->getId());
$result = $playlist->addAudioClip($this->storedFile2->getId());
$result = $playlist->addAudioClip($this->storedFile2->getId());
// Schedule it
$i = new ScheduleGroup();
$this->groupIdCreated = $i->add('2010-11-11 01:30:23', null, $playlist->getId());
}
开发者ID:romansavrulin,项目名称:Airtime,代码行数:25,代码来源:SchedulerExportTests.php
示例14: generateId
public static function generateId($length)
{
$idExists = true;
while ($idExists) {
$chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$id = '';
for ($i = 0; $i < $length; $i++) {
$id .= $chars[rand(0, strlen($chars) - 1)];
}
$idExists = Playlist::exists(array('id' => $id));
}
return $id;
}
开发者ID:boulama,项目名称:DreamVids,代码行数:13,代码来源:playlist.php
示例15: feedPlaylists
/**
* Feed playlists
*/
public function feedPlaylists()
{
$rows = $this->hasMany('UserRelation', 'follower')->where('active', 1)->select('leader')->findArray();
if (!$rows) {
return false;
}
// A little eager loading
$following = array();
foreach ($rows as $item) {
$following[] = $item['leader'];
}
return Playlist::tableAlias('p')->selectMany('p.*', 'username')->join('user', 'u.id = user_id', 'u')->where('p.published', 1)->whereIn('user_id', $following)->orderByDesc('p.id')->paginate();
}
开发者ID:nytr0gen,项目名称:plur-music-explorer,代码行数:16,代码来源:User.php
示例16: index
function index()
{
$userid = $this->session->userdata('userid');
$playlists = null;
$user = null;
if ($userid) {
$this->load->static_model('Playlist');
$playlists = Playlist::getUsersPlaylists($userid);
$user = new User($userid);
}
$data = array('userid' => $userid, 'user' => $user, 'playlists' => $playlists, 'page_title' => "Welcome.");
$this->load->view("common/header.php", $data);
$this->load->view("register/activation_confirmation_view.php");
$this->load->view("common/footer.php");
}
开发者ID:bennetimo,项目名称:comp3013,代码行数:15,代码来源:activated.php
示例17: action_index
public function action_index()
{
$user = $this->is_logged();
if ($user === false) {
return Redirect::to_action('login');
} else {
$song_count = Song::count();
$album_count = Album::count();
$band_count = band::count();
$playlist_count = Playlist::count();
$user_count = User_lif::count();
$best_year_song = DB::query('SELECT date_song, count(*) as count FROM song GROUP BY date_song HAVING count ORDER BY count DESC LIMIT 1');
$max_in_playlist = DB::query('SELECT count(s.id_song) as count, b.name_band, s.`title_song` FROM song s JOIN songplaylist so ON s.id_song = so.id_song JOIN songalbum son ON s.id_song = son.id_song JOIN album a ON son.id_album = a.id_album JOIN band b ON a.id_band = b.id_band GROUP BY s.title_song HAVING count ORDER BY count DESC LIMIT 3');
//var_dump($best_year_song);
}
return View::make('stats.index')->with('song_count', $song_count)->with('album_count', $album_count)->with('best_year_song', $best_year_song)->with('playlist_count', $playlist_count)->with('user_count', $user_count)->with('max_in_playlist', $max_in_playlist)->with('band_count', $band_count);
}
开发者ID:laiello,项目名称:atm-music,代码行数:17,代码来源:stats.php
示例18: explore
private function explore()
{
// Get some tags to show as options
$tags = Tag::select('name')->limit(30)->findArray();
View::set('tags', $tags);
// No tags selected
if (empty($_GET['t']) || !Validate::tags($_GET['t'])) {
$rows = Playlist::join('user', 'user_id = u.id', 'u')->selectMany('playlist.*', 'username')->where('published', 1)->paginate();
Base::eagerLoadingPlaylistTags($rows);
View::set('playlists', $rows);
View::show('explore');
}
// Separate tags by spaces
$tags = trim($_GET['t']);
$tags = explode('/', $tags, 4);
$tags = array_slice($tags, 0, 3);
// Url for selected tags
$selectedTagsUrl = implode('/', $tags);
// Beautifys the title Tags
$selectedTags = array();
foreach ($tags as $key => $item) {
// Removes empty tags
if (empty($item)) {
unset($tags[$key]);
continue;
}
$aux = array();
$aux['name'] = $item;
// When one clicked will remove that tag from the query
unset($tags[$key]);
$aux['href'] = '/' . implode('/', $tags);
$tags[$key] = $item;
$selectedTags[] = $aux;
}
$playlists = Playlist::filter('byTags', $tags)->join('user', 'p.user_id = u.id', 'u')->selectMany('p.*', 'username');
$count = $playlists->countDistinct('p.id');
$playlists = $playlists->groupBy('p.id')->paginate($count);
Base::eagerLoadingPlaylistTags($playlists);
// View preparations
View::set('playlists', $playlists);
View::set('selectedTags', $selectedTags);
View::set('selectedTagsUrl', $selectedTagsUrl);
View::show('explore');
}
开发者ID:nytr0gen,项目名称:plur-music-explorer,代码行数:44,代码来源:explore.php
示例19: search
function search($page = 0, $display = 26)
{
$searchBy = $_POST["search_by"];
$term = $_POST["search_term"];
$userid = $this->session->userdata('userid');
$tracks = array();
try {
if ($searchBy == "name") {
$returned = Track::searchTrackName($term, $userid, $page * $display, $display);
} else {
if ($searchBy == "genre") {
$returned = Track::searchByGenre($term, $userid, $page * $display, $display);
} else {
if ($searchBy == "artist") {
$returned = Track::searchByArtist($term, $userid, $page * $display, $display);
} else {
if ($searchBy == "playlist") {
$this->load->static_model("Playlist");
$returned = Playlist::searchByName($term, $userid, $page * $display, $display);
} else {
echo json_encode(array("error" => "The search criteria is not recognized"));
return;
}
}
}
}
} catch (Exception $e) {
echo json_encode(array("error" => $e->getMessage()));
return;
}
$tracks = $returned['tracks'];
$num_rows = $returned['rows'];
if ($num_rows > $display) {
$num_pages = ceil($num_rows / $display);
} else {
$num_pages = 1;
}
$newTracks = array();
foreach ($tracks as $track) {
$newTracks[] = $track->toArray();
}
$result = array("tracks" => $newTracks, "cur_page" => $page, "num_pages" => $num_pages);
echo json_encode($result);
}
开发者ID:bennetimo,项目名称:comp3013,代码行数:44,代码来源:trackmanager.php
示例20: home
private function home()
{
$this->welcome();
// Staff picks
$staffPicks = Playlist::filter('byTags', 'staff')->select('p.*');
$count = $staffPicks->countDistinct('p.id');
$staffPicks = $staffPicks->groupBy('p.id')->orderByDesc('p.id')->paginate($count);
Base::eagerLoadingPlaylistTags($staffPicks);
View::set('staff_picks', $staffPicks);
// Home tags
$tags = Base::$g['home_tags'];
if (!empty($tags)) {
$tags = explode(', ', $tags);
foreach ($tags as $key => $tag) {
$playlists = Playlist::filter('byTags', $tag)->select('p.*');
$count = $playlists->countDistinct('p.id');
if (!$count) {
unset($tags[$key]);
continue;
}
$playlists = $playlists->groupBy('p.id')->orderByDesc('p.id')->paginate($count);
Base::eagerLoadingPlaylistTags($playlists);
$tags[$key] = $playlists;
$tags[$key]['title'] = $tag;
}
View::set('home_tags_playlists', $tags);
}
// New playlists
$newPlaylists = Playlist::orderByDesc('id')->where('published', 1)->paginate();
Base::eagerLoadingPlaylistTags($newPlaylists);
View::set('new_playlists', $newPlaylists);
if (LOGGED) {
$user = Base::$g['logged'];
// Liked playlists
$likedPlaylists = $user->likedPlaylists();
Base::eagerLoadingPlaylistTags($likedPlaylists);
View::set('liked_playlists', $likedPlaylists);
// Stream
$feedPlaylists = $user->feedPlaylists();
Base::eagerLoadingPlaylistTags($feedPlaylists);
View::set('feed_playlists', $feedPlaylists);
}
View::show('home');
}
开发者ID:nytr0gen,项目名称:plur-music-explorer,代码行数:44,代码来源:home.php
注:本文中的Playlist类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论