예제 #1
0
<?php

session_start();
$playlist_id = $_REQUEST['playlist_id'];
$content_id = $_REQUEST['content_id'];
$operation = $_REQUEST['operation'];
if (isset($_REQUEST['connection'])) {
    $id_item = $_REQUEST['connection'];
}
if ($operation == 'add1') {
    addToPlaylist($playlist_id, $content_id);
} else {
    if ($operation == 'delete') {
        deleteRow($playlist_id, $content_id);
    } else {
        if ($operation == 'moveUp') {
            moveUp($playlist_id, $content_id, $id_item);
        } else {
            if ($operation == 'moveDown') {
                moveDown($playlist_id, $content_id, $id_item);
            }
        }
    }
}
function moveDown($playlist_id, $content_id, $id_item)
{
    $isUp = false;
    $servername = "localhost";
    $username = "******";
    $password = "******";
    $dbname = "Doopy";
예제 #2
0
    global $foldername;
    $hlsPlaylist = "upload/hlsplaylist.html";
    $url = "<li><a href='http://pilatus.d1.comp.nus.edu.sg/~a0110280/upload/{$foldername}/root.m3u8'>{$foldername}</li>\n";
    if (file_exists($hlsPlaylist)) {
        $file = fopen($hlsPlaylist, "a");
    } else {
        $file = fopen($hlsPlaylist, "w");
    }
    fwrite($file, $url);
    fclose($file);
}
$mpd = new SimpleXMLElement($basicxml);
$baseurl = $mpd->BaseURL;
$mp4files = glob($videopath . '*.mp4');
echo "Video path is " . $videopath . "\n";
if ($mp4files !== false) {
    $mp4count = count($mp4files);
    #echo "Number of files=".$mp4count;
    addToMPD($mp4count);
    createM3U8($mp4count);
}
#$mpdFilePath = "upload/" . $foldername . "/" . $foldername . ".mpd";
$mpdFilePath = "upload/{$foldername}/{$foldername}.mpd";
echo $mpdFilePath;
$mpdfp = fopen($mpdFilePath, "w") or die("Unable to open file");
fwrite($mpdfp, formatXML($mpd));
fclose($mpdfp);
$mpdPath = "{$foldername}/{$foldername}.mpd";
addToPlaylist($mpdPath);
createHlsPlaylist();
//fclose($logfp);
예제 #3
0
파일: User.php 프로젝트: Techraav/djMaker
 /**
  *	Create a Youtube Playlist and add some videos
  *
  *	@var $data : [title, description, privacy]
  *	@var $video_or_videos : video(s) to add to the playlist
  */
 public function createPlaylist(array $data, $video_or_videos)
 {
     $youtube = $this->getYoutubeClient();
     if ($youtube != false) {
         try {
             $pSnippet = new Google_Service_YouTube_PlaylistSnippet();
             $pSnippet->setTitle($data['title']);
             $pSnippet->setDescription($data['description']);
             $pStatus = new Google_Service_YouTube_PlaylistStatus();
             $pStatus->setPrivacyStatus($data['privacy']);
             $playlist = new Google_Service_YouTube_Playlist();
             $playlist->setSnippet($pSnippet);
             $playlist->setStatus($pStatus);
             $playlistResponse = $youtube->playlists->insert('snippet,status', $playlist, array());
             dd();
             $playlistId = $playlistResponse['id'];
             addToPlaylist($playlistId, $video_or_videos);
             return true;
         } catch (Google_Service_Exception $e) {
             return false;
         } catch (Google_Exception $e) {
             return false;
         }
     }
     return false;
 }