Skip to content

Commit

Permalink
yt-dlp script and alias
Browse files Browse the repository at this point in the history
  • Loading branch information
wy580477 committed Apr 25, 2022
1 parent aa1da2d commit 4b188ed
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ RUN apk add --no-cache curl caddy jq bash findutils runit aria2 rclone apache2-u
&& sed -i 's|6800|443|g' /.aria2allinoneworkdir/ariang/js/aria-ng-f1dd57abb9.min.js \
&& curl -fsSL https://raw.githubusercontent.com/wy580477/filebrowser-install/master/get.sh | bash \
&& chmod +x /.aria2allinoneworkdir/service/*/run /.aria2allinoneworkdir/service/*/log/run /.aria2allinoneworkdir/aria2/*.sh /.aria2allinoneworkdir/*.sh \
&& mv /.aria2allinoneworkdir/ytdlptorclone.sh /usr/bin/ \
&& mv /.aria2allinoneworkdir/bashrc /mnt/data/config/ \
&& ln -s /.aria2allinoneworkdir/service/* /etc/service/

ENV DOWNLOAD_DIR=/mnt/data/videos
ENV STATE_DIR=/mnt/data/videos/.metube
ENV STATE_DIR=/.aria2allinoneworkdir/.metube

ENTRYPOINT ["sh","/.aria2allinoneworkdir/entrypoint.sh"]
2 changes: 1 addition & 1 deletion content/service/ttyd/.bashrc → content/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
export PS1='\w$ '
export HOME=/mnt/data
alias lux="lux -o /mnt/data/videos -n 50"
alias dlpr="yt-dlp --exec ytdlptorclone.sh -P /mnt/data/videos"
cd
18 changes: 18 additions & 0 deletions content/ytdlptorclone.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

DRIVE_NAME_AUTO="$(sed -n '1p' /mnt/data/config/rclone.conf | sed "s/\[//g" | sed "s/\]//g")"
if [ "${DRIVE_NAME}" = "auto" ]; then
DRIVENAME=${DRIVE_NAME_AUTO}
else
DRIVENAME=${DRIVE_NAME}
fi

DRIVE_DIR="$(grep ^drive-dir /mnt/data/config/script.conf | cut -d= -f2-)"
FILEPATH=$(echo $1 | sed 's:[^/]*$::')
FILENAME=$(echo $1 | sed 's:/.*/::')

if [[ "${POST_MODE}" =~ "move" ]]; then
rclone rc --user "${USER}" --pass "${PASSWORD}" --rc-addr=localhost:56802 operations/movefile srcFs="${FILEPATH}" srcRemote="${FILENAME}" dstFs="${DRIVENAME}":"${DRIVE_DIR}" dstRemote="${FILENAME}" _async=true
elif [[ "${POST_MODE}" =~ "copy" ]]; then
rclone rc --user "${USER}" --pass "${PASSWORD}" --rc-addr=localhost:56802 operations/copyfile srcFs="${FILEPATH}" srcRemote="${FILENAME}" dstFs="${DRIVENAME}":"${DRIVE_DIR}" dstRemote="${FILENAME}" _async=true
fi

0 comments on commit 4b188ed

Please sign in to comment.