public function __construct($AppName, IRequest $Request, $CurrentUID, IL10N $L10N) { parent::__construct($AppName, $Request); if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) { $this->DbType = 1; } $this->CurrentUID = $CurrentUID; $Settings = new Settings(); $Settings->SetKey('ProxyAddress'); $this->ProxyAddress = $Settings->GetValue(); $Settings->SetKey('ProxyPort'); $this->ProxyPort = intval($Settings->GetValue()); $Settings->SetKey('ProxyUser'); $this->ProxyUser = $Settings->GetValue(); $Settings->SetKey('ProxyPasswd'); $this->ProxyPasswd = $Settings->GetValue(); $Settings->SetKey('ProxyOnlyWithYTDL'); $this->ProxyOnlyWithYTDL = $Settings->GetValue(); $this->ProxyOnlyWithYTDL = is_null($this->ProxyOnlyWithYTDL) ? false : strcmp($this->ProxyOnlyWithYTDL, 'Y') == 0; $Settings->SetKey('WhichDownloader'); $this->WhichDownloader = $Settings->GetValue(); $this->WhichDownloader = is_null($this->WhichDownloader) ? 0 : (strcmp($this->WhichDownloader, 'ARIA2') == 0 ? 0 : 1); // 0 means ARIA2, 1 means CURL $Settings->SetTable('personal'); $Settings->SetUID($this->CurrentUID); $Settings->SetKey('DownloadsFolder'); $this->DownloadsFolder = $Settings->GetValue(); $this->DownloadsFolder = '/' . (is_null($this->DownloadsFolder) ? 'Downloads' : $this->DownloadsFolder); $this->AbsoluteDownloadsFolder = \OC\Files\Filesystem::getLocalFolder($this->DownloadsFolder); $this->L10N = $L10N; }
public function __construct($AppName, IRequest $Request, $CurrentUID, IL10N $L10N) { parent::__construct($AppName, $Request); if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) { $this->DbType = 1; } $this->CurrentUID = $CurrentUID; $Settings = new Settings(); $Settings->SetKey('YTDLBinary'); $YTDLBinary = $Settings->GetValue(); $this->YTDLBinary = '/usr/local/bin/youtube-dl'; // default path if (!is_null($YTDLBinary)) { $this->YTDLBinary = $YTDLBinary; } $Settings->SetKey('ProxyAddress'); $this->ProxyAddress = $Settings->GetValue(); $Settings->SetKey('ProxyPort'); $this->ProxyPort = intval($Settings->GetValue()); $Settings->SetKey('ProxyUser'); $this->ProxyUser = $Settings->GetValue(); $Settings->SetKey('ProxyPasswd'); $this->ProxyPasswd = $Settings->GetValue(); $Settings->SetKey('WhichDownloader'); $this->WhichDownloader = $Settings->GetValue(); $this->WhichDownloader = is_null($this->WhichDownloader) ? 0 : (strcmp($this->WhichDownloader, 'ARIA2') == 0 ? 0 : 1); // 0 means ARIA2, 1 means CURL $Settings->SetKey('MaxDownloadSpeed'); $this->MaxDownloadSpeed = $Settings->GetValue(); $Settings->SetKey('AllowProtocolYT'); $this->AllowProtocolYT = $Settings->GetValue(); $this->AllowProtocolYT = is_null($this->AllowProtocolYT) ? true : strcmp($this->AllowProtocolYT, 'Y') == 0; $Settings->SetTable('personal'); $Settings->SetUID($this->CurrentUID); $Settings->SetKey('DownloadsFolder'); $this->DownloadsFolder = $Settings->GetValue(); $this->DownloadsFolder = '/' . (is_null($this->DownloadsFolder) ? 'Downloads' : $this->DownloadsFolder); $this->AbsoluteDownloadsFolder = \OC\Files\Filesystem::getLocalFolder($this->DownloadsFolder); $this->L10N = $L10N; }
public function __construct($AppName, IRequest $Request, $CurrentUID, IL10N $L10N) { parent::__construct($AppName, $Request); if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) { $this->DbType = 1; } $this->CurrentUID = $CurrentUID; $this->Settings = new Settings(); $this->Settings->SetKey('ProxyAddress'); $this->ProxyAddress = $this->Settings->GetValue(); $this->Settings->SetKey('ProxyPort'); $this->ProxyPort = intval($this->Settings->GetValue()); $this->Settings->SetKey('ProxyUser'); $this->ProxyUser = $this->Settings->GetValue(); $this->Settings->SetKey('ProxyPasswd'); $this->ProxyPasswd = $this->Settings->GetValue(); $this->Settings->SetKey('ProxyOnlyWithYTDL'); $this->ProxyOnlyWithYTDL = $this->Settings->GetValue(); $this->ProxyOnlyWithYTDL = is_null($this->ProxyOnlyWithYTDL) ? false : strcmp($this->ProxyOnlyWithYTDL, 'Y') == 0; $this->Settings->SetKey('MaxDownloadSpeed'); $this->MaxDownloadSpeed = $this->Settings->GetValue(); $this->Settings->SetKey('BTMaxUploadSpeed'); $this->BTMaxUploadSpeed = $this->Settings->GetValue(); $this->Settings->SetKey('AllowProtocolBT'); $this->AllowProtocolBT = $this->Settings->GetValue(); $this->AllowProtocolBT = is_null($this->AllowProtocolBT) ? true : strcmp($this->AllowProtocolBT, 'Y') == 0; $this->Settings->SetTable('personal'); $this->Settings->SetUID($this->CurrentUID); $this->Settings->SetKey('DownloadsFolder'); $this->DownloadsFolder = $this->Settings->GetValue(); $this->Settings->SetKey('TorrentsFolder'); $this->TorrentsFolder = $this->Settings->GetValue(); $this->Settings->SetKey('BTRatioToReach'); $this->BTRatioToReach = $this->Settings->GetValue(); $this->BTRatioToReach = is_null($this->BTRatioToReach) ? '0.0' : $this->BTRatioToReach; $this->Settings->SetKey('BTSeedTimeToReach_BTSeedTimeToReachUnit'); $this->SeedTime = $this->Settings->GetValue(); if (!is_null($this->SeedTime)) { $this->SeedTime = explode('_', $this->SeedTime); if (count($this->SeedTime) == 2) { $this->SeedTime = Tools::GetMinutes($this->SeedTime[0], $this->SeedTime[1]); } } else { $this->SeedTime = 10080; // minutes in 1 week - default } $this->DownloadsFolder = '/' . (is_null($this->DownloadsFolder) ? 'Downloads' : $this->DownloadsFolder); $this->TorrentsFolder = '/' . (is_null($this->TorrentsFolder) ? 'Downloads/Files/Torrents' : $this->TorrentsFolder); $this->AbsoluteDownloadsFolder = \OC\Files\Filesystem::getLocalFolder($this->DownloadsFolder); $this->AbsoluteTorrentsFolder = \OC\Files\Filesystem::getLocalFolder($this->TorrentsFolder); $this->L10N = $L10N; }
/** * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem * @param string $path * @return string */ public static function getLocalFolder($path) { return \OC\Files\Filesystem::getLocalFolder($path); }
private static function Load() { if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) { self::$DbType = 1; } self::$CurrentUID = \OC::$server->getUserSession()->getUser(); self::$CurrentUID = self::$CurrentUID ? self::$CurrentUID->getUID() : ''; self::$L10N = \OC::$server->getL10N('ocdownloader'); $Settings = new Settings(); $Settings->SetKey('ProxyAddress'); self::$ProxyAddress = $Settings->GetValue(); $Settings->SetKey('ProxyPort'); self::$ProxyPort = intval($Settings->GetValue()); $Settings->SetKey('ProxyUser'); self::$ProxyUser = $Settings->GetValue(); $Settings->SetKey('ProxyPasswd'); self::$ProxyPasswd = $Settings->GetValue(); $Settings->SetTable('personal'); $Settings->SetUID(self::$CurrentUID); $Settings->SetKey('DownloadsFolder'); self::$DownloadsFolder = $Settings->GetValue(); self::$DownloadsFolder = '/' . (is_null(self::$DownloadsFolder) ? 'Downloads' : self::$DownloadsFolder); self::$AbsoluteDownloadsFolder = \OC\Files\Filesystem::getLocalFolder(self::$DownloadsFolder); $Settings->SetKey('YTDLBinary'); $YTDLBinary = $Settings->GetValue(); self::$YTDLBinary = '/usr/local/bin/youtube-dl'; // default path if (!is_null($YTDLBinary)) { self::$YTDLBinary = $YTDLBinary; } }
private static function Load() { if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) { self::$DbType = 1; } self::$CurrentUID = \OC::$server->getUserSession()->getUser(); self::$CurrentUID = self::$CurrentUID ? self::$CurrentUID->getUID() : ''; self::$L10N = \OC::$server->getL10N('ocdownloader'); $Settings = new Settings(); $Settings->SetKey('ProxyAddress'); self::$ProxyAddress = $Settings->GetValue(); $Settings->SetKey('ProxyPort'); self::$ProxyPort = intval($Settings->GetValue()); $Settings->SetKey('ProxyUser'); self::$ProxyUser = $Settings->GetValue(); $Settings->SetKey('ProxyPasswd'); self::$ProxyPasswd = $Settings->GetValue(); $Settings->SetKey('WhichDownloader'); self::$WhichDownloader = $Settings->GetValue(); self::$WhichDownloader = is_null(self::$WhichDownloader) ? 0 : (strcmp(self::$WhichDownloader, 'ARIA2') == 0 ? 0 : 1); // 0 means ARIA2, 1 means CURL $Settings->SetKey('AllowProtocolHTTP'); self::$AllowProtocolHTTP = $Settings->GetValue(); self::$AllowProtocolHTTP = is_null(self::$AllowProtocolHTTP) ? true : strcmp(self::$AllowProtocolHTTP, 'Y') == 0; $Settings->SetKey('AllowProtocolFTP'); self::$AllowProtocolFTP = $Settings->GetValue(); self::$AllowProtocolFTP = is_null(self::$AllowProtocolFTP) ? true : strcmp(self::$AllowProtocolFTP, 'Y') == 0; $Settings->SetKey('AllowProtocolYT'); self::$AllowProtocolYT = $Settings->GetValue(); self::$AllowProtocolYT = is_null(self::$AllowProtocolYT) ? true : strcmp(self::$AllowProtocolYT, 'Y') == 0; $Settings->SetKey('AllowProtocolBT'); self::$AllowProtocolBT = $Settings->GetValue(); self::$AllowProtocolBT = is_null(self::$AllowProtocolBT) ? true : strcmp(self::$AllowProtocolBT, 'Y') == 0; $Settings->SetTable('personal'); $Settings->SetUID(self::$CurrentUID); $Settings->SetKey('DownloadsFolder'); self::$DownloadsFolder = $Settings->GetValue(); self::$DownloadsFolder = '/' . (is_null(self::$DownloadsFolder) ? 'Downloads' : self::$DownloadsFolder); self::$AbsoluteDownloadsFolder = \OC\Files\Filesystem::getLocalFolder(self::$DownloadsFolder); $Settings->SetKey('YTDLBinary'); $YTDLBinary = $Settings->GetValue(); self::$YTDLBinary = '/usr/local/bin/youtube-dl'; // default path if (!is_null($YTDLBinary)) { self::$YTDLBinary = $YTDLBinary; } }