diff --git a/appinfo/application.php b/appinfo/application.php index 6cd7107..7294a6f 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -4,12 +4,12 @@ namespace OCA\NCDownloader\AppInfo; use OCA\NCDownloader\Controller\Aria2Controller; use OCA\NCDownloader\Controller\MainController; -use OCA\NCDownloader\Controller\YoutubeController; -use OCA\NCDownloader\Tools\Aria2; -use OCA\NCDownloader\Tools\Client; +use OCA\NCDownloader\Controller\YtdlController; +use OCA\NCDownloader\Aria2\Aria2; +use OCA\NCDownloader\Http\Client; use OCA\NCDownloader\Tools\Helper; -use OCA\NCDownloader\Tools\Settings; -use OCA\NCDownloader\Tools\Youtube; +use OCA\NCDownloader\Db\Settings; +use OCA\NCDownloader\Ytdl\Ytdl; use OCP\AppFramework\App; use OCP\IContainer; use Symfony\Component\DomCrawler\Crawler; @@ -32,9 +32,9 @@ class Application extends App return new Aria2(Helper::getAria2Config($this->uid)); }); - $container->registerService('Youtube', function (IContainer $container) { - $config = Helper::getYoutubeConfig($this->uid); - return new Youtube($config); + $container->registerService('Ytdl', function (IContainer $container) { + $config = Helper::getYtdlConfig($this->uid); + return new Ytdl($config); }); $container->registerService('Settings', function (IContainer $container) { @@ -49,7 +49,7 @@ class Application extends App \OC::$server->getL10N('ncdownloader'), //\OC::$server->getRootFolder(), $container->query('Aria2'), - $container->query('Youtube') + $container->query('Ytdl') ); }); @@ -63,14 +63,14 @@ class Application extends App $container->query('Aria2') ); }); - $container->registerService('YoutubeController', function (IContainer $container) { - return new YoutubeController( + $container->registerService('YtdlController', function (IContainer $container) { + return new YtdlController( $container->query('AppName'), $container->query('Request'), $container->query('UserId'), \OC::$server->getL10N('ncdownloader'), $container->query('Aria2'), - $container->query('Youtube') + $container->query('Ytdl') ); }); $container->registerService('httpClient', function () { diff --git a/appinfo/routes.php b/appinfo/routes.php index 3c47c08..a075b4c 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -9,10 +9,10 @@ return [ ['name' => 'Aria2#Action', 'url' => '/aria2/{path}', 'verb' => 'POST'], ['name' => 'Aria2#getStatus', 'url' => '/status/{path}', 'verb' => 'POST'], ['name' => 'Main#scanFolder', 'url' => '/scanfolder', 'verb' => 'POST'], - ['name' => 'Youtube#Index', 'url' => '/youtube/get', 'verb' => 'POST'], - ['name' => 'Youtube#Download', 'url' => '/youtube/new', 'verb' => 'POST'], - ['name' => 'Youtube#Delete', 'url' => '/youtube/delete', 'verb' => 'POST'], - ['name' => 'Youtube#Redownload', 'url' => '/youtube/redownload', 'verb' => 'POST'], + ['name' => 'Ytdl#Index', 'url' => '/ytdl/get', 'verb' => 'POST'], + ['name' => 'Ytdl#Download', 'url' => '/ytdl/new', 'verb' => 'POST'], + ['name' => 'Ytdl#Delete', 'url' => '/ytdl/delete', 'verb' => 'POST'], + ['name' => 'Ytdl#Redownload', 'url' => '/ytdl/redownload', 'verb' => 'POST'], ['name' => 'Search#Execute', 'url' => '/search', 'verb' => 'POST'], // AdminSettings ['name' => 'Settings#Admin', 'url' => '/admin/save', 'verb' => 'POST'], @@ -21,9 +21,9 @@ return [ ['name' => 'Settings#aria2Get', 'url' => '/personal/aria2/get', 'verb' => 'POST'], ['name' => 'Settings#aria2Save', 'url' => '/personal/aria2/save', 'verb' => 'POST'], ['name' => 'Settings#aria2Delete', 'url' => '/personal/aria2/delete', 'verb' => 'POST'], - ['name' => 'Settings#youtubeGet', 'url' => '/personal/youtube-dl/get', 'verb' => 'POST'], - ['name' => 'Settings#youtubeSave', 'url' => '/personal/youtube-dl/save', 'verb' => 'POST'], - ['name' => 'Settings#youtubeDelete', 'url' => '/personal/youtube-dl/delete', 'verb' => 'POST'], + ['name' => 'Settings#ytdlGet', 'url' => '/personal/ytdl/get', 'verb' => 'POST'], + ['name' => 'Settings#ytdlSave', 'url' => '/personal/ytdl/save', 'verb' => 'POST'], + ['name' => 'Settings#ytdlDelete', 'url' => '/personal/ytdl/delete', 'verb' => 'POST'], ['name' => 'Settings#getSettings', 'url' => '/getsettings', 'verb' => 'POST'], ], ]; diff --git a/l10n/zh_CN.js b/l10n/zh_CN.js index 1741242..723e627 100644 --- a/l10n/zh_CN.js +++ b/l10n/zh_CN.js @@ -55,9 +55,9 @@ OC.L10N.register( "Active" : "活动的", "No Torrent Files" : "无torrent文件", "Upload" : "上传", - "ocDownloader" : "ocDownloader", + "NCDownloader" : "NCDownloader", "Easy to use download manager for Nextcloud" : "易用的Nextcloud下载管理器", - "Easy to use download manager using Curl/Aria2 and youtube-dl to allow downloading HTTP(S), FTP(S), YouTube videos and BitTorrent files. For more information on how to install, please go to https://github.com/e-alfred/ncdownloader/blob/master/README.md" : "易用的下载管理器,使用Curl/Aria2和youtube-dl工具来下载HTTP(S)、FTP(S)、YouTube视频和BitTorrent文件。关于如何安装的更多信息,请访问 https://github.com/e-alfred/ncdownloader/blob/master/README.md", + "Easy to use download manager using Curl/Aria2 and ytdl to allow downloading HTTP(S), FTP(S), YouTube videos and BitTorrent files. For more information on how to install, please go to https://github.com/e-alfred/ncdownloader/blob/master/README.md" : "易用的下载管理器,使用Curl/Aria2和youtube-dl工具来下载HTTP(S)、FTP(S)、YouTube视频和BitTorrent文件。关于如何安装的更多信息,请访问 https://github.com/e-alfred/ncdownloader/blob/master/README.md", "Active Downloads" : "活动的下载任务", " using %s" : "正在使用%s", "FILENAME" : "文件名", diff --git a/l10n/zh_CN.json b/l10n/zh_CN.json index 00f59db..82db51d 100644 --- a/l10n/zh_CN.json +++ b/l10n/zh_CN.json @@ -53,9 +53,9 @@ "Active" : "活动的", "No Torrent Files" : "无torrent文件", "Upload" : "上传", - "ocDownloader" : "ocDownloader", + "NCDownloader" : "NCDownloader", "Easy to use download manager for Nextcloud" : "易用的Nextcloud下载管理器", - "Easy to use download manager using Curl/Aria2 and youtube-dl to allow downloading HTTP(S), FTP(S), YouTube videos and BitTorrent files. For more information on how to install, please go to https://github.com/e-alfred/ncdownloader/blob/master/README.md" : "易用的下载管理器,使用Curl/Aria2和youtube-dl工具来下载HTTP(S)、FTP(S)、YouTube视频和BitTorrent文件。关于如何安装的更多信息,请访问 https://github.com/e-alfred/ncdownloader/blob/master/README.md", + "Easy to use download manager using Curl/Aria2 and ytdl to allow downloading HTTP(S), FTP(S), YouTube videos and BitTorrent files. For more information on how to install, please go to https://github.com/e-alfred/ncdownloader/blob/master/README.md" : "易用的下载管理器,使用Curl/Aria2和youtube-dl工具来下载HTTP(S)、FTP(S)、YouTube视频和BitTorrent文件。关于如何安装的更多信息,请访问 https://github.com/e-alfred/ncdownloader/blob/master/README.md", "Active Downloads" : "活动的下载任务", " using %s" : "正在使用%s", "FILENAME" : "文件名", diff --git a/lib/Tools/Aria2.php b/lib/Aria2/Aria2.php similarity index 99% rename from lib/Tools/Aria2.php rename to lib/Aria2/Aria2.php index af730d7..d159ffb 100644 --- a/lib/Tools/Aria2.php +++ b/lib/Aria2/Aria2.php @@ -1,10 +1,11 @@ urlGenerator = \OC::$server->getURLGenerator(); $this->dbconn = new DbHelper(); $this->counters = new Counters($aria2, $this->dbconn, $UserId); - $this->youtube = $youtube; + $this->ytdl = $ytdl; $this->isAdmin = \OC_User::isAdminUser($this->uid); $this->hideError = Helper::getSettings("ncd_hide_errors", false); $this->disable_bt_nonadmin = Helper::getSettings("ncd_disable_bt", false, Settings::TYPE["SYSTEM"]); @@ -67,9 +67,9 @@ class MainController extends Controller $params['aria2_installed'] = $aria2_installed = $this->aria2->isInstalled(); $params['aria2_bin'] = $aria2_bin = $this->aria2->getBin(); $params['aria2_executable'] = $aria2_executable = $this->aria2->isExecutable(); - $params['youtube_installed'] = $youtube_installed = $this->youtube->isInstalled(); - $params['youtube_bin'] = $youtube_bin = $this->youtube->getBin(); - $params['youtube_executable'] = $youtube_executable = $this->youtube->isExecutable(); + $params['ytdlinstalled'] = $ytdlinstalled = $this->ytdl->isInstalled(); + $params['ytdlbin'] = $ytdlbin = $this->ytdl->getBin(); + $params['ytdlexecutable'] = $ytdlexecutable = $this->ytdl->isExecutable(); $params['ncd_hide_errors'] = $this->hideError; $params['counter'] = $this->counters->getCounters(); $params['python_installed'] = Helper::pythonInstalled(); @@ -92,8 +92,8 @@ class MainController extends Controller $this->aria2->start(); } } - 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)); + if ($ytdlinstalled && (!$ytdlexecutable || !@is_readable($ytdlbin))) { + array_push($errors, sprintf("ytdl is installed but don't have the right permissions.Please execute command sudo chmod 755 %s", $ytdlbin)); } foreach ($params as $key => $value) { diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 25b1dbe..f08935f 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -3,7 +3,7 @@ namespace OCA\NCDownloader\Controller; use OCA\NCDownloader\Tools\Helper; -use OCA\NCDownloader\Tools\Settings; +use OCA\NCDownloader\Db\Settings; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; @@ -101,33 +101,33 @@ class SettingsController extends Controller * @NoAdminRequired * @NoCSRFRequired */ - public function youtubeGet() + public function ytdlGet() { - $data = json_decode($this->settings->get("custom_youtube_dl_settings")); + $data = json_decode($this->settings->get("custom_ytdl_settings")); return new JSONResponse($data); } - public function youtubeSave() + public function ytdlSave() { $params = $this->request->getParams(); $data = array_filter($params, function ($key) { return (bool) (!in_array(substr($key, 0, 1), ['_'])); }, ARRAY_FILTER_USE_KEY); - $resp = $this->settings->save("custom_youtube_dl_settings", json_encode($data)); + $resp = $this->settings->save("custom_ytdl_settings", json_encode($data)); return new JSONResponse($resp); } /** * @NoAdminRequired * @NoCSRFRequired */ - public function youtubeDelete() + public function ytdlDelete() { - $saved = json_decode($this->settings->get("custom_youtube_dl_settings"), 1); + $saved = json_decode($this->settings->get("custom_ytdl_settings"), 1); $params = $this->request->getParams(); foreach ($params as $key => $value) { unset($saved[$key]); } - $resp = $this->settings->save("custom_youtube_dl_settings", json_encode($saved)); + $resp = $this->settings->save("custom_ytdl_settings", json_encode($saved)); return new JSONResponse($resp); } public function save($key, $value) diff --git a/lib/Controller/YoutubeController.php b/lib/Controller/YtdlController.php similarity index 87% rename from lib/Controller/YoutubeController.php rename to lib/Controller/YtdlController.php index 4165000..53936f0 100644 --- a/lib/Controller/YoutubeController.php +++ b/lib/Controller/YtdlController.php @@ -1,23 +1,23 @@ appName = $appName; @@ -26,7 +26,7 @@ class YoutubeController extends Controller $this->l10n = $IL10N; $this->downloadDir = Helper::getDownloadDir(); $this->dbconn = new DbHelper(); - $this->youtube = $youtube; + $this->ytdl = $ytdl; $this->aria2 = $aria2; $this->aria2->init(); $this->tablename = $this->dbconn->queryBuilder->getTableName("ncdownloader_info"); @@ -37,7 +37,7 @@ class YoutubeController extends Controller */ public function Index() { - $data = $this->dbconn->getYoutubeByUid($this->uid); + $data = $this->dbconn->getYtdlByUid($this->uid); if (is_array($data) && count($data) < 1) { return []; } @@ -54,9 +54,9 @@ class YoutubeController extends Controller $tmp['speed'] = explode("|", $value['speed']); $tmp['progress'] = $value['progress']; - $path = $this->urlGenerator->linkToRoute('ncdownloader.Youtube.Delete'); + $path = $this->urlGenerator->linkToRoute('ncdownloader.Ytdl.Delete'); $tmp['actions'][] = ['name' => 'delete', 'path' => $path]; - $path = $this->urlGenerator->linkToRoute('ncdownloader.Youtube.Redownload'); + $path = $this->urlGenerator->linkToRoute('ncdownloader.Ytdl.Redownload'); $tmp['actions'][] = ['name' => 'refresh', 'path' => $path]; $tmp['data_gid'] = $value['gid'] ?? 0; @@ -64,7 +64,7 @@ class YoutubeController extends Controller } $resp['title'] = ['filename', 'speed', 'progress', 'actions']; - $resp['counter'] = ['youtube-dl' => count($data)]; + $resp['counter'] = ['ytdl' => count($data)]; folderScan::sync(); return new JSONResponse($resp); } @@ -74,12 +74,12 @@ class YoutubeController extends Controller */ public function Download() { - $dlDir = $this->youtube->getDownloadDir(); + $dlDir = $this->ytdl->getDownloadDir(); if (!is_writable($dlDir)) { return new JSONResponse(['error' => sprintf("%s is not writable", $dlDir)]); } $url = trim($this->request->getParam('text-input-value')); - $yt = $this->youtube; + $yt = $this->ytdl; if (in_array($this->request->getParam('extension'), $this->audio_extensions)) { $yt->audioOnly = true; $yt->audioFormat = $this->request->getParam('extension'); @@ -87,7 +87,7 @@ class YoutubeController extends Controller $yt->videoFormat = $this->request->getParam('extension'); } if (!$yt->isInstalled()) { - return new JSONResponse(["error" => "Please install the latest youtube-dl or make the bundled binary file executable in ncdownloader/bin"]); + return new JSONResponse(["error" => "Please install the latest yt-dlp or make the bundled binary file executable in ncdownloader/bin"]); } if (Helper::isGetUrlSite($url)) { return new JSONResponse($this->downloadUrlSite($url)); @@ -99,7 +99,7 @@ class YoutubeController extends Controller } private function downloadUrlSite($url) { - $yt = $this->youtube; + $yt = $this->ytdl; if ($data = $yt->forceIPV4()->getDownloadUrl($url)) { return $this->_download($data['url'], $data['filename']); } else { @@ -157,16 +157,16 @@ class YoutubeController extends Controller if (!empty($data['link'])) { if (isset($data['ext'])) { if (in_array($data['ext'], $this->audio_extensions)) { - $this->youtube->audioOnly = true; - $this->youtube->audioFormat = $data['ext']; + $this->ytdl->audioOnly = true; + $this->ytdl->audioFormat = $data['ext']; } else { - $this->youtube->audioOnly = false; - $this->youtube->videoFormat = $data['ext']; + $this->ytdl->audioOnly = false; + $this->ytdl->videoFormat = $data['ext']; } } //$this->dbconn->deleteByGid($gid); - $this->youtube->dbDlPath = Helper::getDownloadDir(); - $resp = $this->youtube->forceIPV4()->download($data['link']); + $this->ytdl->dbDlPath = Helper::getDownloadDir(); + $resp = $this->ytdl->forceIPV4()->download($data['link']); folderScan::sync(); return new JSONResponse($resp); } diff --git a/lib/Tools/DbHelper.php b/lib/Db/Helper.php similarity index 93% rename from lib/Tools/DbHelper.php rename to lib/Db/Helper.php index 143f452..b7aecc2 100644 --- a/lib/Tools/DbHelper.php +++ b/lib/Db/Helper.php @@ -1,7 +1,8 @@ queryBuilder = $this->conn->getQueryBuilder(); $this->prefixedTable = $this->queryBuilder->getTableName($this->table); //$container = \OC::$server->query(\OCP\IServerContainer::class); - //Helper::debug(get_class($container->query(\OCP\RichObjectStrings\IValidator::class))); + //ToolsHelper::debug(get_class($container->query(\OCP\RichObjectStrings\IValidator::class))); //$this->conn = \OC::$server->query(Connection::class);//working only with 22 //$this->connAdapter = \OC::$server->getDatabaseConnection(); //$this->conn = $this->connAdapter->getInner(); @@ -58,7 +59,7 @@ class DbHelper return $queryBuilder->fetchColumn(); } - public function getYoutubeByUid($uid) + public function getYtdlByUid($uid) { $qb = $this->queryBuilder ->select('*') @@ -66,7 +67,7 @@ class DbHelper ->where('uid = :uid') ->andWhere('type = :type') ->setParameter('uid', $uid) - ->setParameter('type', Helper::DOWNLOADTYPE['YOUTUBE-DL']) + ->setParameter('type', ToolsHelper::DOWNLOADTYPE['YOUTUBE-DL']) ->orderBy('id', 'DESC') ->execute(); return $qb->fetchAll(); diff --git a/lib/Tools/Settings.php b/lib/Db/Settings.php similarity index 96% rename from lib/Tools/Settings.php rename to lib/Db/Settings.php index 18e9578..34963e2 100644 --- a/lib/Tools/Settings.php +++ b/lib/Db/Settings.php @@ -1,6 +1,6 @@ get("custom_youtube_dl_settings"); + $settings = $this->get("custom_ytdl_settings"); return json_decode($settings, 1); } public function getAll() diff --git a/lib/Tools/Client.php b/lib/Http/Client.php similarity index 97% rename from lib/Tools/Client.php rename to lib/Http/Client.php index 1cbfcdd..9f82de4 100644 --- a/lib/Tools/Client.php +++ b/lib/Http/Client.php @@ -1,6 +1,6 @@ $this->getCounter('tellWaiting'), 'complete' => $this->getCounter('tellStopped'), 'fail' => $this->getCounter('tellFail'), - 'youtube-dl' => $this->getCounter('youtube-dl'), + 'ytdl' => $this->getCounter('ytdl'), ]; } private function getCounter($action = 'tellActive') { - if ($action === 'youtube-dl') { - $data = $this->dbconn->getYoutubeByUid($this->uid); + if ($action === 'ytdl') { + $data = $this->dbconn->getYtdlByUid($this->uid); } else if ($action === 'tellActive') { $data = $this->aria2->{$action}([]); } else { @@ -38,7 +38,7 @@ class Counters if (!is_array($data) && count($data) < 1) { return 0; } - if ($action !== 'youtube-dl') { + if ($action !== 'ytdl') { $data = $this->filterData($data); } return count($data); diff --git a/lib/Tools/Helper.php b/lib/Tools/Helper.php index 3303277..39443fd 100644 --- a/lib/Tools/Helper.php +++ b/lib/Tools/Helper.php @@ -4,8 +4,8 @@ namespace OCA\NCDownloader\Tools; use Exception; use OCA\NCDownloader\Search\Sites\searchInterface; -use OCA\NCDownloader\Tools\aria2Options; -use OCA\NCDownloader\Tools\Settings; +use OCA\NCDownloader\Aria2\Options as aria2Options; +use OCA\NCDownloader\Db\Settings; use OCP\IUser; use OC\Files\Filesystem; use OC_Util; @@ -108,7 +108,7 @@ class Helper public static function isYoutubeType($url) { - $regex = '%^(?:(?:https?)://)(?:[a-z0-9_]*\.)?(?:twitter|youtube)\.com/%i'; + $regex = '%^(?:(?:https?)://)(?:[a-z0-9_]*\.)?(?:twitter|ytdl)\.com/%i'; return (bool) preg_match($regex, $url); } @@ -435,12 +435,12 @@ class Helper return Settings::create($uid); } - public static function getYoutubeConfig($uid = null): array + public static function getYtdlConfig($uid = null): array { $config = [ 'binary' => self::getSettings("ncd_yt_binary", null, Settings::TYPE['SYSTEM']), 'downloadDir' => Helper::getRealDownloadDir(), - 'settings' => self::newSettings()->getYoutube(), + 'settings' => self::newSettings()->getYtdl(), ]; return $config; } diff --git a/lib/Tools/YoutubeHelper.php b/lib/Ytdl/Helper.php similarity index 90% rename from lib/Tools/YoutubeHelper.php rename to lib/Ytdl/Helper.php index 8be0554..cfa0794 100644 --- a/lib/Tools/YoutubeHelper.php +++ b/lib/Ytdl/Helper.php @@ -1,10 +1,10 @@ getSiteInfo($buffer); if (isset($info["id"])) { - $this->gid = Helper::generateGID($info["id"]); + $this->gid = ToolsHelper::generateGID($info["id"]); } if (!$this->gid) { - $this->gid = Helper::generateGID($extra["link"]); + $this->gid = ToolsHelper::generateGID($extra["link"]); } $downloadInfo = $this->getDownloadInfo($buffer); if ($downloadInfo) { @@ -116,9 +116,9 @@ class YoutubeHelper $data = [ 'uid' => $this->user, 'gid' => $this->gid, - 'type' => Helper::DOWNLOADTYPE['YOUTUBE-DL'], + 'type' => ToolsHelper::DOWNLOADTYPE['YOUTUBE-DL'], 'filename' => basename($file), - 'status' => Helper::STATUS['ACTIVE'], + 'status' => ToolsHelper::STATUS['ACTIVE'], 'timestamp' => time(), 'data' => $extra, ]; diff --git a/lib/Tools/youtubedlOptions.php b/lib/Ytdl/Options.php similarity index 98% rename from lib/Tools/youtubedlOptions.php rename to lib/Ytdl/Options.php index 940f72b..bf75d77 100644 --- a/lib/Tools/youtubedlOptions.php +++ b/lib/Ytdl/Options.php @@ -1,7 +1,7 @@ 'Size of a chunk for chunk-based HTTP downloading (e.g. 10485760 or 10M) (default is disabled). May be useful for', 'playlist-reverse' => 'playlist videos in reverse order', 'playlist-random' => 'playlist videos in random order', - 'xattr-set-filesize' => 'file xattribute ytdl.filesize with expected file size', + 'xattr-set-filesize' => 'file xattribute youtube-dl.filesize with expected file size', 'hls-prefer-native' => 'the native HLS downloader instead of ffmpeg', 'hls-prefer-ffmpeg' => 'ffmpeg instead of the native HLS downloader', 'hls-use-mpegts' => 'the mpegts container for HLS videos; allowing some players to play the video while downloading, and reducing the', @@ -130,7 +130,7 @@ class youtubedlOptions 'all-formats' => 'all available video formats', 'prefer-free-formats' => 'video formats with free containers over non-free ones of same quality. Use with "-S ext" to strictly prefer', 'list-formats' => 'available formats of each video. Simulate unless --no-simulate is used', - 'youtube-skip-dash-manifest' => 'not download the DASH manifests and related data on YouTube videos', + 'youtube-dl-skip-dash-manifest' => 'not download the DASH manifests and related data on YouTube videos', 'merge-output-format' => 'If a merge is required (e.g. bestvideo+bestaudio), output to given container format. One of mkv, mp4, ogg, webm,', 'write-sub' => 'subtitle file', 'write-auto-sub' => 'automatically generated subtitle file (YouTube only)', @@ -173,7 +173,7 @@ class youtubedlOptions 'no-live-from-start' => 'livestreams from the current time (default)', 'no-wait-for-video' => 'not wait for scheduled streams (default)', 'no-colors' => 'not emit color codes in output', - 'compat-options' => 'Options that can help keep compatibility with youtube-dl or youtube-dlc configurations by reverting some of the', + 'compat-options' => 'Options that can help keep compatibility with youtube-dl or youtube-dl-dlc configurations by reverting some of the', 'no-match-filter' => 'not use generic video filter (default)', 'no-download-archive' => 'not use archive file (default)', 'break-on-existing' => 'the download process when encountering a file that is in the archive', diff --git a/lib/Tools/Youtube.php b/lib/Ytdl/Ytdl.php similarity index 97% rename from lib/Tools/Youtube.php rename to lib/Ytdl/Ytdl.php index c9ed466..4ae0a9d 100644 --- a/lib/Tools/Youtube.php +++ b/lib/Ytdl/Ytdl.php @@ -1,12 +1,12 @@ isExecutable($binary)) { $this->bin = $binary; } else { - $this->bin = __DIR__ . "/../../bin/yt-dlp"; //Helper::findBinaryPath('youtube-dl', __DIR__ . "/../../bin/yt-dlp"); + $this->bin = __DIR__ . "/../../bin/yt-dlp"; //Helper::findBinaryPath('ytdl', __DIR__ . "/../../bin/yt-dlp"); } if ($this->isInstalled() && !$this->isExecutable()) { chmod($this->bin, 0744); @@ -138,7 +138,7 @@ class Youtube $this->setOption('--format', $this->format); } } - $this->helper = YoutubeHelper::create(); + $this->helper = YtdHelper::create(); $this->downloadDir = $this->downloadDir ?? $this->defaultDir; $this->setOption("--output", $this->downloadDir . "/" . $this->outTpl); $this->setUrl($url); diff --git a/src/App.vue b/src/App.vue index aa142d4..1fa2d7f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -43,7 +43,7 @@ export default { return { display: { download: true, search: false }, uris: { - ytd_url: helper.generateUrl("/apps/ncdownloader/youtube/new"), + ytd_url: helper.generateUrl("/apps/ncdownloader/ytdl/new"), aria2_url: helper.generateUrl("/apps/ncdownloader/new"), search_url: helper.generateUrl("/apps/ncdownloader/search"), upload_url: helper.generateUrl("/apps/ncdownloader/upload"), @@ -62,15 +62,15 @@ export default { helper.error(t("ncdownloader", inputValue + " is Invalid")); return; } - if (formData.type === "youtube-dl") { + if (formData.type === "ytdl") { formData["extension"] = ""; if (formData["select-value-extension"] !== "defaultext") { formData["extension"] = formData["select-value-extension"]; } message = helper.t("Download task started!"); - helper.pollingYoutube(); - helper.setContentTableType("youtube-dl-downloads"); + helper.pollingYtdl(); + helper.setContentTableType("ytdl-downloads"); } else { helper.polling(); helper.setContentTableType("active-downloads"); diff --git a/src/actions/updatePage.js b/src/actions/updatePage.js index 3b584ec..ff25622 100644 --- a/src/actions/updatePage.js +++ b/src/actions/updatePage.js @@ -17,11 +17,11 @@ export default { } helper.setContentTableType(name); let delay; - if (!['active-downloads', 'youtube-dl-downloads'].includes(name)) { + if (!['active-downloads', 'ytdl-downloads'].includes(name)) { delay = 15000; } - if (name === "youtube-dl-downloads") { - helper.pollingYoutube(); + if (name === "ytdl-downloads") { + helper.pollingYtdl(); } else { helper.polling(delay, path); } diff --git a/src/components/mainForm.vue b/src/components/mainForm.vue index ddbe9dc..a383286 100644 --- a/src/components/mainForm.vue +++ b/src/components/mainForm.vue @@ -8,8 +8,8 @@ HTTP/MAGNET @@ -100,13 +100,13 @@ export default { this.downloadType = type; if (type === "aria2") { this.path = this.uris.aria2_url; - } else if (type === "youtube-dl") { + } else if (type === "ytdl") { this.placeholder = t("ncdownloader", "Paste your video link here"); this.path = this.uris.ytd_url; } else { this.path = this.uris.search_url; } - this.checkboxes = type === "youtube-dl" ? true : false; + this.checkboxes = type === "ytdl" ? true : false; this.inputType = type === "search" ? "search" : "download"; }, download(event) { @@ -219,7 +219,7 @@ export default { border-radius: 15px 0px 0px 15px; } - .youtube-dl-link { + .ytdl-link { background-color: #b8b8ca; } .search-torrents { @@ -227,7 +227,7 @@ export default { } .search-torrents, - .youtube-dl-link, + .ytdl-link, .magnet-link, .choose-file { color: #181616; diff --git a/src/css/table.scss b/src/css/table.scss index 56ff72c..8eff83a 100644 --- a/src/css/table.scss +++ b/src/css/table.scss @@ -88,7 +88,7 @@ flex: 1 1 0; } } - #ncdownloader-table-wrapper.youtube-dl-downloads { + #ncdownloader-table-wrapper.ytdl-downloads { #table-cell-speed, .table-heading-speed { diff --git a/src/settings.js b/src/settings.js index ef094f0..e8d8364 100644 --- a/src/settings.js +++ b/src/settings.js @@ -7,7 +7,7 @@ import settingsForm from './lib/settingsForm' import autoComplete from './lib/autoComplete'; import eventHandler from './lib/eventHandler'; import aria2Options from './utils/aria2Options'; -import { options as ytdFullOptions, names as ytdOptions } from './utils/youtubedlOptions'; +import { options as ytdlFullOptions, names as ytdlOptions } from './utils/ytdlOptions'; import helper from './utils/helper'; import './css/autoComplete.css' import './css/settings.scss' @@ -26,9 +26,9 @@ window.addEventListener('DOMContentLoaded', function () { OC_msg.startSaving('#ncdownloader-message-banner'); helper.makePair(data, name); let badOptions = []; - if (name === 'youtube-dl-settings') { + if (name === 'ytdl-settings') { for (let key in data) { - if (!ytdOptions.includes(key) && !customOptions.includes(key)) { + if (!ytdlOptions.includes(key) && !customOptions.includes(key)) { delete data[key]; badOptions.push(key) } @@ -105,10 +105,10 @@ window.addEventListener('DOMContentLoaded', function () { eventHandler.add('click', '.ncdownloader-admin-settings', 'input[type="button"]', (e) => saveHandler(e)); eventHandler.add('click', '.ncdownloader-personal-settings', 'input[type="button"]', (e) => saveHandler(e)); eventHandler.add("click", "#custom-aria2-settings-container", "button.save-custom-aria2-settings", (e) => saveHandler(e)) - eventHandler.add("click", "#custom-youtube-dl-settings-container", "button.save-custom-youtube-dl-settings", (e) => saveHandler(e, 'youtube-dl-settings')) + eventHandler.add("click", "#custom-ytdl-settings-container", "button.save-custom-ytdl-settings", (e) => saveHandler(e, 'ytdl-settings')) eventHandler.add('click', '#custom-aria2-settings-container', "button.add-custom-aria2-settings", (e) => addOption(e, 'aria2', aria2Options)) - eventHandler.add('click', '#custom-youtube-dl-settings-container', "button.add-custom-youtube-dl-settings", (e) => addOption(e, 'youtube-dl', ytdFullOptions)) + eventHandler.add('click', '#custom-ytdl-settings-container', "button.add-custom-ytdl-settings", (e) => addOption(e, 'ytdl', ytdlFullOptions)) eventHandler.add('click', '.ncdownloader-personal-settings', 'button.icon-close', function (e) { @@ -128,7 +128,7 @@ window.addEventListener('DOMContentLoaded', function () { settingsForm.getInstance().render(input); }).send(); - helper.httpClient(generateUrl("/apps/ncdownloader/personal/youtube-dl/get")).setHandler(function (data) { + helper.httpClient(generateUrl("/apps/ncdownloader/personal/ytdl/get")).setHandler(function (data) { if (!data) { return; } @@ -136,7 +136,7 @@ window.addEventListener('DOMContentLoaded', function () { for (let key in data) { input.push({ name: key, value: data[key], id: key }); } - settingsForm.getInstance().setParent("custom-youtube-dl-settings-container").render(input); + settingsForm.getInstance().setParent("custom-ytdl-settings-container").render(input); }).send(); const filepicker = function (event) { diff --git a/src/utils/helper.js b/src/utils/helper.js index c0b191f..c864155 100644 --- a/src/utils/helper.js +++ b/src/utils/helper.js @@ -42,8 +42,8 @@ const helper = { pollingFolder(delay = 1500) { Polling.create().setDelay(delay).run(helper.scanFolder); }, - pollingYoutube(delay = 1500) { - Polling.create().setDelay(delay).run(helper.refresh, "/apps/ncdownloader/youtube/get"); + pollingYtdl(delay = 1500) { + Polling.create().setDelay(delay).run(helper.refresh, "/apps/ncdownloader/ytdl/get"); }, refresh(path) { path = path || "/apps/ncdownloader/status/active"; diff --git a/src/utils/youtubedlOptions.js b/src/utils/youtubedlOptions.js deleted file mode 100644 index 1e34c16..0000000 --- a/src/utils/youtubedlOptions.js +++ /dev/null @@ -1,3 +0,0 @@ -const options = { "ignore-errors": "download and postprocessing errors. The download will be considered successful even if the postprocessing", "abort-on-error": "downloading of further videos if an error occurs (Alias: --no-ignore-errors)", "dump-user-agent": "the current user-agent and exit", "list-extractors": "all supported extractors and exit", "extractor-descriptions": "descriptions of all supported extractors and exit", "force-generic-extractor": "extraction to use the generic extractor", "default-search": "Use this prefix for unqualified URLs. For example \"gvsearch2:\" downloads two videos from google videos for the", "ignore-config": "Don't load any more configuration files except those given by --config-locations. For backward compatibility, if", "config-location": "Location of the configuration file; either the path to the config or its containing directory.", "flat-playlist": "not extract the videos of a playlist, only list them", "mark-watched": "videos watched (even with --simulate). Currently only supported for YouTube", "no-mark-watched": "not mark videos watched (default)", "no-color": "not emit color codes in output", "proxy": "Use the specified HTTP\/HTTPS\/SOCKS proxy. To enable SOCKS proxy, specify a proper scheme. For example", "socket-timeout": "Time to wait before giving up, in seconds", "source-address": "Client-side IP address to bind to", "force-ipv4": "all connections via IPv4", "force-ipv6": "all connections via IPv6", "geo-verification-proxy": "Use this proxy to verify the IP address for some geo-restricted sites. The default proxy specified by --proxy (or", "geo-bypass": "geographic restriction via faking X-Forwarded-For HTTP header (default)", "no-geo-bypass": "not bypass geographic restriction via faking X-Forwarded-For HTTP header", "geo-bypass-country": "Force bypass geographic restriction with explicitly provided two-letter ISO 3166-2 country code", "playlist-start": "Playlist video to start at (default is 1)", "playlist-end": "Playlist video to end at (default is last)", "match-title": "Download only matching titles (regex or caseless sub-string)", "reject-title": "Skip download for matching titles (regex or caseless sub-string)", "max-downloads": "Abort after downloading NUMBER files", "min-filesize": "Do not download any videos smaller than SIZE (e.g. 50k or 44.6m)", "max-filesize": "Do not download any videos larger than SIZE (e.g. 50k or 44.6m)", "date": "Download only videos uploaded on this date. The date can be \"YYYYMMDD\" or in the format", "datebefore": "Download only videos uploaded on or before this date. The date formats accepted is the same as --date", "dateafter": "Download only videos uploaded on or after this date. The date formats accepted is the same as --date", "min-views": "Do not download any videos with less than COUNT views", "max-views": "Do not download any videos with more than COUNT views", "match-filter": "Generic video filter. Any field (see \"OUTPUT TEMPLATE\") can be compared with a number or a string using the", "no-playlist": "only the video, if the URL refers to a video and a playlist", "yes-playlist": "the playlist, if the URL refers to a video and a playlist", "age-limit": "Download only videos suitable for the given age", "download-archive": "Download only videos not listed in the archive file. Record the IDs of all downloaded videos in it", "include-ads": "advertisements as well (experimental)", "limit-rate": "Maximum download rate in bytes per second (e.g. 50K or 4.2M)", "retries": "Number of retries (default is 10), or \"infinite\"", "fragment-retries": "Number of retries for a fragment (default is 10), or \"infinite\" (DASH, hlsnative and ISM)", "skip-unavailable-fragments": "unavailable fragments for DASH, hlsnative and ISM (default) (Alias: --no-abort-on-unavailable-fragment)", "abort-on-unavailable-fragment": "downloading if a fragment is unavailable (Alias: --no-skip-unavailable-fragments)", "keep-fragments": "downloaded fragments on disk after downloading is finished", "buffer-size": "Size of download buffer (e.g. 1024 or 16K) (default is 1024)", "no-resize-buffer": "not automatically adjust the buffer size", "http-chunk-size": "Size of a chunk for chunk-based HTTP downloading (e.g. 10485760 or 10M) (default is disabled). May be useful for", "playlist-reverse": "playlist videos in reverse order", "playlist-random": "playlist videos in random order", "xattr-set-filesize": "file xattribute ytdl.filesize with expected file size", "hls-prefer-native": "the native HLS downloader instead of ffmpeg", "hls-prefer-ffmpeg": "ffmpeg instead of the native HLS downloader", "hls-use-mpegts": "the mpegts container for HLS videos; allowing some players to play the video while downloading, and reducing the", "external-downloader": "Use the specified external downloader. Currently supports aria2c,avconv,axel,curl,ffmpeg,httpie,wget", "external-downloader-args": "Give these arguments to the external downloader", "batch-file": "File containing URLs to download (\"-\" for stdin), one URL per line. Lines starting with \"#\", \";\" or \"]\" are", "id": "only video ID in file name", "output": "an absolute path", "output-na-placeholder": "Placeholder value for unavailable meta fields in output filename template (default: \"NA\")", "autonumber-start": "Specify the start value for %(autonumber)s (default is 1)", "restrict-filenames": "filenames to only ASCII characters, and avoid \"&\" and spaces in filenames", "no-overwrites": "not overwrite any files", "continue": "partially downloaded files\/fragments (default)", "no-continue": "not resume partially downloaded fragments. If the file is not fragmented, restart download of the entire file", "no-part": "not use .part files - write directly into output file", "no-mtime": "not use the Last-modified header to set the file modification time", "write-description": "video description to a .description file", "write-info-json": "video metadata to a .info.json file (this may contain personal information)", "write-annotations": "video annotations to a .annotations.xml file", "load-info-json": "JSON file containing the video information (created with the \"--write-info-json\" option)", "cookies": "Netscape formatted file to read cookies from and dump cookie jar in", "cache-dir": "Location in the filesystem where youtube-dl can store some downloaded information (such as client ids and", "no-cache-dir": "filesystem caching", "rm-cache-dir": "all filesystem cache files", "write-thumbnail": "thumbnail image to disk", "write-all-thumbnails": "all thumbnail image formats to disk", "list-thumbnails": "available thumbnails of each video. Simulate unless --no-simulate is used", "quiet": "", "no-warnings": "warnings", "simulate": "not download the video and do not write anything to disk", "skip-download": "not download the video but write all related files (Alias: --no-download)", "get-url": "Simulate, quiet but print URL", "get-title": "Simulate, quiet but print title", "get-id": "Simulate, quiet but print id", "get-thumbnail": "Simulate, quiet but print thumbnail URL", "get-description": "Simulate, quiet but print video description", "get-duration": "Simulate, quiet but print video length", "get-filename": "Simulate, quiet but print output filename", "get-format": "Simulate, quiet but print output format", "dump-json": "Quiet, but print JSON information for each video. Simulate unless --no-simulate is used. See \"OUTPUT TEMPLATE\" for a", "dump-single-json": "Quiet, but print JSON information for each url or infojson passed. Simulate unless --no-simulate is used. If the URL", "print-json": "quiet and print the video information as JSON (video is still being downloaded).", "newline": "progress bar as new lines", "no-progress": "not print progress bar", "console-title": "progress in console titlebar", "verbose": "various debugging information", "dump-pages": "downloaded pages encoded using base64 to debug problems (very verbose)", "write-pages": "downloaded intermediary pages to files in the current directory to debug problems", "print-traffic": "sent and read HTTP traffic", "call-home": "the youtube-dl server for debugging", "no-call-home": "NOT contact the youtube-dl server for debugging", "encoding": "Force the specified encoding (experimental)", "no-check-certificate": "HTTPS certificate validation", "prefer-insecure": "an unencrypted connection to retrieve information about the video (Currently supported only for YouTube)", "user-agent": "Specify a custom user agent", "referer": "Specify a custom referer, use if the video access is restricted to one domain", "add-header": "Specify a custom HTTP header and its value, separated by a colon ':'. You can use this option multiple times", "bidi-workaround": "around terminals that lack bidirectional text support. Requires bidiv or fribidi executable in PATH", "sleep-interval": "Number of seconds to sleep before each download. This is the minimum time to sleep when used along with --max-sleep-", "max-sleep-interval": "Maximum number of seconds to sleep. Can only be used along with --min-sleep-interval", "format": "Video format code, see \"FORMAT SELECTION\" for more details", "all-formats": "all available video formats", "prefer-free-formats": "video formats with free containers over non-free ones of same quality. Use with \"-S ext\" to strictly prefer", "list-formats": "available formats of each video. Simulate unless --no-simulate is used", "youtube-skip-dash-manifest": "not download the DASH manifests and related data on YouTube videos", "merge-output-format": "If a merge is required (e.g. bestvideo+bestaudio), output to given container format. One of mkv, mp4, ogg, webm,", "write-sub": "subtitle file", "write-auto-sub": "automatically generated subtitle file (YouTube only)", "all-subs": "all the available subtitles of the video", "list-subs": "a list of available language tags", "sub-format": "Subtitle format, accepts formats preference, for example: \"srt\" or \"ass\/srt\/best\"", "sub-lang": "Languages of the subtitles to download (optional) separated by commas, use --list-subs for available language tags", "username": "Login with this account ID", "password": "Account password. If this option is left out, yt-dlp will ask interactively", "twofactor": "Two-factor authentication code", "netrc": ".netrc authentication data", "video-password": "Video password (vimeo, youku)", "ap-mso": "Adobe Pass multiple-system operator (TV provider) identifier, use --ap-list-mso for a list of available MSOs", "ap-username": "Multiple-system operator account login", "ap-password": "Multiple-system operator account password. If this option is left out, yt-dlp will ask interactively", "ap-list-mso": "all supported multiple-system operators", "extract-audio": "video files to audio-only files (requires ffmpeg and ffprobe)", "audio-format": "Specify audio format to convert the audio to when -x is used. Currently supported formats are: best (default) or one", "audio-quality": "Specify ffmpeg audio quality, insert a value between 0 (best) and 10 (worst) for VBR or a specific bitrate like 128K", "recode-video": "Re-encode the video into another format if re-encoding is necessary. The syntax and supported formats are the same", "postprocessor-args": "Give these arguments to the postprocessor", "keep-video": "the intermediate video file on disk after post-processing", "no-post-overwrites": "not overwrite post-processed files", "embed-subs": "subtitles in the video (only for mp4, webm and mkv videos)", "embed-thumbnail": "thumbnail in the video as cover art", "add-metadata": "metadata to the video file", "metadata-from-title": "Parse additional metadata like song title \/ artist from the video title. The format syntax is the same as --output.", "xattrs": "metadata to the video file's xattrs (using dublin core and xdg standards)", "fixup": "Automatically correct known faults of the file. One of never (do nothing), warn (only emit a warning),", "prefer-avconv": "avconv over ffmpeg for running the postprocessors", "prefer-ffmpeg": "ffmpeg over avconv for running the postprocessors (default)", "ffmpeg-location": "Location of the ffmpeg binary; either the path to the binary or its containing directory", "exec": "Execute a command on the file after downloading and post-processing, similar to find's -exec syntax. Example:", "convert-subs": "Convert the subtitles to another format (currently supported: srt|vtt|ass|lrc) (Alias: --convert-subtitles)", "no-abort-on-error": "with next video on download errors; e.g. to skip unavailable videos in a playlist (default)", "no-config-locations": "not load any custom configuration files (default). When given inside a configuration file, ignore all previous", "config-locations": "Location of the main configuration file; either the path to the config or its containing directory. Can be used", "no-flat-playlist": "the videos of a playlist", "live-from-start": "livestreams from the start. Currently only supported for YouTube (Experimental)", "no-live-from-start": "livestreams from the current time (default)", "no-wait-for-video": "not wait for scheduled streams (default)", "no-colors": "not emit color codes in output", "compat-options": "Options that can help keep compatibility with youtube-dl or youtube-dlc configurations by reverting some of the", "no-match-filter": "not use generic video filter (default)", "no-download-archive": "not use archive file (default)", "break-on-existing": "the download process when encountering a file that is in the archive", "break-on-reject": "the download process when encountering a file that has been filtered out", "break-per-input": "--break-on-existing and --break-on-reject act only on the current input URL", "no-break-per-input": "--break-on-existing and --break-on-reject terminates the entire download queue", "skip-playlist-after-errors": "Number of allowed failures until the rest of the playlist is skipped", "concurrent-fragments": "Number of fragments of a dash\/hlsnative video that should be downloaded concurrently (default is 1)", "throttled-rate": "Minimum download rate in bytes per second below which throttling is assumed and the video data is re-extracted (e.g.", "file-access-retries": "Number of times to retry on file access error (default is 3), or \"infinite\"", "no-keep-fragments": "downloaded fragments after downloading is finished (default)", "resize-buffer": "buffer size is automatically resized from an initial value of --buffer-size (default)", "no-playlist-reverse": "playlist videos in default order (default)", "no-hls-use-mpegts": "not use the mpegts container for HLS videos. This is default when not downloading live streams", "no-batch-file": "not read URLs from batch file (default)", "no-restrict-filenames": "Unicode characters, \"&\" and spaces in filenames (default)", "windows-filenames": "filenames to be Windows-compatible", "no-windows-filenames": "filenames Windows-compatible only if using Windows (default)", "trim-filenames": "Limit the filename length (excluding extension) to the specified number of characters", "force-overwrites": "all video and metadata files. This option includes --no-continue", "no-force-overwrites": "not overwrite the video, but overwrite related files (default)", "part": ".part files instead of writing directly into output file (default)", "mtime": "the Last-modified header to set the file modification time (default)", "no-write-description": "not write video description (default)", "no-write-info-json": "not write video metadata (default)", "write-playlist-metafiles": "playlist metadata in addition to the video metadata when using --write-info-json, --write-description etc.", "no-write-playlist-metafiles": "not write playlist metadata when using --write-info-json, --write-description etc.", "clean-info-json": "some private fields such as filenames from the infojson. Note that it could still contain some personal", "no-clean-info-json": "all fields to the infojson", "write-comments": "video comments to be placed in the infojson. The comments are fetched even without this option if the", "no-write-comments": "not retrieve video comments unless the extraction is known to be quick (Alias: --no-get-comments)", "no-cookies": "not read\/dump cookies from\/to file (default)", "no-cookies-from-browser": "not load cookies from browser (default)", "no-write-thumbnail": "not write thumbnail image to disk (default)", "write-link": "an internet shortcut file, depending on the current platform (.url, .webloc or .desktop). The URL may be", "write-url-link": "a .url Windows internet shortcut. The OS caches the URL based on the file path", "write-webloc-link": "a .webloc macOS internet shortcut", "write-desktop-link": "a .desktop Linux internet shortcut", "no-simulate": "used). This option can be used multiple times", "ignore-no-formats-error": "\"No video formats\" error. Useful for extracting metadata even if the videos are not actually available for", "no-ignore-no-formats-error": "error when no downloadable video formats are found (default)", "force-write-archive": "download archive entries to be written as far as no errors occur, even if -s or another simulation option is", "progress": "progress bar, even if in quiet mode", "legacy-server-connect": "allow HTTPS connection to servers that do not support RFC 5746 secure renegotiation", "no-check-certificates": "HTTPS certificate validation", "sleep-requests": "Number of seconds to sleep between requests during data extraction", "sleep-subtitles": "Number of seconds to sleep before each subtitle download", "format-sort": "Sort the formats by the fields given, see \"Sorting Formats\" for more details", "format-sort-force": "user specified sort order to have precedence over all fields, see \"Sorting Formats\" for more details", "no-format-sort-force": "fields have precedence over the user specified sort order (default), see \"Sorting Formats\" for more details", "video-multistreams": "multiple video streams to be merged into a single file", "no-video-multistreams": "one video stream is downloaded for each output file (default)", "audio-multistreams": "multiple audio streams to be merged into a single file", "no-audio-multistreams": "one audio stream is downloaded for each output file (default)", "no-prefer-free-formats": "Don't give any special preference to free containers (default)", "check-formats": "that the selected formats are actually downloadable", "check-all-formats": "all formats for whether they are actually downloadable", "no-check-formats": "not check that the formats are actually downloadable", "write-subs": "subtitle file", "no-write-subs": "not write subtitle file (default)", "write-auto-subs": "automatically generated subtitle file (Alias: --write-automatic-subs)", "no-write-auto-subs": "not write auto-generated subtitles (default) (Alias: --no-write-automatic-subs)", "sub-langs": "Languages of the subtitles to download (can be regex) or \"all\" separated by commas. (Eg: --sub-langs \"en.*,ja\") You", "netrc-location": "Location of .netrc authentication data; either the path or its containing directory. Defaults to ~\/.netrc", "remux-video": "Remux the video into another container if necessary (currently supported:", "no-keep-video": "the intermediate video file after post-processing (default)", "post-overwrites": "post-processed files (default)", "no-embed-subs": "not embed subtitles (default)", "no-embed-thumbnail": "not embed thumbnail (default)", "embed-metadata": "metadata to the video file. Also embeds chapters\/infojson if present unless --no-embed-chapters\/--no-embed-", "no-embed-metadata": "not add metadata to file (default) (Alias: --no-add-metadata)", "embed-chapters": "chapter markers to the video file (Alias: --add-chapters)", "no-embed-chapters": "not add chapter markers (default) (Alias: --no-add-chapters)", "embed-info-json": "the infojson as an attachment to mkv\/mka video files", "no-embed-info-json": "not embed the infojson as an attachment to the video file", "replace-in-metadata": "REGEX REPLACE Replace text in a metadata field using the given regex. This option can be used multiple times", "concat-playlist": "Concatenate videos in a playlist. One of \"never\", \"always\", or \"multi_video\" (default; only when the videos form a", "no-exec": "any previously defined --exec", "convert-thumbnails": "Convert the thumbnails to another format (currently supported: jpg|png|webp)", "split-chapters": "video into multiple files based on internal chapters. The \"chapter:\" prefix can be used with \"--paths\" and \"--", "no-split-chapters": "not split video based on chapters (default)", "remove-chapters": "Remove chapters whose title matches the given regular expression. Time ranges prefixed by a \"*\" can also be used in", "no-remove-chapters": "not remove any chapters from the file (default)", "force-keyframes-at-cuts": "keyframes around the chapters before removing\/splitting them. Requires a re-encode and thus is very slow, but", "no-force-keyframes-at-cuts": "not force keyframes around the chapters when cutting\/splitting (default)", "sponsorblock-mark": "SponsorBlock categories to create chapters for, separated by commas. Available categories are all, default(=all),", "sponsorblock-remove": "SponsorBlock categories to be removed from the video file, separated by commas. If a category is present in both", "sponsorblock-chapter-title": "The title template for SponsorBlock chapters created by --sponsorblock-mark. The same syntax as the output template", "no-sponsorblock": "both --sponsorblock-mark and --sponsorblock-remove", "sponsorblock-api": "SponsorBlock API location, defaults to https:\/\/sponsor.ajay.app", "extractor-retries": "Number of retries for known extractor errors (default is 3), or \"infinite\"", "allow-dynamic-mpd": "dynamic DASH manifests (default) (Alias: --no-ignore-dynamic-mpd)", "ignore-dynamic-mpd": "not process dynamic DASH manifests (Alias: --no-allow-dynamic-mpd)", "hls-split-discontinuity": "HLS playlists to different formats at discontinuities such as ad breaks", "no-hls-split-discontinuity": "not split HLS playlists to different formats at discontinuities such as ad breaks (default)" } -const names = Object.keys(options); -export { names, options } diff --git a/src/utils/ytdlOptions.js b/src/utils/ytdlOptions.js new file mode 100644 index 0000000..5eaa3c1 --- /dev/null +++ b/src/utils/ytdlOptions.js @@ -0,0 +1,3 @@ +const options = { "ignore-errors": "download and postprocessing errors. The download will be considered successful even if the postprocessing", "abort-on-error": "downloading of further videos if an error occurs (Alias: --no-ignore-errors)", "dump-user-agent": "the current user-agent and exit", "list-extractors": "all supported extractors and exit", "extractor-descriptions": "descriptions of all supported extractors and exit", "force-generic-extractor": "extraction to use the generic extractor", "default-search": "Use this prefix for unqualified URLs. For example \"gvsearch2:\" downloads two videos from google videos for the", "ignore-config": "Don't load any more configuration files except those given by --config-locations. For backward compatibility, if", "config-location": "Location of the configuration file; either the path to the config or its containing directory.", "flat-playlist": "not extract the videos of a playlist, only list them", "mark-watched": "videos watched (even with --simulate). Currently only supported for YouTube", "no-mark-watched": "not mark videos watched (default)", "no-color": "not emit color codes in output", "proxy": "Use the specified HTTP\/HTTPS\/SOCKS proxy. To enable SOCKS proxy, specify a proper scheme. For example", "socket-timeout": "Time to wait before giving up, in seconds", "source-address": "Client-side IP address to bind to", "force-ipv4": "all connections via IPv4", "force-ipv6": "all connections via IPv6", "geo-verification-proxy": "Use this proxy to verify the IP address for some geo-restricted sites. The default proxy specified by --proxy (or", "geo-bypass": "geographic restriction via faking X-Forwarded-For HTTP header (default)", "no-geo-bypass": "not bypass geographic restriction via faking X-Forwarded-For HTTP header", "geo-bypass-country": "Force bypass geographic restriction with explicitly provided two-letter ISO 3166-2 country code", "playlist-start": "Playlist video to start at (default is 1)", "playlist-end": "Playlist video to end at (default is last)", "match-title": "Download only matching titles (regex or caseless sub-string)", "reject-title": "Skip download for matching titles (regex or caseless sub-string)", "max-downloads": "Abort after downloading NUMBER files", "min-filesize": "Do not download any videos smaller than SIZE (e.g. 50k or 44.6m)", "max-filesize": "Do not download any videos larger than SIZE (e.g. 50k or 44.6m)", "date": "Download only videos uploaded on this date. The date can be \"YYYYMMDD\" or in the format", "datebefore": "Download only videos uploaded on or before this date. The date formats accepted is the same as --date", "dateafter": "Download only videos uploaded on or after this date. The date formats accepted is the same as --date", "min-views": "Do not download any videos with less than COUNT views", "max-views": "Do not download any videos with more than COUNT views", "match-filter": "Generic video filter. Any field (see \"OUTPUT TEMPLATE\") can be compared with a number or a string using the", "no-playlist": "only the video, if the URL refers to a video and a playlist", "yes-playlist": "the playlist, if the URL refers to a video and a playlist", "age-limit": "Download only videos suitable for the given age", "download-archive": "Download only videos not listed in the archive file. Record the IDs of all downloaded videos in it", "include-ads": "advertisements as well (experimental)", "limit-rate": "Maximum download rate in bytes per second (e.g. 50K or 4.2M)", "retries": "Number of retries (default is 10), or \"infinite\"", "fragment-retries": "Number of retries for a fragment (default is 10), or \"infinite\" (DASH, hlsnative and ISM)", "skip-unavailable-fragments": "unavailable fragments for DASH, hlsnative and ISM (default) (Alias: --no-abort-on-unavailable-fragment)", "abort-on-unavailable-fragment": "downloading if a fragment is unavailable (Alias: --no-skip-unavailable-fragments)", "keep-fragments": "downloaded fragments on disk after downloading is finished", "buffer-size": "Size of download buffer (e.g. 1024 or 16K) (default is 1024)", "no-resize-buffer": "not automatically adjust the buffer size", "http-chunk-size": "Size of a chunk for chunk-based HTTP downloading (e.g. 10485760 or 10M) (default is disabled). May be useful for", "playlist-reverse": "playlist videos in reverse order", "playlist-random": "playlist videos in random order", "xattr-set-filesize": "file xattribute ytdl.filesize with expected file size", "hls-prefer-native": "the native HLS downloader instead of ffmpeg", "hls-prefer-ffmpeg": "ffmpeg instead of the native HLS downloader", "hls-use-mpegts": "the mpegts container for HLS videos; allowing some players to play the video while downloading, and reducing the", "external-downloader": "Use the specified external downloader. Currently supports aria2c,avconv,axel,curl,ffmpeg,httpie,wget", "external-downloader-args": "Give these arguments to the external downloader", "batch-file": "File containing URLs to download (\"-\" for stdin), one URL per line. Lines starting with \"#\", \";\" or \"]\" are", "id": "only video ID in file name", "output": "an absolute path", "output-na-placeholder": "Placeholder value for unavailable meta fields in output filename template (default: \"NA\")", "autonumber-start": "Specify the start value for %(autonumber)s (default is 1)", "restrict-filenames": "filenames to only ASCII characters, and avoid \"&\" and spaces in filenames", "no-overwrites": "not overwrite any files", "continue": "partially downloaded files\/fragments (default)", "no-continue": "not resume partially downloaded fragments. If the file is not fragmented, restart download of the entire file", "no-part": "not use .part files - write directly into output file", "no-mtime": "not use the Last-modified header to set the file modification time", "write-description": "video description to a .description file", "write-info-json": "video metadata to a .info.json file (this may contain personal information)", "write-annotations": "video annotations to a .annotations.xml file", "load-info-json": "JSON file containing the video information (created with the \"--write-info-json\" option)", "cookies": "Netscape formatted file to read cookies from and dump cookie jar in", "cache-dir": "Location in the filesystem where ytdl can store some downloaded information (such as client ids and", "no-cache-dir": "filesystem caching", "rm-cache-dir": "all filesystem cache files", "write-thumbnail": "thumbnail image to disk", "write-all-thumbnails": "all thumbnail image formats to disk", "list-thumbnails": "available thumbnails of each video. Simulate unless --no-simulate is used", "quiet": "", "no-warnings": "warnings", "simulate": "not download the video and do not write anything to disk", "skip-download": "not download the video but write all related files (Alias: --no-download)", "get-url": "Simulate, quiet but print URL", "get-title": "Simulate, quiet but print title", "get-id": "Simulate, quiet but print id", "get-thumbnail": "Simulate, quiet but print thumbnail URL", "get-description": "Simulate, quiet but print video description", "get-duration": "Simulate, quiet but print video length", "get-filename": "Simulate, quiet but print output filename", "get-format": "Simulate, quiet but print output format", "dump-json": "Quiet, but print JSON information for each video. Simulate unless --no-simulate is used. See \"OUTPUT TEMPLATE\" for a", "dump-single-json": "Quiet, but print JSON information for each url or infojson passed. Simulate unless --no-simulate is used. If the URL", "print-json": "quiet and print the video information as JSON (video is still being downloaded).", "newline": "progress bar as new lines", "no-progress": "not print progress bar", "console-title": "progress in console titlebar", "verbose": "various debugging information", "dump-pages": "downloaded pages encoded using base64 to debug problems (very verbose)", "write-pages": "downloaded intermediary pages to files in the current directory to debug problems", "print-traffic": "sent and read HTTP traffic", "call-home": "the ytdl server for debugging", "no-call-home": "NOT contact the ytdl server for debugging", "encoding": "Force the specified encoding (experimental)", "no-check-certificate": "HTTPS certificate validation", "prefer-insecure": "an unencrypted connection to retrieve information about the video (Currently supported only for YouTube)", "user-agent": "Specify a custom user agent", "referer": "Specify a custom referer, use if the video access is restricted to one domain", "add-header": "Specify a custom HTTP header and its value, separated by a colon ':'. You can use this option multiple times", "bidi-workaround": "around terminals that lack bidirectional text support. Requires bidiv or fribidi executable in PATH", "sleep-interval": "Number of seconds to sleep before each download. This is the minimum time to sleep when used along with --max-sleep-", "max-sleep-interval": "Maximum number of seconds to sleep. Can only be used along with --min-sleep-interval", "format": "Video format code, see \"FORMAT SELECTION\" for more details", "all-formats": "all available video formats", "prefer-free-formats": "video formats with free containers over non-free ones of same quality. Use with \"-S ext\" to strictly prefer", "list-formats": "available formats of each video. Simulate unless --no-simulate is used", "ytdl-skip-dash-manifest": "not download the DASH manifests and related data on YouTube videos", "merge-output-format": "If a merge is required (e.g. bestvideo+bestaudio), output to given container format. One of mkv, mp4, ogg, webm,", "write-sub": "subtitle file", "write-auto-sub": "automatically generated subtitle file (YouTube only)", "all-subs": "all the available subtitles of the video", "list-subs": "a list of available language tags", "sub-format": "Subtitle format, accepts formats preference, for example: \"srt\" or \"ass\/srt\/best\"", "sub-lang": "Languages of the subtitles to download (optional) separated by commas, use --list-subs for available language tags", "username": "Login with this account ID", "password": "Account password. If this option is left out, yt-dlp will ask interactively", "twofactor": "Two-factor authentication code", "netrc": ".netrc authentication data", "video-password": "Video password (vimeo, youku)", "ap-mso": "Adobe Pass multiple-system operator (TV provider) identifier, use --ap-list-mso for a list of available MSOs", "ap-username": "Multiple-system operator account login", "ap-password": "Multiple-system operator account password. If this option is left out, yt-dlp will ask interactively", "ap-list-mso": "all supported multiple-system operators", "extract-audio": "video files to audio-only files (requires ffmpeg and ffprobe)", "audio-format": "Specify audio format to convert the audio to when -x is used. Currently supported formats are: best (default) or one", "audio-quality": "Specify ffmpeg audio quality, insert a value between 0 (best) and 10 (worst) for VBR or a specific bitrate like 128K", "recode-video": "Re-encode the video into another format if re-encoding is necessary. The syntax and supported formats are the same", "postprocessor-args": "Give these arguments to the postprocessor", "keep-video": "the intermediate video file on disk after post-processing", "no-post-overwrites": "not overwrite post-processed files", "embed-subs": "subtitles in the video (only for mp4, webm and mkv videos)", "embed-thumbnail": "thumbnail in the video as cover art", "add-metadata": "metadata to the video file", "metadata-from-title": "Parse additional metadata like song title \/ artist from the video title. The format syntax is the same as --output.", "xattrs": "metadata to the video file's xattrs (using dublin core and xdg standards)", "fixup": "Automatically correct known faults of the file. One of never (do nothing), warn (only emit a warning),", "prefer-avconv": "avconv over ffmpeg for running the postprocessors", "prefer-ffmpeg": "ffmpeg over avconv for running the postprocessors (default)", "ffmpeg-location": "Location of the ffmpeg binary; either the path to the binary or its containing directory", "exec": "Execute a command on the file after downloading and post-processing, similar to find's -exec syntax. Example:", "convert-subs": "Convert the subtitles to another format (currently supported: srt|vtt|ass|lrc) (Alias: --convert-subtitles)", "no-abort-on-error": "with next video on download errors; e.g. to skip unavailable videos in a playlist (default)", "no-config-locations": "not load any custom configuration files (default). When given inside a configuration file, ignore all previous", "config-locations": "Location of the main configuration file; either the path to the config or its containing directory. Can be used", "no-flat-playlist": "the videos of a playlist", "live-from-start": "livestreams from the start. Currently only supported for YouTube (Experimental)", "no-live-from-start": "livestreams from the current time (default)", "no-wait-for-video": "not wait for scheduled streams (default)", "no-colors": "not emit color codes in output", "compat-options": "Options that can help keep compatibility with ytdl or ytdl-dlc configurations by reverting some of the", "no-match-filter": "not use generic video filter (default)", "no-download-archive": "not use archive file (default)", "break-on-existing": "the download process when encountering a file that is in the archive", "break-on-reject": "the download process when encountering a file that has been filtered out", "break-per-input": "--break-on-existing and --break-on-reject act only on the current input URL", "no-break-per-input": "--break-on-existing and --break-on-reject terminates the entire download queue", "skip-playlist-after-errors": "Number of allowed failures until the rest of the playlist is skipped", "concurrent-fragments": "Number of fragments of a dash\/hlsnative video that should be downloaded concurrently (default is 1)", "throttled-rate": "Minimum download rate in bytes per second below which throttling is assumed and the video data is re-extracted (e.g.", "file-access-retries": "Number of times to retry on file access error (default is 3), or \"infinite\"", "no-keep-fragments": "downloaded fragments after downloading is finished (default)", "resize-buffer": "buffer size is automatically resized from an initial value of --buffer-size (default)", "no-playlist-reverse": "playlist videos in default order (default)", "no-hls-use-mpegts": "not use the mpegts container for HLS videos. This is default when not downloading live streams", "no-batch-file": "not read URLs from batch file (default)", "no-restrict-filenames": "Unicode characters, \"&\" and spaces in filenames (default)", "windows-filenames": "filenames to be Windows-compatible", "no-windows-filenames": "filenames Windows-compatible only if using Windows (default)", "trim-filenames": "Limit the filename length (excluding extension) to the specified number of characters", "force-overwrites": "all video and metadata files. This option includes --no-continue", "no-force-overwrites": "not overwrite the video, but overwrite related files (default)", "part": ".part files instead of writing directly into output file (default)", "mtime": "the Last-modified header to set the file modification time (default)", "no-write-description": "not write video description (default)", "no-write-info-json": "not write video metadata (default)", "write-playlist-metafiles": "playlist metadata in addition to the video metadata when using --write-info-json, --write-description etc.", "no-write-playlist-metafiles": "not write playlist metadata when using --write-info-json, --write-description etc.", "clean-info-json": "some private fields such as filenames from the infojson. Note that it could still contain some personal", "no-clean-info-json": "all fields to the infojson", "write-comments": "video comments to be placed in the infojson. The comments are fetched even without this option if the", "no-write-comments": "not retrieve video comments unless the extraction is known to be quick (Alias: --no-get-comments)", "no-cookies": "not read\/dump cookies from\/to file (default)", "no-cookies-from-browser": "not load cookies from browser (default)", "no-write-thumbnail": "not write thumbnail image to disk (default)", "write-link": "an internet shortcut file, depending on the current platform (.url, .webloc or .desktop). The URL may be", "write-url-link": "a .url Windows internet shortcut. The OS caches the URL based on the file path", "write-webloc-link": "a .webloc macOS internet shortcut", "write-desktop-link": "a .desktop Linux internet shortcut", "no-simulate": "used). This option can be used multiple times", "ignore-no-formats-error": "\"No video formats\" error. Useful for extracting metadata even if the videos are not actually available for", "no-ignore-no-formats-error": "error when no downloadable video formats are found (default)", "force-write-archive": "download archive entries to be written as far as no errors occur, even if -s or another simulation option is", "progress": "progress bar, even if in quiet mode", "legacy-server-connect": "allow HTTPS connection to servers that do not support RFC 5746 secure renegotiation", "no-check-certificates": "HTTPS certificate validation", "sleep-requests": "Number of seconds to sleep between requests during data extraction", "sleep-subtitles": "Number of seconds to sleep before each subtitle download", "format-sort": "Sort the formats by the fields given, see \"Sorting Formats\" for more details", "format-sort-force": "user specified sort order to have precedence over all fields, see \"Sorting Formats\" for more details", "no-format-sort-force": "fields have precedence over the user specified sort order (default), see \"Sorting Formats\" for more details", "video-multistreams": "multiple video streams to be merged into a single file", "no-video-multistreams": "one video stream is downloaded for each output file (default)", "audio-multistreams": "multiple audio streams to be merged into a single file", "no-audio-multistreams": "one audio stream is downloaded for each output file (default)", "no-prefer-free-formats": "Don't give any special preference to free containers (default)", "check-formats": "that the selected formats are actually downloadable", "check-all-formats": "all formats for whether they are actually downloadable", "no-check-formats": "not check that the formats are actually downloadable", "write-subs": "subtitle file", "no-write-subs": "not write subtitle file (default)", "write-auto-subs": "automatically generated subtitle file (Alias: --write-automatic-subs)", "no-write-auto-subs": "not write auto-generated subtitles (default) (Alias: --no-write-automatic-subs)", "sub-langs": "Languages of the subtitles to download (can be regex) or \"all\" separated by commas. (Eg: --sub-langs \"en.*,ja\") You", "netrc-location": "Location of .netrc authentication data; either the path or its containing directory. Defaults to ~\/.netrc", "remux-video": "Remux the video into another container if necessary (currently supported:", "no-keep-video": "the intermediate video file after post-processing (default)", "post-overwrites": "post-processed files (default)", "no-embed-subs": "not embed subtitles (default)", "no-embed-thumbnail": "not embed thumbnail (default)", "embed-metadata": "metadata to the video file. Also embeds chapters\/infojson if present unless --no-embed-chapters\/--no-embed-", "no-embed-metadata": "not add metadata to file (default) (Alias: --no-add-metadata)", "embed-chapters": "chapter markers to the video file (Alias: --add-chapters)", "no-embed-chapters": "not add chapter markers (default) (Alias: --no-add-chapters)", "embed-info-json": "the infojson as an attachment to mkv\/mka video files", "no-embed-info-json": "not embed the infojson as an attachment to the video file", "replace-in-metadata": "REGEX REPLACE Replace text in a metadata field using the given regex. This option can be used multiple times", "concat-playlist": "Concatenate videos in a playlist. One of \"never\", \"always\", or \"multi_video\" (default; only when the videos form a", "no-exec": "any previously defined --exec", "convert-thumbnails": "Convert the thumbnails to another format (currently supported: jpg|png|webp)", "split-chapters": "video into multiple files based on internal chapters. The \"chapter:\" prefix can be used with \"--paths\" and \"--", "no-split-chapters": "not split video based on chapters (default)", "remove-chapters": "Remove chapters whose title matches the given regular expression. Time ranges prefixed by a \"*\" can also be used in", "no-remove-chapters": "not remove any chapters from the file (default)", "force-keyframes-at-cuts": "keyframes around the chapters before removing\/splitting them. Requires a re-encode and thus is very slow, but", "no-force-keyframes-at-cuts": "not force keyframes around the chapters when cutting\/splitting (default)", "sponsorblock-mark": "SponsorBlock categories to create chapters for, separated by commas. Available categories are all, default(=all),", "sponsorblock-remove": "SponsorBlock categories to be removed from the video file, separated by commas. If a category is present in both", "sponsorblock-chapter-title": "The title template for SponsorBlock chapters created by --sponsorblock-mark. The same syntax as the output template", "no-sponsorblock": "both --sponsorblock-mark and --sponsorblock-remove", "sponsorblock-api": "SponsorBlock API location, defaults to https:\/\/sponsor.ajay.app", "extractor-retries": "Number of retries for known extractor errors (default is 3), or \"infinite\"", "allow-dynamic-mpd": "dynamic DASH manifests (default) (Alias: --no-ignore-dynamic-mpd)", "ignore-dynamic-mpd": "not process dynamic DASH manifests (Alias: --no-allow-dynamic-mpd)", "hls-split-discontinuity": "HLS playlists to different formats at discontinuities such as ad breaks", "no-hls-split-discontinuity": "not split HLS playlists to different formats at discontinuities such as ad breaks (default)" } +const names = Object.keys(options); +export { names, options } diff --git a/templates/Navigation.php b/templates/Navigation.php index e23ef4d..aba3009 100644 --- a/templates/Navigation.php +++ b/templates/Navigation.php @@ -5,7 +5,7 @@ $downloadsList = [ ["name" => "waiting", "label" => "Waiting Downloads", "id" => "waiting-downloads", "path" => "/apps/ncdownloader/status/waiting"], ["name" => "fail", "label" => "Failed Downloads", "id" => "failed-downloads", "path" => "/apps/ncdownloader/status/fail"], ["name" => "complete", "label" => "Complete Downloads", "id" => "complete-downloads", "path" => "/apps/ncdownloader/status/complete"], - ["name" => "youtube-dl", "label" => "Youtube-dl Downloads", "id" => "youtube-dl-downloads", "path" => "/apps/ncdownloader/youtube/get"], + ["name" => "ytdl", "label" => "Youtube-dl Downloads", "id" => "ytdl-downloads", "path" => "/apps/ncdownloader/ytdl/get"], ]; ?>
diff --git a/templates/settings/Admin.php b/templates/settings/Admin.php index f00ba95..66876bc 100644 --- a/templates/settings/Admin.php +++ b/templates/settings/Admin.php @@ -21,8 +21,8 @@ extract($_); t('Youtube-dl Binary Path'));?> + value="" + placeholder='/usr/local/bin/ytdl' />
diff --git a/templates/settings/Personal.php b/templates/settings/Personal.php index db8fc4c..2d47168 100644 --- a/templates/settings/Personal.php +++ b/templates/settings/Personal.php @@ -74,17 +74,17 @@ $time_map = array('i' => 'minutes', 'h' => 'hours', 'w' => 'weeks', 'd' => 'days
-
+

t('Custom Youtube-dl Settings'));?>

-
- -