mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
add subdef_source in config
This commit is contained in:
@@ -329,10 +329,12 @@ workers:
|
||||
vhost: /
|
||||
|
||||
externalservice:
|
||||
ginga:
|
||||
ginger:
|
||||
AutoSubtitling:
|
||||
service_base_url: https://base.uri
|
||||
token: 39c6011d
|
||||
transcript_format: text/vtt
|
||||
subdef_source: preview
|
||||
|
||||
user_account:
|
||||
deleting_policies:
|
||||
|
@@ -457,7 +457,12 @@ class ToolsController extends Controller
|
||||
);
|
||||
|
||||
$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();
|
||||
}
|
||||
|
||||
@@ -524,4 +529,15 @@ class ToolsController extends Controller
|
||||
'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)
|
||||
{
|
||||
$gingaBaseurl = $this->conf->get(['externalservice', 'ginga', 'service_base_url']);
|
||||
$gingaToken = $this->conf->get(['externalservice', 'ginga', 'token']);
|
||||
$gingaTranscriptFormat = $this->conf->get(['externalservice', 'ginga', 'transcript_format']);
|
||||
$gingaBaseurl = $this->conf->get(['externalservice', 'ginger', 'AutoSubtitling', 'service_base_url']);
|
||||
$gingaToken = $this->conf->get(['externalservice', 'ginger', 'AutoSubtitling', 'token']);
|
||||
$gingaTranscriptFormat = $this->conf->get(['externalservice', 'ginger', 'AutoSubtitling', 'transcript_format']);
|
||||
|
||||
if (!$gingaBaseurl || !$gingaToken || !$gingaTranscriptFormat) {
|
||||
$this->logger->error("External service Ginga not set correctly in configuration.yml");
|
||||
|
Reference in New Issue
Block a user