• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Song类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Song的典型用法代码示例。如果您正苦于以下问题:PHP Song类的具体用法?PHP Song怎么用?PHP Song使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Song类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: addSong

 /**
  * Add a song to the library
  *
  * @param artist_id  int: the related artist primary key
  * @param album_id   int: the related album primary key
  * @param genre_id   int: the related genre primary key
  * @param song_array array: the array of song info
  * @return          int: the song insert id
  * @see apps/client/lib/MediaScan.class.php for information about the song_array
  */
 public function addSong($artist_id, $album_id, $last_scan_id, $song_array)
 {
     if (isset($song_array['filename']) && !empty($song_array['filename']) && isset($song_array['mtime']) && !empty($song_array['mtime']) && $last_scan_id) {
         $song = new Song();
         $song->unique_id = sha1(uniqid('', true) . mt_rand(1, 99999999));
         $song->artist_id = (int) $artist_id;
         $song->album_id = (int) $album_id;
         $song->scan_id = (int) $last_scan_id;
         $song->name = $song_array['song_name'];
         $song->length = $song_array['song_length'];
         $song->accurate_length = (int) $song_array['accurate_length'];
         $song->filesize = (int) $song_array['filesize'];
         $song->bitrate = (int) $song_array['bitrate'];
         $song->yearpublished = (int) $song_array['yearpublished'];
         $song->tracknumber = (int) $song_array['tracknumber'];
         $song->label = $song_array['label'];
         $song->mtime = (int) $song_array['mtime'];
         $song->atime = (int) $song_array['atime'];
         $song->filename = $song_array['filename'];
         $song->save();
         $id = $song->getId();
         $song->free();
         unset($song, $song_array);
         return $id;
     }
     return false;
 }
开发者ID:Alenpiera,项目名称:streeme,代码行数:37,代码来源:SongTable.class.php


示例2: getFileSafeTitle

 /**
  * File/Folder safe name of song
  *
  * @return string
  * @throws SMException
  */
 public function getFileSafeTitle()
 {
     if (empty($this->song)) {
         throw new SMException('Song myst be set');
     }
     return Utility::GenerateSafeFileName($this->song->getTitle());
 }
开发者ID:jasonwatt,项目名称:SMParser,代码行数:13,代码来源:FileParserAbstract.php


示例3: get_media_files

/**
 * get_media_files
 *
 * Takes an array of media ids and returns an array of the actual filenames
 *
 * @param    array    $media_ids    Media IDs.
 */
function get_media_files($media_ids)
{
    $media_files = array();
    $total_size = 0;
    foreach ($media_ids as $element) {
        if (is_array($element)) {
            if (isset($element['object_type'])) {
                $type = $element['object_type'];
                $id = $element['object_id'];
            } else {
                $type = array_shift($element);
                $id = array_shift($element);
            }
            $media = new $type($id);
        } else {
            $media = new Song($element);
        }
        if ($media->enabled) {
            $media->format();
            $total_size += sprintf("%.2f", $media->size / 1048576);
            $dirname = '';
            $parent = $media->get_parent();
            if ($parent != null) {
                $pobj = new $parent['object_type']($parent['object_id']);
                $pobj->format();
                $dirname = $pobj->get_fullname();
            }
            if (!array_key_exists($dirname, $media_files)) {
                $media_files[$dirname] = array();
            }
            array_push($media_files[$dirname], Core::conv_lc_file($media->file));
        }
    }
    return array($media_files, $total_size);
}
开发者ID:nioc,项目名称:ampache,代码行数:42,代码来源:batch.lib.php


示例4: getSongs

 public function getSongs($status)
 {
     if ($status == 'all') {
         $songs = AGDO::getInstance()->GetAll("SELECT * FROM SVsongs LEFT OUTER JOIN sv_song_genres ON g_id = website ORDER BY title");
     } elseif ($status == 'repertoire') {
         $songs = AGDO::getInstance()->GetAll("SELECT * FROM SVsongs LEFT OUTER JOIN sv_song_genres ON g_id = website WHERE probe != 1 AND probe != 5 ORDER BY title");
     } elseif ($status == 'uebrige') {
         $songs = AGDO::getInstance()->GetAll("SELECT * FROM SVsongs LEFT OUTER JOIN sv_song_genres ON g_id = website WHERE probe != 1 AND probe != 5 ORDER BY g_id,  title");
     } elseif ($status == 'erschienen') {
         $songs = AGDO::getInstance()->GetAll("SELECT * FROM SVsongs LEFT OUTER JOIN sv_song_genres ON g_id = website  ORDER BY erschienen DESC");
     } elseif ($status == 2) {
         $dringend = AGDO::getInstance()->GetAll("SELECT * FROM SVsongs LEFT OUTER JOIN sv_song_genres ON g_id = website WHERE probe = 3 ORDER BY title");
         $proben = AGDO::getInstance()->GetAll("SELECT * FROM SVsongs LEFT OUTER JOIN sv_song_genres ON g_id = website WHERE probe = 2 ORDER BY title");
         $sonstige = AGDO::getInstance()->GetAll("SELECT * FROM SVsongs LEFT OUTER JOIN sv_song_genres ON g_id = website WHERE probe = 4 ORDER BY letzteProbe");
         $songs = array_merge($dringend, $proben, $sonstige);
     } elseif ($status == 5) {
         $songs = AGDO::getInstance()->GetAll("SELECT * FROM SVsongs LEFT OUTER JOIN sv_song_genres ON g_id = website WHERE\n                    angefangen > '" . date("Y-m-d", time() - 3600 * 24 * 21) . "' OR probe = '5' ORDER BY angefangen DESC");
     } else {
         $songs = AGDO::getInstance()->GetAll("SELECT * FROM SVsongs LEFT OUTER JOIN sv_song_genres ON g_id = website WHERE probe = '" . $status . "' ORDER BY title");
     }
     foreach ($songs as $song) {
         $song['b'] = $song['c'];
         $song['arr_b'] = $song['arr_c'];
         $song['arr_t'] = '';
         $song['arr_p'] = '';
         $S = new Song();
         $S->setSong($song);
         $this->songs[$song['id']] = $S;
     }
     return $this->songs;
 }
开发者ID:hlag,项目名称:svs,代码行数:31,代码来源:Liste.php


示例5: action_add_song

 public function action_add_song()
 {
     $user = $this->is_logged();
     if ($user === false) {
         return Redirect::to_action('login');
     } else {
         $song = new Song();
         $form = $_POST;
         $song->set_id_kind(null);
         if ($_POST['name'] != "") {
             $song->set_title_song($_POST['name']);
         } else {
             $this->_error_form = true;
             $this->_error_msg .= "Il y a une erreur dans le titre. </br>";
         }
         if (isset($_POST['genre'])) {
             $song->set_id_kind($_POST['genre']);
         } else {
             $this->_error_form = true;
             $this->_error_msg .= "Il faut sélectionner au moins 1 genre. </br>";
         }
         if (is_numeric($_POST['anneeF']) and preg_match("/^[0-2][0-9]{3}+\$/", $_POST['anneeF']) == 1) {
             $song->set_date_song($_POST['anneeF']);
         } else {
             $this->_error_form = true;
             $this->_error_msg .= "Le format de l'année n'est pas valable. (Format:AAAA). </br>";
         }
         if (is_numeric($_POST['num'])) {
             $song->set_track_song($_POST['num']);
         } else {
             $this->_error_form = true;
             $this->_error_msg .= "Le numéro dans l'album doit être numérique. </br>";
         }
         if (isset($_POST['path'])) {
             $path = str_replace(' ', '_', $_POST['path']);
             $song->set_path_song(str_replace('public', '', URL::base()) . 'song/' . $path);
         } else {
             $this->_error_form = true;
             $this->_error_msg .= "Vous devez rentrez un fichier dans le formulaire de téléversement. </br>";
         }
         if ($this->_error_form == false) {
             $song->set_length_song($_POST['lengthM'], $_POST['lengthS']);
         }
         //var_dump(isset($_POST['album']));
         if (isset($_POST['album'])) {
             $song->_id_album = $_POST['album'];
         } else {
             $this->_error_form = true;
             $this->_error_msg .= "Ce groupe n'a pas encore d'album, veuillez le créer. </br>";
         }
         if ($this->_error_form == false and !$song->check_exists()) {
             $song->set_id_user_lif($user->get_id_user_lif());
             $song->add();
             $this->_error_msg .= "Chanson ajoutée avec succés!";
             $form = null;
         }
         return Redirect::to_action('song@add')->with('error', true)->with('form', $form)->with('error_msg', $this->_error_msg);
     }
 }
开发者ID:laiello,项目名称:atm-music,代码行数:59,代码来源:song.php


示例6: get

 /**
  * Get a song waveform.
  * @param int $song_id
  * @return binary|string|null
  */
 public static function get($song_id)
 {
     $song = new Song($song_id);
     $waveform = null;
     if ($song->id) {
         $song->format();
         $waveform = $song->waveform;
         if (!$waveform) {
             $catalog = Catalog::create_from_id($song->catalog);
             if ($catalog->get_type() == 'local') {
                 $transcode_to = 'wav';
                 $transcode_cfg = AmpConfig::get('transcode');
                 $valid_types = $song->get_stream_types();
                 if ($song->type != $transcode_to) {
                     $basedir = AmpConfig::get('tmp_dir_path');
                     if ($basedir) {
                         if ($transcode_cfg != 'never' && in_array('transcode', $valid_types)) {
                             $tmpfile = tempnam($basedir, $transcode_to);
                             $tfp = fopen($tmpfile, 'wb');
                             if (!is_resource($tfp)) {
                                 debug_event('waveform', "Failed to open " . $tmpfile, 3);
                                 return null;
                             }
                             $transcoder = Stream::start_transcode($song, $transcode_to);
                             $fp = $transcoder['handle'];
                             if (!is_resource($fp)) {
                                 debug_event('waveform', "Failed to open " . $song->file . " for waveform.", 3);
                                 return null;
                             }
                             do {
                                 $buf = fread($fp, 2048);
                                 fwrite($tfp, $buf);
                             } while (!feof($fp));
                             fclose($fp);
                             fclose($tfp);
                             Stream::kill_process($transcoder);
                             $waveform = self::create_waveform($tmpfile);
                             //$waveform = self::create_waveform("C:\\tmp\\test.wav");
                             @unlink($tmpfile);
                         } else {
                             debug_event('waveform', 'transcode setting to wav required for waveform.', '3');
                         }
                     } else {
                         debug_event('waveform', 'tmp_dir_path setting required for waveform.', '3');
                     }
                 } else {
                     $waveform = self::create_waveform($song->file);
                 }
             }
             if ($waveform) {
                 self::save_to_db($song_id, $waveform);
             }
         }
     }
     return $waveform;
 }
开发者ID:cheese1,项目名称:ampache,代码行数:61,代码来源:waveform.class.php


示例7: isPercussionChannel

 protected function isPercussionChannel(Song $song, $channelId)
 {
     $channels = $song->getChannels();
     foreach ($channels as $channel) {
         if ($channel->getChannelId() == $channelId) {
             return $channel->isPercussionChannel();
         }
     }
     return false;
 }
开发者ID:stdtabs,项目名称:phptabs,代码行数:10,代码来源:Helper.php


示例8: get_current_slideshow

 public static function get_current_slideshow()
 {
     $songs = Song::get_recently_played($GLOBALS['user']->id);
     $images = array();
     if (count($songs) > 0) {
         $last_song = new Song($songs[0]['object_id']);
         $last_song->format();
         $images = self::get_images($last_song->f_artist);
     }
     return $images;
 }
开发者ID:nioc,项目名称:ampache,代码行数:11,代码来源:slideshow.class.php


示例9: retrieveSongs

 public function retrieveSongs()
 {
     global $db, $hades;
     if ($this->itemsPerPage > 0) {
         $modifier = $this->page - 1;
         $offset = $modifier * $this->itemsPerPage;
         $limit = 'LIMIT ' . $offset . ', ' . $this->itemsPerPage;
     } else {
         $limit = '';
     }
     try {
         $statement = $db->prepare('
             SELECT *
             FROM songs ' . $limit);
         $statement->execute();
         $results = $statement->fetchAll(PDO::FETCH_ASSOC);
         foreach ($results as $row) {
             array_push($this->songs, Song::fillValues($row));
         }
         $total = $db->query('
             SELECT *
             FROM songs
         ');
         $this->totalItems = $total->rowCount();
     } catch (Exception $e) {
         $hades->databaseError($e);
         exit;
     }
 }
开发者ID:weirdwater,项目名称:coverlover-service,代码行数:29,代码来源:SongCollection.php


示例10: setSong

 public function setSong($song)
 {
     parent::setSong($song);
     $this->ps_id = $song['ps_id'];
     $this->pl_id = $song['pl_id'];
     $this->pb_id = $song['pb_id'];
     $this->pl_datum = $song['pl_datum'];
     $this->setPlayedButton();
 }
开发者ID:hlag,项目名称:svs,代码行数:9,代码来源:playlistSongs.php


示例11: execute

 public function execute($smarty, $params, $session)
 {
     $smarty->assign('name', $session['screen_name']);
     $artists = Artist::findAll();
     $smarty->assign('artists', $artists);
     $songs = Song::findAll();
     $smarty->assign('songs', $songs);
     $parts = Part::findAll();
     $smarty->assign('parts', $parts);
     $smarty->display('index.tpl');
 }
开发者ID:kenmaz,项目名称:www.kenmaz.net,代码行数:11,代码来源:IndexAction.class.php


示例12: home

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function home()
 {
     $banners = $this->banners;
     $body = 'body goes here';
     $header = 'Header goes here';
     $tweets = Gtweet::get();
     $videos = Video::wherePin(true)->get();
     $songs = Song::get();
     $projects = Project::limit(8)->latest()->get();
     return View::make('pages.home')->with(compact('body', 'header', 'banners', 'tweets', 'videos', 'songs', 'projects'));
 }
开发者ID:PuchkaTs,项目名称:ganbaatar,代码行数:16,代码来源:PagesController.php


示例13: render

 /**
  * Render a list page
  *
  * @param Song $song
  * The song that is currently playing
  *
  * @return string
  * The HTML of the rendered page
  */
 public static function render($song, $previous)
 {
     // instantiate the template engine
     $parser = new Rain\Tpl();
     // get the image data for the song
     $image_data = Song::getImageData($song['Artist'], $song['Album'], 320);
     // assign the values to the template parser
     $parser->assign(array('image' => $image_data, 'song' => $song, 'volume' => Music::getVolume(), 'previous' => $previous));
     // return the HTML
     return $parser->draw("now-playing-page", true);
 }
开发者ID:monstergfx,项目名称:pi-music,代码行数:20,代码来源:NowPlayingPage.php


示例14: get_latest_songs

 public function get_latest_songs($count)
 {
     if (!is_numeric($count)) {
         Logger::log("get_latest_songs: invalid count value");
         return array();
     }
     if (!$this->initialised()) {
         Logger::log("get_latest_songs: user not initialised");
         return array();
     }
     return Song::get_users_latest_songs($this, $count);
 }
开发者ID:horgh,项目名称:song_tracker,代码行数:12,代码来源:model.User.php


示例15: insertAndGet

 public static function insertAndGet($pdo, $name, $artist)
 {
     $st = $pdo->prepare('select * from songs where name = ? and artist_id = ?');
     $st->execute(array($name, $artist->id));
     if ($row = $st->fetch()) {
         return Song::factory($row);
     } else {
         $st = $pdo->prepare('insert into songs(name, artist_id) values(?, ?)');
         $st->execute(array($name, $artist->id));
         return self::insertAndGet($pdo, $name, $artist);
     }
 }
开发者ID:kenmaz,项目名称:www.kenmaz.net,代码行数:12,代码来源:Song.class.php


示例16: actionView

 public function actionView()
 {
     $this->layout = 'hopam_detail';
     $hopam = Song::model()->findByPk($_GET['id']);
     $hopam->view += 1;
     $hopam->update(array('view'));
     //$comment = $this->newComment($hopam);
     $cs = Yii::app()->getClientScript();
     $js = $this->generateJs();
     $cs->registerScript('sharebox', $js, CClientScript::POS_READY);
     $this->render('view', array('hopam' => $hopam));
     //,'comment'=>$comment
 }
开发者ID:ngdvan,项目名称:lntguitar,代码行数:13,代码来源:SongController.php


示例17: get_song_files

/**
 * get_song_files
 *
 * Takes an array of song ids and returns an array of the actual filenames
 *
 * @param    array    $media_ids    Media IDs.
 */
function get_song_files($media_ids)
{
    $media_files = array();
    $total_size = 0;
    foreach ($media_ids as $element) {
        if (is_array($element)) {
            $type = array_shift($element);
            $media = new $type(array_shift($element));
        } else {
            $media = new Song($element);
        }
        if ($media->enabled) {
            $total_size += sprintf("%.2f", $media->size / 1048576);
            $media->format();
            $dirname = $media->f_album_full;
            //debug_event('batch.lib.php', 'Songs file {'.$media->file.'}...', '5');
            if (!array_key_exists($dirname, $media_files)) {
                $media_files[$dirname] = array();
            }
            array_push($media_files[$dirname], $media->file);
        }
    }
    return array($media_files, $total_size);
}
开发者ID:axelsimon,项目名称:ampache,代码行数:31,代码来源:batch.lib.php


示例18: playNextSong

 /**
  * Returns the token of the next song to play
  *
  * This method will mark the playing song as played, and next song as playing.
  * If there is not a next song it will get one based on the Autoplayer
  *
  * @return string Song token
  */
 public function playNextSong()
 {
     // This will mark a song as played if for some reason it wasn't already
     $currentPlayingSong = $this->getQueue()->getPlayingSong();
     if ($currentPlayingSong !== false) {
         $this->markSongPlayed($currentPlayingSong['id']);
     }
     // Load up an autoplayer song if no songs queued
     if ($this->getQueue()->getNextSong() === false && GS_AUTOPLAY === true) {
         // Get autoplay song
         $autoplay = new Autoplay();
         $autoplaySong = $autoplay->getAutoplaySong();
         $user = $this->getUser()->autoplayUser();
         $song = new Song();
         $song->setSongInformation($autoplaySong['SongID'], $autoplaySong['SongName'], $autoplaySong['ArtistName'], $autoplaySong['ArtistID'], $autoplaySong['CoverArtFilename'], 'low');
         $songID = $this->getQueue()->addSongToQueue($song, $this->getUser());
     }
     $nextSong = $this->getQueue()->getNextSong();
     if ($nextSong) {
         $this->markSongPlaying($nextSong['id']);
         return $nextSong['token'];
     }
     return false;
 }
开发者ID:nbar1,项目名称:gs,代码行数:32,代码来源:Player.php


示例19: action_index

 public function action_index()
 {
     $user = $this->is_logged();
     if ($user === false) {
         return Redirect::to_action('login');
     } else {
         $playlist = adminPlaylist::get_completed($user->get_id_user_lif());
         $search = "";
         if (isset($_POST['toSeek'])) {
             $search = $_POST['toSeek'];
         }
         $song = Song::all_completed($_POST['toSeek']);
         return View::make('search.index')->with('toSeek', $_POST['toSeek'])->with('playlist', $playlist)->with('count', count($song))->with('song', $song);
     }
 }
开发者ID:laiello,项目名称:atm-music,代码行数:15,代码来源:search.php


示例20: action_display

 public function action_display()
 {
     $user = $this->is_logged();
     if ($user === false) {
         return Redirect::to_action('login');
     } else {
         $id_playlist = URI::segment(3);
         $adminPlaylist = new adminPlaylist($user->get_id_user_lif(), $id_playlist);
         if ($adminPlaylist->check_exists() == 1) {
             $song_array = array();
             $all = SongPlaylist::all_from_ids($id_playlist);
             foreach ($all as $value) {
                 $song = new Song($value->id_song);
                 $song->load();
                 array_push($song_array, $song);
             }
             $playlist = new Playlist($id_playlist);
             $playlist->load();
             return View::make('playlist.display')->with('playlist', $playlist)->with('songs', $song_array);
         } else {
             return Redirect::to_action('home@index');
         }
     }
 }
开发者ID:laiello,项目名称:atm-music,代码行数:24,代码来源:playlist.php



注:本文中的Song类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP SortableTable类代码示例发布时间:2022-05-23
下一篇:
PHP Something类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap