mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-07 20:10:03 +03:00
Compare commits
38 Commits
GlassedSil
...
db-bug-fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
664b635439 | ||
|
|
692d6eeaac | ||
|
|
9515d5a1b0 | ||
|
|
24df238ff9 | ||
|
|
f5e6815200 | ||
|
|
0e5efd003e | ||
|
|
3e7ef766de | ||
|
|
17fdd0d788 | ||
|
|
ce3e645129 | ||
|
|
acca2d0de2 | ||
|
|
31b4fcb9fc | ||
|
|
336d7a09bd | ||
|
|
7c31a10498 | ||
|
|
a94b8f376e | ||
|
|
84d33b0f82 | ||
|
|
3abf8ecfc3 | ||
|
|
5b919b2b18 | ||
|
|
e290dc0a25 | ||
|
|
a54f07e93a | ||
|
|
8336d886e9 | ||
|
|
6a56b5b065 | ||
|
|
7aca8ab060 | ||
|
|
8cc5c4f733 | ||
|
|
c5eacbb70c | ||
|
|
7268242691 | ||
|
|
d0f5518d31 | ||
|
|
713a97f75a | ||
|
|
0bdcfa3244 | ||
|
|
849c1927d3 | ||
|
|
06ca9cbe76 | ||
|
|
8e4a3119ab | ||
|
|
ec1ccf6888 | ||
|
|
c33e8010b3 | ||
|
|
57fd991d5c | ||
|
|
44c1a34c67 | ||
|
|
9f740020af | ||
|
|
4d4bc76549 | ||
|
|
93ce498e94 |
2
.github/workflows/docker.yml
vendored
2
.github/workflows/docker.yml
vendored
@@ -8,9 +8,9 @@ on:
|
||||
- '.vscode/**'
|
||||
- 'chrome-extension/**'
|
||||
- 'releases/**'
|
||||
- '**/**.md'
|
||||
- '**.crx'
|
||||
- '**.pem'
|
||||
- '**.md'
|
||||
- '.dockerignore'
|
||||
- '.gitignore'
|
||||
|
||||
|
||||
27
Dockerfile
27
Dockerfile
@@ -1,22 +1,23 @@
|
||||
FROM ubuntu:20.04 AS ffmpeg
|
||||
FROM ubuntu:22.04 AS ffmpeg
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
COPY docker-build.sh .
|
||||
RUN sh ./docker-build.sh
|
||||
|
||||
FROM ubuntu:20.04 as frontend
|
||||
#--------------# Stage 2
|
||||
|
||||
FROM ubuntu:22.04 as frontend
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update && apt-get -y install \
|
||||
curl \
|
||||
gnupg && \
|
||||
curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
|
||||
apt-get -y install \
|
||||
gnupg \
|
||||
# Ubuntu 22.04 ships Node.JS 12 by default :)
|
||||
nodejs \
|
||||
# YARN: brings along npm, solves dependency conflicts,
|
||||
# needed on 21.10 and before, maybe not on 22.04 YARN: brings along npm, solves dependency conflicts,
|
||||
# spares us this spaghetti approach: https://stackoverflow.com/a/60547197
|
||||
yarn && \
|
||||
npm && \
|
||||
apt-get install -f && \
|
||||
npm config set strict-ssl false && \
|
||||
npm install -g @angular/cli
|
||||
@@ -29,9 +30,9 @@ COPY [ "angular.json", "tsconfig.json", "/build/" ]
|
||||
COPY [ "src/", "/build/src/" ]
|
||||
RUN npm run build
|
||||
|
||||
#--------------#
|
||||
#--------------# Final Stage
|
||||
|
||||
FROM ubuntu:20.04
|
||||
FROM ubuntu:22.04
|
||||
|
||||
ENV UID=1000 \
|
||||
GID=1000 \
|
||||
@@ -42,11 +43,11 @@ ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN groupadd -g $GID $USER && useradd --system -g $USER --uid $UID $USER
|
||||
|
||||
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
|
||||
RUN apt-get update && apt-get -y install \
|
||||
npm \
|
||||
python2 \
|
||||
python3 \
|
||||
gosu \
|
||||
atomicparsley && \
|
||||
apt-get install -f && \
|
||||
apt-get autoremove --purge && \
|
||||
@@ -55,8 +56,8 @@ RUN apt-get update && apt-get -y install \
|
||||
rm -rf /var/lib/apt
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=ffmpeg /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg
|
||||
COPY --from=ffmpeg /usr/local/bin/ffprobe /usr/local/bin/ffprobe
|
||||
COPY --chown=$UID:$GID --from=ffmpeg [ "/usr/local/bin/ffmpeg", "/usr/local/bin/ffmpeg" ]
|
||||
COPY --chown=$UID:$GID --from=ffmpeg [ "/usr/local/bin/ffprobe", "/usr/local/bin/ffprobe" ]
|
||||
COPY --chown=$UID:$GID [ "backend/package.json", "backend/package-lock.json", "/app/" ]
|
||||
ENV PM2_HOME=/app/pm2
|
||||
RUN npm config set strict-ssl false && \
|
||||
@@ -67,5 +68,5 @@ COPY --chown=$UID:$GID --from=frontend [ "/build/backend/public/", "/app/public/
|
||||
COPY --chown=$UID:$GID [ "/backend/", "/app/" ]
|
||||
|
||||
EXPOSE 17442
|
||||
# ENTRYPOINT [ "/app/entrypoint.sh" ]
|
||||
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
||||
CMD [ "pm2-runtime", "pm2.config.js" ]
|
||||
|
||||
@@ -222,4 +222,83 @@ exports.AVAILABLE_PERMISSIONS = [
|
||||
|
||||
exports.DETAILS_BIN_PATH = 'node_modules/youtube-dl/bin/details'
|
||||
|
||||
// args that have a value after it (e.g. -o <output> or -f <format>)
|
||||
const YTDL_ARGS_WITH_VALUES = [
|
||||
'--default-search',
|
||||
'--config-location',
|
||||
'--proxy',
|
||||
'--socket-timeout',
|
||||
'--source-address',
|
||||
'--geo-verification-proxy',
|
||||
'--geo-bypass-country',
|
||||
'--geo-bypass-ip-block',
|
||||
'--playlist-start',
|
||||
'--playlist-end',
|
||||
'--playlist-items',
|
||||
'--match-title',
|
||||
'--reject-title',
|
||||
'--max-downloads',
|
||||
'--min-filesize',
|
||||
'--max-filesize',
|
||||
'--date',
|
||||
'--datebefore',
|
||||
'--dateafter',
|
||||
'--min-views',
|
||||
'--max-views',
|
||||
'--match-filter',
|
||||
'--age-limit',
|
||||
'--download-archive',
|
||||
'-r',
|
||||
'--limit-rate',
|
||||
'-R',
|
||||
'--retries',
|
||||
'--fragment-retries',
|
||||
'--buffer-size',
|
||||
'--http-chunk-size',
|
||||
'--external-downloader',
|
||||
'--external-downloader-args',
|
||||
'-a',
|
||||
'--batch-file',
|
||||
'-o',
|
||||
'--output',
|
||||
'--output-na-placeholder',
|
||||
'--autonumber-start',
|
||||
'--load-info-json',
|
||||
'--cookies',
|
||||
'--cache-dir',
|
||||
'--encoding',
|
||||
'--user-agent',
|
||||
'--referer',
|
||||
'--add-header',
|
||||
'--sleep-interval',
|
||||
'--max-sleep-interval',
|
||||
'-f',
|
||||
'--format',
|
||||
'--merge-output-format',
|
||||
'--sub-format',
|
||||
'--sub-lang',
|
||||
'-u',
|
||||
'--username',
|
||||
'-p',
|
||||
'--password',
|
||||
'-2',
|
||||
'--twofactor',
|
||||
'--video-password',
|
||||
'--ap-mso',
|
||||
'--ap-username',
|
||||
'--ap-password',
|
||||
'--audio-format',
|
||||
'--audio-quality',
|
||||
'--recode-video',
|
||||
'--postprocessor-args',
|
||||
'--metadata-from-title',
|
||||
'--fixup',
|
||||
'--ffmpeg-location',
|
||||
'--exec',
|
||||
'--convert-subs'
|
||||
];
|
||||
|
||||
// we're using a Set here for performance
|
||||
exports.YTDL_ARGS_WITH_VALUES = new Set(YTDL_ARGS_WITH_VALUES);
|
||||
|
||||
exports.CURRENT_VERSION = 'v4.2';
|
||||
|
||||
@@ -85,8 +85,6 @@ exports.initialize = (input_db, input_users_db) => {
|
||||
}
|
||||
|
||||
exports.connectToDB = async (retries = 5, no_fallback = false, custom_connection_string = null) => {
|
||||
using_local_db = config_api.getConfigItem('ytdl_use_local_db'); // verify
|
||||
if (using_local_db && !custom_connection_string) return;
|
||||
const success = await exports._connectToDB(custom_connection_string);
|
||||
if (success) return true;
|
||||
|
||||
|
||||
@@ -485,7 +485,7 @@ exports.generateArgs = async (url, type, options, user_uid = null, simulated = f
|
||||
}
|
||||
|
||||
if (options.additionalArgs && options.additionalArgs !== '') {
|
||||
downloadConfig = downloadConfig.concat(options.additionalArgs.split(',,'));
|
||||
downloadConfig = utils.injectArgs(downloadConfig, options.additionalArgs.split(',,'));
|
||||
}
|
||||
|
||||
const rate_limit = config_api.getConfigItem('ytdl_download_rate_limit');
|
||||
|
||||
@@ -11,7 +11,7 @@ fi
|
||||
# chown current working directory to current user
|
||||
if [ "$*" = "$CMD" ] && [ "$(id -u)" = "0" ]; then
|
||||
find . \! -user "$UID" -exec chown "$UID:$GID" -R '{}' + || echo "WARNING! Could not change directory ownership. If you manage permissions externally this is fine, otherwise you may experience issues when downloading or deleting videos."
|
||||
exec su-exec "$UID:$GID" "$0" "$@"
|
||||
exec gosu "$UID:$GID" "$0" "$@"
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
|
||||
58
backend/fix-scripts/001-fix_download_permissions.sh
Normal file
58
backend/fix-scripts/001-fix_download_permissions.sh
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
|
||||
# INTERACTIVE PERMISSIONS FIX SCRIPT FOR YTDL-M
|
||||
# Date: 2022-05-03
|
||||
|
||||
# If you want to run this script on a bare-metal installation instead of within Docker
|
||||
# make sure that the paths configured below match your paths! (it's wise to use the full paths)
|
||||
# USAGE: within your container's bash shell:
|
||||
# chmod -R +x ./fix-scripts/
|
||||
# ./fix-scripts/001-fix_download_permissions.sh
|
||||
|
||||
# User defines / Docker env defaults
|
||||
PATH_SUBS=/app/subscriptions
|
||||
PATH_AUDIO=/app/audio
|
||||
PATH_VIDS=/app/video
|
||||
|
||||
clear -x
|
||||
echo "\n"
|
||||
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - # horizontal line
|
||||
echo "Welcome to the INTERACTIVE PERMISSIONS FIX SCRIPT FOR YTDL-M."
|
||||
echo "This script will set YTDL-M's download paths' owner to ${USER} (${UID}:${GID})"
|
||||
echo "and permissions to the default of 644."
|
||||
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - # horizontal line
|
||||
echo "\n"
|
||||
|
||||
# check whether dirs exist
|
||||
i=0
|
||||
[ -d $PATH_SUBS ] && i=$((i+1)) && echo "✔ (${i}/3) Found Subscriptions directory at ${PATH_SUBS}"
|
||||
[ -d $PATH_AUDIO ] && i=$((i+1)) && echo "✔ (${i}/3) Found Audio directory at ${PATH_AUDIO}"
|
||||
[ -d $PATH_VIDS ] && i=$((i+1)) && echo "✔ (${i}/3) Found Video directory at ${PATH_VIDS}"
|
||||
|
||||
# Ask to proceed or cancel, exit on missing paths
|
||||
case $i in
|
||||
0)
|
||||
echo "\nCouldn't find any download path to fix permissions for! \nPlease edit this script to configure!"
|
||||
exit 2;;
|
||||
3)
|
||||
echo "\nFound all download paths to fix permissions for. \nProceed? (Y/N)";;
|
||||
*)
|
||||
echo "\nOnly found ${i} out of 3 download paths! Something about this script's config must be wrong. \nProceed anyways? (Y/N)";;
|
||||
esac
|
||||
old_stty_cfg=$(stty -g)
|
||||
stty raw -echo ; answer=$(head -c 1) ; stty $old_stty_cfg # Careful playing with stty
|
||||
if echo "$answer" | grep -iq "^y" ;then
|
||||
echo "\n Running jobs now... (this may take a while)\n"
|
||||
[ -d $PATH_SUBS ] && chown "$UID:$GID" -R $PATH_SUBS && echo "✔ Set owner of ${PATH_SUBS} to ${USER}."
|
||||
[ -d $PATH_SUBS ] && chmod 644 -R $PATH_SUBS && echo "✔ Set permissions of ${PATH_SUBS} to 644."
|
||||
[ -d $PATH_AUDIO ] && chown "$UID:$GID" -R $PATH_AUDIO && echo "✔ Set owner of ${PATH_AUDIO} to ${USER}."
|
||||
[ -d $PATH_AUDIO ] && chmod 644 -R $PATH_AUDIO && echo "✔ Set permissions of ${PATH_AUDIO} to 644."
|
||||
[ -d $PATH_VIDS ] && chown "$UID:$GID" -R $PATH_VIDS && echo "✔ Set owner of ${PATH_VIDS} to ${USER}."
|
||||
[ -d $PATH_VIDS ] && chmod 644 -R $PATH_VIDS && echo "✔ Set permissions of ${PATH_VIDS} to 644."
|
||||
echo "\n✔ Done."
|
||||
echo "\n If you noticed file access errors those MAY be due to currently running downloads."
|
||||
echo " Feel free to re-run this script, however download parts should have correct file permissions anyhow. :)"
|
||||
exit
|
||||
else
|
||||
echo "\nOkay, bye."
|
||||
fi
|
||||
@@ -386,6 +386,21 @@ describe('Downloader', function() {
|
||||
assert(fs.existsSync(nfo_file_path), true);
|
||||
fs.unlinkSync(nfo_file_path);
|
||||
});
|
||||
|
||||
it('Inject args', async function() {
|
||||
const original_args1 = ['--no-resize-buffer', '-o', '%(title)s', '--no-mtime'];
|
||||
const new_args1 = ['--age-limit', '25', '--yes-playlist', '--abort-on-error', '-o', '%(id)s'];
|
||||
const updated_args1 = utils.injectArgs(original_args1, new_args1);
|
||||
const expected_args1 = ['--no-resize-buffer', '--no-mtime', '--age-limit', '25', '--yes-playlist', '--abort-on-error', '-o', '%(id)s'];
|
||||
assert(JSON.stringify(updated_args1), JSON.stringify(expected_args1));
|
||||
|
||||
const original_args2 = ['-o', '%(title)s.%(ext)s', '--write-info-json', '--print-json', '--audio-quality', '0', '-x', '--audio-format', 'mp3'];
|
||||
const new_args2 = ['--add-metadata', '--embed-thumbnail', '--convert-thumbnails', 'jpg'];
|
||||
const updated_args2 = utils.injectArgs(original_args2, new_args2);
|
||||
const expected_args2 = ['-o', '%(title)s.%(ext)s', '--write-info-json', '--print-json', '--audio-quality', '0', '-x', '--audio-format', 'mp3', '--add-metadata', '--embed-thumbnail', '--convert_thumbnails', 'jpg'];
|
||||
console.log(updated_args2);
|
||||
assert(JSON.stringify(updated_args2), JSON.stringify(expected_args2));
|
||||
});
|
||||
});
|
||||
|
||||
describe('Tasks', function() {
|
||||
|
||||
@@ -415,6 +415,39 @@ async function fetchFile(url, path, file_label) {
|
||||
});
|
||||
}
|
||||
|
||||
// adds or replaces args according to the following rules:
|
||||
// - if it already exists and has value, then replace both arg and value
|
||||
// - if already exists and doesn't have value, ignore
|
||||
// - if it doesn't exist and has value, add both arg and value
|
||||
// - if it doesn't exist and doesn't have value, add arg
|
||||
function injectArgs(original_args, new_args) {
|
||||
const updated_args = original_args.slice();
|
||||
try {
|
||||
for (let i = 0; i < new_args.length; i++) {
|
||||
const new_arg = new_args[i];
|
||||
if (!new_arg.startsWith('-') && !new_arg.startsWith('--') && i > 0 && original_args.includes(new_args[i - 1])) continue;
|
||||
|
||||
if (CONSTS.YTDL_ARGS_WITH_VALUES.has(new_arg)) {
|
||||
if (original_args.includes(new_arg)) {
|
||||
const original_index = original_args.indexOf(new_arg);
|
||||
original_args.splice(original_index, 2);
|
||||
}
|
||||
|
||||
updated_args.push(new_arg, new_args[i + 1]);
|
||||
} else {
|
||||
if (!original_args.includes(new_arg)) {
|
||||
updated_args.push(new_arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
logger.warn(err);
|
||||
logger.warn(`Failed to inject args (${new_args}) into (${original_args})`);
|
||||
}
|
||||
|
||||
return updated_args;
|
||||
}
|
||||
|
||||
// objects
|
||||
|
||||
function File(id, title, thumbnailURL, isAudio, duration, url, uploader, size, path, upload_date, description, view_count, height, abr) {
|
||||
@@ -458,5 +491,6 @@ module.exports = {
|
||||
wait: wait,
|
||||
checkExistsWithTimeout: checkExistsWithTimeout,
|
||||
fetchFile: fetchFile,
|
||||
injectArgs: injectArgs,
|
||||
File: File
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e",
|
||||
"electron": "ng build --base-href ./ && electron .",
|
||||
"generate": "openapi --input ./\"Public API v1.yaml\" --output ./src/api-types --exportCore false --exportServices false --exportModels true"
|
||||
"generate": "openapi --input ./\"Public API v1.yaml\" --output ./src/api-types --exportCore false --exportServices false --exportModels true",
|
||||
"i18n-source": "ng extract-i18n --output-path=src/assets/i18n"
|
||||
},
|
||||
"engines": {
|
||||
"node": "12.3.1",
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
<ng-container i18n="Subscription playlist not available text">Name not available. Playlist retrieval in progress.</ng-container>
|
||||
</div>
|
||||
</a>
|
||||
<button mat-icon-button (click)="editSubscription(sub)">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
<button mat-icon-button (click)="showSubInfo(sub)">
|
||||
<mat-icon>info</mat-icon>
|
||||
</button>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1545,8 +1545,8 @@
|
||||
<note priority="1" from="description">Custom args input placeholder</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="6b995e7130b4d667eaab6c5f61b362ace486d26d" datatype="html">
|
||||
<source>Global custom args for downloads on the home page. Args are delimited using two commas like so: ,,</source>
|
||||
<target>Algemene aanvullende opties voor downloads op de overzichtspagina. Scheidt deze met komma's: ,,</target>
|
||||
<source>Global custom args for downloads on the home page. (Set args for subscriptions for each subscriptions separately!) Args are delimited using two commas like so: ,,</source>
|
||||
<target>Algemene aanvullende opties voor downloads op de overzichtspagina. (Stel de opties per abonnement in!) Scheidt deze met komma's: ,,</target>
|
||||
<context-group purpose="location">
|
||||
<context context-type="sourcefile">src/app/settings/settings.component.html</context>
|
||||
<context context-type="linenumber">134</context>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
||||
<file source-language="en-US" datatype="plaintext" original="ng2.template" target-language="zh-Hans">
|
||||
<body>
|
||||
@@ -902,8 +902,8 @@
|
||||
<note priority="1" from="description">Video path setting input hint</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="6b995e7130b4d667eaab6c5f61b362ace486d26d" datatype="html">
|
||||
<source>Global custom args for downloads on the home page. Args are delimited using two commas like so: ,,</source>
|
||||
<target>开始页面上用于下载的全局自定义参数。参数由两个逗号分隔:,,</target>
|
||||
<source>Global custom args for downloads on the home page. (Set args for subscriptions for each subscriptions separately!) Args are delimited using two commas like so: ,,</source>
|
||||
<target>开始页面上用于下载的全局自定义参数。(单独为每个订阅设置订阅参数!) 参数由两个逗号分隔:,,</target>
|
||||
<context-group purpose="location">
|
||||
<context context-type="sourcefile">app/settings/settings.component.html</context>
|
||||
<context context-type="linenumber">146</context>
|
||||
|
||||
Reference in New Issue
Block a user