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; } }