refactor: Cleanup best format logic

Reuse $defaultFormat everywhere instead of duplicating conditions
This commit is contained in:
Pierre Rudloff 2019-03-27 00:25:02 +01:00
parent 506584ceee
commit f315343798
2 changed files with 11 additions and 12 deletions

View file

@ -97,9 +97,7 @@ class FrontController
$session_factory = new SessionFactory();
$session = $session_factory->newInstance($cookies);
$this->sessionSegment = $session->getSegment(self::class);
if ($this->config->remux) {
$this->defaultFormat = 'bestvideo+bestaudio,best';
} elseif ($this->config->stream) {
if ($this->config->stream) {
$this->defaultFormat = 'best';
}
}
@ -316,13 +314,14 @@ class FrontController
$response,
$template,
[
'video' => $video,
'class' => 'video',
'title' => $title,
'description' => $description,
'config' => $this->config,
'canonical' => $this->getCanonicalUrl($request),
'locale' => $this->localeManager->getLocale(),
'video' => $video,
'class' => 'video',
'title' => $title,
'description' => $description,
'config' => $this->config,
'canonical' => $this->getCanonicalUrl($request),
'locale' => $this->localeManager->getLocale(),
'defaultFormat' => $this->defaultFormat,
]
);