Compare commits

...

11 Commits

15 changed files with 510 additions and 45 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

@@ -1,16 +1,23 @@
#!/bin/bash
set -x
if [ "$1" != "no-progress" ]; then
PROG=--progress
else
if [ "$1" == "no-progress" ]; then
shift
else
PROG=--progress
fi
if [ "$1" == "xxx" ]; then
shift
/usr/bin/rsync -av --inplace --append-verify --exclude=.\*.parts $PROG $* /mnt/ssd/deluge/xxx hrat:tmp/x
exit
fi
if [ ! -z "$*" ]; then
for i in "$@"; do
/usr/bin/rsync -av --inplace --progress --append-verify "/mnt/ssd/deluge/done/$i" "hrat:tmp/tmp/done/"
/usr/bin/rsync -av --chmod=o+rX 644 --inplace --progress --append-verify "/mnt/ssd/deluge/done/$i" "hrat:tmp/tmp/done/"
done
else
/usr/bin/rsync -av --inplace --append-verify $PROG /mnt/ssd/deluge/done hrat:tmp/tmp
/usr/bin/rsync -av --chmod=o+rX --inplace --append-verify $PROG /mnt/ssd/deluge/done hrat:tmp/tmp
fi

View File

@@ -0,0 +1,22 @@
version: "2.1"
services:
calibre:
image: lscr.io/linuxserver/calibre
container_name: calibre-app
environment:
- PUID=1002 #calibre
- PGID=1002 #calibre
- TZ=Europe/London
- PASSWORD= #optional
- CLI_ARGS= #optional
volumes:
- /var/lib/docker/volumes/nextcloud_nextcloud/_data/data/vahagn/files/Books:/downloads
- /srv/calibre/books:/books
- /srv/calibre/config:/config
ports:
- 9080:8080
- 9081:8081
restart: unless-stopped

View File

@@ -3,6 +3,7 @@ version: '3.2'
services:
calibre-web:
image: lscr.io/linuxserver/calibre-web
# image: technosoft2000/calibre-web
container_name: calibre-web
ports:
- 9083:8083
@@ -13,7 +14,9 @@ services:
- DOCKER_MODS=linuxserver/calibre-web:calibre #optional
# - OAUTHLIB_RELAX_TOKEN_SCOPE=1 #optional
volumes:
- /srv/calibre/books:/books:ro
# - /etc/localtime:/etc/localtime:ro
#- /srv/calibre/books:/books:ro
- /srv/calibre/books:/books
- /srv/calibre/config_web:/config
# - /srv/calibre/config_web/gmail.json:/app/calibre-web/gmail.json
restart: always

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

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

View File

@@ -4,15 +4,22 @@ version: '2'
services:
gerbera:
hostname: gerbera
image: gerbera/gerbera:latest
# image: gerbera/gerbera:latest
image: gerbera:local
network_mode: host
user: 1003:1003 #gerbera
expose:
- 49152
- 1900/udp
entrypoint: /sbin/tini -- /bin/gerbera --port 49152 -D --config /var/run/gerbera/config.xml
volumes:
- gerbera:/root/.config
- /srv/gerbera/music:/music
- /srv/gerbera/cached:/cached/cartoons
- /mnt/hdd2_2/movies:/video/movies
- /home/vahagn/tmp/tmp/done:/newvideo/new
- /srv/gerbera/config/:/var/run/gerbera
- /srv/deluge/downloads/done/:/content/deluge:ro
# - /srv/gerbera/music:/content/music:ro
- /srv/gerbera/cached:/content/cartoon:ro
- /mnt/hdd/public/movies/:/content/video2:ro
- /mnt/hdd2_2/movies:/content/video:ro
# - /mnt/hdd/public/pix:/content/pix:ro
- /home/vahagn/tmp/tmp/done:/content/new:ro
restart: always
volumes:
gerbera:

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:

View File

@@ -0,0 +1,24 @@
version: '2'
services:
kodi:
hostname: kodi
image: linuxserver/kodi-headless:latest
network_mode: host
environment:
- PUID=1003 #gerbera
- PGID=1003 #gerbera
- TZ=Europe/London
ports:
- 0.0.0.0:9180:9180
- 0.0.0.0:9090:9090
- 9777:9777/udp
volumes:
- /srv/gerbera/kodi/.kodi:/config/.kodi
- /srv/gerbera/music:/content/music
- /srv/gerbera/cached:/content/cartoon
- /mnt/hdd2_2/movies:/content/video
- /home/vahagn/tmp/tmp/done:/content/new
restart: always

View File

@@ -1,7 +0,0 @@
__
\ \ _____ _ _ _ _ ____
/ / / _ | | | | | | | / _ \
/ /___| | |_| |_| |_| | |_| | | |
(______| | \________/\_____/ |_|
|_|

View File

@@ -1,7 +0,0 @@
_ _
| | ____ _ |_\_ ___ _ _ _ ___
| | / _ \ _ | | | | | __/ _ \| | | | | |/ _ \
| |__| | | | |_| |_| | |_) | |/) / |_| | | | (_) |_
\____|_| |_|___,\___/ \___/| |\_/\_________/\__ _|
|_| |_|

View File

@@ -1,9 +0,0 @@

_ _ _
| |__ ____ | |_ _ _ _| |
| __|_/ _ \| _|_ _ | | | | | | | _
| |__| | | |_| |_| | |_| |_| |_| | |_| |
\____/| | \____/\___\_______ _/\__ |
|_| |_|