Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 public function action_add_playlist()
 {
     $user = $this->is_logged();
     if ($user === false) {
         return Redirect::to_action('login');
     } else {
         $play = new Playlist();
         if (isset($_POST['playlist']) and $_POST['playlist'] != "") {
             $play->set_name_playlist($_POST['playlist']);
         } else {
             $this->_error_form = true;
             $this->_error_msg .= "Il y a une erreur dans le nom";
         }
         if ($this->_error_form == false) {
             $play->set_update(date('y-m-d'));
             $this->_error_msg .= "Ajout réussi!";
             $play->add();
             return Redirect::to_action('playlist');
         }
         return Redirect::to_action('playlist@add');
     }
 }
Esempio n. 3
0
session_start();
ob_start();
include "./common.php";
$error = '';
$action_name = 'add';
$action_value = _('Add');
Admin::checkAuth();
Admin::checkAccess(AdminAccess::ACCESS_VIEW);
foreach (@$_POST as $key => $value) {
    $_POST[$key] = trim($value);
}
$playlist = new Playlist();
if (@$_POST['add']) {
    Admin::checkAccess(AdminAccess::ACCESS_CREATE);
    $playlist->add($_POST['name'], $_POST['group_id']);
    header("Location: playlists.php");
}
$id = @intval($_GET['id']);
if (!empty($id)) {
    if (@$_POST['edit']) {
        Admin::checkAccess(AdminAccess::ACCESS_EDIT);
        $playlist->set(array('name' => $_POST['name'], 'group_id' => $_POST['group_id']), $_GET['id']);
        header("Location: playlists.php");
    } elseif (@$_GET['del']) {
        Admin::checkAccess(AdminAccess::ACCESS_DELETE);
        $playlist->del($id);
        header("Location: playlists.php");
    }
}
if (@$_GET['edit'] && !empty($id)) {