...
 
Commits (7)
......@@ -51,7 +51,7 @@ class issues implements Interfaces\Api
$issue = new Issue;
$issue->setTitle($title)
->setDescription($description)
->setLabels('S - Triage (New), T - Bug (Triage)');
->setLabels('Status::Validation, Type::Bug (Triage)');
// call gitlab api
$res = $manager->postIssue($issue, $pages[0]);
......
......@@ -4,7 +4,7 @@
*/
namespace Minds\Core\Media\ClientUpload;
use Minds\Core\Media\Services\FFMpeg;
use Minds\Core\Media\Video\Transcoder\Manager as TranscoderManager;
use Minds\Core\GuidBuilder;
use Minds\Core\Entities\Actions\Save;
use Minds\Core\Di\Di;
......@@ -12,35 +12,22 @@ use Minds\Entities\Video;
class Manager
{
/** @var FFMpeg */
private $ffmpeg;
/** @var TranscoderManager */
private $transcoderManager;
/** @var Guid $guid */
private $guid;
/** @var bool */
private $full_hd;
/** @var Save $save */
private $save;
/**
* @param bool $value
* @return Manager
*/
public function setFullHD(bool $value): Manager
{
$this->full_hd = $value;
return $this;
}
public function __construct(
FFMpeg $FFMpeg = null,
TranscoderManager $transcoderManager = null,
GuidBuilder $guid = null,
Save $save = null
) {
$this->ffmpeg = $FFMpeg ?: Di::_()->get('Media\Services\FFMpeg');
$this->transcoderManager = $transcoderManager ?: Di::_()->get('Media\Video\Transcoder\Manager');
$this->guid = $guid ?: new GuidBuilder();
$this->save = $save ?: new Save();
}
......@@ -56,13 +43,13 @@ class Manager
throw new \Exception("$type is not currently supported for client based uploads");
}
$guid = $this->guid->build();
$video = new Video();
$video->set('guid', $this->guid->build());
$this->ffmpeg->setKey($guid);
$preSignedUrl = $this->ffmpeg->getPresignedUrl();
$preSignedUrl = $this->transcoderManager->getClientSideUploadUrl($video);
$lease = new ClientUploadLease();
$lease->setGuid($guid)
$lease->setGuid($video->getGuid())
->setMediaType($type)
->setPresignedUrl($preSignedUrl);
......@@ -84,18 +71,12 @@ class Manager
$video->set('guid', $lease->getGuid());
$video->set('cinemr_guid', $lease->getGuid());
$video->set('access_id', 0); // Hide until published
$video->setFlag('full_hd', $this->full_hd);
// Save the video
$this->save->setEntity($video)->save();
$this->ffmpeg->setKey($lease->getGuid());
// Set the full hd flag
$this->ffmpeg->setFullHD($this->full_hd);
// Start the transcoding process
$this->ffmpeg->transcode();
// Kick off the transcoder
$this->transcoderManager->createTranscodes($video);
return true;
}
......
......@@ -72,10 +72,16 @@ class MediaProvider extends Provider
return new ClientUpload\Manager();
}, ['useFactory' => true]);
// Services
// Services (deprecated)
$this->di->bind('Media\Services\FFMpeg', function ($di) {
return new Services\FFMpeg();
}, ['useFactory' => false]);
// Transcoder
$this->di->bind('Media\Video\Transcoder\Manager', function ($di) {
return new Video\Transcoder\Manager();
}, ['useFactory' => false]);
}
}
......@@ -26,9 +26,10 @@ class Thumbnails
*/
public function get($entity, $size)
{
if (is_string($entity)) {
$entity = $this->entitiesBuilder->build($entity);
if (is_numeric($entity)) {
$entity = $this->entitiesBuilder->single($entity);
}
if (!$entity || !Core\Security\ACL::_()->read($entity)) {
return false;
}
......
......@@ -12,7 +12,7 @@ class QueueDelegate
public function __construct($queueClient = null)
{
$this->queueClient = $queueClient ?? Di::_()->get('Queue\SQS');
$this->queueClient = $queueClient ?? Di::_()->get('Queue');
}
/**
......
......@@ -83,6 +83,21 @@ class Manager
return (bool) $this->transcodeStorage->add($source, $path);
}
/**
* This will return a url that can be used by an HTTP client
* to upload the source file
* @param Video $video
* @return string
*/
public function getClientSideUploadUrl(Video $video): string
{
$source = new Transcode();
$source
->setVideo($video)
->setProfile(new TranscodeProfiles\Source());
return $this->transcodeStorage->getClientSideUploadUrl($source);
}
/**
* Create the transcodes from from
* @param Video $video
......
......@@ -47,7 +47,7 @@ abstract class AbstractTranscodeProfile implements TranscodeProfileInterface
*/
public function getId(): string
{
$path = explode('\\', __CLASS__);
$path = explode('\\', get_called_class());
return array_pop($path);
}
......
......@@ -53,6 +53,21 @@ class S3Storage implements TranscodeStorageInterface
]);
}
/**
* This will return a url that can be used by an HTTP client
* to upload the source file
* @param Transcode $transcode
* @return string
*/
public function getClientSideUploadUrl(Transcode $transcode): string
{
$cmd = $this->s3->getCommand('PutObject', [
'Bucket' => 'cinemr',
'Key' => "$this->dir/{$transcode->getGuid()}/{$transcode->getProfile()->getStorageName()}",
]);
return (string) $this->s3->createPresignedRequest($cmd, '+20 minutes')->getUri();
}
/**
* @param Transcode $transcode
......
......@@ -12,6 +12,14 @@ interface TranscodeStorageInterface
*/
public function add(Transcode $transcode, string $path): bool;
/**
* This will return a url that can be used by an HTTP client
* to upload the source file
* @param Transcode $transcode
* @return string
*/
public function getClientSideUploadUrl(Transcode $transcode): string;
/**
* @param Transcode $transcode
* @return string
......
......@@ -1533,3 +1533,14 @@ CREATE MATERIALIZED VIEW minds.withdrawals_by_status AS
WHERE status IS NOT NULL AND user_guid IS NOT NULL AND timestamp IS NOT NULL AND tx IS NOT NULL
PRIMARY KEY (status, timestamp, user_guid, tx)
WITH CLUSTERING ORDER BY (timestamp ASC, user_guid ASC, tx ASC);
CREATE TABLE minds.video_transcodes (
guid bigint,
profile_id text,
progress int,
status text,
last_event_timestamp_ms timestamp,
length_secs int,
bytes int,
PRIMARY KEY (guid, profile_id)
);
\ No newline at end of file
......@@ -29,7 +29,9 @@ class Spam
$foundSpam = Text::strposa($entity->getBody(), ProhibitedDomains::DOMAINS);
break;
}
$foundSpam = Text::strposa($entity->getDescription(), ProhibitedDomains::DOMAINS);
if (method_exists($entity, 'getDescription')) {
$foundSpam = Text::strposa($entity->getDescription(), ProhibitedDomains::DOMAINS);
}
break;
case 'user':
$foundSpam = Text::strposa($entity->briefdescription, ProhibitedDomains::DOMAINS);
......
......@@ -386,4 +386,26 @@ class Image extends File
$this->time_sent = $time_sent;
return $this;
}
/**
* Return description
* @return string
*/
public function getDescription(): string
{
return $this->description ?: '';
}
/**
* Set description
*
* @param string $description - description to be set.
* @return Image
*/
public function setDescription($description): Image
{
$this->description = $description;
return $this;
}
}
......@@ -297,4 +297,25 @@ class Video extends MindsObject
$this->time_sent = $time_sent;
return $this;
}
/**
* Return description
* @return string
*/
public function getDescription(): string
{
return $this->description ?: '';
}
/**
* Set description
*
* @param string $description - description to be set.
* @return Video
*/
public function setDescription($description): Video
{
$this->description = $description;
return $this;
}
}
......@@ -879,8 +879,9 @@ function elgg_get_entities(array $options = array()) {
}
$entity = entity_row_to_elggstar($newrow);
if(Minds\Core\Security\ACL::_()->read($entity))
if ($entity && Minds\Core\Security\ACL::_()->read($entity)) {
$entities[] = $entity;
}
}
}
} catch(Exception $e){
......