Skip to content

Commit

Permalink
refactor: pre production version (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
timerring authored Nov 27, 2024
1 parent 0e307d9 commit 29ea0e0
Show file tree
Hide file tree
Showing 23 changed files with 17 additions and 38 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ pnpm-lock.yaml
package-lock.json

# Ignore the biliup folder
upload/config/*
!upload/config/1234567.yaml
!upload/config/upload_config.json
!upload/uploadVideoQueue.txt
src/uploadProcess/config/*
!src/uploadProcess/config/1234567.yaml
!src/uploadProcess/config/upload_config.json
!src/uploadProcess/uploadVideoQueue.txt

# Ignore the production
startRecord-production.sh
Expand Down
21 changes: 0 additions & 21 deletions src/bilive_upload/LICENSE

This file was deleted.

6 changes: 3 additions & 3 deletions src/burnAndMerge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ while read -r line; do
xmlFile=${line%.mp4}.xml
assFile=${line%.mp4}.ass
if [ -f "$xmlFile" ]; then
$BILIVE_PATH/utils/DanmakuFactory -o "$assFile" -i "$xmlFile" --msgboxfontsize 23 --ignore-warnings
$BILIVE_PATH/src/utils/DanmakuFactory -o "$assFile" -i "$xmlFile" --msgboxfontsize 30 --msgboxsize 400x1000 --ignore-warnings
echo "==================== generated $assFile ===================="
export ASS_PATH="$assFile"
python3 $BILIVE_PATH/utils/removeEmojis.py >> $BILIVE_PATH/logs/removeEmojis.log 2>&1
python3 $BILIVE_PATH/src/utils/removeEmojis.py >> $BILIVE_PATH/logs/removeEmojis.log 2>&1
fi

# Initial some basic parameters and create tmp folder
Expand Down Expand Up @@ -67,5 +67,5 @@ rm -r $tmpDir
rm mergevideo.txt

echo "==================== start upload $firstOutputFile ===================="
echo "$firstOutputFile" >> $BILIVE_PATH/upload/uploadVideoQueue.txt
echo "$firstOutputFile" >> $BILIVE_PATH/src/uploadProcess/uploadVideoQueue.txt
echo "==================== OVER ===================="
6 changes: 3 additions & 3 deletions src/danmakuBurning.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ assPath="${path}/${roomid}_${year}-${month}-${day}-${hour}.ass"
# use DanmakuFactory to convert the xml file
xmlPath="${filenameWithoutExt}.xml"
if [ -f "$xmlPath" ]; then
$BILIVE_PATH/utils/DanmakuFactory -o "$assPath" -i "$xmlPath" --msgboxfontsize 23 --ignore-warnings
$BILIVE_PATH/src/utils/DanmakuFactory -o "$assPath" -i "$xmlPath" --msgboxfontsize 30 --ignore-warnings
rm $xmlPath
echo “danmaku convert success!
export ASS_PATH="$assPath"
python3 $BILIVE_PATH/utils/removeEmojis.py >> $BILIVE_PATH/logs/removeEmojis.log 2>&1
python3 $BILIVE_PATH/src/utils/removeEmojis.py >> $BILIVE_PATH/logs/removeEmojis.log 2>&1
fi

# Burn danmaku into video.
Expand All @@ -74,4 +74,4 @@ echo "ffmpeg successfully complete!"
rm $fullPath

# Upload video.
echo "$formatVideoName" >> $BILIVE_PATH/upload/uploadVideoQueue.txt
echo "$formatVideoName" >> $BILIVE_PATH/src/uploadProcess/uploadVideoQueue.txt
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions upload/uploadQueue.sh → src/uploadProcess/uploadQueue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
# INPUT: none.
# OUTPUT: none.

uploadQueue="$BILIVE_PATH/upload/uploadVideoQueue.txt"
tempQueue="$BILIVE_PATH/upload/tempVideoQueue.txt"
uploadQueue="$BILIVE_PATH/src/uploadProcess/uploadVideoQueue.txt"
tempQueue="$BILIVE_PATH/src/uploadProcess/tempVideoQueue.txt"

processVideo() {
local line="$1"
$BILIVE_PATH/upload/uploadVideo.sh "$line" > $BILIVE_PATH/logs/uploadDanmakuLog/upload-$(date +%Y%m%d%H%M%S).log 2>&1
$BILIVE_PATH/src/uploadProcess/uploadVideo.sh "$line" > $BILIVE_PATH/logs/uploadDanmakuLog/upload-$(date +%Y%m%d%H%M%S).log 2>&1
sleep 10
sed -i '1d' "$uploadQueue"
}
Expand Down
6 changes: 3 additions & 3 deletions upload/uploadVideo.sh → src/uploadProcess/uploadVideo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ echo "hour: $hour"
# original to create the copy. Then upload videos via the copy.

# define the path of yaml.
yamlFile="$BILIVE_PATH/upload/config/$roomID.yaml"
yamlFile="$BILIVE_PATH/src/uploadProcess/config/$roomID.yaml"

# check if the yaml is exist.
if [ ! -f "$yamlFile" ]; then
Expand All @@ -52,7 +52,7 @@ if [ ! -f "$yamlFile" ]; then
fi

# define the path of copy.
copyYamlFile="$BILIVE_PATH/upload/config/copy_$roomID.yaml"
copyYamlFile="$BILIVE_PATH/src/uploadProcess/config/copy_$roomID.yaml"

# make the copy.
cp "$yamlFile" "$copyYamlFile"
Expand All @@ -68,7 +68,7 @@ sed -i "s|BILI_SOURCE|https://live.bilibili.com/$roomID|g" "$copyYamlFile"
echo "The parameters have been updated in the $copyYamlFile"

# Use biliup tool to upload video, and then delete the subtitle ass file and video file.
if $BILIVE_PATH/upload/biliup upload "$uploadPath" --config "$copyYamlFile"; then
if $BILIVE_PATH/src/uploadProcess/biliup upload "$uploadPath" --config "$copyYamlFile"; then
echo "Upload successfully,then delete the video"
rm $uploadPath
else
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion startUpload.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# kill the previous scanSegments process
kill -9 $(pgrep -f uploadQueue)
# start the scanSegments process
nohup $BILIVE_PATH/upload/uploadQueue.sh > $BILIVE_PATH/logs/uploadQueue.log 2>&1 &
nohup $BILIVE_PATH/src/uploadProcess/uploadQueue.sh > $BILIVE_PATH/logs/uploadQueue.log 2>&1 &
# Check if the last command was successful
if [ $? -eq 0 ]; then
echo "success"
Expand Down

0 comments on commit 29ea0e0

Please sign in to comment.