mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
add subdef_source in config
This commit is contained in:
@@ -329,10 +329,12 @@ workers:
|
|||||||
vhost: /
|
vhost: /
|
||||||
|
|
||||||
externalservice:
|
externalservice:
|
||||||
ginga:
|
ginger:
|
||||||
service_base_url: https://base.uri
|
AutoSubtitling:
|
||||||
token: 39c6011d
|
service_base_url: https://base.uri
|
||||||
transcript_format: text/vtt
|
token: 39c6011d
|
||||||
|
transcript_format: text/vtt
|
||||||
|
subdef_source: preview
|
||||||
|
|
||||||
user_account:
|
user_account:
|
||||||
deleting_policies:
|
deleting_policies:
|
||||||
|
@@ -457,7 +457,12 @@ class ToolsController extends Controller
|
|||||||
);
|
);
|
||||||
|
|
||||||
$permalinkUrl = '';
|
$permalinkUrl = '';
|
||||||
if ($record->has_preview() && ($previewLink = $record->get_preview()->get_permalink()) != null) {
|
$conf = $this->getConf();
|
||||||
|
|
||||||
|
// if subdef_source not set, by default use the preview permalink
|
||||||
|
$subdefSource = $conf->get(['externalservice', 'ginger', 'AutoSubtitling', 'subdef_source']) ?: 'preview';
|
||||||
|
|
||||||
|
if ($this->isPhysicallyPresent($record, $subdefSource) && ($previewLink = $record->get_subdef($subdefSource)->get_permalink()) != null) {
|
||||||
$permalinkUrl = $previewLink->get_url()->__toString();
|
$permalinkUrl = $previewLink->get_url()->__toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -524,4 +529,15 @@ class ToolsController extends Controller
|
|||||||
'videoTextTrackFields' => $videoTextTrackFields
|
'videoTextTrackFields' => $videoTextTrackFields
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function isPhysicallyPresent(\record_adapter $record, $subdefName)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return $record->get_subdef($subdefName)->is_physically_present();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
unset($e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,9 +31,9 @@ class SubtitleWorker implements WorkerInterface
|
|||||||
|
|
||||||
public function process(array $payload)
|
public function process(array $payload)
|
||||||
{
|
{
|
||||||
$gingaBaseurl = $this->conf->get(['externalservice', 'ginga', 'service_base_url']);
|
$gingaBaseurl = $this->conf->get(['externalservice', 'ginger', 'AutoSubtitling', 'service_base_url']);
|
||||||
$gingaToken = $this->conf->get(['externalservice', 'ginga', 'token']);
|
$gingaToken = $this->conf->get(['externalservice', 'ginger', 'AutoSubtitling', 'token']);
|
||||||
$gingaTranscriptFormat = $this->conf->get(['externalservice', 'ginga', 'transcript_format']);
|
$gingaTranscriptFormat = $this->conf->get(['externalservice', 'ginger', 'AutoSubtitling', 'transcript_format']);
|
||||||
|
|
||||||
if (!$gingaBaseurl || !$gingaToken || !$gingaTranscriptFormat) {
|
if (!$gingaBaseurl || !$gingaToken || !$gingaTranscriptFormat) {
|
||||||
$this->logger->error("External service Ginga not set correctly in configuration.yml");
|
$this->logger->error("External service Ginga not set correctly in configuration.yml");
|
||||||
|
Reference in New Issue
Block a user