1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00

Allow add video watermark and playlist play live and TV

This commit is contained in:
DanielnetoDotCom 2020-11-30 16:44:26 -03:00
parent 5daa8640cb
commit 65f5b4cd23
62 changed files with 2761 additions and 380 deletions

View file

@ -150,6 +150,20 @@ Options All -Indexes
RewriteRule ^fileUpload$ view/mini-upload-form/upload.php [NC,L]
RewriteRule ^uploadPoster/([0-9]+)/(jpg|gif)$ objects/uploadPoster.php?video_id=$1&type=$2 [NC,L]
#for the Article name
RewriteRule ^article/([^!#$&'()*,\/:;=?@[\]]+)/?$ view/?videoName=$1 [QSA]
RewriteRule ^article/([^!#$&'()*,\/:;=?@[\]]+)/page/([0-9]+)/??$ view/?videoName=$1&page=$2 [QSA]
RewriteRule ^article/([0-9]+)/([^!#$&'()*,\/:;=?@[\]]+)/?$ view/?v=$1 [QSA]
RewriteRule ^article/([0-9]+)/([^!#$&'()*,\/:;=?@[\]]+)/page/([0-9]+)/??$ view/?v=$1&page=$3 [QSA]
#for the embeded article name
RewriteRule ^articleEmbed/([0-9]+)/? view/videoEmbeded.php?v=$1 [QSA]
RewriteRule ^articleEmbed/([^!#$&'()*+,\/:;=?@[\]]+)/?$ view/videoEmbeded.php?videoName=$1 [QSA]
RewriteRule ^cat/([^!#$&'()*,\/:;=?@[\]]+)/articleEmbed/([^!#$&'()*+,\/:;=?@[\]]+)/?$ view/videoEmbeded.php?catName=$1&videoName=$2 [QSA]
RewriteRule ^articleEmbed/([0-9]+)/? view/videoEmbeded.php?v=$1 [QSA]
RewriteRule ^articleEmbed/([^!#$&'()*+,\/:;=?@[\]]+)/?$ view/videoEmbeded.php?videoName=$1 [QSA]
RewriteRule ^articleEmbed/([0-9]+)/([^!#$&'()*+,\/:;=?@[\]]+)/?$ view/videoEmbeded.php?v=$1 [QSA]
#edit your own user
RewriteRule ^user$ view/user.php [NC,L]
@ -188,6 +202,13 @@ Options All -Indexes
RewriteRule ^runDBScriptPlugin.json$ objects/pluginRunDatabaseScript.json.php [NC,L]
#manager playList
RewriteRule ^epg.xml$ plugin/PlayLists/epg.xml.php [NC,L,QSA]
RewriteRule ^epg.json$ plugin/PlayLists/epg.json.php [NC,L,QSA]
RewriteRule ^epg.html$ plugin/PlayLists/epg.html.php [NC,L,QSA]
RewriteRule ^epg$ plugin/PlayLists/epg.php [NC,L,QSA]
RewriteRule ^tv$ plugin/PlayLists/tv.php [NC,L,QSA]
RewriteRule ^iptv$ plugin/PlayLists/iptv.php [NC,L,QSA]
RewriteRule ^iptv/([^/]+)/?$ plugin/PlayLists/iptv.php?channelName=$1 [NC,L,QSA]
RewriteRule ^playLists.json$ objects/playlists.json.php [NC,L]
RewriteRule ^playListsVideos.json$ objects/playlistsVideos.json.php [NC,L]
RewriteRule ^playListsFromUser.json/([0-9]+)/?$ objects/playlistsFromUser.json.php?users_id=$1 [NC,L]

View file

@ -415,14 +415,16 @@ ENGINE = InnoDB;
-- Table `playlists`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `playlists` (
`id` INT NOT NULL AUTO_INCREMENT,
`id` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`created` DATETIME NULL,
`modified` DATETIME NULL,
`users_id` INT NOT NULL,
`created` DATETIME NULL DEFAULT NULL,
`modified` DATETIME NULL DEFAULT NULL,
`users_id` INT(11) NOT NULL,
`status` ENUM('public', 'private', 'unlisted', 'favorite', 'watch_later') NOT NULL DEFAULT 'public',
`showOnTV` TINYINT NULL,
PRIMARY KEY (`id`),
INDEX `fk_playlists_users1_idx` (`users_id` ASC),
INDEX `showOnTVindex3` (`showOnTV` ASC),
CONSTRAINT `fk_playlists_users1`
FOREIGN KEY (`users_id`)
REFERENCES `users` (`id`)
@ -430,7 +432,6 @@ CREATE TABLE IF NOT EXISTS `playlists` (
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `playlists_has_videos`
-- -----------------------------------------------------

View file

@ -238,7 +238,7 @@ class Configuration {
function getFavicon($getPNG = false, $getTime = true) {
$return = self::_getFavicon($getPNG);
if ($getTime) {
return $return['url'] . "?" . filectime($return['file']);
return $return['url'] . "?" . filemtime($return['file']);
} else {
return $return['url'];
}

View file

@ -205,6 +205,7 @@ $object->isLogged = User::isLogged();
$object->isAdmin = User::isAdmin();
$object->canUpload = User::canUpload();
$object->canComment = User::canComment();
$object->canStream = User::canStream();
$object->redirectUri = @$_POST['redirectUri'];
//_error_log("login.json.php setup object done");

View file

@ -10,7 +10,7 @@ require_once $global['systemRootPath'] . 'objects/user.php';
class PlayList extends ObjectYPT {
protected $id, $name, $users_id, $status;
protected $id, $name, $users_id, $status, $showOnTV;
static $validStatus = array('public', 'private', 'unlisted', 'favorite', 'watch_later');
static function getSearchFieldsNames() {
@ -409,11 +409,20 @@ class PlayList extends ObjectYPT {
}
static function getVideosIdFromPlaylist($playlists_id) {
global $getVideosIdFromPlaylist;
if(empty($getVideosIdFromPlaylist)){
$getVideosIdFromPlaylist = array();
}
if(isset($getVideosIdFromPlaylist[$playlists_id])){
return $getVideosIdFromPlaylist[$playlists_id];
}
$videosId = array();
$rows = static::getVideosIDFromPlaylistLight($playlists_id);
foreach ($rows as $value) {
$videosId[] = $value['videos_id'];
}
$getVideosIdFromPlaylist[$playlists_id] = $videosId;
return $videosId;
}
@ -547,4 +556,53 @@ class PlayList extends ObjectYPT {
return true;
}
static function getEPG(){
global $config, $global;
$encoder = $config->_getEncoderURL();
$url = "{$encoder}view/videosListEPG.php?date_default_timezone=". urlencode(date_default_timezone_get());
$content = url_get_contents($url);
return json_decode($content);
}
function getShowOnTV() {
return intval($this->showOnTV);
}
function setShowOnTV($showOnTV) {
if(strtolower($showOnTV)==="false"){
$showOnTV = 0;
}else if(strtolower($showOnTV)==="true"){
$showOnTV = 1;
}
$this->showOnTV = intval($showOnTV);
}
static function getAllToShowOnTV() {
global $global;
if (!static::isTableInstalled()) {
return false;
}
$sql = "SELECT u.*, pl.* FROM playlists pl "
. " LEFT JOIN users u ON users_id = u.id "
. " WHERE showOnTV=1 ";
$sql .= self::getSqlFromPost();
//echo $sql;exit;
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = array();
if ($res != false) {
foreach ($fullData as $row) {
$rows[] = $row;
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
}

View file

@ -271,6 +271,8 @@ class Plugin extends ObjectYPT {
static function getDatabaseFileName($pluginName) {
global $global;
$pluginName = AVideoPlugin::fixName($pluginName);
$dir = $global['systemRootPath'] . "plugin";
$filename = $dir . DIRECTORY_SEPARATOR . $pluginName . DIRECTORY_SEPARATOR . "install" . DIRECTORY_SEPARATOR . "install.sql";
if (!file_exists($filename)) {

View file

@ -418,7 +418,7 @@ if (typeof gtag !== \"function\") {
}
if (!empty($photo) && preg_match("/videos\/userPhoto\/.*/", $photo)) {
if (file_exists($global['systemRootPath'] . $photo)) {
$photo = $global['webSiteRootURL'] . $photo . "?" . filectime($global['systemRootPath'] . $photo);
$photo = $global['webSiteRootURL'] . $photo . "?" . filemtime($global['systemRootPath'] . $photo);
} else {
$photo = "";
}

View file

@ -2728,7 +2728,7 @@ if (!class_exists('Video')) {
if (substr($type, -4) === ".jpg" || substr($type, -4) === ".png" || substr($type, -4) === ".gif" || substr($type, -4) === ".webp") {
$x = uniqid();
if (file_exists($source['path'])) {
$x = filectime($source['path']);
$x = filemtime($source['path']);
} else if (!empty($video)) {
$x = strtotime($video['modified']);
}
@ -2770,6 +2770,7 @@ if (!class_exists('Video')) {
}
static function getHigestResolution($filename) {
$filename = self::getCleanFilenameFromFile($filename);
$cacheName = "getHigestResolution($filename)";
$return = ObjectYPT::getCache($cacheName, 0);
if (!empty($return)) {
@ -2810,6 +2811,21 @@ if (!class_exists('Video')) {
return $return;
}
static function getResolutionFromFilename($filename) {
$resolution = false;
if(preg_match("/_([0-9]+).(mp4|webm)/i", $filename, $matches)){
if(!empty($matches[1])){
$resolution = intval($matches[1]);
}
}else if(preg_match('/res([0-9]+)\/index.m3u8/i', $filename, $matches)){
if(!empty($matches[1])){
$resolution = intval($matches[1]);
}
}
//var_dump($filename, $resolution);exit;
return $resolution;
}
static function getHigestResolutionVideoMP4Source($filename, $includeS3 = false) {
$types = array('', '_HD', '_SD', '_Low');
foreach ($types as $value) {

View file

@ -212,11 +212,14 @@ class API extends PluginAbstract {
$parameters['currentPlaylistTime'] = 0;
foreach ($parameters['videos'] as $key => $value) {
$parameters['videos'][$key]['path'] = Video::getHigherVideoPathFromID($value['id']);;
$parameters['videos'][$key]['path'] = Video::getHigherVideoPathFromID($value['id']);
if($key && $key<=$parameters['index']){
$parameters['currentPlaylistTime'] += durationToSeconds($parameters['videos'][$key-1]['duration']);
}
$parameters['totalPlaylistDuration'] += durationToSeconds($parameters['videos'][$key]['duration']);
$parameters['videos'][$key]['info'] = Video::getTags($value['id']);
$parameters['videos'][$key]['category'] = Category::getCategory($value['categories_id']);
}
if(empty($parameters['totalPlaylistDuration'])){
$parameters['percentage_progress'] = 0;

View file

@ -300,6 +300,7 @@ class AVideoPlugin {
static function isPluginTablesInstalled($name, $installIt = false) {
global $global, $isPluginTablesInstalled;
$name = self::fixName($name);
$installSQLFile = "{$global['systemRootPath']}plugin/{$name}/install/install.sql";
if (isset($isPluginTablesInstalled[$installSQLFile])) {
return $isPluginTablesInstalled[$installSQLFile];
@ -486,6 +487,7 @@ class AVideoPlugin {
public static function exists($name) {
global $global;
$name = self::fixName($name);
$filename = "{$global['systemRootPath']}plugin/{$name}/{$name}.php";
return file_exists($filename);
}
@ -1409,6 +1411,13 @@ class AVideoPlugin {
return in_array($UUID, $UUIDs);
}
static function fixName($name){
if($name==='Programs'){
return 'PlayLists';
}
return $name;
}
}
class YouPHPTubePlugin extends AVideoPlugin {

View file

@ -33,7 +33,7 @@ class Gallery extends PluginAbstract {
$obj = $this->getDataObject();
// preload image
$js = "<script>var img1 = new Image();img1.src=\"{$global['webSiteRootURL']}view/img/video-placeholder-gray.png\";</script>";
$css = '<link href="' . $global['webSiteRootURL'] . 'plugin/Gallery/style.css?'.(filectime($global['systemRootPath'].'plugin/Gallery/style.css')).'" rel="stylesheet" type="text/css"/>';
$css = '<link href="' . $global['webSiteRootURL'] . 'plugin/Gallery/style.css?'.(filemtime($global['systemRootPath'].'plugin/Gallery/style.css')).'" rel="stylesheet" type="text/css"/>';
if(!empty($obj->playVideoOnFullscreen) && (!empty($_GET['videoName']) || !empty($_GET['evideo']))){
$css .= '<link href="' . $global['webSiteRootURL'] . 'plugin/Gallery/fullscreen.css" rel="stylesheet" type="text/css"/>';
}

View file

@ -92,7 +92,7 @@
?>
<div id="categoriesContainer"></div>
<p class="pagination infiniteScrollPagination">
<a class="pagination__next" href="<?php echo $global['webSiteRootURL']; ?>plugin/Gallery/view/modeGalleryCategory.php?tags_id=<?php echo intval(@$_GET['tags_id']); ?>&current=1&search=<?php echo getSearchVar(); ?>"></a>
<a class="pagination__next" href="<?php echo $global['webSiteRootURL']; ?>plugin/Gallery/view/modeGalleryCategory.php?tags_id=<?php echo intval(@$_GET['tags_id']); ?>&search=<?php echo getSearchVar(); ?>&current=1"></a>
</p>
<div class="scroller-status">
<div class="infinite-scroll-request loader-ellips text-center">

View file

@ -111,6 +111,14 @@ class Live extends PluginAbstract {
sqlDal::writeSql(trim($value));
}
}
//update version 5.2
if (AVideoPlugin::compareVersion($this->getName(), "6.0") < 0) {
$sqls = file_get_contents($global['systemRootPath'] . 'plugin/Live/install/updateV6.0.sql');
$sqlParts = explode(";", $sqls);
foreach ($sqlParts as $value) {
sqlDal::writeSql(trim($value));
}
}
return true;
}
@ -419,13 +427,15 @@ class Live extends PluginAbstract {
static function getPlayerServer() {
$obj = AVideoPlugin::getObjectData("Live");
$url = $obj->playerServer;
if (!empty($obj->useLiveServers)) {
$ls = new Live_servers(self::getCurrentLiveServersId());
if (!empty($ls->getPlayerServer())) {
return $ls->getPlayerServer();
$url = $ls->getPlayerServer();
}
}
return $obj->playerServer;
$url = str_replace("encoder.gdrive.local","192.168.1.18", $url);
return $url;
}
static function getUseAadaptiveMode() {
@ -710,6 +720,20 @@ class Live extends PluginAbstract {
}
}
static function getLastServersIdFromUser($users_id) {
$last = LiveTransmitionHistory::getLatestFromUser($users_id);
if (empty($last)) {
return 0;
} else {
return intval($last['live_servers_id']);
}
}
static function getLinkToLiveFromUsers_idWithLastServersId($users_id){
$live_servers_id = self::getLastServersIdFromUser($users_id);
return self::getLinkToLiveFromUsers_idAndLiveServer($users_id, $live_servers_id);
}
static function getCurrentLiveServersId() {
$live_servers_id = self::getLiveServersIdRequest();
if ($live_servers_id) {
@ -958,8 +982,8 @@ class Live extends PluginAbstract {
if(!empty($matches[1])){
$_REQUEST['playlists_id_live'] = intval($matches[1]);
$playlists_id_live = $_REQUEST['playlists_id_live'];
$pl = new PlayList($_REQUEST['playlists_id_live']);
$title = $pl->getName();
$photo = PlayLists::getImage($_REQUEST['playlists_id_live']);
$title = PlayLists::getNameOrSerieTitle($_REQUEST['playlists_id_live']);
}
}

View file

@ -121,6 +121,23 @@ class LiveTransmitionHistory extends ObjectYPT {
return $row;
}
static function getLatestFromUser($users_id) {
global $global;
$sql = "SELECT * FROM " . static::getTableName() . " WHERE `users_id` = ? ORDER BY created DESC LIMIT 1";
// I had to add this because the about from customize plugin was not loading on the about page http://127.0.0.1/AVideo/about
$res = sqlDAL::readSql($sql, "i", array($users_id));
$data = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if ($res) {
$row = $data;
} else {
$row = false;
}
return $row;
}
public function save() {
if (empty($this->live_servers_id)) {
$this->live_servers_id = 'NULL';

View file

@ -15,32 +15,33 @@ SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- Table `live_transmitions`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `live_transmitions` (
`id` INT NOT NULL AUTO_INCREMENT,
`id` INT(11) NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL,
`public` TINYINT(1) NULL DEFAULT 1,
`saveTransmition` TINYINT(1) NULL DEFAULT 0,
`created` DATETIME NULL,
`modified` DATETIME NULL,
`key` VARCHAR(255) NULL,
`description` TEXT NULL,
`users_id` INT NOT NULL,
`categories_id` INT NOT NULL,
`created` DATETIME NULL DEFAULT NULL,
`modified` DATETIME NULL DEFAULT NULL,
`key` VARCHAR(255) NULL DEFAULT NULL,
`description` TEXT NULL DEFAULT NULL,
`users_id` INT(11) NOT NULL,
`categories_id` INT(11) NOT NULL,
`showOnTV` TINYINT NULL,
PRIMARY KEY (`id`),
INDEX `fk_live_transmitions_users1_idx` (`users_id` ASC),
INDEX `fk_live_transmitions_categories1_idx` (`categories_id` ASC),
CONSTRAINT `fk_live_transmitions_users1`
FOREIGN KEY (`users_id`)
REFERENCES `users` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
INDEX `showOnTVLiveindex3` (`showOnTV` ASC),
CONSTRAINT `fk_live_transmitions_categories1`
FOREIGN KEY (`categories_id`)
REFERENCES `categories` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_live_transmitions_users1`
FOREIGN KEY (`users_id`)
REFERENCES `users` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `live_transmitions_has_users_groups`
-- -----------------------------------------------------

View file

@ -0,0 +1,3 @@
ALTER TABLE `live_transmitions`
ADD COLUMN `showOnTV` TINYINT NULL DEFAULT NULL,
ADD INDEX `showOnTVLiveindex3` (`showOnTV` ASC);

View file

@ -1,4 +1,3 @@
<link href="<?php echo $global['webSiteRootURL']; ?>view/css/font-awesome-animation.min.css" rel="stylesheet" type="text/css"/>
<style>
.liveVideo{
position: relative;

View file

@ -34,7 +34,18 @@ $video['users_id'] = $user_id;
$subscribe = Subscribe::getButton($user_id);
$name = $u->getNameIdentificationBd();
$name = "<a href='" . User::getChannelLink($user_id) . "' class='btn btn-xs btn-default'>{$name} " . User::getEmailVerifiedIcon($user_id) . "</a>";
$video['creator'] = '<div class="pull-left"><img src="' . User::getPhoto($user_id) . '" alt="User Photo" class="img img-responsive img-circle" style="max-width: 40px;"/></div><div class="commentDetails" style="margin-left:45px;"><div class="commenterName text-muted"><strong>' . $name . '</strong><br>' . $subscribe . '</div></div>';
$liveTitle = $livet['title'];
$liveDescription = $livet['description'];
$liveImg = User::getPhoto($user_id);
if(!empty($_REQUEST['playlists_id_live'])){
$liveTitle = PlayLists::getNameOrSerieTitle($_REQUEST['playlists_id_live']);
$liveDescription = PlayLists::getDescriptionIfIsSerie($_REQUEST['playlists_id_live']);
$liveImg = PlayLists::getImage($_REQUEST['playlists_id_live']);
}
$video['creator'] = '<div class="pull-left"><img src="' . $liveImg . '" alt="User Photo" class="img img-responsive img-circle" style="max-width: 40px;"/></div><div class="commentDetails" style="margin-left:45px;"><div class="commenterName text-muted"><strong>' . $name . '</strong><br>' . $subscribe . '</div></div>';
$img = "{$global['webSiteRootURL']}plugin/Live/getImage.php?u={$_GET['u']}&format=jpg";
$imgw = 640;
@ -58,7 +69,7 @@ if(empty($sideAd) && !AVideoPlugin::loadPluginIfEnabled("Chat2")){
<!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>">
<head>
<title><?php echo $livet['title']; ?> - <?php echo __("Live Video"); ?> - <?php echo $config->getWebSiteTitle(); ?></title>
<title><?php echo $liveTitle; ?> - <?php echo __("Live Video"); ?> - <?php echo $config->getWebSiteTitle(); ?></title>
<link href="<?php echo $global['webSiteRootURL']; ?>js/video.js/video-js.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>css/player.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>js/webui-popover/jquery.webui-popover.min.css" rel="stylesheet" type="text/css"/>
@ -69,13 +80,13 @@ if(empty($sideAd) && !AVideoPlugin::loadPluginIfEnabled("Chat2")){
<meta property="fb:app_id" content="774958212660408" />
<meta property="og:url" content="<?php echo Live::getLinkToLiveFromUsers_id($user_id); ?>" />
<meta property="og:type" content="video.other" />
<meta property="og:title" content="<?php echo str_replace('"', '', $livet['title']); ?> - <?php echo $config->getWebSiteTitle(); ?>" />
<meta property="og:description" content="<?php echo str_replace('"', '', $livet['title']); ?>" />
<meta property="og:title" content="<?php echo str_replace('"', '', $liveTitle); ?> - <?php echo $config->getWebSiteTitle(); ?>" />
<meta property="og:description" content="<?php echo str_replace('"', '', $liveTitle); ?>" />
<meta property="og:image" content="<?php echo $img; ?>" />
<meta property="og:image:width" content="<?php echo $imgw; ?>" />
<meta property="og:image:height" content="<?php echo $imgh; ?>" />
<?php
echo AVideoPlugin::getHeadCode();
//echo AVideoPlugin::getHeadCode();
?>
</head>
@ -147,11 +158,11 @@ if(empty($sideAd) && !AVideoPlugin::loadPluginIfEnabled("Chat2")){
<?php
}
?>
<?php echo $livet['title']; ?>
<?php echo $liveTitle; ?>
</h1>
<div class="col-xs-12 col-sm-12 col-lg-12"><?php echo $video['creator']; ?></div>
<p><?php echo nl2br(textToLink($livet['description'])); ?></p>
<p><?php echo nl2br(textToLink($liveDescription)); ?></p>
<div class="row">
<div class="col-md-12 watch8-action-buttons text-muted">
<a href="#" class="btn btn-default no-outline" id="shareBtn">
@ -172,7 +183,7 @@ if(empty($sideAd) && !AVideoPlugin::loadPluginIfEnabled("Chat2")){
</div>
<?php
$link = Live::getLinkToLiveFromUsers_id($user_id);
getShareMenu($livet['title'], $link, $link, $link .= "?embed=1");
getShareMenu($liveTitle, $link, $link, $link .= "?embed=1");
?>
<div class="row">

View file

@ -59,6 +59,9 @@ $poster = Live::getPosterImage($livet['users_id'], $_REQUEST['live_servers_id'])
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
var player;
</script>
<?php
echo AVideoPlugin::getHeadCode();
?>
</head>
<body>
@ -95,9 +98,7 @@ $poster = Live::getPosterImage($livet['users_id'], $_REQUEST['live_servers_id'])
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/script.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/js-cookie/js.cookie.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/jquery-toast/jquery.toast.min.js" type="text/javascript"></script>
<?php
echo AVideoPlugin::getHeadCode();
?>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/seetalert/sweetalert.min.js" type="text/javascript"></script>
<script>
<?php
echo PlayerSkins::getStartPlayerJS();

View file

@ -0,0 +1,104 @@
<?php
require_once dirname(__FILE__) . '/../../../videos/configuration.php';
class Playlists_schedules extends ObjectYPT {
protected $id,$playlists_id,$name,$description,$status,$loop,$start_datetime,$finish_datetime,$repeat,$parameters;
static $REPEAT_MONTHLY = 'm';
static $REPEAT_WEEKLY = 'w';
static $REPEAT_DAYLY = 'd';
static $REPEAT_NEVER = 'n';
static function getSearchFieldsNames() {
return array('name','description','parameters');
}
static function getTableName() {
return 'playlists_schedules';
}
function setId($id) {
$this->id = intval($id);
}
function setPlaylists_id($playlists_id) {
$this->playlists_id = intval($playlists_id);
}
function setName($name) {
$this->name = $name;
}
function setDescription($description) {
$this->description = $description;
}
function setStatus($status) {
$this->status = $status;
}
function setLoop($loop) {
$this->loop = intval($loop);
}
function setStart_datetime($start_datetime) {
$this->start_datetime = $start_datetime;
}
function setFinish_datetime($finish_datetime) {
$this->finish_datetime = $finish_datetime;
}
function setRepeat($repeat) {
$this->repeat = $repeat;
}
function setParameters($parameters) {
$this->parameters = $parameters;
}
function getId() {
return intval($this->id);
}
function getPlaylists_id() {
return intval($this->playlists_id);
}
function getName() {
return $this->name;
}
function getDescription() {
return $this->description;
}
function getStatus() {
return $this->status;
}
function getLoop() {
return intval($this->loop);
}
function getStart_datetime() {
return $this->start_datetime;
}
function getFinish_datetime() {
return $this->finish_datetime;
}
function getRepeat() {
return $this->repeat;
}
function getParameters() {
return $this->parameters;
}
}

View file

@ -4,6 +4,7 @@ require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php';
require_once $global['systemRootPath'] . 'objects/playlist.php';
require_once $global['systemRootPath'] . 'plugin/PlayLists/Objects/Playlists_schedules.php';
class PlayLists extends PluginAbstract {
public function getTags() {
@ -12,6 +13,7 @@ class PlayLists extends PluginAbstract {
PluginTags::$FREE,
);
}
public function getDescription() {
return "Playlists or Program Playlists are identified by default as programs of content on the AVideo Platform.<br>"
. " You can use the Edit Parameters button to rename it to your choosing.<br> We recommend to keep the Program name "
@ -46,12 +48,16 @@ class PlayLists extends PluginAbstract {
$obj->showFavoriteOnProfileMenu = true;
$obj->showPlayLiveButton = true;
$obj->showTrailerInThePlayList = true;
$obj->showTVFeatures = false;
return $obj;
}
public function getWatchActionButton($videos_id) {
global $global;
global $global, $livet;
if (isLive() && empty($videos_id) && !empty($livet)) {
include $global['systemRootPath'] . 'plugin/PlayLists/actionButtonLive.php';
} else {
if (!self::canAddVideoOnPlaylist($videos_id)) {
return "";
}
@ -60,6 +66,7 @@ class PlayLists extends PluginAbstract {
$btnClass = "btn btn-default no-outline";
include $global['systemRootPath'] . 'plugin/PlayLists/actionButton.php';
}
}
public function getNetflixActionButton($videos_id) {
global $global;
@ -90,6 +97,7 @@ class PlayLists extends PluginAbstract {
$obj = $this->getDataObject();
$css = '<link href="' . $global['webSiteRootURL'] . 'plugin/PlayLists/style.css" rel="stylesheet" type="text/css"/>';
$css .= '<style>.epgProgress.progress-bar-primary{opacity: 0.5;}.epgProgress:hover{opacity: 1.0;}.epgProgressText{border-right: 1px solid #FFF; height:100%;}</style>';
return $css;
}
@ -97,8 +105,25 @@ class PlayLists extends PluginAbstract {
public function getFooterCode() {
global $global;
$obj = $this->getDataObject();
include $global['systemRootPath'] . 'plugin/PlayLists/footer.php';
$js = '<script src="' . $global['webSiteRootURL'] . 'plugin/PlayLists/script.js" type="text/javascript"></script>';
if(isEmbed()){
if(self::showTVFeatures()){
$js .= '<script>'. file_get_contents("{$global['systemRootPath']}plugin/PlayLists/showOnTV.js").'</script>';
}
}
if(isLive() && self::showTVFeatures()){
if(!empty($_REQUEST['playlists_id_live']) &&
!self::isPlaylistLive($_REQUEST['playlists_id_live']) &&
self::canManagePlaylist($_REQUEST['playlists_id_live'])){
$liveLink = PlayLists::getLiveLink($_REQUEST['playlists_id_live']);
$js .= '<script>var liveLink = "'.$liveLink.'";'. file_get_contents("{$global['systemRootPath']}plugin/PlayLists/goLiveNow.js").'</script>';
}
}
return $js;
}
static function canAddVideoOnPlaylist($videos_id) {
@ -231,11 +256,12 @@ class PlayLists extends PluginAbstract {
}
public function navBarButtons() {
global $global;
$obj = AVideoPlugin::getObjectData("PlayLists");
$str = "";
if($obj->showWatchLaterOnLeftMenu){
if ($obj->showWatchLaterOnLeftMenu) {
$str .= '<li>
<div>
<a href="' . self::getWatchLaterLink() . '" class="btn btn-default btn-block" style="border-radius: 0;">
@ -245,7 +271,7 @@ class PlayLists extends PluginAbstract {
</div>
</li>';
}
if($obj->showFavoriteOnLeftMenu){
if ($obj->showFavoriteOnLeftMenu) {
$str .= '<li>
<div>
<a href="' . self::getFavoriteLink() . '" class="btn btn-default btn-block" style="border-radius: 0;">
@ -258,13 +284,12 @@ class PlayLists extends PluginAbstract {
return $str;
}
public function navBarProfileButtons() {
global $global;
$obj = AVideoPlugin::getObjectData("PlayLists");
$str = "";
if($obj->showWatchLaterOnProfileMenu){
if ($obj->showWatchLaterOnProfileMenu) {
$str .= '<li>
<a href="' . self::getWatchLaterLink() . '" class="" style="border-radius: 0;">
<i class="fas fa-clock"></i>
@ -272,7 +297,7 @@ class PlayLists extends PluginAbstract {
</a>
</li>';
}
if($obj->showFavoriteOnProfileMenu){
if ($obj->showFavoriteOnProfileMenu) {
$str .= '<li>
<a href="' . self::getFavoriteLink() . '" class="" style="border-radius: 0;">
<i class="fas fa-heart"></i>
@ -283,34 +308,34 @@ class PlayLists extends PluginAbstract {
return $str;
}
static function getLiveLink($playlists_id){
static function getLiveLink($playlists_id) {
global $global;
if(!self::canPlayProgramsLive()){
if (!self::canPlayProgramsLive()) {
return false;
}
// does it has videos?
$videosArrayId = PlayLists::getOnlyVideosAndAudioIDFromPlaylistLight($playlists_id);
if(empty($videosArrayId)){
if (empty($videosArrayId)) {
return false;
}
return "{$global['webSiteRootURL']}plugin/PlayLists/playProgramsLive.json.php?playlists_id=" . $playlists_id;
}
static function showPlayLiveButton(){
if(!$obj = AVideoPlugin::getDataObjectIfEnabled("PlayLists")){
static function showPlayLiveButton() {
if (!$obj = AVideoPlugin::getDataObjectIfEnabled("PlayLists")) {
return false;
}
return !empty($obj->showPlayLiveButton);
}
static function canPlayProgramsLive(){
static function canPlayProgramsLive() {
// can the user live?
if(!User::canStream()){
if (!User::canStream()) {
return false;
}
// Is API enabled
if(!AVideoPlugin::isEnabledByName("API")){
if (!AVideoPlugin::isEnabledByName("API")) {
return false;
}
return true;
@ -342,4 +367,341 @@ class PlayLists extends PluginAbstract {
return $rows;
}
static function getLiveEPGLink($playlists_id, $type = 'html') {
global $global;
$pl = new PlayList($playlists_id);
$site = get_domain($global['webSiteRootURL']);
$channel = $pl->getUsers_id();
$link = "{$global['webSiteRootURL']}epg.{$type}?site={$site}&channel={$channel}&playlists_id={$playlists_id}";
return $link;
}
static function getLinkToLive($playlists_id) {
global $global;
$pl = new PlayList($playlists_id);
$link = Live::getLinkToLiveFromUsers_idWithLastServersId($pl->getUsers_id());
return $link . "?playlists_id_live={$playlists_id}";
}
static function getImage($playlists_id) {
global $global;
if(self::isPlaylistLive($playlists_id)){
return self::getLivePosterImage($playlists_id);
}
$serie = self::isPlayListASerie($playlists_id);
if (!empty($serie)) {
$tvg_logo = "videos/{$serie['filename']}_tvg.jpg";
$tvg_logo_path = "{$global['systemRootPath']}{$tvg_logo}";
if (!file_exists($tvg_logo_path)) {
$images = Video::getSourceFile($serie['filename']);
$img = $images["path"];
im_resizeV2($img, $tvg_logo_path, 150, 150, 80);
}
$tvg_logo_url = "{$global['webSiteRootURL']}{$tvg_logo}";
return $tvg_logo_url;
} else {
$pl = new PlayList($playlists_id);
return User::getPhoto($pl->getUsers_id());
}
}
static function getLiveImage($playlists_id) {
global $global;
if(self::isPlaylistLive($playlists_id)){
return self::getLivePosterImage($playlists_id);
}else{
return "{$global['webSiteRootURL']}plugin/Live/view/Offline.jpg";
}
}
static function getNameOrSerieTitle($playlists_id) {
$serie = self::isPlayListASerie($playlists_id);
if (!empty($serie)) {
return $serie['title'];
} else {
$pl = new PlayList($playlists_id);
return $pl->getName();
}
}
static function getDescriptionIfIsSerie($playlists_id) {
$serie = self::isPlayListASerie($playlists_id);
if (!empty($serie)) {
return $serie['description'];
}
return "";
}
static function getLinkToM3U8($playlists_id, $key, $live_servers_id) {
global $global;
$_REQUEST['playlists_id_live'] = $playlists_id;
$_REQUEST['live_servers_id'] = $live_servers_id;
return Live::getM3U8File($key);
}
static function getM3U8File($playlists_id) {
$pl = new PlayList($playlists_id);
$users_id = intval($pl->getUsers_id());
$key = self::getPlaylistLiveKey($playlists_id, $users_id);
$live_servers_id = self::getPlaylistLiveServersID($playlists_id, $users_id);
return self::getLinkToM3U8($playlists_id, $key, $live_servers_id);
}
static function showTVFeatures() {
$obj = AVideoPlugin::getObjectData("PlayLists");
return !empty($obj->showTVFeatures);
}
static function canManagePlaylist($playlists_id) {
if (!User::isLogged()) {
return false;
}
if (User::isAdmin()) {
return true;
}
$pl = new PlayList($playlists_id);
if ($pl->getUsers_id() == User::getId()) {
return true;
}
return false;
}
static function getShowOnTVSwitch($playlists_id) {
if (!self::showTVFeatures()) {
return "";
}
if (!self::canManagePlaylist($playlists_id)) {
return "";
}
$input = __('Show on TV') . '<div class="material-switch" style="margin:0 10px;">
<input class="ShowOnTVSwitch" data-toggle="toggle" type="checkbox" id="ShowOnTVSwitch' . $playlists_id . '" name="ShowOnTVSwitch' . $playlists_id . '" value="1" ' . (self::showOnTV($playlists_id) ? "checked" : "") . ' onchange="saveShowOnTV(' . $playlists_id . ', $(this).is(\':checked\'))" >
<label for="ShowOnTVSwitch' . $playlists_id . '" class="label-primary"></label>
</div> ';
return $input;
}
static function getPlayListEPG($playlists_id, $users_id = 0) {
if (empty($users_id)) {
$pl = new PlayList($playlists_id);
$users_id = ($pl->getUsers_id());
}
$epg = self::getUserEPG($users_id);
if (empty($epg["playlists"]) || empty($epg["playlists"][$playlists_id])) {
return array();
}
$epg["playlists"][$playlists_id]['generated'] = $epg['generated'];
return $epg["playlists"][$playlists_id];
}
static function getUserEPG($users_id) {
$epg = self::getSiteEPGs();
if (empty($epg) || empty($epg[$users_id])) {
return array();
}
$epg[$users_id]['generated'] = $epg['generated'];
return $epg[$users_id];
}
static function getSiteEPGs($addPlaylistInfo=false) {
global $global;
$siteDomain = get_domain($global['webSiteRootURL']);
$epg = self::getALLEPGs();
if (empty($epg[$siteDomain])) {
return array();
}
if($addPlaylistInfo){
foreach ($epg[$siteDomain]["channels"] as $key => $value) {
foreach ($value['playlists'] as $key2 => $value2) {
$pl = new PlayList($value2['playlist_id']);
$epg[$siteDomain]["channels"][$key]['playlists'][$key2]['title'] = $pl->getName();
$epg[$siteDomain]["channels"][$key]['playlists'][$key2]['image'] = PlayLists::getImage($value2['playlist_id']);
$epg[$siteDomain]["channels"][$key]['playlists'][$key2]['m3u8'] = PlayLists::getLinkToM3U8($value2['playlist_id'], $value2['key'], $value2['live_servers_id']);
}
}
}
$epg[$siteDomain]["channels"]['generated'] = $epg['generated'];
return $epg[$siteDomain]["channels"];
}
static function getALLEPGs() {
global $config, $global, $getSiteEPGs;
if (!empty($getSiteEPGs)) {
return $getSiteEPGs;
}
$encoder = $config->_getEncoderURL();
$url = "{$encoder}view/videosListEPG.php";
$content = url_get_contents($url);
$name = "getALLEPGs_" . md5($url);
//$cache = ObjectYPT::getCache($name, 15);
//if (!empty($cache)) {
// return object_to_array($cache);
//}
$json = json_decode($content);
$getSiteEPGs = object_to_array($json->sites);
$getSiteEPGs['generated'] = $json->generated;
//ObjectYPT::setCache($name, $getSiteEPGs);
return $getSiteEPGs;
}
static function epgFromPlayList($playListArray, $generated, $created, $showClock = false, $linkToLive = false, $showTitle = false) {
if (empty($playListArray) || empty($created)) {
return '';
}
global $global;
$uid = uniqid();
$totalDuration = 0;
foreach ($playListArray as $value) {
$totalDuration += $value['duration_seconds'];
}
$playlists_id = $playListArray[0]['id'];
$current = $generated - $created;
$endTime = ($created + $totalDuration);
$durationLeft = $endTime - $generated;
$percentage_progress = ($current / $totalDuration) * 100;
$percentage_left = 100 - floatval($percentage_progress);
$epgStep = number_format($percentage_left / $durationLeft, 2);
$searchFor = array('{playListname}', '{showClock}',
'{linkToLive}', '{totalDuration}',
'{created}', '{uid}',
'{percentage_progress}', '{epgBars}',
'{epgStep}', '{generated}',
'{implode}');
$searchForEPGbars = array('{thumbsJpg}', '{represents_percentage}',
'{className}', '{epgId}', '{title}',
'{text}', '{uid}', '{percentage_progress}');
$epgTemplate = file_get_contents($global['systemRootPath'] . 'plugin/PlayLists/epg.template.html');
$epgBarsTemplate = file_get_contents($global['systemRootPath'] . 'plugin/PlayLists/epg.template.bar.html');
$html = "";
if ($showTitle) {
$pl = new PlayList($playlists_id);
$playListname = " <strong>" . $pl->getName() . "</strong>";
} else {
$playListname = "";
}
if ($showClock) {
$showClock = " <div class='label label-primary'><i class=\"far fa-clock\"></i> " . getServerClock() . "</div>";
} else {
$showClock = "";
}
if ($linkToLive) {
$link = PlayLists::getLinkToLive($playlists_id);
$linkToLive = " <a href='{$link}' class='btn btn-xs btn-primary'>" . __("Watch Live") . "</a>";
} else {
$linkToLive = "";
}
$totalDuration_ = secondsToDuration($totalDuration);
$created = humanTimingAgo($created);
$js = array();
$per = 0;
$className = "class_{$uid}";
$epgBars = "";
foreach ($playListArray as $key => $value) {
$epgId = "epg_" . uniqid();
$represents_percentage = number_format(($value['duration_seconds'] / $totalDuration) * 100, 2);
$images = Video::getImageFromFilename($value['filename']);
$per += $represents_percentage;
$thumbsJpg = $images->thumbsJpg;
if ($per > 100) {
$represents_percentage -= $per - 100;
}
$img = "<img src='{$images->thumbsJpg}' class='img img-responsive' style='height: 60px; padding: 2px;'><br>";
$title = addcslashes("{$img} {$value['title']} {$value['duration']}<br>{$value['start_date']}", '"');
$text = "{$value['title']}";
$epgBars .= str_replace($searchForEPGbars, array($thumbsJpg, $represents_percentage, $className,
$epgId, $title,
$text, $uid, $percentage_progress), $epgBarsTemplate);
$js[] = " if(currentTime{$uid}>={$value['start']} && currentTime{$uid}<={$value['stop']}){\$('.{$className}').not('#{$epgId}').removeClass('progress-bar-success').addClass('progress-bar-primary');\$('#{$epgId}').addClass('progress-bar-success').removeClass('progress-bar-primary');}";
}
$implode = implode("else", $js);
return str_replace($searchFor, array($playListname, $showClock,
$linkToLive, $totalDuration_,
$created, $uid,
$percentage_progress, $epgBars,
$epgStep, $generated,
$implode), $epgTemplate);
}
static function showOnTV($playlists_id) {
if (!self::showTVFeatures()) {
return false;
}
$pl = new PlayList($playlists_id);
return !empty($pl->getShowOnTV());
}
static function getPlayLiveButton($playlists_id) {
if (!self::showPlayLiveButton()) {
return "";
}
if (!self::canManagePlaylist($playlists_id)) {
return "";
}
global $global;
$btnId = "btnId". uniqid();
$label = __("Play Live");
$tooltip = __("Play this Program live now");
$liveLink = PlayLists::getLiveLink($playlists_id);
$labelLive = __("Is Live");
$tooltipLive = __("Stop this Program and start over again");
$isLive = "false";
if(self::isPlaylistLive($playlists_id)){
$isLive = "true";
}
if (!empty($liveLink)) {
$template = file_get_contents("{$global['systemRootPath']}plugin/PlayLists/playLiveButton.html");
return str_replace(array('{isLive}','{liveLink}', '{btnId}', '{label}','{labelLive}', '{tooltip}', '{tooltipLive}'), array($isLive, $liveLink, $btnId, $label, $labelLive, $tooltip, $tooltipLive), $template);
}
return '';
}
static function getVideosIdFromPlaylist($playlists_id){
return PlayList::getVideosIdFromPlaylist($playlists_id);
}
static function isPlaylistLive($playlists_id, $users_id = 0){
global $isPlaylistLive;
if(!isset($isPlaylistLive)){
$isPlaylistLive = array();
}
if(!isset($isPlaylistLive[$playlists_id])){
$json = self::getPlayListEPG($playlists_id, $users_id);
$isPlaylistLive[$playlists_id] = !empty($json['isPIDRunning']);
}
return $isPlaylistLive[$playlists_id];
}
static function getPlaylistLiveServersID($playlists_id, $users_id = 0){
$json = self::getPlayListEPG($playlists_id, $users_id);
return intval($json['live_servers_id']);
}
static function getPlaylistLiveKey($playlists_id, $users_id = 0){
$json = self::getPlayListEPG($playlists_id, $users_id);
return $json['key'];
}
public function getLivePosterImage($playlists_id) {
$live = AVideoPlugin::loadPluginIfEnabled("Live");
if($live){
$pl = new PlayList($playlists_id);
$users_id = intval($pl->getUsers_id());
$live_servers_id = self::getPlaylistLiveServersID($playlists_id, $users_id);
return $live->getLivePosterImage($users_id, $live_servers_id)."&playlists_id_live={$playlists_id}";
}
return "";
}
public function getPluginMenu() {
global $global;
return '<a href="plugin/PlayLists/View/editor.php" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fa fa-edit"></i> Schedule</a>';
}
}

View file

@ -0,0 +1,32 @@
<?php
header('Content-Type: application/json');
require_once '../../../../videos/configuration.php';
require_once $global['systemRootPath'] . 'plugin/PlayLists/Objects/Playlists_schedules.php';
$obj = new stdClass();
$obj->error = true;
$obj->msg = "";
$plugin = AVideoPlugin::loadPluginIfEnabled('PlayLists');
if(!User::isAdmin()){
$obj->msg = "You cant do this";
die(json_encode($obj));
}
$o = new Playlists_schedules(@$_POST['id']);
$o->setPlaylists_id($_POST['playlists_id']);
$o->setName($_POST['name']);
$o->setDescription($_POST['description']);
$o->setStatus($_POST['status']);
$o->setLoop($_POST['loop']);
$o->setStart_datetime($_POST['start_datetime']);
$o->setFinish_datetime($_POST['finish_datetime']);
$o->setRepeat($_POST['repeat']);
$o->setParameters($_POST['parameters']);
if($id = $o->save()){
$obj->error = false;
}
echo json_encode($obj);

View file

@ -0,0 +1,20 @@
<?php
require_once '../../../../videos/configuration.php';
require_once $global['systemRootPath'] . 'plugin/PlayLists/Objects/Playlists_schedules.php';
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
$plugin = AVideoPlugin::loadPluginIfEnabled('PlayLists');
if(!User::isAdmin()){
$obj->msg = "You cant do this";
die(json_encode($obj));
}
$id = intval($_POST['id']);
$row = new Playlists_schedules($id);
$obj->error = !$row->delete();
die(json_encode($obj));
?>

View file

@ -0,0 +1,29 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../../videos/configuration.php';
}
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not do this"));
exit;
}
?>
<!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>">
<head>
<title><?php echo $config->getWebSiteTitle(); ?> :: PlayLists</title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
include $global['systemRootPath'] . 'plugin/PlayLists/View/{$classname}/index_head.php';
?>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
include $global['systemRootPath'] . 'plugin/PlayLists/View/{$classname}/index_body.php';
include $global['systemRootPath'] . 'view/include/footer.php';
?>
<script type="text/javascript" src="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.js"></script>
</body>
</html>

View file

@ -0,0 +1,269 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../../videos/configuration.php';
}
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not do this"));
exit;
}
?>
<div class="panel panel-default">
<div class="panel-heading">
<i class="fas fa-cog"></i> <?php echo __("Configurations"); ?>
</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-4">
<div class="panel panel-default ">
<div class="panel-heading"><i class="far fa-plus-square"></i> <?php echo __("Create"); ?></div>
<div class="panel-body">
<form id="panelPlaylists_schedulesForm">
<div class="row">
<input type="hidden" name="id" id="Playlists_schedulesid" value="" >
<div class="form-group col-sm-12">
<label for="Playlists_schedulesname"><?php echo __("Name"); ?>:</label>
<input type="text" id="Playlists_schedulesname" name="name" class="form-control input-sm" placeholder="<?php echo __("Name"); ?>" required="true">
</div>
<div class="form-group col-sm-12">
<label for="Playlists_schedulesdescription"><?php echo __("Description"); ?>:</label>
<textarea id="Playlists_schedulesdescription" name="description" class="form-control input-sm" placeholder="<?php echo __("Description"); ?>" required="true"></textarea>
</div>
<div class="form-group col-sm-6">
<label for="Playlists_schedulesplaylists_id"><?php echo __("Program"); ?>:</label>
<select class="form-control input-sm" name="playlists_id" id="Playlists_schedulesplaylists_id">
<?php
$_POST['sort']['pl.name'] = 'ASC';
$options = PlayList::getAllToShowOnTV();
foreach ($options as $value) {
echo '<option value="' . $value['id'] . '">' . $value['name'] . " from (" . $value['user'] . ')</option>';
}
?>
</select>
</div>
<div class="form-group col-sm-6">
<label for="status"><?php echo __("Status"); ?>:</label>
<select class="form-control input-sm" name="status" id="Playlists_schedulesstatus">
<option value="a"><?php echo __("Active"); ?></option>
<option value="i"><?php echo __("Inactive"); ?></option>
</select>
</div>
<div class="form-group col-sm-6">
<label for="Playlists_schedulesstart_datetime"><?php echo __("Start Datetime"); ?>:</label>
<input type="text" id="Playlists_schedulesstart_datetime" name="start_datetime" class="form-control input-sm" placeholder="<?php echo __("Start Datetime"); ?>" required="true" autocomplete="off">
</div>
<div class="form-group col-sm-6">
<label for="Playlists_schedulesfinish_datetime"><?php echo __("Finish Datetime"); ?>:</label>
<input type="text" id="Playlists_schedulesfinish_datetime" name="finish_datetime" class="form-control input-sm" placeholder="<?php echo __("Finish Datetime"); ?>" required="true" autocomplete="off">
</div>
<div class="form-group col-sm-6">
<label for="Playlists_schedulesloop"><?php echo __("Loop"); ?>:</label>
<select class="form-control input-sm" name="loop" id="Playlists_schedulesloop">
<option value="1"><?php echo __("Yes"); ?></option>
<option value="0"><?php echo __("No"); ?></option>
</select>
</div>
<div class="form-group col-sm-6">
<label for="Playlists_schedulesrepeat"><?php echo __("Repeat"); ?>:</label>
<select class="form-control input-sm" name="repeat" id="Playlists_schedulesrepeat">
<option value="<?php echo Playlists_schedules::$REPEAT_NEVER; ?>"><?php echo __("Never"); ?></option>
<option value="<?php echo Playlists_schedules::$REPEAT_DAYLY; ?>"><?php echo __("Dayly"); ?></option>
<option value="<?php echo Playlists_schedules::$REPEAT_WEEKLY; ?>"><?php echo __("Weekly"); ?></option>
<option value="<?php echo Playlists_schedules::$REPEAT_MONTHLY; ?>"><?php echo __("Monthly"); ?></option>
</select>
</div>
<div class="form-group col-sm-12" style="display: none;">
<label for="Playlists_schedulesparameters"><?php echo __("Parameters"); ?>:</label>
<textarea id="Playlists_schedulesparameters" name="parameters" class="form-control input-sm" placeholder="<?php echo __("Parameters"); ?>"></textarea>
</div>
<div class="form-group col-sm-12">
<div class="btn-group pull-right">
<span class="btn btn-success" id="newPlaylists_schedulesLink" onclick="clearPlaylists_schedulesForm()"><i class="fas fa-plus"></i> <?php echo __("New"); ?></span>
<button class="btn btn-primary" type="submit"><i class="fas fa-save"></i> <?php echo __("Save"); ?></button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-sm-8">
<div class="panel panel-default ">
<div class="panel-heading"><i class="fas fa-edit"></i> <?php echo __("Edit"); ?></div>
<div class="panel-body">
<table id="Playlists_schedulesTable" class="display table table-bordered table-responsive table-striped table-hover table-condensed" width="100%" cellspacing="0">
<thead>
<tr>
<th>#</th>
<th><?php echo __("Name"); ?></th>
<th><?php echo __("Status"); ?></th>
<th><?php echo __("Loop"); ?></th>
<th><?php echo __("Start Datetime"); ?></th>
<th><?php echo __("Finish Datetime"); ?></th>
<th><?php echo __("Repeat"); ?></th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>#</th>
<th><?php echo __("Name"); ?></th>
<th><?php echo __("Status"); ?></th>
<th><?php echo __("Loop"); ?></th>
<th><?php echo __("Start Datetime"); ?></th>
<th><?php echo __("Finish Datetime"); ?></th>
<th><?php echo __("Repeat"); ?></th>
<th></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="Playlists_schedulesbtnModelLinks" style="display: none;">
<div class="btn-group pull-right">
<button href="" class="edit_Playlists_schedules btn btn-default btn-xs">
<i class="fa fa-edit"></i>
</button>
<button href="" class="delete_Playlists_schedules btn btn-danger btn-xs">
<i class="fa fa-trash"></i>
</button>
</div>
</div>
<script type="text/javascript">
function clearPlaylists_schedulesForm() {
$('#Playlists_schedulesid').val('');
$('#Playlists_schedulesplaylists_id').val('');
$('#Playlists_schedulesname').val('');
$('#Playlists_schedulesdescription').val('');
$('#Playlists_schedulesstatus').val('');
$('#Playlists_schedulesloop').val('');
$('#Playlists_schedulesstart_datetime').val('');
$('#Playlists_schedulesfinish_datetime').val('');
$('#Playlists_schedulesrepeat').val('');
$('#Playlists_schedulesparameters').val('');
}
$(document).ready(function () {
$('#addPlaylists_schedulesBtn').click(function () {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/View/addPlaylists_schedulesVideo.php',
data: $('#panelPlaylists_schedulesForm').serialize(),
type: 'post',
success: function (response) {
if (response.error) {
swal("<?php echo __("Sorry!"); ?>", response.msg, "error");
} else {
swal("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your register has been saved!"); ?>", "success");
$("#panelPlaylists_schedulesForm").trigger("reset");
}
clearPlaylists_schedulesForm();
tableVideos.ajax.reload();
modal.hidePleaseWait();
}
});
});
var Playlists_schedulestableVar = $('#Playlists_schedulesTable').DataTable({
"ajax": "<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/View/Playlists_schedules/list.json.php",
"columns": [
{"data": "id"},
{"data": "name"},
{"data": "status"},
{"data": "loop"},
{"data": "start_datetime"},
{"data": "finish_datetime"},
{"data": "repeat"},
{
sortable: false,
data: null,
defaultContent: $('#Playlists_schedulesbtnModelLinks').html()
}
],
select: true,
});
$('#newPlaylists_schedules').on('click', function (e) {
e.preventDefault();
$('#panelPlaylists_schedulesForm').trigger("reset");
$('#Playlists_schedulesid').val('');
});
$('#panelPlaylists_schedulesForm').on('submit', function (e) {
e.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/View/Playlists_schedules/add.json.php',
data: $('#panelPlaylists_schedulesForm').serialize(),
type: 'post',
success: function (response) {
if (response.error) {
swal("<?php echo __("Sorry!"); ?>", response.msg, "error");
} else {
swal("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your register has been saved!"); ?>", "success");
$("#panelPlaylists_schedulesForm").trigger("reset");
}
Playlists_schedulestableVar.ajax.reload();
$('#Playlists_schedulesid').val('');
modal.hidePleaseWait();
}
});
});
$('#Playlists_schedulesTable').on('click', 'button.delete_Playlists_schedules', function (e) {
e.preventDefault();
var tr = $(this).closest('tr')[0];
var data = Playlists_schedulestableVar.row(tr).data();
swal({
title: "<?php echo __("Are you sure?"); ?>",
text: "<?php echo __("You will not be able to recover this action!"); ?>",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then((willDelete) => {
if (willDelete) {
modal.showPleaseWait();
$.ajax({
type: "POST",
url: "<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/View/Playlists_schedules/delete.json.php",
data: data
}).done(function (resposta) {
if (resposta.error) {
swal("<?php echo __("Sorry!"); ?>", resposta.msg, "error");
}
Playlists_schedulestableVar.ajax.reload();
modal.hidePleaseWait();
});
} else {
}
});
});
$('#Playlists_schedulesTable').on('click', 'button.edit_Playlists_schedules', function (e) {
e.preventDefault();
var tr = $(this).closest('tr')[0];
var data = Playlists_schedulestableVar.row(tr).data();
$('#Playlists_schedulesid').val(data.id);
$('#Playlists_schedulesplaylists_id').val(data.playlists_id);
$('#Playlists_schedulesname').val(data.name);
$('#Playlists_schedulesdescription').val(data.description);
$('#Playlists_schedulesstatus').val(data.status);
$('#Playlists_schedulesloop').val(data.loop);
$('#Playlists_schedulesstart_datetime').val(data.start_datetime);
$('#Playlists_schedulesfinish_datetime').val(data.finish_datetime);
$('#Playlists_schedulesrepeat').val(data.repeat);
$('#Playlists_schedulesparameters').val(data.parameters);
});
});
</script>
<script> $(document).ready(function () {
$('#Playlists_schedulesstart_datetime').datetimepicker({format: 'yyyy-mm-dd hh:ii', autoclose: true});
});</script>
<script> $(document).ready(function () {
$('#Playlists_schedulesfinish_datetime').datetimepicker({format: 'yyyy-mm-dd hh:ii', autoclose: true});
});</script>

View file

@ -0,0 +1,5 @@
<?php
$plugin = AVideoPlugin::loadPluginIfEnabled('PlayLists');
?>
<link rel="stylesheet" type="text/css" href="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css"/>

View file

@ -0,0 +1,8 @@
<?php
require_once '../../../../videos/configuration.php';
require_once $global['systemRootPath'] . 'plugin/PlayLists/Objects/Playlists_schedules.php';
header('Content-Type: application/json');
$rows = Playlists_schedules::getAll();
?>
{"data": <?php echo json_encode($rows); ?>}

View file

@ -0,0 +1,46 @@
<?php
require_once '../../../videos/configuration.php';
AVideoPlugin::loadPlugin("PlayLists");
?>
<!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>">
<head>
<title><?php echo $config->getWebSiteTitle(); ?> :: PlayLists</title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<link rel="stylesheet" type="text/css" href="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css"/>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container-fluid">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('PlayLists') ?>
<div class="pull-right">
<?php echo AVideoPlugin::getSwitchButton("PlayLists"); ?>
</div>
</div>
<div class="panel-body">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#Playlists_schedules"><?php echo __("Playlists Schedules"); ?></a></li>
</ul>
<div class="tab-content">
<div id="Playlists_schedules" class="tab-pane fade in active" style="padding: 10px;">
<?php
include $global['systemRootPath'] . 'plugin/PlayLists/View/Playlists_schedules/index_body.php';
?>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.js"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
</body>
</html>

View file

@ -0,0 +1,20 @@
<?php
$playlists_id = intval(@$_REQUEST['playlists_id_live']);
if(empty($playlists_id)){
return "";
}
?>
<span id="epg"></span>
<script>
$(document).ready(function () {
$("#epg").closest(".row").prepend("<div class='col-sm-12 watch8-action-buttons' id='epgLine' style='display:none;'></div>");
$.ajax({
url: '<?php echo PlayLists::getLiveEPGLink($playlists_id); ?>',
success: function (response) {
$("#epgLine").html(response);
$("#epgLine").slideDown();
}
});
});
</script>

View file

@ -0,0 +1,255 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/playlist.php';
require_once $global['systemRootPath'] . 'objects/configuration.php';
// get the encoder
$_REQUEST['site'] = get_domain($global['webSiteRootURL']);
$json = PlayList::getEPG();
$generated = $json->generated;
$precision = 1; // minutes
$timeSteps = 1440 / $precision; // how many cells each row
$time = time();
function secondsToDayTime($seconds) {
$duration = secondsToDuration($seconds);
$parts = explode(":", $duration);
unset($parts[2]);
return implode(":", $parts);
}
?>
<style>
td.hasVideo{
background-color: #EFE;
}
td.playingNow{
background-color: #CFC;
}
td.finished, td.finished a{
background-color: #EEE;
color: #AAA;
}
#epgDiv{
position: relative;
}
#epgTable > thead > tr > th{
font-size: 0.7em;
}
#epgTable th,
#epgTable td{
padding: 2px 4px;
}
#epgTable td:empty{
padding: 0;
border: none;
width: 2px;
}
#timeline{
background-color: red;
border: solid 1px #A00;
width: 2px;
height: 100%;
position: absolute;
top: 0;
left: 0;
opacity: 0.3;
}
#epgTable th{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.hasVideo{
overflow: hidden;
}
.hasVideo > a {
font-size: 0.7em;
max-height: 26px;
display: block;
}
</style>
<a class="btn btn-default pull-right" href="#timeline"> <i class="far fa-clock"></i> <?php echo __('Now'); ?> </a>
<hr>
<div class="table-responsive" id="epgDiv">
<table class="table table-hover table-bordered table-striped header-fixed" id="epgTable">
<thead>
<tr>
<th scope="col"><?php echo __("Program"); ?></th>
<?php
for ($i = 0; $i < $timeSteps; $i++) {
$duration = secondsToDayTime($i * $precision * 60);
$currentCellTime = strtotime("today " . $duration);
$durationNext = secondsToDuration(($i + 1) * $precision * 60);
$currentCellTimeNext = strtotime("today " . $duration);
$class = "";
if ($time >= $currentCellTime && $time <= $currentCellTimeNext) {
$class .= " now ";
}
if ($i % 15 === 0) {
echo '<th scope="col" class="' . $class . '" colspan="15">' . $duration . '</th>';
}
}
?>
<th scope="col">00:00</th>
</tr>
</thead>
<tbody>
<?php
foreach ($json->sites as $key => $value) {
if ($key == $_REQUEST['site']) {
$site = $value;
foreach ($site->channels as $users_id => $channel) {
$identification = User::getNameIdentificationById($users_id);
foreach ($channel->playlists as $playlist) {
if (!PlayLists::showOnTV($playlist->playlists_id)) {
continue;
}
echo "<tr>";
if (!empty($playlist->programme)) {
$pl = new PlayList($playlist->playlists_id);
?>
<th class="programColumn">
<?php echo $playlist->playlists_id, " ", $pl->getName(); ?><br>
<small><?php echo $identification; ?></small>
</th>
<?php
for ($i = 0; $i < $timeSteps + 1; $i++) {
$tooltip = "";
$currentCellTime = strtotime("today " . secondsToDuration($i * $precision * 60));
$durationNext = secondsToDuration(($i + 1) * $precision * 60);
$currentCellTimeNext = strtotime("today " . $durationNext);
$currentCellDate = date("Y/m/d H:i:s", $currentCellTime);
$currentCellTimeNextDate = date("Y/m/d H:i:s", $currentCellTimeNext);
$content = "";
$colspan = 0;
$class = "";
$firstColumns = true;
foreach ($playlist->programme as $plItem) {
//$content = "-Next:{$currentCellTimeNextDate}<br>-Stop: {$plItem->stop_date}<br>-$currentCellTimeNext >= $plItem->stop<br>" ;
if ($currentCellTime >= $plItem->start && $currentCellTimeNext <= $plItem->stop) {
$images = Video::getImageFromFilename($plItem->filename);
$img = "<img src='{$images->thumbsJpg}' class='img img-responsive' style='height: 60px; padding: 2px;'><br>";
$title = addcslashes("{$img} {$plItem->title}<br>{$plItem->start_date}", '"');
$tooltip = "data-toggle=\"tooltip\" data-html=\"true\" data-original-title=\"{$title}\" data-placement=\"bottom\" ";
$colspan++;
$class .= " hasVideo ";
$link = PlayLists::getLinkToLive($playlist->playlists_id);
$content = " <span class='label label-primary'>" . $plItem->duration . "</span><br><a href='{$link}'>".$plItem->title."</a>";
//$content = "<br>Stop: {$plItem->stop_date}<br>Next:{$currentCellTimeNextDate}<br>$currentCellTimeNext >= $plItem->stop<br>" . $plItem->title;
if ($time >= $plItem->start && $time <= $plItem->stop) {
$class .= " playingNow ";
} else if ($time >= $plItem->stop) {
$class .= " finished ";
}
for (; $i < $timeSteps + 1; $i++) {
$currentCellTime = strtotime("today " . secondsToDuration($i * $precision * 60));
$currentCellDate = date("Y/m/d H:i:s", $currentCellTime);
if ($currentCellTime <= $plItem->stop) {
$colspan++;
continue;
} else {
break;
}
}
break;
} else if ($currentCellTime >= $plItem->start && $currentCellTime <= $plItem->stop) {
$images = Video::getImageFromFilename($plItem->filename);
$img = "<img src='{$images->thumbsJpg}' class='img img-responsive' style='height: 60px; padding: 2px;'><br>";
$title = addcslashes("{$img} {$plItem->title}<br>{$plItem->start_date}", '"');
$tooltip = "data-toggle=\"tooltip\" data-html=\"true\" data-original-title=\"{$title}\" data-placement=\"bottom\" ";
$colspan++;
$class .= " hasVideo ";
$link = PlayLists::getLinkToLive($playlist->playlists_id);
$content = " <span class='label label-primary'>" . $plItem->duration . "</span><br><a href='{$link}'>".$plItem->title."</i></a>";
//$content = "<br>Stop: {$plItem->stop_date}<br>Next:{$currentCellTimeNextDate}<br>$currentCellTimeNext >= $plItem->stop<br>" . $plItem->title;
if ($time >= $plItem->start && $time <= $plItem->stop) {
$class .= " playingNow ";
} else if ($time >= $plItem->stop) {
$class .= " finished ";
}
break;
}
}
if ($colspan) {
$colspan = " colspan='{$colspan}' ";
} else {
$colspan = "";
}
$id = "";
if($firstColumns){
$firstColumns = false;
$id = "id=\"col{$currentCellTime}\"";
}
echo '<td scope"col" ' . $colspan . ' class="' . $class . '" ' . $tooltip . ' '.$id.'>' . $content . '</td>';
}
}
echo "</tr>";
}
}
}
}
?>
</tbody>
</table>
<div id="timeline" style="display: none;"></div>
</div>
<script>
var timeNow = <?php echo strtotime(date("Y-m-d H:i:00", $time)); ?>;
var timeNowPositionIncrement = 0;
var timeNowPositionLeft = 0;
var timeNowPositionWidth = 0;
var stepDetails = 5;
$(document).ready(function () {
/*
$('#epgTable th').each(function (i) {
var remove = 0;
var tds = $(this).parents('table').find('tr td:nth-child(' + (i + 1) + ')')
tds.each(function (j) {
if (this.innerHTML == '' || this.innerHTML == '&nbsp;')
remove++;
});
if (remove == ($('#epgTable tr').length - 1)) {
$(this).hide();
tds.hide();
}
});
*
*/
if ($('#col' + timeNow).length) {
timeNowPositionLeft = $('#col' + timeNow).position().left;
timeNowPositionWidth = $('#col' + timeNow).outerWidth();
$('#timeline').css({'left': timeNowPositionLeft + 'px'});
var left = timeNowPositionLeft-(35*5);
if(left<0){
left = 0;
}
$('#timeline').fadeIn('slow');
$('#epgDiv').animate({scrollLeft: left}, 500);
}
setInterval(function () {
timeNow += 1;
timeNowPositionIncrement++;
if ($('#col' + timeNow).length) {
timeNowPositionIncrement = 0;
timeNowPositionLeft = $('#col' + timeNow).position().left;
timeNowPositionWidth = $('#col' + timeNow).outerWidth();
}
var timeNowPositionStep = (timeNowPositionWidth / (60)) * timeNowPositionIncrement;
if(timeNowPositionWidth===0){
timeNowPositionStep = 0.38 * timeNowPositionIncrement;//35/(60*15);//35px / 15 min
}
$('#timeline').css({'left': (timeNowPositionLeft + timeNowPositionStep) + 'px'});
}, 1000);
});
</script>

View file

@ -0,0 +1,38 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/playlist.php';
require_once $global['systemRootPath'] . 'objects/configuration.php';
if (!empty($_REQUEST['playlists_id'])) {
$json = PlayLists::getPlayListEPG($_REQUEST['playlists_id'], @$_REQUEST['users_id']);
if(!empty($json['programme'])){
echo PlayLists::epgFromPlayList($json['programme'], $json['generated'], $json['created']);
}
} else if (!empty($_REQUEST['users_id'])) {
$channel = PlayLists::getUserEPG($_REQUEST['users_id']);
if (!empty($channel['playlists'])) {
foreach ($channel['playlists'] as $json) {
if (!empty($json['programme'])) {
echo PlayLists::epgFromPlayList($json['programme'], $channel['generated'], $json['created'], false, true, true);
}
}
}
}else{
$channels = PlayLists::getSiteEPGs();
foreach ($channels as $channel) {
if (!empty($channel['playlists'])) {
foreach ($channel['playlists'] as $json) {
if (!empty($json['programme'])) {
echo PlayLists::epgFromPlayList($json['programme'], $channels['generated'], $json['created']);
}
}
}
}
}
?>

View file

@ -0,0 +1,26 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/playlist.php';
require_once $global['systemRootPath'] . 'objects/configuration.php';
header('Content-Type: application/json');
if (!empty($_REQUEST['playlists_id'])) {
$json = PlayLists::getPlayListEPG($_REQUEST['playlists_id'], @$_REQUEST['users_id']);
die(json_encode($json));
} else if (!empty($_REQUEST['users_id'])) {
$channel = PlayLists::getUserEPG($_REQUEST['users_id']);
if (!empty($channel['playlists'])) {
die(json_encode($channel['playlists']));
}else{
die(json_encode(array()));
}
} else {
$channels = PlayLists::getSiteEPGs(true);
die(json_encode($channels));
}
?>

33
plugin/PlayLists/epg.php Normal file
View file

@ -0,0 +1,33 @@
<?php
if (!isset($global['systemRootPath'])) {
require_once '../../videos/configuration.php';
}
?>
<!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>">
<head>
<title>EPG :: <?php echo $config->getWebSiteTitle(); ?></title>
<?php include $global['systemRootPath'] . 'view/include/head.php'; ?>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php include $global['systemRootPath'] . 'view/include/navbar.php'; ?>
<div class="container-fluid">
<?php
$_REQUEST['site'] = get_domain($global['webSiteRootURL']);
echo '<div class="panel panel-default"><div class="panel-heading">' . __("Now Playing") . '</div><div class="panel-body">';
//include_once $global['systemRootPath'] . 'plugin/PlayLists/epg.html.php';
include_once $global['systemRootPath'] . 'plugin/PlayLists/epg.day.php';
echo '</div></div>';
?>
</div>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
<script>
</script>
</body>
</html>
<?php include $global['systemRootPath'] . 'objects/include_end.php'; ?>

View file

@ -0,0 +1,5 @@
<div class="progress-bar progress-bar-primary epgProgress {className}" role="progressbar"
style="width:{represents_percentage}%; overflow:hidden; " id="{epgId}" data-toggle="tooltip" data-placement="bottom" data-html="true"
data-original-title="{title}" title="{title}" >
<div class='epgProgressText'>{text}</div>
</div>

View file

@ -0,0 +1,29 @@
{playListname}
{showClock}
{linkToLive}
<div class='label label-primary'>Total {totalDuration}</div>
<div class='label label-primary'>Started {created}</div>
<div class="progress" style="margin:5px 0 0 0; border-radius: 4px 4px 0 0; height: 10px; display: flex;">
<div class="progress-bar progress-bar-danger" role="progressbar" id="percentageEPGProgress{uid}" style="width:{percentage_progress}%"></div>
</div>
<div class="progress" style="border-radius: 0 0 4px 4px; overflow:visible;" id="EPGProgress{uid}">
{epgBars}
</div>
<script>
var epgStep{uid} = {epgStep};
var epgPercent{uid} = {percentage_progress};
var currentTime{uid} = {generated};
$(document).ready(function () {
setInterval(function () {
epgPercent{uid} += epgStep{uid};
if (epgPercent{uid} > 100) {
epgPercent{uid} = 100;
}
$("#percentageEPGProgress{uid}").css({"width": epgPercent{uid} + "%"});
$(".epgPercentage").text(epgPercent{uid} + "%");
currentTime{uid}++;
{implode}
}, 1000);
$('div[data-toggle="tooltip"]').tooltip({container: '#EPGProgress{uid}'});
});
</script>

View file

@ -1,190 +1,60 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
* http://wiki.xmltv.org/index.php/XMLTVFormat
* https://en.f-player.ru/xmltv-format-description
*/
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/playlist.php';
require_once $global['systemRootPath'] . 'objects/configuration.php';
allowOrigin();
header("Content-type: text/xml");
$domain = get_domain($global['webSiteRootURL']);
?><?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE tv SYSTEM "xmltv.dtd">
<tv source-info-url="http://www.schedulesdirect.org/" source-info-name="Schedules Direct" generator-info-name="XMLTV/$Id: tv_grab_na_dd.in,v 1.70 2008/03/03 15:21:41 rmeden Exp $" generator-info-url="http://www.xmltv.org/">
<channel id="I10436.labs.zap2it.com">
<display-name>13 KERA</display-name>
<display-name>13 KERA TX42822:-</display-name>
<display-name>13</display-name>
<display-name>13 KERA fcc</display-name>
<display-name>KERA</display-name>
<display-name>KERA</display-name>
<display-name>PBS Affiliate</display-name>
<icon src="file://C:\Perl\site/share/xmltv/icons/KERA.gif" />
<tv source-info-url="<?php echo $global['webSiteRootURL']; ?>"
source-info-name="<?php echo addcslashes($config->getWebSiteTitle(), '"'); ?>"
generator-info-name="<?php echo $domain, " " . date("Y/m/d H:i:s"); ?>"
generator-info-url="<?php echo $global['webSiteRootURL']; ?>">
<?php
$channels = PlayLists::getSiteEPGs();
foreach ($channels as $channel) {
if (empty($channel['playlists'])) {
continue;
}
if (!empty($channel['playlists'])) {
foreach ($channel['playlists'] as $json) {
if (empty($json['playlists_id']) || !PlayLists::showOnTV($json['playlists_id'])) {
continue;
}
$id = "{$json['playlists_id']}.{$channel['users_id']}.$domain";
?>
<channel id="<?php echo $id; ?>">
<display-name><?php echo htmlspecialchars(PlayLists::getNameOrSerieTitle($json['playlists_id'])); ?></display-name>
<icon src="<?php echo htmlspecialchars(PlayLists::getImage($json['playlists_id'])); ?>" />
</channel>
<channel id="I10759.labs.zap2it.com">
<display-name>11 KTVT</display-name>
<display-name>11 KTVT TX42822:-</display-name>
<display-name>11</display-name>
<display-name>11 KTVT fcc</display-name>
<display-name>KTVT</display-name>
<display-name>KTVT</display-name>
<display-name>CBS Affiliate</display-name>
<icon src="file://C:\Perl\site/share/xmltv/icons/KTVT.gif" />
</channel>
<programme start="20080715003000 -0600" stop="20080715010000 -0600" channel="I10436.labs.zap2it.com">
<title lang="en">NOW on PBS</title>
<desc lang="en">Jordan's Queen Rania has made job creation a priority to help curb the staggering unemployment rates among youths in the Middle East.</desc>
<date>20080711</date>
<category lang="en">Newsmagazine</category>
<category lang="en">Interview</category>
<category lang="en">Public affairs</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP01006886.0028</episode-num>
<episode-num system="onscreen">427</episode-num>
<?php
if (!empty($json['programme'])) {
foreach ($json['programme'] as $programme) {
?>
<programme start="<?php echo date("YmdHis", $programme["start"]); ?>" stop="<?php echo date("YmdHis", $programme["stop"]); ?>" channel="<?php echo $id; ?>">
<title><?php echo htmlspecialchars(strip_tags($programme['title'])); ?></title>
<desc><?php echo htmlspecialchars(strip_tags(br2nl($programme['desc']))); ?></desc>
<date><?php echo date("Ymd", $programme["start"]); ?></date>
<category><?php echo strip_tags(@$programme['category']); ?></category>
<audio>
<stereo>stereo</stereo>
</audio>
<previously-shown start="20080711000000" />
<subtitles type="teletext" />
</programme>
<programme start="20080715010000 -0600" stop="20080715023000 -0600" channel="I10436.labs.zap2it.com">
<title lang="en">Mystery!</title>
<sub-title lang="en">Foyle's War, Series IV: Bleak Midwinter</sub-title>
<desc lang="en">Foyle investigates an explosion at a munitions factory, which he comes to believe may have been premeditated.</desc>
<date>20070701</date>
<category lang="en">Anthology</category>
<category lang="en">Mystery</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP00003026.0665</episode-num>
<episode-num system="onscreen">2705</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<previously-shown start="20070701000000" />
<subtitles type="teletext" />
</programme>
<programme start="20080715023000 -0600" stop="20080715040000 -0600" channel="I10436.labs.zap2it.com">
<title lang="en">Mystery!</title>
<sub-title lang="en">Foyle's War, Series IV: Casualties of War</sub-title>
<desc lang="en">The murder of a prominent scientist may have been due to a gambling debt.</desc>
<date>20070708</date>
<category lang="en">Anthology</category>
<category lang="en">Mystery</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP00003026.0666</episode-num>
<episode-num system="onscreen">2706</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<previously-shown start="20070708000000" />
<subtitles type="teletext" />
</programme>
<programme start="20080715040000 -0600" stop="20080715043000 -0600" channel="I10436.labs.zap2it.com">
<title lang="en">BBC World News</title>
<desc lang="en">International issues.</desc>
<category lang="en">News</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">SH00315789.0000</episode-num>
<previously-shown />
<subtitles type="teletext" />
</programme>
<programme start="20080715043000 -0600" stop="20080715050000 -0600" channel="I10436.labs.zap2it.com">
<title lang="en">Sit and Be Fit</title>
<date>20070924</date>
<category lang="en">Exercise</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP00003847.0074</episode-num>
<episode-num system="onscreen">901</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<previously-shown start="20070924000000" />
<subtitles type="teletext" />
</programme>
<programme start="20080715060000 -0600" stop="20080715080000 -0600" channel="I10759.labs.zap2it.com">
<title lang="en">The Early Show</title>
<desc lang="en">Republican candidate John McCain; premiere of the film "The Dark Knight."</desc>
<date>20080715</date>
<category lang="en">Talk</category>
<category lang="en">News</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP00337003.2361</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<subtitles type="teletext" />
</programme>
<programme start="20080715080000 -0600" stop="20080715090000 -0600" channel="I10759.labs.zap2it.com">
<title lang="en">Rachael Ray</title>
<desc lang="en">Actresses Kim Raver, Brooke Shields and Lindsay Price ("Lipstick Jungle"); women in their 40s tell why they got breast implants; a 30-minute meal.</desc>
<credits>
<presenter>Rachael Ray</presenter>
</credits>
<date>20080306</date>
<category lang="en">Talk</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP00847333.0303</episode-num>
<episode-num system="onscreen">2119</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<previously-shown start="20080306000000" />
<subtitles type="teletext" />
</programme>
<programme start="20080715090000 -0600" stop="20080715100000 -0600" channel="I10759.labs.zap2it.com">
<title lang="en">The Price Is Right</title>
<desc lang="en">Contestants bid for prizes then compete for fabulous showcases.</desc>
<credits>
<director>Bart Eskander</director>
<producer>Roger Dobkowitz</producer>
<presenter>Drew Carey</presenter>
</credits>
<category lang="en">Game show</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">SH00004372.0000</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<subtitles type="teletext" />
<rating system="VCHIP">
<value>TV-G</value>
</rating>
</programme>
<programme start="20080715100000 -0600" stop="20080715103000 -0600" channel="I10759.labs.zap2it.com">
<title lang="en">Jeopardy!</title>
<credits>
<presenter>Alex Trebek</presenter>
</credits>
<date>20080715</date>
<category lang="en">Game show</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP00002348.1700</episode-num>
<episode-num system="onscreen">5507</episode-num>
<subtitles type="teletext" />
<rating system="VCHIP">
<value>TV-G</value>
</rating>
</programme>
<programme start="20080715103000 -0600" stop="20080715113000 -0600" channel="I10759.labs.zap2it.com">
<title lang="en">The Young and the Restless</title>
<sub-title lang="en">Sabrina Offers Victoria a Truce</sub-title>
<desc lang="en">Jeff thinks Kyon stole the face cream; Nikki asks Nick to give David a chance; Amber begs Adrian to go to Australia.</desc>
<credits>
<actor>Peter Bergman</actor>
<actor>Eric Braeden</actor>
<actor>Jeanne Cooper</actor>
<actor>Melody Thomas Scott</actor>
</credits>
<date>20080715</date>
<category lang="en">Soap</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">EP00004422.1359</episode-num>
<episode-num system="onscreen">8937</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<subtitles type="teletext" />
<rating system="VCHIP">
<value>TV-14</value>
</rating>
</programme>
<?php
}
}
}
}
}
?>
</tv>

View file

@ -0,0 +1,32 @@
$(document).ready(function () {
swal({
title: "Your playlist is NOT live, do you want to go live now?",
icon: "warning",
dangerMode: true,
buttons: {
goLive: true
}
}).then(function (value) {
switch (value) {
case "goLive":
//modal.showPleaseWait();
$.ajax({
url: liveLink,
success: function (response) {
if (response.error) {
avideoAlertError(response.msg);
//modal.hidePleaseWait();
} else {
avideoToast(response.msg);
setTimeout(function () {
tryToPlay(0);
//location.reload();
}, 2000);
}
}
});
break;
}
});
});

View file

@ -0,0 +1,21 @@
CREATE TABLE IF NOT EXISTS `playlists_schedules` (
`id` INT NOT NULL AUTO_INCREMENT,
`playlists_id` INT NOT NULL,
`name` VARCHAR(255) NULL,
`description` TEXT NULL,
`status` CHAR(1) NULL,
`created` DATETIME NULL,
`modified` DATETIME NULL,
`loop` TINYINT NULL,
`start_datetime` DATETIME NULL,
`finish_datetime` DATETIME NULL,
`repeat` CHAR(1) NULL,
`parameters` TEXT NULL,
PRIMARY KEY (`id`),
INDEX `fk_playlists_schedules_playlists_idx` (`playlists_id` ASC),
CONSTRAINT `fk_playlists_schedules_playlists`
FOREIGN KEY (`playlists_id`)
REFERENCES `playlists` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;

34
plugin/PlayLists/iptv.php Normal file
View file

@ -0,0 +1,34 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/playlist.php';
require_once $global['systemRootPath'] . 'objects/configuration.php';
header('Content-Type: application/mpegurl');
$_REQUEST['site'] = get_domain($global['webSiteRootURL']);
$json = PlayList::getEPG();
echo "#EXTM3U refresh=\"60\"".PHP_EOL;
foreach ($json->sites as $key => $value) {
if ($key == $_REQUEST['site']) {
$site = $value;
foreach ($site->channels as $users_id => $channel) {
$identification = User::getNameIdentificationById($users_id);
foreach ($channel->playlists as $playlist) {
if(!PlayLists::showOnTV($playlist->playlists_id)){
continue;
}
$pl = new PlayList($playlist->playlists_id);
$link = PlayLists::getLinkToM3U8($playlist->playlists_id, $playlist->key, $playlist->live_servers_id);
$u = new User($pl->getId());
$groupTitle = str_replace('"', "", $u->getChannelName());
$title = str_replace('"', "", PlayLists::getNameOrSerieTitle($playlist->playlists_id));
$image = PlayLists::getImage($playlist->playlists_id);
echo '#EXTINF:-1 tvg-id="'."{$playlist->playlists_id}.{$users_id}.{$_REQUEST['site']}".'" tvg-logo="'.$image.'" group-title="'.$groupTitle.'", '.$title.PHP_EOL;
echo $link.PHP_EOL;
}
}
}
}
?>

View file

@ -0,0 +1,37 @@
<button class="btn btn-xs btn-default playAll hrefLink" id="{btnId}" data-toggle="tooltip" title="{tooltip}" style="display: none;" ><i class="fas fa-broadcast-tower"></i> {label}</button>
<button class="btn btn-xs btn-default playAll hrefLink playListIsLive" id="{btnId}Live" data-toggle="tooltip" title="{tooltipLive}" style="display: none;" ><i class="fas fa-broadcast-tower"></i> {labelLive}</button>
<script>
var {btnId}isLive = {isLive};
$(document).ready(function () {
toogle{btnId}isLive();
$('#{btnId},#{btnId}Live').click(function (e) {
e.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '{liveLink}',
success: function (response) {
if (response.error) {
{btnId}isLive = false;
avideoAlertError(response.msg);
}else{
{btnId}isLive = true;
avideoToast(response.msg);
}
toogle{btnId}isLive();
modal.hidePleaseWait();
}
});
return false;
});
$('#{btnId},#{btnId}Live').tooltip();
});
function toogle{btnId}isLive(){
if({btnId}isLive){
$('#{btnId}Live').show();
$('#{btnId}').hide();
}else{
$('#{btnId}').show();
$('#{btnId}Live').hide();
}
}
</script>

View file

@ -18,6 +18,13 @@ if (!$users_id) {
_error_log("playProgramsLive:: {$obj->msg}");
die(json_encode($obj));
}
if (!User::canStream()) {
$obj->msg = __("User cannot stream");
_error_log("playProgramsLive:: {$obj->msg}");
die(json_encode($obj));
}
$playlistPlugin = AVideoPlugin::getObjectDataIfEnabled('PlayLists');
if (empty($playlistPlugin)) {
@ -68,17 +75,13 @@ if(empty($status->version) || version_compare($status->version, "3.2") < 0){
_error_log("playProgramsLive:: {$obj->msg}");
die(json_encode($obj));
}
ini_set('max_execution_time', 0);
Live::stopLive($users_id);
$webSiteRootURL = urlencode($global['webSiteRootURL']);
$live_servers_id = Live::getCurrentLiveServersId();
$videosListToLive = "{$encoder}videosListToLive?playlists_id={$playlists_id}&APISecret={$api->APISecret}&webSiteRootURL={$webSiteRootURL}&user=".User::getUserName()."&pass=".User::getUserPass()."&liveKey={$key}&rtmp=". urlencode(Live::getServer())."&live_servers_id={$live_servers_id}";
echo $videosListToLive;
$cmd = "wget -O/dev/null -q \"{$videosListToLive}\" > /dev/null 2>/dev/null &";
_error_log("playProgramsLive:: {$cmd}");
//echo "** executing command {$cmd}\n";
//exec($cmd);
$obj->videosListToLive = $videosListToLive;
$videosListToLive = "{$encoder}videosListToLive?playlists_id={$playlists_id}&APISecret={$api->APISecret}&webSiteRootURL={$webSiteRootURL}&user=".User::getUserName()."&pass=".User::getUserPass();
//$obj->url = $videosListToLive;
$obj->videosListToLive = url_get_contents($videosListToLive);
$obj->error = false;
$obj->msg = __("Your stream will start soon");
die(json_encode($obj));

View file

@ -0,0 +1,62 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/playlist.php';
require_once $global['systemRootPath'] . 'objects/configuration.php';
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
$obj->msg = "";
$users_id = User::getId();
if (!User::canStream()) {
$obj->msg = __("User cannot stream");
_error_log("playProgramsLive:: {$obj->msg}");
die(json_encode($obj));
}
$playlistPlugin = AVideoPlugin::getObjectDataIfEnabled('PlayLists');
if (empty($playlistPlugin)) {
$obj->msg = __("Programs plugin not enabled");
_error_log("playProgramsLive:: {$obj->msg}");
die(json_encode($obj));
}
$live = AVideoPlugin::getObjectDataIfEnabled("Live");
if (empty($live)) {
$obj->msg = __("Live Plugin is not enabled");
_error_log("playProgramsLive:: {$obj->msg}");
die(json_encode($obj));
}
$playlists_id = intval($_REQUEST['playlists_id']);
if (empty($playlists_id)) {
$obj->msg = __("Programs id error");
_error_log("playProgramsLive:: {$obj->msg}");
die(json_encode($obj));
}
if(!PlayLists::canManagePlaylist($playlists_id)){
$obj->msg = __("Programs does not belong to you");
_error_log("playProgramsLive:: {$obj->msg}");
die(json_encode($obj));
}
$pl = new PlayList($playlists_id);
$pl->setShowOnTV($_REQUEST['showOnTV']);
$obj->error = empty($pl->save());
if(empty($obj->error)){
if(empty($pl->getShowOnTV())){
$obj->msg = __("showOnTV is OFF");
}else{
$obj->msg = __("showOnTV is ON");
}
}
die(json_encode($obj));

View file

@ -0,0 +1,14 @@
function saveShowOnTV(playlists_id, showOnTV) {
modal.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'plugin/PlayLists/saveShowOnTV.json.php?playlists_id=' + playlists_id + '&showOnTV=' + showOnTV,
success: function (response) {
if (response.errro) {
avideoAlertError(response.msg);
} else {
avideoToast(response.msg);
}
modal.hidePleaseWait();
}
});
}

View file

@ -0,0 +1,35 @@
$(document).ready(function () {
$(document).keyup(function (e) {
if (typeof window.parent.closeLiveVideo === "function") {
parent.focus();
window.parent.focus();
}
if (e.key === "Escape") {
if (typeof window.parent.closeLiveVideo === "function") {
e.preventDefault();
parent.focus();
window.parent.focus();
window.parent.closeLiveVideo();
}
} else if (e.key === "ArrowUp") {
e.preventDefault();
var volume = player.volume();
volume += 0.1;
if (volume > 1) {
volume = 1;
}
console.log(volume);
player.muted(false);
player.volume(volume);
} else if (e.key === "ArrowDown") {
e.preventDefault();
var volume = player.volume();
volume -= 0.1;
if (volume < 0) {
volume = 0;
}
console.log(volume);
player.volume(volume);
}
});
});

View file

@ -12,3 +12,8 @@
.vjs-playlist .vjs-up-next-text {
font-size: .8em;
}
.playListIsLive .fas{
-webkit-animation: flash 2s ease infinite;
animation: flash 2s ease infinite;
color: red;
}

533
plugin/PlayLists/tv.php Normal file
View file

@ -0,0 +1,533 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/playlist.php';
require_once $global['systemRootPath'] . 'objects/configuration.php';
?>
<!DOCTYPE html>
<html lang="us">
<head>
<title>TV</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="device_id" content="<?php echo getDeviceID(); ?>">
<link rel="apple-touch-icon" sizes="180x180" href="<?php echo $config->getFavicon(true); ?>">
<link rel="icon" type="image/png" href="<?php echo $config->getFavicon(true); ?>">
<link rel="shortcut icon" href="<?php echo $config->getFavicon(); ?>" sizes="16x16,24x24,32x32,48x48,144x144">
<meta name="msapplication-TileImage" content="<?php echo $config->getFavicon(true); ?>">
<link rel="apple-touch-icon" sizes="180x180" href="<?php echo $global['webSiteRootURL']; ?>videos/favicon.png?1602260237">
<link rel="icon" type="image/png" href="<?php echo $global['webSiteRootURL']; ?>videos/favicon.png?1602260237">
<link rel="shortcut icon" href="<?php echo $global['webSiteRootURL']; ?>videos/favicon.ico?1601872356" sizes="16x16,24x24,32x32,48x48,144x144">
<meta name="msapplication-TileImage" content="<?php echo $global['webSiteRootURL']; ?>videos/favicon.png?1602260237">
<link href="<?php echo $global['webSiteRootURL']; ?>view/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/css/custom/cyborg.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/css/fontawesome-free-5.5.0-web/css/all.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/css/font-awesome-animation.min.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/jquery-3.5.1.min.js"></script>
<script>
var loopBGHLS = '<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/loopBGHLS/index.m3u8';
</script>
<style>
.playListIsLive .fas{
-webkit-animation: flash 2s ease infinite;
animation: flash 2s ease infinite;
color: red;
}
body.showingVideo{
margin:0px;
padding:0px;
overflow:hidden
}
.videoLinkDiv{
padding: 10px;
text-align: center;
}
.videoLinkDiv h4{
color: #999;
}
.videoLinkDiv img{
border: transparent 6px solid;
}
.videoLinkDiv:focus, .focus{
outline: none;
}
.videoLinkDiv:focus img, .focus img{
border-color: #FFF;
background-color: #333;
}
.videoLinkDiv:focus h4, .focus h4{
color: #FFF;
}
#channelTop{
position: fixed;
top: 20px;
right: 20px;
font-size: 2em;
padding: 10px;
color: white;
text-shadow: 2px 2px 4px #000000;
}
#leftNav{
width: 100px;
height: 100%;
position: fixed;
top: 0;
left: 0;
border-color: #FFF;
background-color: #333;
padding: 10px;
overflow: hidden;
opacity: 0.5;
transition: all 0.25s ease-in-out;
-moz-transition: all 0.25s ease-in-out;
-webkit-transition: all 0.25s ease-in-out;
}
.container-fluid{
margin-left: 100px;
transition: all 0.25s ease-in-out;
-moz-transition: all 0.25s ease-in-out;
-webkit-transition: all 0.25s ease-in-out;
}
body.menuOpen #leftNav{
width: 300px;
opacity: 1;
}
.listLabel {
display: none;
}
body.menuOpen #leftNav .listLabel {
display: block;
}
body.menuOpen .container-fluid{
margin-left: 300px;
}
body.menuOpen .videoLinkCol {
padding: 0;
}
</style>
</head>
<body class="">
<div id="leftNav">
<ul class="list-group">
<li class="list-group-item active" nabBarIndex="1">
<button class="btn btn-danger btn-block" id="closeMenuBtn">
<i class="fas fa-times"></i>
<span class="listLabel">Close</span>
</button>
</li>
<li class="list-group-item" nabBarIndex="2">
<a href="http://192.168.1.4/YouPHPTube/epg" target="_blank" class="btn btn-primary btn-block ">
<i class="fas fa-stream"></i>
<span class="listLabel">EPG</span>
</a>
</li>
<li class="list-group-item" nabBarIndex="3">
<a href="http://192.168.1.4/YouPHPTube/iptv" target="_blank" class="btn btn-primary btn-block ">
<i class="fas fa-stream"></i>
<span class="listLabel">IPTV m3u</span>
</a>
</li>
<li class="list-group-item" nabBarIndex="4">
<a href="http://192.168.1.4/YouPHPTube/epg.xml" target="_blank" class="btn btn-primary btn-block ">
<i class="fas fa-stream"></i>
<span class="listLabel">EPG XMLTV</span>
</a>
</li>
</ul>
</div>
<div class="container-fluid">
<?php
include $global['systemRootPath'] . 'plugin/PlayLists/tv_body.php';
?>
</div>
<?php
include $global['systemRootPath'] . 'plugin/PlayLists/tv_videoPlayer.php';
?>
<div id="channelTop" style="display: none;"></div>
<script>
var undoArray = [];
var totalItems = 0;
var tabindex = 0;
var nabBarIndex = 1;
var nabBarTotalItems = 0;
$(function () {
totalItems = $('.videoLink').length;
nabBarTotalItems = $('#leftNav li').length;
$('.videoLink').click(function (e) {
e.preventDefault();
tabindex = parseInt($(this).parent().attr('tabindex'));
loadLiveVideo($(this).attr('href'));
if (isIframe) {
loadLiveVideoIframe($(this).attr('href'));
} else {
loadLiveVideo($(this).attr('source'))
}
});
$('#closeMenuBtn').click(function (e) {
closeNavBar();
});
$(document).keyup(function (e) {
console.log(e.key, tabindex);
if (e.key === "Escape") { // escape key maps to keycode `27`
e.preventDefault();
backButton();
} else if (e.key === "ArrowUp") {
e.preventDefault();
//moveTotabindex(-<?php echo $itemsPerRow ?>);
moveToColAbove();
} else if (e.key === "ArrowDown") {
e.preventDefault();
//moveTotabindex(<?php echo $itemsPerRow ?>);
moveToColBelow();
} else if (e.key === "ArrowRight") {
e.preventDefault();
moveTotabindex(1);
} else if (e.key === "ArrowLeft") {
e.preventDefault();
//moveTotabindex(-1);
moveToLeft();
} else if (e.key === "Tab") {
e.preventDefault();
cicleTotabindex();
} else if (e.key === "Enter") {
e.preventDefault();
triggerChannelClick();
}else if(e.key.match(/^[0-9]$/)){
typeNumber(e.key);
}
});
setInterval(function () {
loadBody();
}, 60000);
setInterval(function () {
reloadImages();
}, 30000);
});
var channelTypedNumber = "";
var typeNumberTimeout;
function backButton(){
var evalCode = undoArray.pop();
if (evalCode) {
eval(evalCode);
}
}
function typeNumber(num){
channelTypedNumber += num;
showMessage(channelTypedNumber);
clearTimeout(typeNumberTimeout);
typeNumberTimeout = setTimeout(function(){goToChannelNumber()},1000);
}
function goToChannelNumber(){
var index = parseInt($('div[channelNumber="' + channelTypedNumber + '"]').attr('tabindex'));
if(index){
tabindex = index;
triggerChannelClick();
}else{
showMessage("Channel not found");
}
channelTypedNumber = "";
}
function isVideoOpened() {
return $('body').hasClass('showingVideo');
}
var showChannelTopTimeout;
function showChannelTop() {
showMessage($('div[tabindex="' + tabindex + '"] a h5').html());
}
function showMessage(msg) {
console.log('showMessage', msg);
$('#channelTop').html(msg);
$('#channelTop').show();
clearTimeout(showChannelTopTimeout);
showChannelTopTimeout = setTimeout(function () {
$('#channelTop').fadeOut('slow');
}, 4000);
}
function gettabindex(total) {
tabindex += total;
if (tabindex < 1) {
tabindex = $('.videoLink').length;
} else if (tabindex > $('.videoLink').length) {
tabindex = 1;
}
return tabindex;
}
function getLiveTabindex(total) {
if (!thereIsSomethingLive()) {
return gettabindex(total);
}
tabindex += total;
if (tabindex < 1) {
tabindex = $('.videoLink').length;
} else if (tabindex > $('.videoLink').length) {
tabindex = 1;
}
if (!isIndexLive(tabindex)) {
return getLiveTabindex(total);
}
return tabindex;
}
function moveTotabindex(total) {
if (isNavBarOpen()) {
closeNavBar();
} else {
if (isVideoOpened()) {
var currentTIndex = tabindex;
var tindex = getLiveTabindex(total);
if (currentTIndex != tindex) {
tabFocus(tindex);
triggerChannelClick();
} else {
showMessage("There are no more live programs");
}
} else {
var tindex = gettabindex(total);
tabFocus(tindex);
}
}
}
function thereIsSomethingLive() {
return $('.playListIsLive').length;
}
function isIndexLive(index) {
return $('div[tabindex="' + index + '"]').find('.playListIsLive').length;
}
function moveToLeft() {
var col = getCurrentColumn();
if (col === 0 && !isVideoOpened()) {
openNavBar();
} else {
moveTotabindex(-1);
}
}
function getCurrentColumn() {
return parseInt($('div[tabindex="' + tabindex + '"]').attr('tabindexCol'));
}
function openNavBar() {
$('body').addClass('menuOpen');
}
function closeNavBar() {
$('body').removeClass('menuOpen');
}
function isNavBarOpen() {
return $('body').hasClass('menuOpen');
}
function getCurrentNavbarIndex() {
return parseInt($('#leftNav .active').attr("nabBarIndex"));
}
function cicleNavbar(goTo) {
var index = getCurrentNavbarIndex();
var newIndex = index + goTo;
if (newIndex < 1) {
newIndex = nabBarTotalItems;
} else if (newIndex > nabBarTotalItems) {
newIndex = 1;
}
$('#leftNav li').removeClass("active");
$('#leftNav li[nabBarIndex="' + newIndex + '"]').addClass("active");
//nabBarIndex
}
function moveToColAbove() {
if (isVideoOpened()) {
showChannelTop();
if (isIframe) {
setFocus();
} else {
changeVolume(0.1);
}
} else if (isNavBarOpen()) {
cicleNavbar(-1);
} else
if (tabindex > 0) {
var tabPosition = tabindex;
var col = getCurrentColumn();
tabPosition--;
for (i = tabPosition; i > 0; i--) {
var element = $('div[tabindex="' + i + '"]').parent().find('div[tabindexCol="' + col + '"]');
var element = $('div[tabindex="' + i + '"]').parent().find('div[tabindexCol="' + col + '"]');
if (element.length) {
$(element).focus();
tabindex = parseInt($(element).attr('tabindex'));
tabFocus(tabindex);
break;
}
}
}
}
var changeVolumeTimeOut;
function changeVolume(total){
clearTimeout(changeVolumeTimeOut);
$("#volumeBar").fadeIn('fast');
var newVolume = player.volume();
newVolume += total;
if (newVolume > 1) {
newVolume = 1;
}
if (newVolume < 0) {
newVolume = 0;
}
console.log('changeVolume: ' + newVolume);
player.volume(newVolume);
for(i=0;i<=newVolume*10;i++){
console.log('changeVolume:fadeIn ' + i);
$('.volume'+i).fadeIn('slow');
}
for(;i<=10;i++){
console.log('changeVolume:fadeOut ' + i);
$('.volume'+i).fadeOut('slow');
}
changeVolumeTimeOut = setTimeout(function(){$("#volumeBar").fadeOut();},3000);
}
function setFocus() {
if (isIframe) {
focusIframe();
} else {
focusVideo();
}
}
function moveToColBelow() {
if (isVideoOpened()) {
showChannelTop();
if (isIframe) {
setFocus();
} else {
changeVolume(-0.1);
}
} else if (isNavBarOpen()) {
cicleNavbar(1);
} else
if (tabindex < totalItems) {
var tabPosition = tabindex;
var col = getCurrentColumn();
tabPosition++;
for (i = tabPosition; i <= totalItems; i++) {
var element = $('div[tabindex="' + i + '"]').parent().find('div[tabindexCol="' + col + '"]');
var element = $('div[tabindex="' + i + '"]').parent().find('div[tabindexCol="' + col + '"]');
if (element.length) {
$(element).focus();
tabindex = parseInt($(element).attr('tabindex'));
tabFocus(tabindex);
break;
}
}
}
}
function cicleTotabindex() {
tabindex += 1;
if (tabindex > $('.videoLink').length) {
tabindex = 1;
}
console.log('div[tabindex="' + tabindex + '"]');
tabFocus(tabindex);
}
function triggerChannelClick() {
if (isNavBarOpen()) {
console.log('triggerChannelClick', 'isNavBarOpen');
var index = getCurrentNavbarIndex();
console.log($('#leftNav li[nabBarIndex="' + index + '"]').find('.btn'));
var href = $('#leftNav li[nabBarIndex="' + index + '"]').find('.btn').attr('href');
if (href) {
var win = window.open(href, '_blank');
win.focus();
} else {
$('#leftNav li[nabBarIndex="' + index + '"]').find('.btn').trigger('click');
}
} else {
console.log('triggerChannelClick', 'click');
if (isIframe) {
loadLiveVideoIframe($('div[tabindex="' + tabindex + '"]').find('.videoLink').attr('href'));
} else {
loadLiveVideo($('div[tabindex="' + tabindex + '"]').find('.videoLink').attr('source'))
}
}
}
function tabFocus(index) {
$('.videoLinkDiv').removeClass('focus');
$('div[tabindex="' + tabindex + '"]').addClass('focus').focus();
}
function loadBody() {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/tv_body.php',
success: function (response) {
$(response).find('.videoLinkDiv').each(function (index) {
var bodyTabindex = parseInt($(this).attr('tabindex'));
if (bodyTabindex != tabindex) {
if ($('div[tabindex="' + bodyTabindex + '"]').find('a').hasClass('playListIsLive') !== $(this).find('a').hasClass('playListIsLive')) {
$('div[tabindex="' + bodyTabindex + '"]').html($(this).html());
console.log("loadBody: changed", bodyTabindex);
}
}
});
}
});
}
function reloadImages() {
$('.videoLinkDiv').each(function (index) {
var bodyTabindex = parseInt($(this).attr('tabindex'));
var img = $('div[tabindex="' + bodyTabindex + '"]').find('img');
var originalSrc = $(img).attr('originalSrc');
if (originalSrc.indexOf('?') > -1) {
originalSrc += '&' + Math.round();
} else {
originalSrc += '?' + Math.round();
}
$(img).attr('src', originalSrc);
});
}
</script>
</body>
</html>

View file

@ -0,0 +1,59 @@
<?php
if (!isset($global['systemRootPath'])) {
require_once '../../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/playlist.php';
require_once $global['systemRootPath'] . 'objects/configuration.php';
}
$PlayListChannels = PlayLists::getSiteEPGs();
$tabindex = 1;
foreach ($PlayListChannels as $users_id => $PlayListChannel) {
if ($users_id === 'generated') {
continue;
}
?>
<div class="row">
<hr>
<div class="col-sm-12">
<h3 style="display: inline-flex;">
<img src="<?php echo $PlayListChannel['icon']; ?>" class="img img-rounded img-responsive" style="height: 30px; margin: 5px 10px;"/>
<?php echo $PlayListChannel['name']; ?>
</h3>
</div>
<?php
$itemsPerRow = 6;
$count = 0;
$tabindexCol = 0;
foreach ($PlayListChannel["playlists"] as $key_playlists_id => $playlist) {
$count++;
?>
<div class="col-sm-<?php echo 12 / $itemsPerRow; ?> videoLinkCol">
<div class="videoLinkDiv" tabindex="<?php echo $tabindex++; ?>" tabindexCol="<?php echo $tabindexCol++; ?>" channelNumber="<?php echo $count; ?>" >
<a tabindex="-1"
href="<?php echo $playlist['embedlink']; ?>"
link="<?php echo $playlist['link']; ?>"
source="<?php echo PlayLists::getM3U8File($key_playlists_id); ?>"
class="videoLink <?php echo PlayLists::isPlaylistLive($key_playlists_id) ? "playListIsLive" : ""; ?>">
<img src="<?php echo PlayLists::getLiveImage($key_playlists_id); ?>"
originalSrc="<?php echo PlayLists::getLiveImage($key_playlists_id); ?>"
class="img img-rounded img-responsive" style="margin: 0 auto;"/>
<h5>
<i class="fas fa-broadcast-tower "></i>
<span class="badge"><?php echo sprintf('%03d', $count); ?> </span>
<?php echo PlayLists::getNameOrSerieTitle($key_playlists_id); ?>
</h5>
</a>
</div>
</div>
<?php
if ($count % $itemsPerRow === 0) {
$tabindexCol = 0;
echo "<div class='clearfix'></div>";
}
}
?>
</div>
<?php
}
?>
</div>

View file

@ -0,0 +1,56 @@
<style>
#videoIFrame{
width: 100vw;
height: 100vh;
border:none;
overflow:hidden;
position: fixed;
top: 0;
left: 0;
background-color: #000;
}
</style>
<iframe width="100%" height="100%" style="display: none;"
src=""
frameborder="0" allowfullscreen="allowfullscreen" allow="autoplay" scrolling="no" id="videoIFrame">iFrame is not supported!</iframe>
<script>
var isIframe = true;
function loadLiveVideoIframe(embedLink) {
showChannelTop();
if (isIframeOpened()) {
console.log('loadLiveVideo::isIframeOpened', embedLink);
if ($('#videoIFrame').attr('src') !== embedLink) {
$('#videoIFrame').attr('src', embedLink);
}
} else {
console.log('loadLiveVideo', embedLink);
$('#videoIFrame').attr('src', '');
$('#videoIFrame').fadeIn('slow', function () {
$('#videoIFrame').attr('src', embedLink);
$('body').addClass('showingIframe');
});
undoArray.push("closeLiveVideoIframe();");
}
}
function closeLiveVideoIframe() {
$('#channelTop').fadeOut('slow');
$('#videoIFrame').fadeOut('slow', function () {
$('#videoIFrame').attr('src', "");
$('body').removeClass('showingIframe');
});
}
function focusIframe() {
$('#videoIFrame').focus();
var iframe = $('#videoIFrame')[0];
iframe.contentWindow.focus();
}
function isIframeOpened() {
return $('body').hasClass('showingIframe');
}
</script>

View file

@ -0,0 +1,99 @@
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/video.js/video-js.min.css" rel="stylesheet" type="text/css"/>
<style>
#mainVideo{
width: 100vw;
height: 100vh;
border:none;
overflow:hidden;
position: fixed;
top: 0;
left: 0;
background-color: #000;
}
#volumeBar{
position: fixed;
left: 25px;
bottom: 25px;
width: 50px;
}
#volumeBar .volumeDot{
margin: 5px;
background-color: #FFF;
box-shadow: 2px 2px 4px #000000;
}
#volumeBar .volume10{
background-color: #2a9fd6;
}
<?php
for ($i = 9; $i > 0; $i--) {
?>
.volume<?php echo $i; ?>{
opacity: <?php echo 0.1 * $i; ?>;
}
<?php
}
?>
.volume0{
opacity: 0.05;
}
</style>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/video.js/video.min.js" type="text/javascript"></script>
<video poster="<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg" playsinline webkit-playsinline="webkit-playsinline"
class="video-js vjs-default-skin vjs-big-play-centered"
id="mainVideo" style="display: none;">
<source src="<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/loopBGHLS/index.m3u8" type='application/x-mpegURL'>
</video>
<div id="volumeBar" style="display: none;">
<?php
for ($i = 10; $i >= 0; $i--) {
echo "<div class=' volumeDot volume{$i}' >&nbsp;</div>";
}
?>
</div>
<script>
var isIframe = false;
function loadLiveVideo(sourceLink) {
showChannelTop();
if (isVideoOpened()) {
console.log('loadLiveVideo::isVideoOpened', sourceLink);
var currentSource = player.currentSources()
if (currentSource[0].src !== sourceLink) {
player.src({
src: sourceLink,
type: "application/x-mpegURL"});
player.play();
}
} else {
player.src({
src: sourceLink,
type: "application/x-mpegURL"});
console.log('loadLiveVideo', sourceLink);
$('#mainVideo, #mainVideo video').fadeIn('slow', function () {
player.play();
$('body').addClass('showingVideo');
});
undoArray.push("closeLiveVideo();");
}
}
function closeLiveVideo() {
$('#channelTop').fadeOut('slow');
$('#mainVideo').fadeOut('slow', function () {
player.src({
src: loopBGHLS,
type: "application/x-mpegURL"});
player.pause();
$('body').removeClass('showingVideo');
});
}
function focusVideo() {
$('#mainVideo').focus();
}
player = videojs('mainVideo', {errorDisplay: false, html5: {nativeAudioTracks: false, nativeVideoTracks: false, hls: {overrideNative: true}}, liveui: true});
</script>

View file

@ -88,7 +88,7 @@ if ($canDownloadVideosFromVideo) {
}";
}
}
if ($playerSkinsObj->showSocialShareOnEmbed && $playerSkinsObj->contextMenuShare) {
if ($playerSkinsObj->showSocialShareOnEmbed && $playerSkinsObj->contextMenuShare && CustomizeUser::canShareVideosFromVideo($video['id'])) {
$contextMenu[] = "{name: '" . __("Share") . "',
onClick: function () {
showSharing();

View file

@ -9,7 +9,7 @@ require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
$plugin = AVideoPlugin::loadPluginIfEnabled("PayPalYPT");
$pluginS = AVideoPlugin::loadPluginIfEnabled("YPTWallet");
$pluginS = AVideoPlugin::loadPlugin("YPTWallet");
$objS = $pluginS->getDataObject();
$obj= new stdClass();

View file

@ -0,0 +1,10 @@
-- Add Login control
-- Fix some layout issues
-- support for encoder 3.3 and dynamic resolutions for MP4 and webm
ALTER TABLE `playlists`
ADD COLUMN `showOnTV` TINYINT NULL DEFAULT NULL,
ADD INDEX `showOnTVindex3` (`showOnTV` ASC);
UPDATE configurations SET version = '10.0', modified = now() WHERE id = 1;

View file

@ -54,7 +54,7 @@ TimeLogEnd($timeLog, __LINE__);
<?php
if (empty($advancedCustomUser->doNotShowTopBannerOnChannel)) {
?>
<div class="row bg-info profileBg" style="margin: 20px -10px; background: url('<?php echo $global['webSiteRootURL'], $user->getBackgroundURL(), "?", @filectime($global['systemRootPath'] . $user->getBackgroundURL()); ?>') no-repeat 50% 50%;">
<div class="row bg-info profileBg" style="margin: 20px -10px; background: url('<?php echo $global['webSiteRootURL'], $user->getBackgroundURL(), "?", @filemtime($global['systemRootPath'] . $user->getBackgroundURL()); ?>') no-repeat 50% 50%;">
<img src="<?php echo User::getPhoto($user_id); ?>" alt="<?php echo $user->_getName(); ?>" class="img img-responsive img-thumbnail" style="max-width: 100px;"/>
</div>
<?php

View file

@ -1,48 +1,50 @@
<div class="programsContainerItem">
<?php
global $global, $config, $isChannel;
$isChannel = 1; // still workaround, for gallery-functions, please let it there.
if (!isset($global['systemRootPath'])) {
<?php
global $global, $config, $isChannel;
$isChannel = 1; // still workaround, for gallery-functions, please let it there.
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/video.php';
require_once $global['systemRootPath'] . 'objects/playlist.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/video.php';
require_once $global['systemRootPath'] . 'objects/playlist.php';
if (empty($_GET['channelName'])) {
if (empty($_GET['channelName'])) {
if (User::isLogged()) {
$_GET['user_id'] = User::getId();
} else {
return false;
}
} else {
} else {
$user = User::getChannelOwner($_GET['channelName']);
if (!empty($user)) {
$_GET['user_id'] = $user['id'];
} else {
$_GET['user_id'] = $_GET['channelName'];
}
}
$user_id = $_GET['user_id'];
}
$user_id = $_GET['user_id'];
$timeLog2 = __FILE__ . " - channelPlayList: {$_GET['channelName']}";
TimeLogStart($timeLog2);
$timeLog2 = __FILE__ . " - channelPlayList: {$_GET['channelName']}";
TimeLogStart($timeLog2);
$publicOnly = true;
$isMyChannel = false;
if (User::isLogged() && $user_id == User::getId()) {
$publicOnly = true;
$isMyChannel = false;
if (User::isLogged() && $user_id == User::getId()) {
$publicOnly = false;
$isMyChannel = true;
}
if (empty($_GET['current'])) {
}
if (empty($_GET['current'])) {
$_POST['current'] = 1;
} else {
} else {
$_POST['current'] = intval($_GET['current']);
}
$_REQUEST['rowCount'] = 4;
$playlists = PlayList::getAllFromUser($user_id, $publicOnly);
$current = $_POST['current'];
unset($_POST['current']);
}
$_REQUEST['rowCount'] = 4;
$playlists = PlayList::getAllFromUser($user_id, $publicOnly);
$current = $_POST['current'];
unset($_POST['current']);
?>
<div class="programsContainerItem">
<?php
if (empty($playlists)) {
die("</div>");
}
@ -52,6 +54,7 @@
unset($_GET['channelName']);
$startC = microtime(true);
TimeLogEnd($timeLog2, __LINE__);
$countSuccess = 0;
$get = array();
if (!empty($_GET['channelName'])) {
@ -82,6 +85,12 @@
} else {
$videosP = Video::getAllVideos("viewable", false, true, $videosArrayId, false, true);
}//var_dump($videosArrayId, $videosP); exit;
$totalDuration = 0;
foreach ($videosP as $value) {
$totalDuration += durationToSeconds($value['duration']);
}
$_REQUEST['rowCount'] = $rowCount;
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
@ -101,7 +110,7 @@
<div class="panel-heading">
<strong style="font-size: 1.1em;" class="playlistName">
<?php echo $playlist['name']; ?>
<?php echo __($playlist['name']); ?> (<?php echo secondsToDuration($totalDuration); ?>)
</strong>
<?php
@ -111,18 +120,12 @@
<a href="<?php echo $link; ?>" class="btn btn-xs btn-default playAll hrefLink" ><span class="fa fa-play"></span> <?php echo __("Play All"); ?></a><?php echo $playListButtons; ?>
<?php
}
if ($isMyChannel && PlayLists::showPlayLiveButton()) {
$liveLink = PlayLists::getLiveLink($playlist['id']);
if (!empty($liveLink)) {
echo PlayLists::getPlayLiveButton($playlist['id']);
?>
<a href="<?php echo $liveLink; ?>" class="btn btn-xs btn-default playAll hrefLink" ><i class="fas fa-broadcast-tower"></i> <?php echo __("Play Live"); ?></a>
<?php
}
}
?>
<div class="pull-right btn-group">
<div class="pull-right btn-group" style="display: inline-flex;">
<?php
if ($isMyChannel) {
echo PlayLists::getShowOnTVSwitch($playlist['id']);
if ($playlist['status'] != "favorite" && $playlist['status'] != "watch_later") {
if (AVideoPlugin::isEnabledByName("PlayLists")) {
?>
@ -274,6 +277,7 @@
<div class="clearfix"></div>
<?php
$count = 0;
$_REQUEST['site'] = get_domain($global['webSiteRootURL']);
foreach ($videosP as $value) {
// make sure the video exists
if (empty($value['created'])) {
@ -410,18 +414,28 @@
<?php
}
if(PlayLists::showTVFeatures()){
?>
<div class="panel-footer">
<?php
$_REQUEST['user_id'] = $user_id;
$_REQUEST['playlists_id'] = $playlist['id'];
include $global['systemRootPath'] . 'plugin/PlayLists/epg.html.php';
?>
</div>
<?php
}
if (!empty($videosP) && empty($countSuccess)) {
?>
</div>
<?php
}
if (!empty($videosP) && empty($countSuccess)) {
header("Location: {$global['webSiteRootURL']}view/channelPlaylistItems.php?current=" . (count($playlists) ? $_POST['current'] + 1 : $_POST['current']) . "&channelName={$_GET['channelName']}");
exit;
}
TimeLogEnd($timeLog2, __LINE__);
$_GET['channelName'] = $channelName;
?>
}
TimeLogEnd($timeLog2, __LINE__);
$_GET['channelName'] = $channelName;
?>
<script>
$(function () {
@ -568,14 +582,14 @@
</script>
<!--
channelPlaylist
<?php
$timesC[__LINE__] = microtime(true) - $startC;
$startC = microtime(true);
foreach ($timesC as $key => $value) {
<?php
$timesC[__LINE__] = microtime(true) - $startC;
$startC = microtime(true);
foreach ($timesC as $key => $value) {
echo "Line: {$key} -> {$value}\n";
}
$_POST['current'] = $current;
?>
}
$_POST['current'] = $current;
?>
-->
</div>
<p class="pagination">

View file

@ -109,14 +109,7 @@ $playListsObj = AVideoPlugin::getObjectData("PlayLists");
?>
<a href="<?php echo $link; ?>" class="btn btn-xs btn-default playAll hrefLink" ><span class="fa fa-play"></span> <?php echo __("Play All"); ?></a><?php echo $playListButtons; ?>
<?php
if ($isMyChannel && PlayLists::showPlayLiveButton()) {
$liveLink = PlayLists::getLiveLink($program['id']);
if (!empty($liveLink)) {
?>
<a href="<?php echo $liveLink; ?>" class="btn btn-xs btn-default playAll hrefLink" ><i class="fas fa-broadcast-tower"></i> <?php echo __("Play Live"); ?></a>
<?php
}
}
echo PlayLists::getPlayLiveButton($program['id']);
}
if ($isMyChannel) {
?>
@ -213,7 +206,11 @@ $playListsObj = AVideoPlugin::getObjectData("PlayLists");
?>
<div class="panel-body">
<?php
$_REQUEST['user_id'] = $program['users_id'];
$_REQUEST['playlists_id'] = $program['id'];
include $global['systemRootPath'] . 'plugin/PlayLists/epg.html.php';
?>
<div id="sortable<?php echo $program['id']; ?>" style="list-style: none;">
<?php
$count = 0;

View file

@ -862,3 +862,7 @@ img.blur{
border-bottom-left-radius:0;
border-right-width: 1px;
}
#modeYoutubeTop, #mvideo, #videoContainer{
position: relative;
}

View file

@ -16,9 +16,9 @@ $filename = "{$global['systemRootPath']}videos/{$_GET['videoDirectory']}/index.
$_GET['file'] = "{$global['systemRootPath']}videos/{$_GET['videoDirectory']}/index.m3u8";
//var_dump($_GET['file']);exit;
$cachedPath = explode("/", $_GET['videoDirectory']);
if(empty($_SESSION['hls'][$cachedPath[0]])){
if(empty($_SESSION['user']['sessionCache']['hls'][$cachedPath[0]])){
AVideoPlugin::xsendfilePreVideoPlay();
$_SESSION['hls'][$cachedPath[0]] = 1;
$_SESSION['user']['sessionCache']['hls'][$cachedPath[0]] = 1;
}
$tokenIsValid = false;

View file

@ -64,6 +64,7 @@ echo $dif, " Seconds "; ?>">
<link href="<?php echo $global['webSiteRootURL']; ?>view/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/webui-popover/jquery.webui-popover.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/css/fontawesome-free-5.5.0-web/css/all.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/css/font-awesome-animation.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/css/flagstrap/css/flags.css" rel="stylesheet" type="text/css"/>
<?php
$cssFiles = array();

View file

@ -18,7 +18,7 @@ if (isIframe() && !empty($_SESSION['noNavbar'])) {
}
}
if (empty($_SESSION['noNavbarClose'])) {
//$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
//$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$actual_link = basename($_SERVER['PHP_SELF']);
$params = $_GET;
unset($params['noNavbar']);
@ -752,6 +752,28 @@ if (!User::isLogged() && !empty($advancedCustomUser->userMustBeLoggedIn) && !emp
<?php
}
if (AVideoPlugin::isEnabledByName("PlayLists") && PlayLists::showTVFeatures()) {
?>
<li>
<div>
<a href="<?php echo $global['webSiteRootURL']; ?>epg" class="btn btn-primary btn-block " style="border-radius: 0 0 0 0;">
<i class="fas fa-stream"></i>
<?php echo __("EPG"); ?>
</a>
</div>
</li>
<li>
<div>
<a href="<?php echo $global['webSiteRootURL']; ?>tv" class="btn btn-primary btn-block " style="border-radius: 0 0 0 0;">
<i class="fas fa-tv"></i>
<?php echo __("TV"); ?>
</a>
</div>
</li>
<?php
}
if (empty($advancedCustom->doNotShowLeftTrendingButton)) {
?>
<li>

View file

@ -26,6 +26,11 @@ if (!empty($videoSerie)) {
<ul class="nav navbar-nav">
<li class="navbar-header">
<a>
<div class="pull-right">
<?php
echo PlayLists::getPlayLiveButton($playlist_id);
?>
</div>
<h3 class="nopadding">
<?php
echo $playlist->getName();

View file

@ -397,13 +397,21 @@ function inIframe() {
return true;
}
}
function playerIsReady(){
return (typeof player !== 'undefined' && player.isReady_);
}
var promisePlaytry = 20;
var promisePlayTimeoutTime = 500;
var promisePlayTimeout;
var promisePlay;
var browserPreventShowed = false;
function playerPlay(currentTime) {
if (typeof player === 'undefined' || !player.isReady_) {
if(currentTime){
console.log("playerPlay time:", currentTime);
}
if (!playerIsReady()) {
setTimeout(function () {
playerPlay(currentTime);
}, 200);
@ -451,6 +459,13 @@ function playerPlay(currentTime) {
}
}
}).catch(function (error) {
if(player.networkState()===3){
promisePlaytry = 20;
console.log("playerPlay: Network error detected, trying again");
player.src(player.currentSources());
userIsControling = false;
tryToPlay(currentTime);
}else{
if (promisePlaytry <= 10) {
console.log("playerPlay: (" + promisePlaytry + ") Autoplay was prevented, trying to mute and play ***");
tryToPlayMuted(currentTime);
@ -458,6 +473,7 @@ function playerPlay(currentTime) {
console.log("playerPlay: (" + promisePlaytry + ") Autoplay was prevented, trying to play again");
tryToPlay(currentTime);
}
}
});
} else {
tryToPlay(currentTime);
@ -823,6 +839,10 @@ function avideoAlert(title, msg, type) {
}
}
function avideoToast(msg){
$.toast(msg);
}
function avideoAlertHTMLText(title, msg, type) {
var span = document.createElement("span");
span.innerHTML = msg;

View file

@ -124,7 +124,7 @@ if(User::hasBlockedUser($video['users_id'])){
$files = getVideosURLZIP($video['filename']);
}else{
$files = getVideosURL($video['filename']);
}
}//var_dump($files);exit;
foreach ($files as $key => $theLink) {
$notAllowedKeys = array('m3u8');
if (empty($advancedCustom->showImageDownloadOption)) {