mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-17 18:20:56 +03:00
Compare commits
59 Commits
4.3-bug-fi
...
docker-ubu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab5cd409bb | ||
|
|
e0509e8091 | ||
|
|
83a9d93ce5 | ||
|
|
2707b09627 | ||
|
|
8118906b0a | ||
|
|
2ad42ebf27 | ||
|
|
2b3490e52c | ||
|
|
55fd60acd3 | ||
|
|
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 | ||
|
|
e5b256b8df | ||
|
|
05ea5a816f | ||
|
|
01fd2fb990 | ||
|
|
1bb4d9dbf6 | ||
|
|
0c1568b38d | ||
|
|
f8a0d14968 | ||
|
|
f5894e6bc0 | ||
|
|
f205f8e58e | ||
|
|
02e683add9 | ||
|
|
d90b2d3687 | ||
|
|
32b68033e8 | ||
|
|
08027a5c0b | ||
|
|
25aac19cfb |
2
.github/workflows/docker.yml
vendored
2
.github/workflows/docker.yml
vendored
@@ -8,9 +8,9 @@ on:
|
|||||||
- '.vscode/**'
|
- '.vscode/**'
|
||||||
- 'chrome-extension/**'
|
- 'chrome-extension/**'
|
||||||
- 'releases/**'
|
- 'releases/**'
|
||||||
|
- '**/**.md'
|
||||||
- '**.crx'
|
- '**.crx'
|
||||||
- '**.pem'
|
- '**.pem'
|
||||||
- '**.md'
|
|
||||||
- '.dockerignore'
|
- '.dockerignore'
|
||||||
- '.gitignore'
|
- '.gitignore'
|
||||||
|
|
||||||
|
|||||||
36
Dockerfile
36
Dockerfile
@@ -1,22 +1,24 @@
|
|||||||
FROM ubuntu:20.04 AS ffmpeg
|
FROM ubuntu:22.04 AS ffmpeg
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
COPY docker-build.sh .
|
RUN apt-get update && apt-get install -y software-properties-common
|
||||||
RUN sh ./docker-build.sh
|
RUN add-apt-repository ppa:savoury1/ffmpeg4
|
||||||
|
RUN add-apt-repository ppa:savoury1/ffmpeg5 && apt-get update && apt-get install -y ffmpeg
|
||||||
|
|
||||||
FROM ubuntu:20.04 as frontend
|
#--------------# Stage 2
|
||||||
|
|
||||||
|
FROM ubuntu:22.04 as frontend
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
RUN apt-get update && apt-get -y install \
|
RUN apt-get update && apt-get -y install \
|
||||||
curl \
|
curl \
|
||||||
gnupg && \
|
gnupg \
|
||||||
curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
|
# Ubuntu 22.04 ships Node.JS 12 by default :)
|
||||||
apt-get -y install \
|
|
||||||
nodejs \
|
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
|
# spares us this spaghetti approach: https://stackoverflow.com/a/60547197
|
||||||
yarn && \
|
npm && \
|
||||||
apt-get install -f && \
|
apt-get install -f && \
|
||||||
npm config set strict-ssl false && \
|
npm config set strict-ssl false && \
|
||||||
npm install -g @angular/cli
|
npm install -g @angular/cli
|
||||||
@@ -29,9 +31,9 @@ COPY [ "angular.json", "tsconfig.json", "/build/" ]
|
|||||||
COPY [ "src/", "/build/src/" ]
|
COPY [ "src/", "/build/src/" ]
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
#--------------#
|
#--------------# Final Stage
|
||||||
|
|
||||||
FROM ubuntu:20.04
|
FROM ubuntu:22.04
|
||||||
|
|
||||||
ENV UID=1000 \
|
ENV UID=1000 \
|
||||||
GID=1000 \
|
GID=1000 \
|
||||||
@@ -42,12 +44,13 @@ ENV DEBIAN_FRONTEND=noninteractive
|
|||||||
|
|
||||||
RUN groupadd -g $GID $USER && useradd --system -g $USER --uid $UID $USER
|
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 \
|
RUN apt-get update && apt-get -y install \
|
||||||
npm \
|
npm \
|
||||||
python2 \
|
python2 \
|
||||||
python3 \
|
python3 \
|
||||||
atomicparsley && \
|
gosu \
|
||||||
|
atomicparsley \
|
||||||
|
--no-install-recommends && \
|
||||||
apt-get install -f && \
|
apt-get install -f && \
|
||||||
apt-get autoremove --purge && \
|
apt-get autoremove --purge && \
|
||||||
apt-get autoremove && \
|
apt-get autoremove && \
|
||||||
@@ -55,14 +58,17 @@ RUN apt-get update && apt-get -y install \
|
|||||||
rm -rf /var/lib/apt
|
rm -rf /var/lib/apt
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=ffmpeg /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg
|
COPY --chown=$UID:$GID --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/ffprobe", "/usr/local/bin/ffprobe" ]
|
||||||
COPY --chown=$UID:$GID [ "backend/package.json", "backend/package-lock.json", "/app/" ]
|
COPY --chown=$UID:$GID [ "backend/package.json", "backend/package-lock.json", "/app/" ]
|
||||||
ENV PM2_HOME=/app/pm2
|
ENV PM2_HOME=/app/pm2
|
||||||
RUN npm config set strict-ssl false && \
|
RUN npm config set strict-ssl false && \
|
||||||
npm install pm2 -g && \
|
npm install pm2 -g && \
|
||||||
npm install && chown -R $UID:$GID ./
|
npm install && chown -R $UID:$GID ./
|
||||||
|
|
||||||
|
# needed for ubuntu, see #596
|
||||||
|
RUN ln -s /usr/bin/python3 /usr/bin/python
|
||||||
|
|
||||||
COPY --chown=$UID:$GID --from=frontend [ "/build/backend/public/", "/app/public/" ]
|
COPY --chown=$UID:$GID --from=frontend [ "/build/backend/public/", "/app/public/" ]
|
||||||
COPY --chown=$UID:$GID [ "/backend/", "/app/" ]
|
COPY --chown=$UID:$GID [ "/backend/", "/app/" ]
|
||||||
|
|
||||||
|
|||||||
2
Dockerfile.heroku
Normal file
2
Dockerfile.heroku
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
FROM tzahi12345/youtubedl-material:nightly
|
||||||
|
CMD [ "pm2-runtime", "pm2.config.js" ]
|
||||||
1
app.json
1
app.json
@@ -2,6 +2,7 @@
|
|||||||
"name": "YoutubeDL-Material",
|
"name": "YoutubeDL-Material",
|
||||||
"description": "An open-source and self-hosted YouTube downloader based on Google's Material Design specifications.",
|
"description": "An open-source and self-hosted YouTube downloader based on Google's Material Design specifications.",
|
||||||
"repository": "https://github.com/Tzahi12345/YoutubeDL-Material",
|
"repository": "https://github.com/Tzahi12345/YoutubeDL-Material",
|
||||||
|
"stack": "container",
|
||||||
"logo": "https://i.imgur.com/GPzvPiU.png",
|
"logo": "https://i.imgur.com/GPzvPiU.png",
|
||||||
"keywords": ["youtube-dl", "youtubedl-material", "nodejs"]
|
"keywords": ["youtube-dl", "youtubedl-material", "nodejs"]
|
||||||
}
|
}
|
||||||
@@ -249,14 +249,6 @@ async function startServer() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function restartServer(is_update = false) {
|
|
||||||
logger.info(`${is_update ? 'Update complete! ' : ''}Restarting server...`);
|
|
||||||
|
|
||||||
// the following line restarts the server through nodemon
|
|
||||||
fs.writeFileSync(`restart${is_update ? '_update' : '_general'}.json`, 'internal use only');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function updateServer(tag) {
|
async function updateServer(tag) {
|
||||||
// no tag provided means update to the latest version
|
// no tag provided means update to the latest version
|
||||||
if (!tag) {
|
if (!tag) {
|
||||||
@@ -297,7 +289,7 @@ async function updateServer(tag) {
|
|||||||
updating: true,
|
updating: true,
|
||||||
'details': 'Update complete! Restarting server...'
|
'details': 'Update complete! Restarting server...'
|
||||||
}
|
}
|
||||||
restartServer(true);
|
utils.restartServer(true);
|
||||||
}, err => {
|
}, err => {
|
||||||
logger.error(err);
|
logger.error(err);
|
||||||
updaterStatus = {
|
updaterStatus = {
|
||||||
@@ -676,6 +668,7 @@ async function getUrlInfos(url) {
|
|||||||
|
|
||||||
async function startYoutubeDL() {
|
async function startYoutubeDL() {
|
||||||
// auto update youtube-dl
|
// auto update youtube-dl
|
||||||
|
youtubedl_api.verifyBinaryExistsLinux();
|
||||||
const update_available = await youtubedl_api.checkForYoutubeDLUpdate();
|
const update_available = await youtubedl_api.checkForYoutubeDLUpdate();
|
||||||
if (update_available) await youtubedl_api.updateYoutubeDL(update_available);
|
if (update_available) await youtubedl_api.updateYoutubeDL(update_available);
|
||||||
}
|
}
|
||||||
@@ -764,7 +757,7 @@ app.get('/api/versionInfo', (req, res) => {
|
|||||||
|
|
||||||
app.post('/api/restartServer', optionalJwt, (req, res) => {
|
app.post('/api/restartServer', optionalJwt, (req, res) => {
|
||||||
// delayed by a little bit so that the client gets a response
|
// delayed by a little bit so that the client gets a response
|
||||||
setTimeout(() => {restartServer()}, 100);
|
setTimeout(() => {utils.restartServer()}, 100);
|
||||||
res.send({success: true});
|
res.send({success: true});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1802,6 +1795,7 @@ app.post('/api/updateTaskData', optionalJwt, async (req, res) => {
|
|||||||
|
|
||||||
app.post('/api/getDBBackups', optionalJwt, async (req, res) => {
|
app.post('/api/getDBBackups', optionalJwt, async (req, res) => {
|
||||||
const backup_dir = path.join('appdata', 'db_backup');
|
const backup_dir = path.join('appdata', 'db_backup');
|
||||||
|
fs.ensureDirSync(backup_dir);
|
||||||
const db_backups = [];
|
const db_backups = [];
|
||||||
|
|
||||||
const candidate_backups = await utils.recFindByExt(backup_dir, 'bak', null, [], false);
|
const candidate_backups = await utils.recFindByExt(backup_dir, 'bak', null, [], false);
|
||||||
|
|||||||
@@ -222,4 +222,83 @@ exports.AVAILABLE_PERMISSIONS = [
|
|||||||
|
|
||||||
exports.DETAILS_BIN_PATH = 'node_modules/youtube-dl/bin/details'
|
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';
|
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) => {
|
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);
|
const success = await exports._connectToDB(custom_connection_string);
|
||||||
if (success) return true;
|
if (success) return true;
|
||||||
|
|
||||||
|
|||||||
@@ -485,7 +485,7 @@ exports.generateArgs = async (url, type, options, user_uid = null, simulated = f
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (options.additionalArgs && options.additionalArgs !== '') {
|
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');
|
const rate_limit = config_api.getConfigItem('ytdl_download_rate_limit');
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ fi
|
|||||||
# chown current working directory to current user
|
# chown current working directory to current user
|
||||||
if [ "$*" = "$CMD" ] && [ "$(id -u)" = "0" ]; then
|
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."
|
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
|
fi
|
||||||
|
|
||||||
exec "$@"
|
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);
|
assert(fs.existsSync(nfo_file_path), true);
|
||||||
fs.unlinkSync(nfo_file_path);
|
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() {
|
describe('Tasks', function() {
|
||||||
|
|||||||
@@ -415,6 +415,47 @@ async function fetchFile(url, path, file_label) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function restartServer(is_update = false) {
|
||||||
|
logger.info(`${is_update ? 'Update complete! ' : ''}Restarting server...`);
|
||||||
|
|
||||||
|
// the following line restarts the server through nodemon
|
||||||
|
fs.writeFileSync(`restart${is_update ? '_update' : '_general'}.json`, 'internal use only');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
// objects
|
||||||
|
|
||||||
function File(id, title, thumbnailURL, isAudio, duration, url, uploader, size, path, upload_date, description, view_count, height, abr) {
|
function File(id, title, thumbnailURL, isAudio, duration, url, uploader, size, path, upload_date, description, view_count, height, abr) {
|
||||||
@@ -458,5 +499,7 @@ module.exports = {
|
|||||||
wait: wait,
|
wait: wait,
|
||||||
checkExistsWithTimeout: checkExistsWithTimeout,
|
checkExistsWithTimeout: checkExistsWithTimeout,
|
||||||
fetchFile: fetchFile,
|
fetchFile: fetchFile,
|
||||||
|
restartServer: restartServer,
|
||||||
|
injectArgs: injectArgs,
|
||||||
File: File
|
File: File
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ const utils = require('./utils');
|
|||||||
const CONSTS = require('./consts');
|
const CONSTS = require('./consts');
|
||||||
const config_api = require('./config.js');
|
const config_api = require('./config.js');
|
||||||
|
|
||||||
|
const OUTDATED_VERSION = "2020.00.00";
|
||||||
|
|
||||||
const is_windows = process.platform === 'win32';
|
const is_windows = process.platform === 'win32';
|
||||||
|
|
||||||
const download_sources = {
|
const download_sources = {
|
||||||
@@ -31,7 +33,7 @@ exports.checkForYoutubeDLUpdate = async () => {
|
|||||||
let current_app_details_exists = fs.existsSync(CONSTS.DETAILS_BIN_PATH);
|
let current_app_details_exists = fs.existsSync(CONSTS.DETAILS_BIN_PATH);
|
||||||
if (!current_app_details_exists) {
|
if (!current_app_details_exists) {
|
||||||
logger.warn(`Failed to get youtube-dl binary details at location '${CONSTS.DETAILS_BIN_PATH}'. Generating file...`);
|
logger.warn(`Failed to get youtube-dl binary details at location '${CONSTS.DETAILS_BIN_PATH}'. Generating file...`);
|
||||||
fs.writeJSONSync(CONSTS.DETAILS_BIN_PATH, {"version":"2020.00.00", "downloader": default_downloader});
|
fs.writeJSONSync(CONSTS.DETAILS_BIN_PATH, {"version": OUTDATED_VERSION, "downloader": default_downloader});
|
||||||
}
|
}
|
||||||
let current_app_details = JSON.parse(fs.readFileSync(CONSTS.DETAILS_BIN_PATH));
|
let current_app_details = JSON.parse(fs.readFileSync(CONSTS.DETAILS_BIN_PATH));
|
||||||
let current_version = current_app_details['version'];
|
let current_version = current_app_details['version'];
|
||||||
@@ -86,6 +88,18 @@ exports.updateYoutubeDL = async (latest_update_version) => {
|
|||||||
await download_sources[default_downloader]['func'](latest_update_version);
|
await download_sources[default_downloader]['func'](latest_update_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.verifyBinaryExistsLinux = () => {
|
||||||
|
const details_json = fs.readJSONSync(CONSTS.DETAILS_BIN_PATH);
|
||||||
|
if (!is_windows && details_json && details_json['path'].includes('.exe')) {
|
||||||
|
details_json['path'] = 'node_modules/youtube-dl/bin/youtube-dl';
|
||||||
|
details_json['exec'] = 'youtube-dl';
|
||||||
|
details_json['version'] = OUTDATED_VERSION;
|
||||||
|
fs.writeJSONSync(CONSTS.DETAILS_BIN_PATH, details_json);
|
||||||
|
|
||||||
|
utils.restartServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function downloadLatestYoutubeDLBinary(new_version) {
|
async function downloadLatestYoutubeDLBinary(new_version) {
|
||||||
const file_ext = is_windows ? '.exe' : '';
|
const file_ext = is_windows ? '.exe' : '';
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
-----BEGIN PRIVATE KEY-----
|
|
||||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDMX9Wk5SM5cIfY
|
|
||||||
6ReKX3ybY1rsbNbOzG8ceN7yyeXB0mor8pVsX1MOna2HewOyBuaaYNJRO4tJBxic
|
|
||||||
7a8zQErfgHL/i/QrVvVCpfJ7xKvq6zij5NYoqd/FBUwawqjeH5/voIcAp9z5Vmsr
|
|
||||||
kL0sxJUKy6b4IWNp3noU7Nvq2RwxnXQbKDhz8FrX6oQAnDC6gsG5a2OSPsaE4oqw
|
|
||||||
6nmonORJypmpP5hqyHY8ffXBT2lAxjHT7OnYbaCBe2TQP8+rH6rDBOhjVNtUJ089
|
|
||||||
ocTQL6LtQEPkcF4yKJmtcOwHl8OPGZs5l9i8xb4j9RuSPkm2lbzZX8sOsdGGoqJZ
|
|
||||||
q68nYhsHAgMBAAECggEAXmtKEzfPObq88B/kAcgSk+FngMHZzcmR7bgD3GwdSxnQ
|
|
||||||
dkRI9zvk7eQ35tcUwntAr4Lat6/ILjFqlBmVLxrdXHuF5Xz9jcZLYgKzz61xdYM9
|
|
||||||
dC6FKF0u5eGIIvbauGAo7jaeGFX1F3Zu5b4lP9kEOGwU1B7sxF0FzsQM5+dtCJgv
|
|
||||||
We/hWQeF+9gtoVnkCSS/Mq2p0UomXXHW0Bz4+HuHlTR9aiYbviYnotABiLUhZyzt
|
|
||||||
v5yUaktb9qniBfdLpRlq8cp06xYlTEA9gJpa4Pnok8OWUsbAiW6EiXUSaZ/cchVa
|
|
||||||
AnO8WWYvVOnnt6WHI3+QdFTnqVjE5TBX4N/7bVhHGQKBgQD0dtbFqp7vZK/jVYvE
|
|
||||||
z0WPdySOg2ZDmoSfk5ZlR1+Y9zWToHv0qu8zqoOjL8Ubxrh9fGlOow+cCVdkEuaa
|
|
||||||
jWC2AWetuRvW0Z5A3XMXr0/N/1fgOkTqtp3WNrUPjVJahEg3lN+90opgFoT8swSi
|
|
||||||
s1oxW0oLcVIlrjhGBXAPCfsAuQKBgQDWBLRhHsRAvGcK5wGuVnxVApTIyBOermsW
|
|
||||||
3bJt+7+UI+4sYrBAwkWdQG93IG0cQtn48TEPBgmR2fjRF5IFT9M4/u+QOeeByT7I
|
|
||||||
we7nVtHgSY5ByC9N0mjWbcmSg8fktz/LonjldNC4kWdOFb75fxGf8kOGS5rUaMA4
|
|
||||||
zHucfB6ZvwKBgQCPHJrysMXGY21MaqIeHzEboaX3ABl37hdBzAa5V6UxSVdGCydF
|
|
||||||
vmO2HVZey/JaJmWOoKyNaowSzq0oWqBBTg6VvhDR9JHFmoVId9uOvAS+FYN+Mt5x
|
|
||||||
gWK5KuGoLxVNBC+6yh6JY526TrSfsrU+Aj0Es+qO9FIg2PL8muZVB4S3kQKBgH/5
|
|
||||||
CDMaxpc/EQ5/2413wZjDllwI51J3USm3Hz6Mzp2ybnSz/lh60k2Zfg1polTH1Lb6
|
|
||||||
4i7tmUNRZ2sAARyUAuWN64n+VeRRhe1dqZFDZPQMh7fmEAMk0fOGaoXlrt2ghdEq
|
|
||||||
Mchi9Xun1nHmpu9hgBR4NNBU3RwuFuLfwvprbZDZAoGAWa62QJChE86xQGP1MrL2
|
|
||||||
SbIzw3cfeP5xdQ3MKldJiy5IkbMR7Z13WZ7FwvPTy0g/onLHD1rqlm1kUMsGRHpD
|
|
||||||
5vH06PNpKXQ6x8BYaRGtE6P39jLycO/X+WK/lYTrWo1bR+mGCebDh4B5XrwT3gI6
|
|
||||||
x4Gvz134pZCTyQCf5JCwbQs=
|
|
||||||
-----END PRIVATE KEY-----
|
|
||||||
3
heroku.yml
Normal file
3
heroku.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
build:
|
||||||
|
docker:
|
||||||
|
web: Dockerfile.heroku
|
||||||
@@ -6,13 +6,14 @@
|
|||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"build": "ng build --configuration production",
|
"build": "ng build --configuration production",
|
||||||
"prebuild": "node src/postbuild.mjs",
|
"prebuild": "node src/postbuild.js",
|
||||||
"heroku-postbuild": "npm install --prefix backend",
|
"heroku-postbuild": "npm install --prefix backend",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
"e2e": "ng e2e",
|
"e2e": "ng e2e",
|
||||||
"electron": "ng build --base-href ./ && electron .",
|
"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": {
|
"engines": {
|
||||||
"node": "12.3.1",
|
"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>
|
<ng-container i18n="Subscription playlist not available text">Name not available. Playlist retrieval in progress.</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
<button mat-icon-button (click)="editSubscription(sub)">
|
||||||
|
<mat-icon>edit</mat-icon>
|
||||||
|
</button>
|
||||||
<button mat-icon-button (click)="showSubInfo(sub)">
|
<button mat-icon-button (click)="showSubInfo(sub)">
|
||||||
<mat-icon>info</mat-icon>
|
<mat-icon>info</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1545,8 +1545,8 @@
|
|||||||
<note priority="1" from="description">Custom args input placeholder</note>
|
<note priority="1" from="description">Custom args input placeholder</note>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="6b995e7130b4d667eaab6c5f61b362ace486d26d" datatype="html">
|
<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>
|
<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. Scheidt deze met komma's: ,,</target>
|
<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-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/settings/settings.component.html</context>
|
<context context-type="sourcefile">src/app/settings/settings.component.html</context>
|
||||||
<context context-type="linenumber">134</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">
|
<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">
|
<file source-language="en-US" datatype="plaintext" original="ng2.template" target-language="zh-Hans">
|
||||||
<body>
|
<body>
|
||||||
@@ -902,8 +902,8 @@
|
|||||||
<note priority="1" from="description">Video path setting input hint</note>
|
<note priority="1" from="description">Video path setting input hint</note>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="6b995e7130b4d667eaab6c5f61b362ace486d26d" datatype="html">
|
<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>
|
<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>
|
<target>开始页面上用于下载的全局自定义参数。(单独为每个订阅设置订阅参数!) 参数由两个逗号分隔:,,</target>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">app/settings/settings.component.html</context>
|
<context context-type="sourcefile">app/settings/settings.component.html</context>
|
||||||
<context context-type="linenumber">146</context>
|
<context context-type="linenumber">146</context>
|
||||||
|
|||||||
43
src/postbuild.js
Normal file
43
src/postbuild.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
const fs = require('fs-extra');
|
||||||
|
const path = require('path');
|
||||||
|
const xliffToJSON = require('xliff-to-json');
|
||||||
|
|
||||||
|
async function recFindByExt(base,ext,files,result)
|
||||||
|
{
|
||||||
|
files = files || (await fs.readdir(base))
|
||||||
|
result = result || []
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
var newbase = path.join(base,file)
|
||||||
|
if ( (await fs.stat(newbase)).isDirectory() )
|
||||||
|
{
|
||||||
|
result = await recFindByExt(newbase,ext,await fs.readdir(newbase),result)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( file.substr(-1*(ext.length+1)) == '.' + ext )
|
||||||
|
{
|
||||||
|
result.push(newbase)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
// outputs array of supported locales
|
||||||
|
async function createLocalizationJSON() {
|
||||||
|
xliffToJSON.convert('src/assets/i18n');
|
||||||
|
const files = await recFindByExt(path.join('src', 'assets', 'i18n'), 'json');
|
||||||
|
const locales = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < files.length; i++) {
|
||||||
|
const file = path.basename(files[i]);
|
||||||
|
const file_parts = file.split('.');
|
||||||
|
locales.push(file_parts[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.unlinkSync('src/assets/i18n/messages.en.json');
|
||||||
|
fs.writeJSONSync('src/assets/i18n/supported_locales.json', {supported_locales: locales});
|
||||||
|
}
|
||||||
|
|
||||||
|
createLocalizationJSON();
|
||||||
Binary file not shown.
Reference in New Issue
Block a user