Skip to content

Commit

Permalink
PPV live now can support custom posters
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Dec 11, 2024
1 parent 0a11e50 commit 0b1c6e8
Show file tree
Hide file tree
Showing 19 changed files with 119 additions and 89 deletions.
4 changes: 2 additions & 2 deletions objects/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6510,7 +6510,7 @@ function getMediaSession()
if ($liveLink = isLiveLink()) {
$MediaMetadata = LiveLinks::getMediaSession($liveLink);
} elseif ($live = isLive()) {
$MediaMetadata = Live::getMediaSession($live['key'], $live['live_servers_id'], @$live['live_schedule_id']);
$MediaMetadata = Live::getMediaSession($live['key'], $live['live_servers_id'], @$live['live_schedule_id'], 0);
} elseif (!empty($videos_id)) {
if (!empty($videos_id)) {
$MediaMetadata = Video::getMediaSession($videos_id);
Expand All @@ -6520,7 +6520,7 @@ function getMediaSession()
} elseif (!empty($_REQUEST['videos_id'])) {
$MediaMetadata = Video::getMediaSession($_REQUEST['videos_id']);
} elseif (!empty($_REQUEST['key'])) {
$MediaMetadata = Live::getMediaSession($_REQUEST['key'], @$_REQUEST['live_servers_id'], @$_REQUEST['live_schedule_id']);
$MediaMetadata = Live::getMediaSession($_REQUEST['key'], @$_REQUEST['live_servers_id'], @$_REQUEST['live_schedule_id'], 0);
}
if (empty($MediaMetadata) || empty($MediaMetadata->title)) {
$MediaMetadata = new stdClass();
Expand Down
4 changes: 2 additions & 2 deletions objects/functionsOpenGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ function getOpenGraphLiveSchedule($live_schedule_id)
$title = $liveS->getTitle();
$description = '';
$duration_in_seconds = 0;
$poster = Live_schedule::getPosterURL($live_schedule_id);
$poster = Live_schedule::getPosterURL($live_schedule_id, 0);
$liveStreamObject = new LiveStreamObject($liveS->getKey(), $liveS->getLive_servers_id(), 0, 0, @$_REQUEST['live_schedule']);
$sourceFileURL = $liveStreamObject->getM3U8(true);
$pageURL = $liveStreamObject->getURL();
Expand All @@ -380,7 +380,7 @@ function getOpenGraphLive()
$isLive = isLive();
$liveT = LiveTransmition::getFromKey($isLive['cleanKey']);
$users_id = $liveT['users_id'];
$poster = Live::getPosterImage($users_id, $isLive['live_servers_id'], $isLive['live_schedule']);
$poster = Live::getRegularPosterImage($users_id, $isLive['live_servers_id'], $isLive['live_schedule'], 0);
$liveStreamObject = new LiveStreamObject($isLive['cleanKey'], $isLive['live_servers_id'], $isLive['live_index'], 0);
echo PHP_EOL . "<!-- OpenGraph Live users_id={$users_id} ".json_encode($isLive)." -->" . PHP_EOL;
$videoType = '';
Expand Down
28 changes: 14 additions & 14 deletions plugin/API/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ public function get_api_video($parameters)
$rows[$key]['isSubscribed'] = Subscribe::isSubscribed($rows[$key]['users_id']);
}


$sub = self::getSubtitle($value['filename']);

$rows[$key]['subtitles_available'] = $sub['subtitles_available'];
Expand Down Expand Up @@ -1464,15 +1464,15 @@ public function set_api_live_schedule($parameters)
$live_schedule_id = $o->save();
if ($live_schedule_id) {
if (!empty($parameters['base64PNGImageRegular'])) {
$image = Live_schedule::getPosterPaths($live_schedule_id, Live::$posterType_regular);
$image = Live_schedule::getPosterPaths($live_schedule_id, 0, Live::$posterType_regular);
saveBase64DataToPNGImage($parameters['base64PNGImageRegular'], $image['path']);
}
if (!empty($parameters['base64PNGImagePreRoll'])) {
$image = Live_schedule::getPosterPaths($live_schedule_id, Live::$posterType_preroll);
$image = Live_schedule::getPosterPaths($live_schedule_id, 0, Live::$posterType_preroll);
saveBase64DataToPNGImage($parameters['base64PNGImagePreRoll'], $image['path']);
}
if (!empty($parameters['base64PNGImagePostRoll'])) {
$image = Live_schedule::getPosterPaths($live_schedule_id, Live::$posterType_postroll);
$image = Live_schedule::getPosterPaths($live_schedule_id, 0, Live::$posterType_postroll);
saveBase64DataToPNGImage($parameters['base64PNGImagePostRoll'], $image['path']);
}

Expand Down Expand Up @@ -1597,7 +1597,7 @@ public function get_api_user($parameters)
$obj->livestream["server_v3"] = addLastSlash($url);
$obj->livestream["key_v3"] = "{$obj->livestream['key_with_index']}?s={$encrypt}";

$obj->livestream["poster"] = $global['webSiteRootURL'] . $p->getPosterImage($user->getBdId(), $obj->livestream["live_servers_id"]);
$obj->livestream["poster"] = $global['webSiteRootURL'] . Live::getRegularPosterImage($user->getBdId(), $obj->livestream["live_servers_id"], 0, 0);
$obj->livestream["joinURL"] = Live::getLinkToLiveFromUsers_idAndLiveServer($user->getBdId(), $obj->livestream["live_servers_id"]);

$obj->livestream["activeLives"] = array();
Expand Down Expand Up @@ -2151,7 +2151,7 @@ private function like($parameters, $like)
new Like($like, $parameters['videos_id']);

$obj = Like::getLikes($parameters['videos_id']);
if(empty($obj)){
if (empty($obj)) {
$obj = new stdClass();
}

Expand Down Expand Up @@ -2834,12 +2834,12 @@ public function set_api_birth($parameters)
return new ApiObject("You must login first");
}
$msg = '';
$obj = new stdClass();
$obj = new stdClass();

$user = new User(0);
$user->loadSelfUser();
$user->setBirth_date($_REQUEST['birth_date']);
$obj->users_id = $user->save();
$obj->users_id = $user->save();
$obj->error = empty($obj->users_id);
User::updateSessionInfo();

Expand All @@ -2859,13 +2859,13 @@ public function get_api_is_verified($parameters)
if (!self::isAPISecretValid()) {
return new ApiObject("APISecret is required");
}
$obj = new stdClass();
$obj = new stdClass();
$obj->users_id = intval($_REQUEST['users_id']);
if (empty($obj->users_id)) {
return new ApiObject("Users ID is required");
}
$user = new User($obj->users_id);
$obj->email_verified = !empty($user->getEmailVerified());
$obj->email_verified = !empty($user->getEmailVerified());

return new ApiObject('', false, $obj);
}
Expand All @@ -2883,12 +2883,12 @@ public function set_api_send_verification_email($parameters)
if (!self::isAPISecretValid()) {
return new ApiObject("APISecret is required");
}
$obj = new stdClass();
$obj = new stdClass();
$obj->users_id = intval($_REQUEST['users_id']);
if (empty($obj->users_id)) {
return new ApiObject("Users ID is required");
}
$user = new User($obj->users_id);
$user = new User($obj->users_id);
$obj->sent = User::sendVerificationLink($obj->users_id);
return new ApiObject('', false, $obj);
}
Expand All @@ -2906,7 +2906,7 @@ public static function isAPISecretValid()
return false;
}

/**
/**
* return true if the secret is valid and false if it is not
* 'APISecret' mandatory for security reasons - required
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&APISecret={APISecret}
Expand All @@ -2917,7 +2917,7 @@ public function get_api_isAPISecretValid()
global $global;
if (!self::isAPISecretValid()) {
return new ApiObject("APISecret is invalid");
}else{
} else {
return new ApiObject("APISecret is valid", false);
}
}
Expand Down
Loading

0 comments on commit 0b1c6e8

Please sign in to comment.