Compare commits

...

5 Commits

Author SHA1 Message Date
2653361486 deluge docker-compose.yml 2022-11-17 23:17:11 +00:00
194a977fc9 Local gerbera build 2022-11-17 23:17:11 +00:00
537709c30c mkv_normalise.sh 2022-11-17 23:17:11 +00:00
ae4e3aa7c7 backup private folders 2022-11-17 23:17:11 +00:00
18527c5e1d gitea moved to 9082 2022-11-17 23:17:11 +00:00
8 changed files with 434 additions and 13 deletions

159
bin/avi2mp4.sh Executable file
View File

@@ -0,0 +1,159 @@
#!/bin/bash
function setTitle(){
KEY="$1"
NFO="${KEY}.nfo"
if [ -f "$NFO" ]; then
TITLE=$(xmllint --xpath 'string(//title)' "$NFO")
YEAR=$(xmllint --xpath 'string(//year)' "$NFO")
fi
if [ -n "$TITLE" ]; then
echo "Setting title to '$TITLE'"
$RUN mkvpropedit --set title="$TITLE" "$MKV"
fi
# [ -n "$YEAR" ] && mkvpropedit --set year="$YEAR" "$MKV"
}
function appendMainInput() {
IN="$1"
CMD+=" -i \"${IN}\""
MAIN_INPUT_ID=$INPUT_ID
INPUT_ID=$((INPUT_ID+1))
}
function appendMainInputMapping() {
if [ -n "$MAIN_INPUT_ID" ]; then
CMD+=" -map $MAIN_INPUT_ID -c copy"
fi
}
function appendSrt() {
KEY="$1"
SRT="${KEY}.srt"
if [ -f "$SRT" ]; then
echo "Adding SRT: $SRT".
CMD+=" -i \"${SRT}\""
SRT_INPUT_ID=$INPUT_ID
INPUT_ID=$((INPUT_ID+1))
fi
}
function appendSrtMapping() {
if [ -n "$SRT_INPUT_ID" ]; then
echo "Mapping SRT: $SRT_INPUT_ID".
CMD+=" -map $SRT_INPUT_ID -c:s mov_text -metadata:s:s:0 language=eng"
fi
}
function addCover(){
KEY="$1"
COVER="${KEY}-poster.jpg"
if [ ! -f "$COVER" ]; then
COVER="${KEY}.jpg"
fi
if [ -f "$COVER" ]; then
# convert "$COVER" -resize 600x /tmp/cover.jpg
echo "Attaching cover '$COVER'"
ACMD+=" --artwork \"${COVER}\""
fi
}
function addTitle(){
KEY="$1"
NFO="${KEY}.nfo"
if [ -f "$NFO" ]; then
TITLE=$(xmllint --xpath 'string(//title)' "$NFO")
fi
if [ -n "$TITLE" ]; then
echo "Setting title to '$TITLE'"
ACMD+=" --title \"$TITLE\""
fi
}
function addYear(){
KEY="$1"
NFO="${KEY}.nfo"
if [ -f "$NFO" ]; then
YEAR=$(xmllint --xpath 'string(//year)' "$NFO")
fi
if [ -n "$TITLE" ]; then
echo "Setting year to '$YEAR'"
ACMD+=" --year $YEAR"
fi
}
function mkvAddSub() {
MKV="$1"
IDX="${KEY}.idx"
SUB="${KEY}.sub"
if [ -f "$SUB" ]; then
OUT="${KEY}.SUB.mkv"
echo "Adding SUB: $OUT".
OUT+=" -i '$SRT' -map $INPUT_ID -c:s mov_text -metadata:s:s:1 language=eng"
$RUN ffmpeg -y -i "$MKV" -i "$IDX" -i "$SUB" -map 0 -c copy -map 1 -c:s:1 dvd_subtitle -f matroska "$OUT"
INPUT_ID=$((INPUT_ID+1))
fi
}
ARGS=$(getopt -o 'nas' -- "$@") || exit
eval "set -- $ARGS"
RUN=eval
ADD_SRT=1
while true; do
case $1 in
-n)
RUN=echo
;;
-a)
ADD_AAC=1
;;
-s)
ADD_SRT=1
;;
--)
shift
break
;;
*)
exit 1
;;
esac
shift
done
INPUT="$1"
INPUT_ID=0
KEY="${INPUT%.*}"
OUT="${KEY}.mp4"
CMD="ffmpeg"
appendMainInput "$INPUT"
if [ -n "$ADD_SRT" ]; then
appendSrt "$KEY"
# appendSub "$KEY"
fi
appendMainInputMapping
# setTitle "$KEY"
appendSrtMapping
CMD+=" \"${OUT}\""
$RUN "$CMD"
addTitle "$KEY"
addYear "$KEY"
addCover "$KEY"
if [ -n "$ACMD" ]; then
TMPOUT="${KEY}.tmp.mp4"
$RUN "mv \"${OUT}\" \"${TMPOUT}\" "
$RUN "AtomicParsley \"${TMPOUT}\" $ACMD --output \"${OUT}\""
fi

View File

@@ -91,15 +91,10 @@ echo start `$DATE` | $LOG
#
# Sync folders
#
#backup "/srv/nextcloud" "/mnt/hdd/backup/docker"
# backup "/var/lib/docker/volumes" "/mnt/hdd/backup/docker"
backup_gitea
backup_nextcloud
backup "/src/gerbera/music" "/mnt/hdd/public"
#backup "/srv/gitlab" "/mnt/hdd/backup/gitlab"
#backup "/srv/git" "/mnt/hdd/backup/git"
backup "/src/calibre" "/mnt/hdd/backup"
#
# Backup Lusntag
@@ -117,7 +112,7 @@ backupyerevak "/home/vahagn/devel" "/mnt/hdd/backup/yerevak"
# Backup hdd1 to hdd2
#
backuphdd "backup"
backuphdd "vahagn"
backuphdd "private"
for i in $(ls /mnt/hdd/public); do
if [ $i != "movies" ]; then
backuphdd "public/$i"

193
bin/mkv_normalise.sh Executable file
View File

@@ -0,0 +1,193 @@
#!/bin/bash
function mkvSetTitle(){
MKV="$1"
KEY="$2"
NFO="${KEY}.nfo"
if [ -f "$NFO" ]; then
TITLE=$(xmllint --xpath 'string(//title)' "$NFO")
YEAR=$(xmllint --xpath 'string(//year)' "$NFO")
fi
if [ -n "$TITLE" ]; then
echo "Setting title to '$TITLE'"
$RUN mkvpropedit --set title="$TITLE" "$MKV"
fi
# [ -n "$YEAR" ] && mkvpropedit --set year="$YEAR" "$MKV"
}
function mkvAddCover(){
MKV="$1"
KEY="$2"
COVER="${KEY}-poster.jpg"
if [ -f "$COVER" ]; then
convert "$COVER" -resize 600x /tmp/cover.jpg
echo "Attaching cover '$COVER'"
$RUN mkvpropedit --replace-attachment name:cover.jpg:/tmp/cover.jpg "$MKV"
if [ $? -ne 0 ]; then
$RUN mkvpropedit --attachment-name cover.jpg --attachment-mime-type "image/jpeg" --add-attachment /tmp/cover.jpg "$MKV"
fi
fi
}
function mkvAddSmallCover(){
MKV="$1"
KEY="$2"
COVER="${KEY}-poster.jpg"
if [ -f "$COVER" ]; then
convert "$COVER" -resize 120x /tmp/small_cover.jpg
echo "Attaching small cover '$COVER'"
$RUN mkvpropedit --replace-attachment name:small_cover.jpg:/tmp/small_cover.jpg "$MKV"
if [ $? -ne 0 ]; then
$RUN mkvpropedit --attachment-name small_cover.jpg --attachment-mime-type "image/jpeg" --add-attachment /tmp/small_cover.jpg "$MKV"
fi
fi
}
function mkvAddPoster(){
MKV="$1"
KEY="$2"
FILE="${KEY}-poster.jpg"
if [ -f "$FILE" ]; then
echo "Attaching poster '$FILE'"
$RUN mkvpropedit --replace-attachment "name:poster.jpg:$FILE" "$MKV"
if [ $? -ne 0 ]; then
$RUN mkvpropedit --attachment-name poster.jpg --attachment-mime-type "image/jpeg" --add-attachment "$FILE" "$MKV"
fi
fi
}
function mkvAddFanart(){
MKV="$1"
KEY="$2"
FILE="${KEY}-fanart.jpg"
if [ -f "$FILE" ]; then
echo "Attaching fanart '$FILE'"
$RUN mkvpropedit --replace-attachment "name:fanart.jpg:$FILE" "$MKV"
if [ $? -ne 0 ]; then
$RUN mkvpropedit --attachment-name fanart.jpg --attachment-mime-type "image/jpeg" --add-attachment "$FILE" "$MKV"
fi
fi
}
function mkvAddNfo(){
MKV="$1"
KEY="$2"
FILE="${KEY}.nfo"
if [ -f "$FILE" ]; then
echo "Attaching NFO '$FILE'"
$RUN mkvpropedit --replace-attachment "name:movie.nfo:$FILE" "$MKV"
if [ $? -ne 0 ]; then
$RUN mkvpropedit --attachment-name movie.nfo --attachment-mime-type "application/xml" --add-attachment "$FILE" "$MKV"
fi
fi
}
function mkvMake() {
IN="$1"
KEY="$2"
EXT="${IN##*.}"
if [ "$EXT" != "mkv" ]; then
OUT="${KEY}.mkv"
echo "Converting to mkv: $OUT".
$RUN ffmpeg -i "$IN" -map 0 -c copy -use_wallclock_as_timestamps 1 -fflags +genpts -f matroska "$OUT"
else
echo "Already an MKV. $OUT"
fi
}
function mkvAddAac() {
MKV="$1"
KEY="$2"
ffprobe "$MKV" 2>&1 | grep Stream | grep dts
if [ $? -eq 0 ]; then
ffprobe "$MKV" 2>&1 | grep Stream | grep aac
if [ $? -ne 0 ]; then
OUT="${KEY}.AAC.mkv"
ENCODE_AAC=""
echo "DTS stream found, adding AAC: $OUT".
$RUN ffmpeg -y -i "$MKV" -strict -2 -map 0 -c copy -map 0:a0 -c:a:1 aac -b:a 192k -ac 2 -f matroska "$OUT"
fi
fi
}
function mkvAddSrt() {
MKV="$1"
KEY="$2"
SRT="${KEY}.srt"
if [ -f "$SRT" ]; then
OUT="${KEY}.SRT.mkv"
echo "Adding SRT: $OUT".
$RUN ffmpeg -y -i "$MKV" -i "$SRT" -map 0 -map 1 -c copy -metadata:s:s:1 language=eng -f matroska "$OUT"
fi
}
function mkvAddSub() {
MKV="$1"
KEY="$2"
IDX="${KEY}.idx"
SUB="${KEY}.sub"
if [ -f "$SUB" ]; then
OUT="${KEY}.SUB.mkv"
echo "Adding SUB: $OUT".
$RUN ffmpeg -y -i "$MKV" -i "$IDX" -i "$SUB" -map 0 -c copy -map 1 -c:s:1 dvd_subtitle -f matroska "$OUT"
fi
}
ARGS=$(getopt -o 'nas' -- "$@") || exit
eval "set -- $ARGS"
while true; do
case $1 in
-n)
RUN=echo
;;
-a)
ADD_AAC=1
;;
-s)
ADD_SRT=1
;;
--)
shift
break
;;
*)
exit 1
;;
esac
shift
done
INPUT="$1"
KEY="${INPUT%.*}"
OUT="$INPUT"
echo $INPUT
echo $KEY
echo $OUT
if [ -n "$ADD_AAC" ]; then
mkvAddAac "$OUT" "$KEY"
exit 0
fi
if [ -n "$ADD_SRT" ]; then
mkvAddSrt "$OUT" "$KEY"
mkvAddSub "$OUT" "$KEY"
exit 0
fi
mkvMake "$OUT" "$KEY"
mkvSetTitle "$OUT" "$KEY"
mkvAddCover "$OUT" "$KEY"
mkvAddSmallCover "$OUT" "$KEY"
mkvAddPoster "$OUT" "$KEY"
mkvAddFanart "$OUT" "$KEY"
# mkvAddNfo "$OUT" "$KEY"

View File

@@ -0,0 +1,35 @@
version: '3.2'
services:
deluge:
#image: lscr.io/linuxserver/deluge:latest
# image: ebrianne/docker-deluge-openvpn
image: deluge:vahagn
# image: c4f0d093ce57
container_name: deluge
environment:
- OPENVPN_PROVIDER=expressvpn
- OPENVPN_CONFIG=my_expressvpn_germany_-_nuremberg_udp
#- OPENVPN_CONFIG=my_expressvpn_belarus_udp
# - OPENVPN_CONFIG=my_expressvpn_armenia_udp
# - OPENVPN_CONFIG=my_expressvpn_usa_-_lincoln_park_udp
- OPENVPN_USERNAME=r1n1j7kcx3uvierq5gqo2rsq
- OPENVPN_PASSWORD=3b2x1l8ef7evn7hbmrqygg2w
- LOCAL_NETWORK=192.168.0.0/16
- PUID=998
- PGID=998
- TZ=Europe/London
#- DELUGE_LOGLEVEL=error #optional
cap_add:
- NET_ADMIN
sysctls:
- net.ipv6.conf.all.disable_ipv6=1
ports:
- 8112:8112
- 58846:58846
#- 6881:6881/udp
volumes:
- /srv/deluge/config:/config
- /srv/deluge/downloads:/download
restart: unless-stopped

View File

@@ -0,0 +1,36 @@
version: '3.2'
services:
deluge:
image: lscr.io/linuxserver/deluge:latest
# image: adamfisher90/docker-deluge-1.3.11
# image: ebrianne/docker-deluge-openvpn
container_name: deluge2
environment:
# - OPENVPN_PROVIDER=expressvpn
# - OPENVPN_CONFIG=my_expressvpn_germany_-_nuremberg_udp
#- OPENVPN_CONFIG=my_expressvpn_belarus_udp
# - OPENVPN_CONFIG=my_expressvpn_armenia_udp
# - OPENVPN_CONFIG=my_expressvpn_usa_-_lincoln_park_udp
# - OPENVPN_USERNAME=r1n1j7kcx3uvierq5gqo2rsq
# - OPENVPN_PASSWORD=3b2x1l8ef7evn7hbmrqygg2w
# - LOCAL_NETWORK=192.168.0.0/16
- PUID=998
- PGID=998
- TZ=Europe/London
- DELUGE_LOGLEVEL=error #optional
# cap_add:
# - NET_ADMIN
sysctls:
- net.ipv6.conf.all.disable_ipv6=1
ports:
- 8112:8112
- 6881:6881
- 6881:6881/udp
- 58846:58846
#- 6881:6881/udp
volumes:
- /srv/deluge/config:/config
- /srv/deluge/downloads:/downloads
restart: unless-stopped

View File

@@ -1,4 +1,6 @@
FROM gerbera/gerbera:latest
FROM gerbera:vahagn
# FROM gerbera/gerbera:master
# FROM gerbera/gerbera:latest
# alpine:3.14 AS builder
RUN apk add --no-cache ffmpeg

View File

@@ -11,13 +11,14 @@ services:
expose:
- 49152
- 1900/udp
entrypoint: /sbin/tini -- /usr/local/bin/gerbera -D --port 49152 --config /var/run/gerbera/config.xml
entrypoint: /sbin/tini -- /bin/gerbera --port 49152 -D --config /var/run/gerbera/config.xml
volumes:
- /srv/gerbera/config/:/var/run/gerbera
- /srv/gerbera/music:/content/music:ro
- /srv/deluge/downloads/done/:/content/deluge:ro
# - /srv/gerbera/music:/content/music:ro
- /srv/gerbera/cached:/content/cartoon:ro
- /mnt/hdd2_2/movies:/content/video:ro
- /mnt/hdd/public/pix:/content/pix:ro
# - /mnt/hdd/public/pix:/content/pix:ro
- /home/vahagn/tmp/tmp/done:/content/new:ro
restart: always

View File

@@ -19,7 +19,7 @@ services:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "9082:3000"
- "222:22"
volumes: