Skip to content

Commit

Permalink
Fix(snap): Improve interoperability with nc snap
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr committed Sep 6, 2023
1 parent 55b968a commit 92a32ea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
33 changes: 19 additions & 14 deletions lib/Migration/InstallDeps.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,28 +72,33 @@ public function __construct(IConfig $config, IClientService $clientService, Logg
}

public function getName(): string {
return 'Install dependencies';
return 'Install recognize dependencies';
}

public function run(IOutput $output): void {
$existingBinary = $this->config->getAppValue('recognize', 'node_binary', '');
if ($existingBinary !== '') {
$version = $this->testBinary($existingBinary);
if ($version === null) {
try {
$existingBinary = $this->config->getAppValue('recognize', 'node_binary', '');
if ($existingBinary !== '') {
$version = $this->testBinary($existingBinary);
if ($version === null) {
$this->installNodeBinary($output);
}
} else {
$this->installNodeBinary($output);
}
} else {
$this->installNodeBinary($output);
}

$this->setBinariesPermissions();
$this->setBinariesPermissions();

$binaryPath = $this->config->getAppValue('recognize', 'node_binary', '');
$binaryPath = $this->config->getAppValue('recognize', 'node_binary', '');

$this->runTfjsInstall($binaryPath);
$this->runFfmpegInstall($binaryPath);
$this->runTfjsGpuInstall($binaryPath);
$this->setNiceBinaryPath();
$this->runTfjsInstall($binaryPath);
$this->runFfmpegInstall($binaryPath);
$this->runTfjsGpuInstall($binaryPath);
$this->setNiceBinaryPath();
} catch(\Throwable $e) {
$output->warning('Failed to automatically install dependencies for recognize. Check the recognize admin panel for potential problems.');
$this->logger->error('Failed to automatically install dependencies for recognize. Check the recognize admin panel for potential problems.', ['exception' => $e]);
}
}

protected function setNiceBinaryPath() : void {
Expand Down
1 change: 1 addition & 0 deletions src/components/ViewAdmin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@
<p>
<input v-model="settings['node_binary']" type="text" @change="onChange">
</p>
<p>{{ t('recognize', 'For Nextcloud Snap users, you need to adjust this path to point to the snap\'s "current" directory as the pre-configured path will change with each update. For example, set it to "/var/snap/nextcloud/current/nextcloud/extra-apps/recognize/bin/node" instead of "/var/snap/nextcloud/9337974/nextcloud/extra-apps/recognize/bin/node"') }}</p>
</NcSettingsSection>
<NcSettingsSection :title="t('recognize', 'Classifier process priority')">
<p v-if="nice === undefined">
Expand Down

0 comments on commit 92a32ea

Please sign in to comment.