update
This commit is contained in:
1
1024fj
Executable file
1
1024fj
Executable file
@@ -0,0 +1 @@
|
|||||||
|
for a in 1024fj.com_*.mp4; do echo "======== $a ========"; mv "$a" "$(echo $a | gawk -F'1024fj.com_' '{print $2}')"; done
|
||||||
13
2aac
Executable file
13
2aac
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
TMPFILE=$(mktemp)
|
||||||
|
LOGFILE="/tmp/2aac.log"
|
||||||
|
|
||||||
|
if [ "$(is_cuda)" == "ok!" ]; then
|
||||||
|
echo "======== CUDA ========"
|
||||||
|
time ffmpeg -y -hwaccel cuda -i "$1" -f mp4 -vcodec copy -acodec aac -ar 44100 -ab 128k -ac 2 $TMPFILE
|
||||||
|
else
|
||||||
|
echo "======== VAPPI ========"
|
||||||
|
time ffmpeg -y -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -i "$1" -f mp4 -vcodec copy -acodec aac -ar 44100 -ab 128k -ac 2 $TMPFILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
backup_and_replace "$1" "$TMPFILE" "$LOGFILE"
|
||||||
15
2avc1
Executable file
15
2avc1
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
TMPFILE=$(mktemp)
|
||||||
|
LOGFILE="/tmp/2avc1.log"
|
||||||
|
|
||||||
|
BITRATE=$(ffprobe -v error -select_streams v:0 -show_entries stream=bit_rate -of csv=p=0 "$1")
|
||||||
|
|
||||||
|
if [ "$(is_cuda)" == "ok!" ]; then
|
||||||
|
echo "======== CUDA ========"
|
||||||
|
time ffmpeg -y -hwaccel cuda -i "$1" -f mp4 -vcodec h264_nvenc -acodec copy -b:v "$BITRATE" $TMPFILE
|
||||||
|
else
|
||||||
|
echo "======== VAPPI ========"
|
||||||
|
time ffmpeg -y -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -i "$1" -f mp4 -vcodec h264 -acodec copy -b:v "$BITRATE" $TMPFILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
backup_and_replace "$1" "$TMPFILE" "$LOGFILE"
|
||||||
15
2hevc
Executable file
15
2hevc
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
TMPFILE=$(mktemp)
|
||||||
|
LOGFILE="/tmp/2hevc.log"
|
||||||
|
|
||||||
|
BITRATE=$(ffprobe -v error -select_streams v:0 -show_entries stream=bit_rate -of csv=p=0 "$1")
|
||||||
|
|
||||||
|
if [ "$(is_cuda)" == "ok!" ]; then
|
||||||
|
echo "======== CUDA ========"
|
||||||
|
time ffmpeg -y -hwaccel cuda -i "$1" -f mp4 -vcodec hevc_nvenc -acodec copy -b:v "$BITRATE" $TMPFILE
|
||||||
|
else
|
||||||
|
echo "======== VAPPI ========"
|
||||||
|
time ffmpeg -y -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -i "$1" -f mp4 -vcodec hevc -acodec copy -b:v "$BITRATE" $TMPFILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
backup_and_replace "$1" "$TMPFILE" "$LOGFILE"
|
||||||
13
2mp3
Executable file
13
2mp3
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
TMPFILE=$(mktemp)
|
||||||
|
LOGFILE="/tmp/2mp3.log"
|
||||||
|
|
||||||
|
if [ "$(is_cuda)" == "ok!" ]; then
|
||||||
|
echo "======== CUDA ========"
|
||||||
|
time ffmpeg -y -hwaccel cuda -i "$1" -f mp4 -vcodec copy -acodec mp3 -ar 44100 -ab 128k -ac 2 $TMPFILE
|
||||||
|
else
|
||||||
|
echo "======== VAPPI ========"
|
||||||
|
time ffmpeg -y -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -i "$1" -f mp4 -vcodec copy -acodec mp3 -ar 44100 -ab 128k -ac 2 $TMPFILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
backup_and_replace "$1" "$TMPFILE" "$LOGFILE"
|
||||||
13
2mp4
Executable file
13
2mp4
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
TMPFILE=$(mktemp)
|
||||||
|
LOGFILE="/tmp/2mp4.log"
|
||||||
|
|
||||||
|
if [ "$(is_cuda)" == "ok!" ]; then
|
||||||
|
echo "======== CUDA ========"
|
||||||
|
time ffmpeg -y -hwaccel cuda -i "$1" -f mp4 -vcodec copy -acodec copy $TMPFILE
|
||||||
|
else
|
||||||
|
echo "======== VAPPI ========"
|
||||||
|
time ffmpeg -y -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -i "$1" -f mp4 -vcodec copy -acodec copy $TMPFILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
backup_and_replace "$1" "$TMPFILE" "$LOGFILE"
|
||||||
1
acodec
Executable file
1
acodec
Executable file
@@ -0,0 +1 @@
|
|||||||
|
ffp "$1" | grep -B 3 "codec_type\": \"audio" | grep codec_name | gawk -F'\"' '{print $4}'
|
||||||
50
all2avc1
Executable file
50
all2avc1
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
EXITFILE="/tmp/all2avc1.stop"
|
||||||
|
if [[ $1 == stop ]]
|
||||||
|
then
|
||||||
|
touch $EXITFILE
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == resume ]]
|
||||||
|
then
|
||||||
|
rm $EXITFILE
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f $EXITFILE ]]
|
||||||
|
then
|
||||||
|
echo "FORCED STOP by $EXITFILE"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
TMPFILE0=$(mktemp)
|
||||||
|
ls -l | grep "^d" | gawk -F":" '{print $2}' | cut -c 4- > $TMPFILE0
|
||||||
|
TMPFILE=$(mktemp)
|
||||||
|
cat $TMPFILE0 | grep -v "\@eaDir" > $TMPFILE
|
||||||
|
rm $TMPFILE0
|
||||||
|
IFS=$'\n'
|
||||||
|
DIRS=($(cat "$TMPFILE"))
|
||||||
|
NUMDIR=$(wc "$TMPFILE" | gawk -F' ' '{print $1}')
|
||||||
|
rm $TMPFILE
|
||||||
|
BASE_PATH=$(pwd)
|
||||||
|
|
||||||
|
CNTDIR=1
|
||||||
|
for a in "${DIRS[@]}"
|
||||||
|
do
|
||||||
|
pwd
|
||||||
|
echo "[$CNTDIR/$NUMDIR] $a ===="
|
||||||
|
CNTDIR="$(echo "$CNTDIR+1" | bc)"
|
||||||
|
cd "$a"
|
||||||
|
all2hevc
|
||||||
|
cd "$BASE_PATH"
|
||||||
|
done;
|
||||||
|
|
||||||
|
TMPFILE1=$(mktemp)
|
||||||
|
ls -l | grep -v "^d" | gawk -F":" '{print $2}' | cut -c 4- > $TMPFILE1
|
||||||
|
TMPFILE2=$(mktemp)
|
||||||
|
#echo "11111"
|
||||||
|
#cat $TMPFILE2
|
||||||
|
#echo "22222"
|
||||||
|
for a in avi m4v mkv mp4 ts mov; do cat $TMPFILE1 | grep "."$a"$" > $TMPFILE2; all2avc1_ $TMPFILE2; done
|
||||||
|
rm $TMPFILE1 $TMPFILE2
|
||||||
34
all2avc1_
Executable file
34
all2avc1_
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
IFS=$'\n'
|
||||||
|
VIDEOS=($(cat $1))
|
||||||
|
EXITFILE="/tmp/all2avc1.stop"
|
||||||
|
LOGFILE="/tmp/all2avc1.log"
|
||||||
|
NUMFILE=$(wc $1 | gawk -F' ' '{print $1}')
|
||||||
|
CNTFILE=1
|
||||||
|
EXECFILE="2avc1"
|
||||||
|
#cat $1
|
||||||
|
for a in ${VIDEOS[@]}
|
||||||
|
do
|
||||||
|
pwd
|
||||||
|
echo "[$CNTFILE/$NUMFILE] $a ===="
|
||||||
|
CNTFILE="$(echo "$CNTFILE+1" | bc)"
|
||||||
|
if [[ -f $EXITFILE ]]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $(ffp_vcodec "$a") != "hevc" ]]
|
||||||
|
then
|
||||||
|
res=$(ffp_resolution "$a")
|
||||||
|
val=$(($res - 1000))
|
||||||
|
if [[ $val > 0 ]]
|
||||||
|
then
|
||||||
|
echo $(date) "\""$(pwd)"/"$a"\"" $(ffp_resolution "$a") >> $LOGFILE
|
||||||
|
$EXECFILE "$a"
|
||||||
|
else
|
||||||
|
echo $(date) "\"$(pwd)/$a\" $(ffp_resolution "$a") skipped!" >> $LOGFILE
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo $(date) "\"$(pwd)/$a\"" $(ffp_vcodec "$a") "skipped!" >> $LOGFILE
|
||||||
|
fi
|
||||||
|
done
|
||||||
50
all2hevc
Executable file
50
all2hevc
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
EXITFILE="/tmp/all2hevc.stop"
|
||||||
|
if [[ $1 == stop ]]
|
||||||
|
then
|
||||||
|
touch $EXITFILE
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == resume ]]
|
||||||
|
then
|
||||||
|
rm $EXITFILE
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f $EXITFILE ]]
|
||||||
|
then
|
||||||
|
echo "FORCED STOP by $EXITFILE"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
TMPFILE0=$(mktemp)
|
||||||
|
ls -l | grep "^d" | gawk -F":" '{print $2}' | cut -c 4- > $TMPFILE0
|
||||||
|
TMPFILE=$(mktemp)
|
||||||
|
cat $TMPFILE0 | grep -v "\@eaDir" > $TMPFILE
|
||||||
|
rm $TMPFILE0
|
||||||
|
IFS=$'\n'
|
||||||
|
DIRS=($(cat "$TMPFILE"))
|
||||||
|
NUMDIR=$(wc "$TMPFILE" | gawk -F' ' '{print $1}')
|
||||||
|
rm $TMPFILE
|
||||||
|
BASE_PATH=$(pwd)
|
||||||
|
|
||||||
|
CNTDIR=1
|
||||||
|
for a in "${DIRS[@]}"
|
||||||
|
do
|
||||||
|
pwd
|
||||||
|
echo "[$CNTDIR/$NUMDIR] $a ===="
|
||||||
|
CNTDIR="$(echo "$CNTDIR+1" | bc)"
|
||||||
|
cd "$a"
|
||||||
|
all2hevc
|
||||||
|
cd "$BASE_PATH"
|
||||||
|
done;
|
||||||
|
|
||||||
|
TMPFILE1=$(mktemp)
|
||||||
|
ls -l | grep -v "^d" | gawk -F":" '{print $2}' | cut -c 4- > $TMPFILE1
|
||||||
|
TMPFILE2=$(mktemp)
|
||||||
|
#echo "11111"
|
||||||
|
#cat $TMPFILE2
|
||||||
|
#echo "22222"
|
||||||
|
for a in avi m4v mkv mp4 ts; do cat $TMPFILE1 | grep "."$a"$" > $TMPFILE2; all2hevc_ $TMPFILE2; done
|
||||||
|
rm $TMPFILE1 $TMPFILE2
|
||||||
32
all2hevc_
Executable file
32
all2hevc_
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
IFS=$'\n'
|
||||||
|
VIDEOS=($(cat $1))
|
||||||
|
EXITFILE="/tmp/all2hevc.stop"
|
||||||
|
NUMFILE=$(wc $1 | gawk -F' ' '{print $1}')
|
||||||
|
CNTFILE=1
|
||||||
|
#cat $1
|
||||||
|
for a in ${VIDEOS[@]}
|
||||||
|
do
|
||||||
|
pwd
|
||||||
|
echo "[$CNTFILE/$NUMFILE] $a ===="
|
||||||
|
CNTFILE="$(echo "$CNTFILE+1" | bc)"
|
||||||
|
if [[ -f $EXITFILE ]]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $(ffp_vcodec "$a") != "hevc" ]]
|
||||||
|
then
|
||||||
|
res=$(ffp_resolution "$a")
|
||||||
|
val=$(($res - 1000))
|
||||||
|
if [[ $val > 0 ]]
|
||||||
|
then
|
||||||
|
echo $(date) "\""$(pwd)"/"$a"\"" $(ffp_resolution "$a") >> /tmp/all2hevc.log
|
||||||
|
2hevc "$a"
|
||||||
|
else
|
||||||
|
echo $(date) "\"$(pwd)/$a\" $(ffp_resolution "$a") skipped!" >> /tmp/all2hevc.log
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo $(date) "\"$(pwd)/$a\"" $(ffp_vcodec "$a") "skipped!" >> /tmp/all2hevc.log
|
||||||
|
fi
|
||||||
|
done
|
||||||
38
all2mp4
Executable file
38
all2mp4
Executable file
@@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
EXITFILE="/tmp/all2mp4.stop"
|
||||||
|
if [[ $1 == stop ]]
|
||||||
|
then
|
||||||
|
touch $EXITFILE
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == resume ]]
|
||||||
|
then
|
||||||
|
rm $EXITFILE
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f $EXITFILE ]]
|
||||||
|
then
|
||||||
|
echo "FORCED STOP by $EXITFILE"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
TMPFILE0=$(mktemp)
|
||||||
|
ls -l | grep "^d" | gawk -F":" '{print $2}' | cut -c 4- > $TMPFILE0
|
||||||
|
TMPFILE=$(mktemp)
|
||||||
|
cat $TMPFILE0 | grep -v "\@eaDir" > $TMPFILE
|
||||||
|
rm $TMPFILE0
|
||||||
|
IFS=$'\n'
|
||||||
|
DIRS=($(cat "$TMPFILE"))
|
||||||
|
rm $TMPFILE
|
||||||
|
BASE_PATH=$(pwd)
|
||||||
|
for a in "${DIRS[@]}"; do echo "====" $a "===="; cd "$a"; pwd; all2mp4; cd "$BASE_PATH"; pwd; done;
|
||||||
|
TMPFILE1=$(mktemp)
|
||||||
|
ls -l | grep -v "^d" | gawk -F":" '{print $2}' | cut -c 4- > $TMPFILE1
|
||||||
|
TMPFILE2=$(mktemp)
|
||||||
|
#echo "11111"
|
||||||
|
#cat $TMPFILE2
|
||||||
|
#echo "22222"
|
||||||
|
for a in avi m4v mkv wmv ts; do cat $TMPFILE1 | grep "."$a"$" > $TMPFILE2; all2mp4_ $TMPFILE2; done
|
||||||
|
rm $TMPFILE1 $TMPFILE2
|
||||||
14
all2mp4_
Executable file
14
all2mp4_
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
IFS=$'\n'
|
||||||
|
VIDEOS=($(cat $1))
|
||||||
|
EXITFILE="/tmp/all2mp4.stop"
|
||||||
|
#cat $1
|
||||||
|
for a in ${VIDEOS[@]}; do echo "== $a =="
|
||||||
|
if [[ -f $EXITFILE ]]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $(date) "\""$(pwd)"/"$a"\"" >> /tmp/all2mp4.log
|
||||||
|
2mp4 "$a"
|
||||||
|
done
|
||||||
2
any2hevc
Executable file
2
any2hevc
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
for a in wmv mkv mp4; do for b in *.$a; do if [[ -e "$b" ]]; then if [[ $(vcodec "$b") != "hevc" ]]; then echo "======== $b ========"; 2hevc "$b"; fi; fi; done; done
|
||||||
22
apt_upgrade.sh
Executable file
22
apt_upgrade.sh
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# This script will update and upgrade all packages automatically.
|
||||||
|
# Run as root or with sudo.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "=== Starting full system upgrade ==="
|
||||||
|
|
||||||
|
# Update the package lists
|
||||||
|
apt update -y
|
||||||
|
|
||||||
|
# Upgrade all packages without interaction
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt -y upgrade
|
||||||
|
|
||||||
|
# Upgrade including kernel and dependencies
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt -y dist-upgrade
|
||||||
|
|
||||||
|
# Remove unused packages
|
||||||
|
apt -y autoremove
|
||||||
|
apt -y autoclean
|
||||||
|
|
||||||
|
echo "=== Upgrade completed successfully ==="
|
||||||
62
backup_and_replace
Executable file
62
backup_and_replace
Executable file
@@ -0,0 +1,62 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SRCFILE="$1"
|
||||||
|
TMPFILE="$2"
|
||||||
|
LOGFILE="$3"
|
||||||
|
echo $(date) $TMPFILE "created for \"$SRCFILE\"" >> $LOGFILE
|
||||||
|
if [[ $(ffp_duration $TMPFILE) == $(ffp_duration "$SRCFILE") ]]
|
||||||
|
then
|
||||||
|
NEWFILE="$(cut_ext "$SRCFILE").mp4"
|
||||||
|
mv "$SRCFILE" "$SRCFILE.bak"
|
||||||
|
mv "$TMPFILE" "$NEWFILE"
|
||||||
|
echo $(date) "$(pwd)/$\" done!" >> $LOGFILE
|
||||||
|
else
|
||||||
|
keep_temp "$SRCFILE" $TMPFILE
|
||||||
|
echo "SOMETHING WRONG!!"
|
||||||
|
echo $(date) "\"$(pwd)/$SRCFILE\" NOT FINISHED!" >> $LOGFILE
|
||||||
|
fi
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SRCFILE="$1"
|
||||||
|
TMPFILE="$2"
|
||||||
|
LOGFILE="$3"
|
||||||
|
|
||||||
|
# Log the creation of the temporary file
|
||||||
|
echo "$(date) $TMPFILE created for \"$SRCFILE\"" >> "$LOGFILE"
|
||||||
|
|
||||||
|
# Function to check duration
|
||||||
|
ffp_duration() {
|
||||||
|
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to remove the file extension
|
||||||
|
cut_ext() {
|
||||||
|
echo "${1%.*}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if the durations of the source and temporary files match
|
||||||
|
if [[ $(ffp_duration "$TMPFILE") == $(ffp_duration "$SRCFILE") ]]; then
|
||||||
|
NEWFILE="$(cut_ext "$SRCFILE").mp4"
|
||||||
|
|
||||||
|
# Backup the original file
|
||||||
|
mv "$SRCFILE" "$SRCFILE.bak"
|
||||||
|
|
||||||
|
# Replace the original file with the new file
|
||||||
|
mv "$TMPFILE" "$NEWFILE"
|
||||||
|
|
||||||
|
# Log the successful operation
|
||||||
|
echo "$(date) $(pwd)/$SRCFILE done!" >> "$LOGFILE"
|
||||||
|
else
|
||||||
|
# Function to keep the temporary file
|
||||||
|
keep_temp() {
|
||||||
|
local src="$1"
|
||||||
|
local tmp="$2"
|
||||||
|
mv "$tmp" "${src}_tmp"
|
||||||
|
}
|
||||||
|
|
||||||
|
keep_temp "$SRCFILE" "$TMPFILE"
|
||||||
|
|
||||||
|
# Log the failure
|
||||||
|
echo "SOMETHING WRONG!!"
|
||||||
|
echo "$(date) $(pwd)/$SRCFILE NOT FINISHED!" >> "$LOGFILE"
|
||||||
|
fi
|
||||||
|
|
||||||
1
backup_immich_
Executable file
1
backup_immich_
Executable file
@@ -0,0 +1 @@
|
|||||||
|
sudo rsync -rv --delete --exclude=*.xmp /mnt/hdd/immich/library/library/admin rsync://rozbrian@192.168.1.18/NetBackup/truenas/immich_photo
|
||||||
9
backup_wiki
Executable file
9
backup_wiki
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/expect
|
||||||
|
set timeout -1
|
||||||
|
spawn /home/rozbrian/bin/backup_wiki_
|
||||||
|
match_max 100
|
||||||
|
expect -exact "\[sudo\] password for rozbrian: "
|
||||||
|
send -- "$env(PASSWORD)\r"
|
||||||
|
expect -exact "Password: "
|
||||||
|
send -- "$env(PASSWORD4DS918)\r"
|
||||||
|
expect eof
|
||||||
1
backup_wiki_
Executable file
1
backup_wiki_
Executable file
@@ -0,0 +1 @@
|
|||||||
|
sudo rsync -avzP --delete /var/www/html/wiki rsync://rozbrian@192.168.1.18/NetBackup/truenas
|
||||||
28
categorize
Executable file
28
categorize
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Find directories in the current directory and process each one
|
||||||
|
find . -maxdepth 1 -type d -print0 | while IFS= read -r -d '' dir; do
|
||||||
|
if [[ "$dir" != "." ]]; then
|
||||||
|
# Extract the old directory name, stripping leading './'
|
||||||
|
OLDNAME="${dir:2}"
|
||||||
|
echo "==== $OLDNAME ===="
|
||||||
|
|
||||||
|
# Generate the new directory name
|
||||||
|
NEWNAME=$(echo "$OLDNAME" | awk -F'시즌[0-9]' '{ print $1 }')
|
||||||
|
|
||||||
|
if [[ "$OLDNAME" == "$NEWNAME" ]]; then
|
||||||
|
echo "\"$OLDNAME\" ok!"
|
||||||
|
else
|
||||||
|
echo "\"$OLDNAME\" -> \"$NEWNAME\""
|
||||||
|
|
||||||
|
# Ensure the new directory does not already exist to avoid overwriting
|
||||||
|
if [[ ! -d "$NEWNAME" ]]; then
|
||||||
|
sudo mkdir "$NEWNAME"
|
||||||
|
sudo mv "$dir" "$NEWNAME"
|
||||||
|
else
|
||||||
|
echo "\"$NEWNAME\" already exists, skipping move $OLDNAME"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
28
cert_install
Executable file
28
cert_install
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
#tar xvf cert_key.tar
|
||||||
|
sudo ls > /dev/null
|
||||||
|
export DIR_SSL="/etc/ssl/private"
|
||||||
|
sudo cp cert.pem $DIR_SSL/cert.pem
|
||||||
|
sudo cp privkey.pem $DIR_SSL/key.pem;
|
||||||
|
#sudo cp $1 $DIR_SSL/cert.pem
|
||||||
|
#sudo cp $2 $DIR_SSL/key.pem;
|
||||||
|
#sudo cd $DIR_SSL; sudo chown root:root cert.pem key.pem
|
||||||
|
|
||||||
|
for a in /etc/docker/homeassistant/ssl /etc/docker/jellyfin/config/ssl
|
||||||
|
do
|
||||||
|
cd $a;
|
||||||
|
echo "====" $(pwd) "===="
|
||||||
|
sudo rm cert.pem key.pem
|
||||||
|
sudo cp $DIR_SSL/cert.pem .
|
||||||
|
sudo cp $DIR_SSL/key.pem .
|
||||||
|
# sudo ln -s $DIR_SSL/cert.pem cert.pem
|
||||||
|
# sudo ln -s $DIR_SSL/key.pem key.pem
|
||||||
|
done
|
||||||
|
|
||||||
|
cd /etc/cockpit/ws-certs.d
|
||||||
|
echo "====" $(pwd) "===="
|
||||||
|
sudo rm pem.cert pem.key
|
||||||
|
sudo cp $DIR_SSL/cert.pem pem.cert
|
||||||
|
sudo cp $DIR_SSL/key.pem pem.key
|
||||||
|
#sudo ln -s $DIR_SSL/cert.pem pem.cert
|
||||||
|
#sudo ln -s $DIR_SSL/key.pem pem.key
|
||||||
17
cert_remove
Executable file
17
cert_remove
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
#tar xvf cert_key.tar
|
||||||
|
sudo ls > /dev/null
|
||||||
|
export DIR_SSL="/etc/ssl/private"
|
||||||
|
sudo rm $DIR_SSL/cert.pem
|
||||||
|
sudo rm $DIR_SSL/key.pem
|
||||||
|
|
||||||
|
for a in /etc/docker/homeassistant/ssl /etc/docker/jellyfin/config/ssl
|
||||||
|
do
|
||||||
|
cd $a;
|
||||||
|
echo "====" $(pwd) "===="
|
||||||
|
sudo rm cert.pem key.pem
|
||||||
|
done
|
||||||
|
|
||||||
|
cd /etc/cockpit/ws-certs.d
|
||||||
|
echo "====" $(pwd) "===="
|
||||||
|
sudo rm pem.cert pem.key
|
||||||
4
cut_ext
Executable file
4
cut_ext
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
OLDFILE="$1"
|
||||||
|
NEWFILE=${OLDFILE::-4}
|
||||||
|
echo "$NEWFILE"
|
||||||
1
dockerpid
Executable file
1
dockerpid
Executable file
@@ -0,0 +1 @@
|
|||||||
|
sudo docker ps -q | xargs sudo docker inspect --format '{{.State.Pid}}: {{.Name}}'
|
||||||
11
duckdns
Executable file
11
duckdns
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
docker run -d \
|
||||||
|
--name=duckdns \
|
||||||
|
-e PUID=0 \
|
||||||
|
-e PGID=0 \
|
||||||
|
-e TZ=Asia/Seoul \
|
||||||
|
-e SUBDOMAINS=rozbrian \
|
||||||
|
-e TOKEN=bdb0d679-6419-4743-9e3c-085e7ecbf1b0 \
|
||||||
|
-e LOG_FILE=false \
|
||||||
|
-v /etc/docker/duckdns/config:/config \
|
||||||
|
--restart unless-stopped \
|
||||||
|
lscr.io/linuxserver/duckdns:latest
|
||||||
41
ffmpeg_concat
Executable file
41
ffmpeg_concat
Executable file
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Check if all required arguments are provided
|
||||||
|
if [ $# -lt 2 ]; then
|
||||||
|
echo "Usage: $0 <file_list.txt> <output_file>"
|
||||||
|
echo ""
|
||||||
|
echo "Arguments:"
|
||||||
|
echo " <file_list.txt> Text file containing a list of files to concatenate."
|
||||||
|
echo " <output_file> Path to the output video file."
|
||||||
|
echo ""
|
||||||
|
echo "Example:"
|
||||||
|
echo " $0 file_list.txt output.mp4"
|
||||||
|
echo ""
|
||||||
|
echo "Notes:"
|
||||||
|
echo " - The <file_list.txt> must contain file paths in the following format:"
|
||||||
|
echo " file 'video1.mp4'"
|
||||||
|
echo " file 'video2.mp4'"
|
||||||
|
echo " - All files in the list must have the same codec, resolution, and frame rate."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Assign input arguments to variables
|
||||||
|
file_list=$1
|
||||||
|
output_file=$2
|
||||||
|
|
||||||
|
# Check if the file list exists
|
||||||
|
if [ ! -f "$file_list" ]; then
|
||||||
|
echo "Error: The file list '$file_list' does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the ffmpeg command
|
||||||
|
ffmpeg -f concat -safe 0 -i "$file_list" -c copy "$output_file"
|
||||||
|
|
||||||
|
# Check if the ffmpeg command succeeded
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Concatenation completed successfully. Output saved to '$output_file'."
|
||||||
|
else
|
||||||
|
echo "Error: ffmpeg failed to concatenate the files."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
26
ffmpeg_cut
Executable file
26
ffmpeg_cut
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Check if all required arguments are provided
|
||||||
|
if [ $# -lt 4 ]; then
|
||||||
|
echo "Usage: $0 <input_file> <output_file> <start_time> <duration>"
|
||||||
|
echo ""
|
||||||
|
echo "Arguments:"
|
||||||
|
echo " <input_file> Path to the input video file."
|
||||||
|
echo " <output_file> Path to the output video file."
|
||||||
|
echo " <start_time> Start time in format HH:MM:SS or seconds."
|
||||||
|
echo " <duration> Duration of the segment in format HH:MM:SS or seconds."
|
||||||
|
echo ""
|
||||||
|
echo "Example:"
|
||||||
|
echo " $0 input.mp4 output.mp4 00:01:00 30"
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Assign input arguments to variables
|
||||||
|
input_file=$1
|
||||||
|
output_file=$2
|
||||||
|
start_time=$3
|
||||||
|
duration=$4
|
||||||
|
|
||||||
|
# Run ffmpeg command
|
||||||
|
ffmpeg -i "$input_file" -ss "$start_time" -t "$duration" -vcodec copy -acodec copy "$output_file"
|
||||||
41
ffmpeg_cut_head
Executable file
41
ffmpeg_cut_head
Executable file
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Check if all required arguments are provided
|
||||||
|
if [ $# -lt 3 ]; then
|
||||||
|
echo "Usage: $0 <input_file> <output_file> <duration>"
|
||||||
|
echo ""
|
||||||
|
echo "Arguments:"
|
||||||
|
echo " <input_file> Path to the input video file."
|
||||||
|
echo " <output_file> Path to the output video file."
|
||||||
|
echo " <duration> Duration of the extracted segment in format HH:MM:SS or seconds."
|
||||||
|
echo ""
|
||||||
|
echo "Example:"
|
||||||
|
echo " $0 input.mp4 output.mp4 30"
|
||||||
|
echo " $0 input.mp4 output.mp4 00:00:30"
|
||||||
|
echo ""
|
||||||
|
echo "Note: The output file will contain the first <duration> seconds of the input file."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Assign input arguments to variables
|
||||||
|
input_file=$1
|
||||||
|
output_file=$2
|
||||||
|
duration=$3
|
||||||
|
|
||||||
|
# Check if the input file exists
|
||||||
|
if [ ! -f "$input_file" ]; then
|
||||||
|
echo "Error: The input file '$input_file' does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the ffmpeg command
|
||||||
|
ffmpeg -i "$input_file" -t "$duration" -vcodec copy -acodec copy "$output_file"
|
||||||
|
|
||||||
|
# Check if the ffmpeg command succeeded
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Video extraction completed successfully. Output saved to '$output_file'."
|
||||||
|
else
|
||||||
|
echo "Error: ffmpeg failed to extract the video."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
39
ffmpeg_cut_tail
Executable file
39
ffmpeg_cut_tail
Executable file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Check if all required arguments are provided
|
||||||
|
if [ $# -lt 3 ]; then
|
||||||
|
echo "Usage: $0 <input_file> <output_file> <start_time>"
|
||||||
|
echo ""
|
||||||
|
echo "Arguments:"
|
||||||
|
echo " <input_file> Path to the input video file."
|
||||||
|
echo " <output_file> Path to the output video file."
|
||||||
|
echo " <start_time> Start time in format HH:MM:SS or seconds."
|
||||||
|
echo ""
|
||||||
|
echo "Example:"
|
||||||
|
echo " $0 input.mp4 output.mp4 00:01:00"
|
||||||
|
echo ""
|
||||||
|
echo "Note: The output file will start from <start_time> and will include all remaining content of the input file."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Assign input arguments to variables
|
||||||
|
input_file=$1
|
||||||
|
output_file=$2
|
||||||
|
start_time=$3
|
||||||
|
|
||||||
|
# Check if the input file exists
|
||||||
|
if [ ! -f "$input_file" ]; then
|
||||||
|
echo "Error: The input file '$input_file' does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the ffmpeg command
|
||||||
|
ffmpeg -i "$input_file" -ss "$start_time" -vcodec copy -acodec copy "$output_file"
|
||||||
|
|
||||||
|
# Check if the ffmpeg command succeeded
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Video extraction completed successfully. Output saved to '$output_file'."
|
||||||
|
else
|
||||||
|
echo "Error: ffmpeg failed to extract the video."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
1
ffp
Executable file
1
ffp
Executable file
@@ -0,0 +1 @@
|
|||||||
|
ffprobe -show_format -show_streams -loglevel quiet -print_format json "$1"
|
||||||
1
ffp_duration
Executable file
1
ffp_duration
Executable file
@@ -0,0 +1 @@
|
|||||||
|
printf "%.0f" $(ffp "$1" | grep -m 1 "\"duration\": " | gawk -F'\"' '{print $4}')
|
||||||
1
ffp_forder
Executable file
1
ffp_forder
Executable file
@@ -0,0 +1 @@
|
|||||||
|
ffp "$1" | grep "field_order\": \"tb" | gawk -F'\"' '{ print $4 }'
|
||||||
1
ffp_resolution
Executable file
1
ffp_resolution
Executable file
@@ -0,0 +1 @@
|
|||||||
|
ffp "$1" | grep "coded_height\": " | gawk -F': ' '{print $2}' | gawk -F',' '{ print $1 }'
|
||||||
1
ffp_vcodec
Executable file
1
ffp_vcodec
Executable file
@@ -0,0 +1 @@
|
|||||||
|
ffp "$1" | grep -B 3 "codec_type\": \"video" | grep codec_name | gawk -F'\"' '{print $4}'
|
||||||
27
git_repo.sh
Executable file
27
git_repo.sh
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# This script creates a bare Git repository under /home/git/
|
||||||
|
# Usage: ./create-git-repo.sh <project_name>
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Error: Project name is required."
|
||||||
|
echo "Usage: $0 <project_name>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PROJECT_NAME=$1
|
||||||
|
REPO_PATH="/home/git/${PROJECT_NAME}.git"
|
||||||
|
|
||||||
|
# Create the directory
|
||||||
|
mkdir -p "$REPO_PATH"
|
||||||
|
|
||||||
|
# Initialize as bare repository
|
||||||
|
git init --bare "$REPO_PATH"
|
||||||
|
|
||||||
|
# Set ownership to user 'git'
|
||||||
|
chown -R git:git "$REPO_PATH"
|
||||||
|
|
||||||
|
echo "=== Repository created successfully ==="
|
||||||
|
echo "Path: $REPO_PATH"
|
||||||
|
echo "To clone: git clone git@your-server:${PROJECT_NAME}.git"
|
||||||
10
homeassistant
Executable file
10
homeassistant
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
sudo docker run \
|
||||||
|
--network=host \
|
||||||
|
--detach \
|
||||||
|
--name=homeassistant \
|
||||||
|
-e PUDI0 -e PGID=0 \
|
||||||
|
-e TZ=Asia/Seoul \
|
||||||
|
-v /etc/docker/homeassistant:/config \
|
||||||
|
--privileged \
|
||||||
|
--restart unless-stopped \
|
||||||
|
docker.io/homeassistant/home-assistant:latest
|
||||||
1
is_cuda
Executable file
1
is_cuda
Executable file
@@ -0,0 +1 @@
|
|||||||
|
if [ "$( nvcc --version | grep "Cuda" | gawk -F" " '{ print $1 }' )" != "" ]; then echo "ok!"; else echo "NO"; fi
|
||||||
17
jellyfin
Executable file
17
jellyfin
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
sudo chmod 666 /dev/dri/renderD128
|
||||||
|
sudo docker run \
|
||||||
|
--network host \
|
||||||
|
--detach \
|
||||||
|
--label "io.containers.autoupdate=registry" \
|
||||||
|
--name jellyfin \
|
||||||
|
--publish 8096:8096 \
|
||||||
|
--user 0:0 \
|
||||||
|
--userns keep-id \
|
||||||
|
--group-add="109" \
|
||||||
|
--volume /etc/docker/jellyfin/cache:/cache \
|
||||||
|
--volume /etc/docker/jellyfin/config:/config \
|
||||||
|
--mount type=bind,source=/etc/docker/jellyfin/media,destination=/media,rw=true,relabel=private \
|
||||||
|
--device /dev/dri/renderD128:/dev/dri/renderD128 \
|
||||||
|
--tmpfs /sys \
|
||||||
|
--no-healthcheck \
|
||||||
|
docker.io/nyanmisaka/jellyfin:latest
|
||||||
6
just-tit
Executable file
6
just-tit
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
sudo docker run \
|
||||||
|
--network=host \
|
||||||
|
--detach \
|
||||||
|
--name=just-tit \
|
||||||
|
--publish 8080:8080 \
|
||||||
|
docker.io/dsmatilla/just-tit:latest
|
||||||
3
keep_temp
Executable file
3
keep_temp
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
NEWFILE="$(cut_ext "$1").$2.mp4"
|
||||||
|
mv "$2" "$NEWFILE"
|
||||||
8
metatube
Executable file
8
metatube
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
sudo docker run \
|
||||||
|
--restart=always \
|
||||||
|
--network=host \
|
||||||
|
-d \
|
||||||
|
-p 8080:8080 \
|
||||||
|
-v /etc/docker/metatube/config:/config \
|
||||||
|
--name metatube metatube/metatube-server:latest \
|
||||||
|
-dsn /config/metatube.db
|
||||||
1
mon
Executable file
1
mon
Executable file
@@ -0,0 +1 @@
|
|||||||
|
while true; do sleep 1; head -v -n 8 /proc/meminfo; head -v -n 2 /proc/stat /proc/version /proc/uptime /proc/loadavg /proc/sys/fs/file-nr /proc/sys/kernel/hostname; tail -v -n 16 /proc/net/dev; echo '==> /proc/df <=='; df -l; echo '==> /proc/netstat <=='; netstat -tpan | grep -Ev '[a-fA-F:]*[0-9.+:[0-9]+ +[a-fA-F:]*[0-9.]:[0-9]+ | TIME_WAIT| CLOSING| CLOSE_WAIT'; echo '==> /proc/who <==';who;echo '==> /proc/end <=='; echo '##Moba##'; done
|
||||||
114
mp3tag
Executable file
114
mp3tag
Executable file
@@ -0,0 +1,114 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
import music_tag
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
def show_help():
|
||||||
|
print("Usage: " + sys.argv[0] + " <mp3file> <command> {value}")
|
||||||
|
print(" commands:")
|
||||||
|
print(" album albumartist")
|
||||||
|
print(" comment compilation composer")
|
||||||
|
print(" discnumber")
|
||||||
|
print(" genre")
|
||||||
|
print(" rename")
|
||||||
|
print(" totaldiscs totaltracks tracknumber tracktitle")
|
||||||
|
print(" year")
|
||||||
|
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
show_help()
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
filename = sys.argv[1]
|
||||||
|
mp3 = music_tag.load_file(filename)
|
||||||
|
|
||||||
|
if len(sys.argv) < 3:
|
||||||
|
show_tags(mp3)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
command = sys.argv[2]
|
||||||
|
|
||||||
|
# Dictionary to map commands to functions or subprocess commands
|
||||||
|
command_actions = {
|
||||||
|
'rename': lambda: rename_mp3(mp3, filename),
|
||||||
|
'folder': lambda: move_to_album_folder(mp3, filename),
|
||||||
|
'_folder': lambda: move_to_parent_album_folder(mp3, filename),
|
||||||
|
'~comment': lambda: remove_tag(mp3, 'comment'),
|
||||||
|
'~albumartist': lambda: remove_tag(mp3, 'albumartist'),
|
||||||
|
'album': lambda value: set_tag(mp3, 'album', value),
|
||||||
|
'albumartist': lambda value: set_tag(mp3, 'albumartist', value),
|
||||||
|
'artist': lambda value: set_tag(mp3, 'artist', value),
|
||||||
|
'comment': lambda value: set_tag(mp3, 'comment', value),
|
||||||
|
'composer': lambda value: set_tag(mp3, 'composer', value),
|
||||||
|
'discnumber': lambda value: set_tag(mp3, 'discnumber', value),
|
||||||
|
'totaldiscs': lambda value: set_tag(mp3, 'totaldiscs', value),
|
||||||
|
'genre': lambda value: set_tag(mp3, 'genre', value),
|
||||||
|
'totaltracks': lambda value: set_tag(mp3, 'totaltracks', value),
|
||||||
|
'tracktitle': lambda value: set_tag(mp3, 'tracktitle', value),
|
||||||
|
'tracknumber': lambda value: set_tag(mp3, 'tracknumber', value),
|
||||||
|
'year': lambda value: set_tag(mp3, 'year', value),
|
||||||
|
}
|
||||||
|
|
||||||
|
if command in command_actions:
|
||||||
|
if len(sys.argv) < 4:
|
||||||
|
print("Value is missing!")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
value = sys.argv[3]
|
||||||
|
command_actions[command](value)
|
||||||
|
else:
|
||||||
|
print("Unknown command:", command)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
def rename_mp3(mp3, filename):
|
||||||
|
newfilename = f"{mp3['tracknumber'].value.zfill(3)}.{mp3['tracktitle']}.{bitrate_kbps(mp3)}.mp3"
|
||||||
|
subprocess.run(['mv', filename, newfilename])
|
||||||
|
|
||||||
|
def move_to_album_folder(mp3, filename):
|
||||||
|
folder = mp3['album']
|
||||||
|
subprocess.run(['mkdir', folder])
|
||||||
|
subprocess.run(['mv', filename, folder])
|
||||||
|
|
||||||
|
def move_to_parent_album_folder(mp3, filename):
|
||||||
|
folder = mp3['album']
|
||||||
|
subprocess.run(['mkdir', f'../{folder}'])
|
||||||
|
subprocess.run(['mv', filename, f'../{folder}'])
|
||||||
|
|
||||||
|
def remove_tag(mp3, tag):
|
||||||
|
mp3.remove_tag(tag)
|
||||||
|
mp3.save()
|
||||||
|
print(f"{tag} removed!")
|
||||||
|
|
||||||
|
def set_tag(mp3, tag, value):
|
||||||
|
old_value = str(mp3[tag].value)
|
||||||
|
mp3[tag] = value
|
||||||
|
new_value = str(mp3[tag].value)
|
||||||
|
mp3.save()
|
||||||
|
print(f"{tag}: {old_value} -> {new_value}")
|
||||||
|
|
||||||
|
def bitrate_kbps(mp3):
|
||||||
|
bitrate = int(int(mp3['#bitrate']) / 1000)
|
||||||
|
return f"{bitrate}kbps"
|
||||||
|
|
||||||
|
def show_tags(mp3):
|
||||||
|
print(f"{mp3['artist']} / {mp3['album']} / {mp3['tracknumber'].value.zfill(3)}.{mp3['tracktitle']}")
|
||||||
|
print("========")
|
||||||
|
print(f"album : {mp3['album']}")
|
||||||
|
print(f"albumartist : {mp3['albumartist']}")
|
||||||
|
print(f"artist : {mp3['artist']}")
|
||||||
|
print(f"artwork : {mp3['artwork']}")
|
||||||
|
print(f"comment : {mp3['comment']}")
|
||||||
|
print(f"compilation : {mp3['compilation']}")
|
||||||
|
print(f"composer : {mp3['composer']}")
|
||||||
|
print(f"discnumber / totaldiscs : {mp3['discnumber'].value} / {mp3['totaldiscs'].value}")
|
||||||
|
print(f"genre : {mp3['genre']}")
|
||||||
|
print(f"tracknumber / totaltracks : {mp3['tracknumber'].value} / {mp3['totaltracks'].value}")
|
||||||
|
print(f"tracktitle : {mp3['tracktitle']}")
|
||||||
|
print(f"year : {mp3['year']}")
|
||||||
|
print(f"isrc : {mp3['isrc']}")
|
||||||
|
length = mp3['#length'].value
|
||||||
|
min = int(length / 60)
|
||||||
|
sec = int(length - min * 60 + .5)
|
||||||
|
print("---")
|
||||||
|
print(f"{bitrate_kbps(mp3)} / {mp3['#codec']} / {min}m{sec}s / {mp3['#channels']} channels / {mp3['#samplerate'] / 1000}kHz")
|
||||||
|
|
||||||
127
naver_campaign.py
Executable file
127
naver_campaign.py
Executable file
@@ -0,0 +1,127 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import re # 정규 표현식 모듈
|
||||||
|
import uuid # 고유 식별자 생성 모듈
|
||||||
|
import requests # HTTP 요청을 처리하는 모듈
|
||||||
|
import rsa # RSA 암호화 알고리즘 모듈
|
||||||
|
import lzstring # LZ-String 압축 알고리즘 모듈
|
||||||
|
from urllib3.util.retry import Retry # HTTP 요청 재시도를 위한 모듈
|
||||||
|
from requests.adapters import HTTPAdapter # HTTP 어댑터
|
||||||
|
import time # 시간 처리 모듈
|
||||||
|
from bs4 import BeautifulSoup # HTML/XML 파서
|
||||||
|
from urllib.parse import urljoin # URL 조합 함수
|
||||||
|
|
||||||
|
# 주어진 키와 사용자 정보를 이용하여 암호화하는 함수
|
||||||
|
def encrypt(key_str, uid, upw):
|
||||||
|
# 문자열을 조합하는 함수
|
||||||
|
def naver_style_join(l):
|
||||||
|
return ''.join([chr(len(s)) + s for s in l])
|
||||||
|
|
||||||
|
# 암호화 키 분리 및 정수 변환
|
||||||
|
sessionkey, keyname, e_str, n_str = key_str.split(',')
|
||||||
|
e, n = int(e_str, 16), int(n_str, 16)
|
||||||
|
|
||||||
|
# 메시지 조합 및 인코딩
|
||||||
|
message = naver_style_join([sessionkey, uid, upw]).encode()
|
||||||
|
|
||||||
|
# 공개키 생성 및 메시지 암호화
|
||||||
|
pubkey = rsa.PublicKey(e, n)
|
||||||
|
encrypted = rsa.encrypt(message, pubkey)
|
||||||
|
|
||||||
|
return keyname, encrypted.hex()
|
||||||
|
|
||||||
|
# 사용자 계정을 암호화하는 함수
|
||||||
|
def encrypt_account(uid, upw):
|
||||||
|
key_str = requests.get('https://nid.naver.com/login/ext/keys.nhn').content.decode("utf-8")
|
||||||
|
return encrypt(key_str, uid, upw)
|
||||||
|
|
||||||
|
# 네이버 세션 생성 함수
|
||||||
|
def naver_session(nid, npw):
|
||||||
|
encnm, encpw = encrypt_account(nid, npw)
|
||||||
|
|
||||||
|
# HTTP 세션 설정
|
||||||
|
s = requests.Session()
|
||||||
|
retries = Retry(total=5, backoff_factor=0.1, status_forcelist=[500, 502, 503, 504])
|
||||||
|
s.mount('https://', HTTPAdapter(max_retries=retries))
|
||||||
|
request_headers = {'User-agent': 'Mozilla/5.0'}
|
||||||
|
|
||||||
|
# 인증 데이터 생성 및 압축
|
||||||
|
bvsd_uuid = uuid.uuid4()
|
||||||
|
encData = '{"a":"%s-4","b":"1.3.4","d":[{"i":"id","b":{"a":["0,%s"]},"d":"%s","e":false,"f":false},{"i":"%s","e":true,"f":false}],"h":"1f","i":{"a":"Mozilla/5.0"}}' % (bvsd_uuid, nid, nid, npw)
|
||||||
|
bvsd = '{"uuid":"%s","encData":"%s"}' % (bvsd_uuid, lzstring.LZString.compressToEncodedURIComponent(encData))
|
||||||
|
|
||||||
|
# 로그인 요청 및 최종 URL 접속
|
||||||
|
resp = s.post('https://nid.naver.com/nidlogin.login', data={'svctype': '0', 'enctp': '1', 'encnm': encnm, 'enc_url': 'http0X0.0000000000001P-10220.0000000.000000www.naver.com', 'url': 'www.naver.com', 'smart_level': '1', 'encpw': encpw, 'bvsd': bvsd}, headers=request_headers)
|
||||||
|
finalize_url = re.search(r'location\.replace\("([^"]+)"\)', resp.content.decode("utf-8")).group(1)
|
||||||
|
s.get(finalize_url)
|
||||||
|
|
||||||
|
return s
|
||||||
|
|
||||||
|
# 네이버 캠페인 링크를 찾는 함수
|
||||||
|
def find_naver_campaign_links(base_url, visited_urls_file='/tmp/visited_urls.txt'):
|
||||||
|
# 방문한 URL 파일에서 읽기
|
||||||
|
try:
|
||||||
|
with open(visited_urls_file, 'r') as file:
|
||||||
|
visited_urls = set(file.read().splitlines())
|
||||||
|
except FileNotFoundError:
|
||||||
|
visited_urls = set()
|
||||||
|
|
||||||
|
# 기본 URL에 대한 요청
|
||||||
|
response = requests.get(base_url)
|
||||||
|
soup = BeautifulSoup(response.text, 'html.parser')
|
||||||
|
|
||||||
|
# 'list_subject' 클래스를 가진 span 요소 찾기 및 'a' 태그 추출
|
||||||
|
list_subject_links = soup.find_all('span', class_='list_subject')
|
||||||
|
naver_links = []
|
||||||
|
for span in list_subject_links:
|
||||||
|
a_tag = span.find('a', href=True)
|
||||||
|
if a_tag and '네이버' in a_tag.text:
|
||||||
|
#print(a_tag['href'])
|
||||||
|
naver_links.append(a_tag['href'])
|
||||||
|
|
||||||
|
# 캠페인 링크를 저장할 리스트 초기화
|
||||||
|
campaign_links = []
|
||||||
|
|
||||||
|
# 각 네이버 링크 확인
|
||||||
|
for link in naver_links:
|
||||||
|
full_link = urljoin(base_url, link)
|
||||||
|
if full_link in visited_urls:
|
||||||
|
print(link + " already visited!")
|
||||||
|
continue # 이미 방문한 링크는 건너뛰기
|
||||||
|
|
||||||
|
res = requests.get(full_link)
|
||||||
|
inner_soup = BeautifulSoup(res.text, 'html.parser')
|
||||||
|
|
||||||
|
# 캠페인 URL로 시작하는 링크 찾기
|
||||||
|
for a_tag in inner_soup.find_all('a', href=True):
|
||||||
|
if a_tag['href'].startswith("https://campaign2-api.naver.com"):
|
||||||
|
campaign_links.append(a_tag['href'])
|
||||||
|
|
||||||
|
# 방문한 링크 추가
|
||||||
|
visited_urls.add(full_link)
|
||||||
|
|
||||||
|
# 방문한 URL 파일에 저장
|
||||||
|
with open(visited_urls_file, 'w') as file:
|
||||||
|
for url in visited_urls:
|
||||||
|
file.write(url + '\n')
|
||||||
|
|
||||||
|
return campaign_links
|
||||||
|
|
||||||
|
# 시작할 기본 URL
|
||||||
|
base_url = "https://www.clien.net/service/board/jirum"
|
||||||
|
|
||||||
|
# 메인 실행 부분
|
||||||
|
if __name__ == "__main__":
|
||||||
|
s = naver_session(os.getenv('NAVER_ID'), os.getenv('NAVER_PWD'))
|
||||||
|
campaign_links = find_naver_campaign_links(base_url)
|
||||||
|
if(campaign_links == []):
|
||||||
|
print("All links visited.")
|
||||||
|
else:
|
||||||
|
for link in campaign_links:
|
||||||
|
print(link + "to be visited")
|
||||||
|
response = s.get(link)
|
||||||
|
#print(response.text) # 디버깅용
|
||||||
|
response.raise_for_status()
|
||||||
|
time.sleep(5)
|
||||||
|
print(link + " done!")
|
||||||
19
nfs
Executable file
19
nfs
Executable file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
for a in homes music NetBackup photo tmp usbshare1 video video2 video3 video4; do sudo umount /mnt/diskstation/$a; sudo mkdir /mnt/diskstation/$a; done;
|
||||||
|
#for a in homes music NetBackup photo tmp usbshare2 video video2; do sudo umount /mnt/diskstation/$a; sudo mkdir /mnt/diskstation/$a; done;
|
||||||
|
nfs_ $DS918_IP volume1/homes $DS918_DIR/homes
|
||||||
|
nfs_ $DS918_IP volume1/music $DS918_DIR/music
|
||||||
|
nfs_ $DS918_IP volume3/NetBackup $DS918_DIR/NetBackup
|
||||||
|
nfs_ $DS918_IP volume1/photo $DS918_DIR/photo
|
||||||
|
nfs_ $DS918_IP volume5/tmp $DS918_DIR/tmp
|
||||||
|
nfs_ $DS918_IP volumeUSB1/usbshare $DS918_DIR/usbshare1
|
||||||
|
#nfs_ $DS918_IP volumeUSB2/usbshare $DS918_DIR/usbshare2
|
||||||
|
nfs_ $DS918_IP volume3/video $DS918_DIR/video
|
||||||
|
nfs_ $DS918_IP volume2/video2 $DS918_DIR/video2
|
||||||
|
#nfs_ $DS918_IP volume3/video3 $DS918_DIR/video3
|
||||||
|
nfs_ $DS918_IP volume4/video4 $DS918_DIR/video4
|
||||||
|
nfs_ 192.168.1.28 mnt/hdd $DS918_DIR/hdd
|
||||||
|
nfs_ 192.168.1.28 mnt/hdd1 $DS918_DIR/hdd1
|
||||||
|
nfs_ 192.168.1.28 mnt/hdd2 $DS918_DIR/hdd2
|
||||||
|
nfs_ 192.168.1.28 mnt/hdd3 $DS918_DIR/hdd3
|
||||||
|
#nfs_ 192.168.1.28 mnt/hdd4 $DS918_DIR/hdd4
|
||||||
10
nfs_
Executable file
10
nfs_
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "==== $1:/$2 -> $3 ===="
|
||||||
|
if [ -d "$3" ]; then
|
||||||
|
echo "Directory found: $3"
|
||||||
|
else
|
||||||
|
echo "Directory NOT found. Creating: $3"
|
||||||
|
sudo mkdir -p "$3"
|
||||||
|
echo "done.."
|
||||||
|
fi
|
||||||
|
sudo mount -t nfs $(echo $1):/$2 $3
|
||||||
9
openmediavault
Executable file
9
openmediavault
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
sudo docker run -d \
|
||||||
|
--name openmediavault \
|
||||||
|
--privileged \
|
||||||
|
-v /etc/docker/openmediavault/config:/etc/openmediavault \
|
||||||
|
-v /etc/docker/openmediavault/data:/srv \
|
||||||
|
-p 10080:80 \
|
||||||
|
-p 10443:443 \
|
||||||
|
--restart unless-stopped \
|
||||||
|
openmediavault
|
||||||
7
openvpn-client
Executable file
7
openvpn-client
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
sudo docker run \
|
||||||
|
--detach \
|
||||||
|
--name=openvpn-client \
|
||||||
|
--cap-add=NET_ADMIN \
|
||||||
|
--device=/dev/net/tun \
|
||||||
|
--volume /etc/docker/openvpn-client:/config \
|
||||||
|
ghcr.io/wfg/openvpn-client
|
||||||
4
openwrt
Executable file
4
openwrt
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
sudo docker run --name openwrt -d --privileged \
|
||||||
|
--network wan_network --network-alias=wan \
|
||||||
|
--network lan_network --network-alias=lan \
|
||||||
|
openwrt/rootfs
|
||||||
17
plex
Executable file
17
plex
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
sudo docker run \
|
||||||
|
--network=host \
|
||||||
|
--detach \
|
||||||
|
--name=plex \
|
||||||
|
-p 32400:32400 \
|
||||||
|
-p 32400:32400/udp \
|
||||||
|
-e VERSIONlatest \
|
||||||
|
-e PUID=0 \
|
||||||
|
-e PGID=0 \
|
||||||
|
-e TZ=Asia/Seoul \
|
||||||
|
-v /etc/docker/plex/config:/config \
|
||||||
|
-v /etc/docker/plex/transcode:/transcode \
|
||||||
|
-v /etc/docker/plex/media:/media \
|
||||||
|
--device=/dev/dri:/dev/dri \
|
||||||
|
--privileged \
|
||||||
|
--restart unless-stopped \
|
||||||
|
docker.io/linuxserver/plex:latest
|
||||||
25
smb_ds918+
Executable file
25
smb_ds918+
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/expect
|
||||||
|
set timeout -1
|
||||||
|
spawn smb_ds918+_
|
||||||
|
match_max 100
|
||||||
|
expect -exact "\[sudo\] password for rozbrian: "
|
||||||
|
send -- "$env(PASSWORD)\r"
|
||||||
|
expect -exact "Password for rozbrian@"
|
||||||
|
send -- "$env(PASSWORD4DS918)\r"
|
||||||
|
expect -exact "Password for rozbrian@"
|
||||||
|
send -- "$env(PASSWORD4DS918)\r"
|
||||||
|
expect -exact "Password for rozbrian@"
|
||||||
|
send -- "$env(PASSWORD4DS918)\r"
|
||||||
|
expect -exact "Password for rozbrian@"
|
||||||
|
send -- "$env(PASSWORD4DS918)\r"
|
||||||
|
expect -exact "Password for rozbrian@"
|
||||||
|
send -- "$env(PASSWORD4DS918)\r"
|
||||||
|
expect -exact "Password for rozbrian@"
|
||||||
|
send -- "$env(PASSWORD4DS918)\r"
|
||||||
|
expect -exact "Password for rozbrian@"
|
||||||
|
send -- "$env(PASSWORD4DS918)\r"
|
||||||
|
expect -exact "Password for rozbrian@"
|
||||||
|
send -- "$env(PASSWORD4DS918)\r"
|
||||||
|
expect -exact "Password for rozbrian@"
|
||||||
|
send -- "$env(PASSWORD4DS918)\r"
|
||||||
|
expect eof
|
||||||
2
smb_ds918+_
Executable file
2
smb_ds918+_
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
#sudo mkdir /mnt/diskstation
|
||||||
|
for a in homes music NetBackup photo usbshare2 video video1 video2 video3; do sudo umount /mnt/diskstation/$a; sudo mkdir /mnt/diskstation/$a; sudo mount -t cifs -o username=rozbrian //192.168.2.2/$a /mnt/diskstation/$a; done
|
||||||
18
transmission
Executable file
18
transmission
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
sudo docker run -d \
|
||||||
|
--network=host \
|
||||||
|
--detach \
|
||||||
|
--name=transmission \
|
||||||
|
-e PUID=1000 \
|
||||||
|
-e PGID=1000 \
|
||||||
|
-e TZ=Asia/Seoul \
|
||||||
|
-e USER=rozbrian \
|
||||||
|
-e PASS=m@libu0551 \
|
||||||
|
-e HOST_WHITELIST= `#optional` \
|
||||||
|
-p 9091:9091 \
|
||||||
|
-p 51413:51413 \
|
||||||
|
-p 51413:51413/udp \
|
||||||
|
-v /etc/docker/transmission/config:/config \
|
||||||
|
-v /etc/docker/transmission/downloads:/downloads \
|
||||||
|
-v /etc/docker/transmission/watch:/watch \
|
||||||
|
--restart unless-stopped \
|
||||||
|
docker.io/linuxserver/transmission:latest
|
||||||
15
tvshow_categorize
Executable file
15
tvshow_categorize
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Change to the target directory
|
||||||
|
TARGET_DIR="$DS918_DIR/video/#tvshow"
|
||||||
|
if cd "$TARGET_DIR"; then
|
||||||
|
echo "==== $(pwd) ===="
|
||||||
|
else
|
||||||
|
echo "Failed to change directory to $TARGET_DIR"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the categorization scripts
|
||||||
|
tvshow_categorize_folders
|
||||||
|
tvshow_categorize_files
|
||||||
|
tvshow_categorize_etc
|
||||||
52
tvshow_categorize_etc
Executable file
52
tvshow_categorize_etc
Executable file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
# source the other script
|
||||||
|
source tvshow_categorize_merge
|
||||||
|
|
||||||
|
process_merge "1박2일시즌4" "1박2일/S04"
|
||||||
|
process_merge "MAKE미남(맥미남)" "MAKE(미남)"
|
||||||
|
process_merge "PD가사라졌다" "PD가사라졌다!"
|
||||||
|
process_merge "Singles" "솔로지옥/S3"
|
||||||
|
process_merge "가보자GO2" "가보자GO/S2"
|
||||||
|
process_merge "가보자GO시즌2" "가보자GO/S2"
|
||||||
|
process_merge "고딩엄빠5" "고딩엄빠/S5"
|
||||||
|
process_merge "고민순삭-있었는데요없었습니다" "고민순삭있었는데요없었습니다"
|
||||||
|
process_merge "과몰입인생사2" "과몰입인생사/S2"
|
||||||
|
process_merge "구해줘홈즈" "구해줘!홈즈"
|
||||||
|
process_merge "김창옥쇼2" "김창옥쇼/S2"
|
||||||
|
process_merge "꽃길만걸어요시즌2" "꽃길만걸어요/S2"
|
||||||
|
process_merge "나는SOLO그후,사랑은계속된다(나솔사계)" "나는SOLO그후사랑은계속된다"
|
||||||
|
process_merge "나는SOLO나는솔로" "나는SOLO"
|
||||||
|
process_merge "나만믿고따라와도시어부5" "나만믿고따라와도시어부/S5"
|
||||||
|
process_merge "놀라운토요일도레미마켓" "놀라운토요일"
|
||||||
|
process_merge "니돈내산독박투어3" "니돈내산독박투어/S3"
|
||||||
|
process_merge "대학체전소년선수촌" "대학체전-소년선수촌"
|
||||||
|
process_merge "더시즌즈-지코의아티스트" "더시즌즈/S5"
|
||||||
|
process_merge "더와일드(THEWILD)" "더와일드"
|
||||||
|
process_merge "돈쭐맛짱뜨러왔습니다2" "돈쭐,맛짱뜨러왔습니다2"
|
||||||
|
process_merge "돌싱글즈5" "돌싱글즈/S5"
|
||||||
|
process_merge "동상이몽2-너는내운명" "동상이몽2너는내운명"
|
||||||
|
process_merge "뭉쳐야찬다3" "뭉쳐야찬다/S3"
|
||||||
|
process_merge "박원숙의같이삽시다시즌3" "박원숙의같이삽시다/S3"
|
||||||
|
process_merge "빌드업-보컬보이그룹서바이벌" "빌드업보컬보이그룹서바이벌"
|
||||||
|
process_merge "살림하는남자들시즌2" "살림하는남자들/S2"
|
||||||
|
process_merge "서진이네2" "서진이네/S2"
|
||||||
|
process_merge "솔로지옥S3.Single'sInferno3" "솔로지옥/S3"
|
||||||
|
process_merge "쇼음악중심" "쇼!음악중심"
|
||||||
|
process_merge "쇼챔피언" "쇼!챔피언"
|
||||||
|
process_merge "심야괴담회4" "심야괴담회/S4"
|
||||||
|
process_merge "심야괴담회시즌4" "심야괴담회/S4"
|
||||||
|
process_merge "어서와~한국은처음이지" "어서와한국은처음이지/S2"
|
||||||
|
process_merge "어서와한국은처음이지시즌2" "어서와한국은처음이지/S2"
|
||||||
|
process_merge "연애의참견시즌3" "연애의참견/S3"
|
||||||
|
process_merge "오은영리포트-결혼지옥" "오은영리포트결혼지옥"
|
||||||
|
process_merge "요즘남자라이프-신랑수업" "요즘남자라이프신랑수업"
|
||||||
|
process_merge "용감한형사들3" "용감한형사들/S3"
|
||||||
|
process_merge "이혼숙려캠프-새로고침" "이혼숙려캠프새로고침"
|
||||||
|
process_merge "제철요리해주는옆집누나시즌3" "제철요리해주는옆집누나/S3"
|
||||||
|
process_merge "지구마불_세계여행2" "지구마불세계여행/S2"
|
||||||
|
process_merge "지구마불세계여행2" "지구마불세계여행/S2"
|
||||||
|
process_merge "지구마불세계여행시즌2" "지구마불세계여행/S2"
|
||||||
|
process_merge "태군노래자랑2" "태군노래자랑/S2"
|
||||||
|
process_merge "태군노래자랑PART2" "태군노래자랑/S2"
|
||||||
|
process_merge "태군노래자랑시즌2" "태군노래자랑/S2"
|
||||||
32
tvshow_categorize_files
Executable file
32
tvshow_categorize_files
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# to categorize named files
|
||||||
|
#
|
||||||
|
|
||||||
|
# Check if tvshow_categorize_name is available
|
||||||
|
if ! command -v tvshow_categorize_name &> /dev/null; then
|
||||||
|
echo "tvshow_categorize_name command not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Find and process files
|
||||||
|
find . -maxdepth 1 -type f -print0 | while IFS= read -r -d '' file; do
|
||||||
|
# Get the name from tvshow_categorize_name
|
||||||
|
NAME="$(tvshow_categorize_name "$file")"
|
||||||
|
|
||||||
|
# Check if the name was successfully retrieved
|
||||||
|
if [[ -z "$NAME" ]]; then
|
||||||
|
echo "Failed to categorize $file"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$file -> $NAME"
|
||||||
|
|
||||||
|
# Create the directory if it doesn't exist
|
||||||
|
if [[ ! -d "$NAME" ]]; then
|
||||||
|
sudo mkdir -p "$NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Move the file to the categorized directory
|
||||||
|
sudo mv "$file" "$NAME"
|
||||||
|
done
|
||||||
40
tvshow_categorize_folders
Executable file
40
tvshow_categorize_folders
Executable file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# to categorize named folders
|
||||||
|
#
|
||||||
|
|
||||||
|
# Check if tvshow_categorize_name is available
|
||||||
|
if ! command -v tvshow_categorize_name &> /dev/null; then
|
||||||
|
echo "tvshow_categorize_name command not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Find and process directories
|
||||||
|
find . -maxdepth 1 -type d -name "[^.]*.*E[0-9][0-9]*" -print0 | while IFS= read -r -d '' dir; do
|
||||||
|
# Get the name from tvshow_categorize_name
|
||||||
|
NAME="$(tvshow_categorize_name "$dir")"
|
||||||
|
|
||||||
|
# Check if the name was successfully retrieved
|
||||||
|
if [[ -z "$NAME" ]]; then
|
||||||
|
echo "Failed to categorize $dir"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$dir -> $NAME"
|
||||||
|
|
||||||
|
# Create the destination directory if it doesn't exist
|
||||||
|
if [[ ! -d "$NAME" ]]; then
|
||||||
|
sudo mkdir -p "$NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Move the video files to the categorized directory
|
||||||
|
sudo mv "$dir/"*.mp4 "$NAME" 2>/dev/null
|
||||||
|
sudo mv "$dir/"*.mkv "$NAME" 2>/dev/null
|
||||||
|
|
||||||
|
# Check if the move was successful before removing the directory
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
sudo rm -rf "$dir"
|
||||||
|
else
|
||||||
|
echo "Failed to move files from $dir to $NAME"
|
||||||
|
fi
|
||||||
|
done
|
||||||
13
tvshow_categorize_merge
Executable file
13
tvshow_categorize_merge
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
process_merge() {
|
||||||
|
local src="$1"
|
||||||
|
local dst="$2"
|
||||||
|
if [ -d "$src" ]; then
|
||||||
|
echo "======== $src -> $dst ========"
|
||||||
|
# echo $(pwd)
|
||||||
|
# mkdir -p "$dst"
|
||||||
|
# ls "$src/"*
|
||||||
|
mv "$src/"* "$dst"
|
||||||
|
rm -rf "$src"
|
||||||
|
fi
|
||||||
|
}
|
||||||
8
tvshow_categorize_name
Executable file
8
tvshow_categorize_name
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Usage: $0 <string>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$1" | sed -e 's/시즌/.S/g' -e 's/ //g' -e 's|^\./||' | awk -F'.' '{ print $1 }'
|
||||||
30
tvshow_prune
Executable file
30
tvshow_prune
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Function to process files
|
||||||
|
process_files() {
|
||||||
|
local pattern="$1"
|
||||||
|
shift
|
||||||
|
local replacements=("$@")
|
||||||
|
|
||||||
|
for file in *"$pattern"*; do
|
||||||
|
echo "==== $file ===="
|
||||||
|
for replacement in "${replacements[@]}"; do
|
||||||
|
local new_name="${file/$pattern/$replacement}"
|
||||||
|
if [ -e "$new_name" ]; then
|
||||||
|
echo "$new_name to be removed!"
|
||||||
|
rm "$new_name"
|
||||||
|
else
|
||||||
|
echo "$new_name NOT found"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Process 720p files
|
||||||
|
process_files "720p-NEXT" "720p.H264-F1RST" "720p-NICE" "720p.WANNA"
|
||||||
|
|
||||||
|
# Process 1080p files with 1080p.H264-F1RST
|
||||||
|
process_files "1080p.H264-F1RST" "1080p-NICE" "1080p.WANNA" "720p-NEXT"
|
||||||
|
|
||||||
|
# Process 1080p files with 1080p-NEXT
|
||||||
|
process_files "1080p-NEXT" "720p-NEXT" "1080p.H264-F1RST" "1080p-NICE" "1080p.WANNA"
|
||||||
26
tvshow_prune_all
Executable file
26
tvshow_prune_all
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Set up environment variables
|
||||||
|
TVSHOW_PATH="$DS918_DIR/video/#tvshow"
|
||||||
|
TVSHOW_DIRS=$(mktemp /tmp/tvshow_dir.XXXXXX)
|
||||||
|
TVSHOW_PRUNE=$(mktemp /tmp/tvshow_prune.XXXXXX)
|
||||||
|
|
||||||
|
echo "TVSHOW_DIRS=$TVSHOW_DIRS"
|
||||||
|
echo "TVSHOW_PRUNE=$TVSHOW_PRUNE"
|
||||||
|
|
||||||
|
# Change to the TV show directory
|
||||||
|
cd "$TVSHOW_PATH" || { echo "Failed to change directory to $TVSHOW_PATH"; exit 1; }
|
||||||
|
pwd
|
||||||
|
|
||||||
|
# Find directories and save to TVSHOW_DIRS
|
||||||
|
find . -maxdepth 2 -type d > "$TVSHOW_DIRS"
|
||||||
|
|
||||||
|
# Generate commands for pruning TV shows
|
||||||
|
awk -v PATH="$TVSHOW_PATH" -F"./" '{print "cd \""PATH"\"; pwd; export NEW_NAME=\""$2"\"; cd \"$NEW_NAME\"; pwd; tvshow_prune;"}' "$TVSHOW_DIRS" > "$TVSHOW_PRUNE"
|
||||||
|
|
||||||
|
# Make the generated script executable and run it
|
||||||
|
chmod +x "$TVSHOW_PRUNE"
|
||||||
|
"$TVSHOW_PRUNE"
|
||||||
|
|
||||||
|
# Clean up temporary files
|
||||||
|
#rm "$TVSHOW_DIRS" "$TVSHOW_PRUNE"
|
||||||
12
tvshow_remove_empty
Executable file
12
tvshow_remove_empty
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Find and remove empty directories
|
||||||
|
#
|
||||||
|
|
||||||
|
# Find and process empty directories
|
||||||
|
TARGET_DIR="$DS918_DIR/video/#tvshow"
|
||||||
|
cd "$TARGET_DIR"
|
||||||
|
find . -maxdepth 1 -type d -empty -print0 | while IFS= read -r -d '' dir; do
|
||||||
|
echo "$dir to be removed"
|
||||||
|
rm -r "$dir" || echo "Failed to remove $dir"
|
||||||
|
done
|
||||||
7
vaultwarden
Executable file
7
vaultwarden
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
sudo docker run \
|
||||||
|
--network=host \
|
||||||
|
--detach \
|
||||||
|
--name=vaultwarden \
|
||||||
|
-p 8080:8080 \
|
||||||
|
-v /etc/docker/vaultwarden/data:/data \
|
||||||
|
docker.io/vaultwarden/server:latest
|
||||||
1
vim4git.sh
Executable file
1
vim4git.sh
Executable file
@@ -0,0 +1 @@
|
|||||||
|
git config core.editor "vim"
|
||||||
Reference in New Issue
Block a user