Skip to content

Commit

Permalink
Merge branch 'development' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
orkit committed Jun 26, 2024
2 parents 5db708d + 0a2f9ba commit 99a0e9e
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 53 deletions.
6 changes: 0 additions & 6 deletions app/Services/Notify/PlayStoreNotify.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ public function sendSuccess(string $type)
$this->presentation->title = ['sv' => $this->presentation['title'], 'en' => $this->presentation['title']];
}

if ($type == 'edit') {
//For now
$this->presentation
->makeHidden('sources');
}

if ($type == 'mediasite') {
$this->presentation->makeHidden('video_id')->makeHidden('mediasite_folder_id');
}
Expand Down
127 changes: 82 additions & 45 deletions app/Services/Upload/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Jobs\JobUploadFailedNotification;
use App\ManualPresentation;
use App\Stream;
use App\StreamResolution;
use Illuminate\Support\Collection;

class Metadata
Expand All @@ -22,61 +23,86 @@ public function create(ManualPresentation $presentation)
$subtitlePath = $finalPath . '/subtitle/';
//Creates the source attribute
$presentation->sources = [];

//Adds source and created thumbs
foreach (\Illuminate\Support\Facades\Storage::disk('play-store')->files($videoPath) as $key => $filename) {
/* Disabled 231102 RD
//Add duration
if($key == 0 ) {
if($presentation->duration = $Determine->duration($filename)) {
$presentation->save();
} else {
//Something went wrong - Send email to uploader
$job = (new JobUploadFailedNotification($presentation));
// Dispatch Job and continue
dispatch($job);
if($presentation->type == 'edit') {
//Retrive all streams for presentation
$streams = Stream::where('video_id', $presentation->pkg_id)->get();

foreach ($streams as $stream) {
$resolutions = StreamResolution::where('stream_id', $stream->id)->get();

foreach ($resolutions as $resolution) {
$videosource[$resolution->resolution] = 'video/'. $resolution->filename;
}
$build = \Illuminate\Support\Collection::make([
//'video' => \Illuminate\Support\Collection::make($videosource), /* Disabled for now */
//'poster' => 'poster/' . $stream->poster, /* Disabled for now */
'playAudio' => (bool)$stream->audio
]);

}
$buildsource[$stream->name] = $build;

//Set time in sec for thumb generation
if($presentation->duration < 30 ) {
$thumbcreated_after = $presentation->duration/3;
} else {
//Fallback
$thumbcreated_after = 30;
}
//Create thumb for uploaded video
$thumburl = $Thumb->create($finalPath, $filename, $thumbcreated_after);
//Sources
$thumb_name = preg_replace('/\\.[^.\\s]{3,4}$/', '', basename($filename));
//Add video source
*/

foreach($files = \Illuminate\Support\Facades\Storage::disk('play-store')->files($videoPath) as $stream => $f) {
$thumb_name = preg_replace('/\\.[^.\\s]{3,4}$/', '', basename($f));
if($stream == 0) {
$this->source['main'] = [
'video' => 'video/'. basename($f),
//'poster' => 'poster/'. $thumb_name . '.png',
'playAudio' => true,
];
} else {
$this->source['camera'.$stream] = [
'video' => 'video/'. basename($f),
//'poster' => 'poster/'. $thumb_name . '.png',
'playAudio' => false,
];
}
//If videostreams exist
if($buildsource) {
$this->source = \Illuminate\Support\Collection::make($buildsource);
}

$presentation->sources = $this->source;

} else {
foreach (\Illuminate\Support\Facades\Storage::disk('play-store')->files($videoPath) as $key => $filename) {
/* Disabled 231102 RD
//Add duration
if($key == 0 ) {
if($presentation->duration = $Determine->duration($filename)) {
$presentation->save();
} else {
//Something went wrong - Send email to uploader
$job = (new JobUploadFailedNotification($presentation));
// Dispatch Job and continue
dispatch($job);
}
}
//Set time in sec for thumb generation
if($presentation->duration < 30 ) {
$thumbcreated_after = $presentation->duration/3;
} else {
//Fallback
$thumbcreated_after = 30;
}
//Create thumb for uploaded video
$thumburl = $Thumb->create($finalPath, $filename, $thumbcreated_after);
//Sources
$thumb_name = preg_replace('/\\.[^.\\s]{3,4}$/', '', basename($filename));
//Add video source
*/
foreach($files = \Illuminate\Support\Facades\Storage::disk('play-store')->files($videoPath) as $stream => $f) {
$thumb_name = preg_replace('/\\.[^.\\s]{3,4}$/', '', basename($f));
if($stream == 0) {
$this->source['main'] = [
'video' => 'video/'. basename($f),
//'poster' => 'poster/'. $thumb_name . '.png',
'playAudio' => true,
];
} else {
$this->source['camera'.$stream] = [
'video' => 'video/'. basename($f),
//'poster' => 'poster/'. $thumb_name . '.png',
'playAudio' => false,
];
}
}
}
}

$presentation->sources = $this->source;
//Subtitle
if($subtitles = \Illuminate\Support\Facades\Storage::disk('play-store')->files($subtitlePath)) {
switch($presentation->sublanguage) {
Expand Down Expand Up @@ -193,4 +219,15 @@ private function storage()

return $this->system_config['nfs']['storage'];
}

private function base_uri()
{
$this->file = base_path() . '/systemconfig/play.ini';
if (!file_exists($this->file)) {
abort(503);
}
$this->system_config = parse_ini_file($this->file, true);

return $this->system_config['store']['base_uri'];
}
}
4 changes: 2 additions & 2 deletions resources/views/layouts/partials/header.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,11 @@ class="fas fa-file-download fa-icon fa-fw mr-2"></i>Retrive
</div>
</header>
<!-- Display the message banner exclusively for staff members. -->

{{--}}
@if(app()->make('play_role') == 'Administrator' or app()->make('play_role') == 'Courseadmin' or app()->make('play_role') == 'Uploader' or app()->make('play_role') == 'Staff')
@include('layouts.partials.message_banner')
@endif

{{--}}

0 comments on commit 99a0e9e

Please sign in to comment.