fixed bugs
This commit is contained in:
@@ -54,14 +54,31 @@ class MainController extends Controller
|
|||||||
// OC_Util::addStyle($this->appName, 'table');
|
// OC_Util::addStyle($this->appName, 'table');
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['aria2_running'] = $this->aria2->isRunning();
|
$params['aria2_running'] = $this->aria2->isRunning();
|
||||||
$params['aria2_installed'] = $this->aria2->isInstalled();
|
$params['aria2_installed'] = $aria2_installed = $this->aria2->isInstalled();
|
||||||
$params['aria2_bin'] = $this->aria2->getBin();
|
$params['aria2_bin'] = $aria2_bin = $this->aria2->getBin();
|
||||||
$params['aria2_executable'] = $this->aria2->isExecutable();
|
$params['aria2_executable'] = $aria2_executable = $this->aria2->isExecutable();
|
||||||
$params['youtube_installed'] = $this->youtube->isInstalled();
|
$params['youtube_installed'] = $youtube_installed = $this->youtube->isInstalled();
|
||||||
$params['youtube_bin'] = $this->youtube->getBin();
|
$params['youtube_bin'] = $youtube_bin = $this->youtube->getBin();
|
||||||
$params['youtube_executable'] = $this->youtube->isExecutable();
|
$params['youtube_executable'] = $youtube_executable = $this->youtube->isExecutable();
|
||||||
$params['ncd_hide_errors'] = $this->settings->get("ncd_hide_errors", false);
|
$params['ncd_hide_errors'] = $this->settings->get("ncd_hide_errors", false);
|
||||||
$params['counter'] = $this->counters->getCounters();
|
$params['counter'] = $this->counters->getCounters();
|
||||||
|
$params['python_installed'] = $python_installed = Helper::pythonInstalled();
|
||||||
|
|
||||||
|
$errors = [];
|
||||||
|
if ($aria2_installed && !$aria2_executable) {
|
||||||
|
array_push($errors, sprintf("aria2 is installed but don't have the right permissions.Please execute command sudo chmod 755 %s", $aria2_bin));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($youtube_installed && (!$youtube_executable || !@is_readable($youtube_bin))) {
|
||||||
|
array_push($errors, sprintf("youtube-dl is installed but don't have the right permissions.Please execute command sudo chmod 755 %s", $youtube_bin));
|
||||||
|
} else if (!$youtube_installed) {
|
||||||
|
array_push($errors, "youtube-dl is not installed!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$python_installed) {
|
||||||
|
array_push($errors, "python is not installed!");
|
||||||
|
}
|
||||||
|
$params['errors'] = $errors;
|
||||||
|
|
||||||
$params['settings'] = json_encode([
|
$params['settings'] = json_encode([
|
||||||
'is_admin' => \OC_User::isAdminUser($this->uid),
|
'is_admin' => \OC_User::isAdminUser($this->uid),
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class Aria2
|
|||||||
$this->bin = Helper::findBinaryPath('aria2c', __DIR__ . "/../../bin/aria2c");
|
$this->bin = Helper::findBinaryPath('aria2c', __DIR__ . "/../../bin/aria2c");
|
||||||
}
|
}
|
||||||
if ($this->isInstalled() && !$this->isExecutable()) {
|
if ($this->isInstalled() && !$this->isExecutable()) {
|
||||||
chmod($this->bin, 755);
|
chmod($this->bin, 0744);
|
||||||
}
|
}
|
||||||
$this->setDownloadDir($dir);
|
$this->setDownloadDir($dir);
|
||||||
$this->setTorrentsDir($torrents_dir);
|
$this->setTorrentsDir($torrents_dir);
|
||||||
|
|||||||
@@ -209,8 +209,10 @@ class Helper
|
|||||||
$exeSniffer = new ExecutableFinder();
|
$exeSniffer = new ExecutableFinder();
|
||||||
// Returns null if nothing is found
|
// Returns null if nothing is found
|
||||||
$result = $exeSniffer->find($program, $default, $paths);
|
$result = $exeSniffer->find($program, $default, $paths);
|
||||||
|
if ($result) {
|
||||||
// store the value for 5 minutes
|
// store the value for 5 minutes
|
||||||
$memcache->set($program, $result, 300);
|
$memcache->set($program, $result, 300);
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,4 +326,9 @@ class Helper
|
|||||||
return self::doSignal($pid, 9);
|
return self::doSignal($pid, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function pythonInstalled()
|
||||||
|
{
|
||||||
|
return (bool) self::findBinaryPath('python');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class Youtube
|
|||||||
$this->bin = Helper::findBinaryPath('youtube-dl', __DIR__ . "/../../bin/youtube-dl");
|
$this->bin = Helper::findBinaryPath('youtube-dl', __DIR__ . "/../../bin/youtube-dl");
|
||||||
}
|
}
|
||||||
if ($this->isInstalled() && !$this->isExecutable()) {
|
if ($this->isInstalled() && !$this->isExecutable()) {
|
||||||
chmod($this->bin, 755);
|
chmod($this->bin, 0744);
|
||||||
}
|
}
|
||||||
$this->setDownloadDir($downloadDir);
|
$this->setDownloadDir($downloadDir);
|
||||||
if (!empty($settings)) {
|
if (!empty($settings)) {
|
||||||
@@ -246,6 +246,11 @@ class Youtube
|
|||||||
return @is_executable($this->bin);
|
return @is_executable($this->bin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isReadable()
|
||||||
|
{
|
||||||
|
return @is_readable($this->bin);
|
||||||
|
}
|
||||||
|
|
||||||
public function getBin()
|
public function getBin()
|
||||||
{
|
{
|
||||||
return $this->bin;
|
return $this->bin;
|
||||||
|
|||||||
@@ -1,16 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
extract($_);
|
extract($_);
|
||||||
$errors = [];
|
|
||||||
if ($aria2_installed && !$aria2_executable) {
|
|
||||||
array_push($errors, sprintf("aria2 is installed but not executable.Please execute command sudo chmod 755 %s", $aria2_bin));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($youtube_installed && !$youtube_executable) {
|
|
||||||
array_push($errors, sprintf("youtube-dl is installed but not executable.Please execute command sudo chmod 755 %s", $youtube_bin));
|
|
||||||
} else if (!$youtube_installed) {
|
|
||||||
array_push($errors, "youtube-dl is not installed!");
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div id="app-navigation">
|
<div id="app-navigation">
|
||||||
<?php if (!$ncd_hide_errors): ?>
|
<?php if (!$ncd_hide_errors): ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user