Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/burnAndMerge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ while read -r line; do
xmlFile=${line%.mp4}.xml
assFile=${line%.mp4}.ass
if [ -f "$xmlFile" ]; then
python $BILIVE_PATH/src/utils/adjustPrice.py $xmlFile
$BILIVE_PATH/src/utils/DanmakuFactory -o "$assFile" -i "$xmlFile" --msgboxfontsize 30 --msgboxsize 400x1000 --ignore-warnings
echo "==================== generated $assFile ===================="
export ASS_PATH="$assFile"
Expand Down Expand Up @@ -57,6 +58,7 @@ while read -r line; do
rm ${line%.mp4}.*
done < ./src/sameSegments.txt

rm $BILIVE_PATH/src/sameSegments.txt
# merge the videos
echo "==================== merge starts ===================="
# echo "ffmpeg -f concat -i mergevideo.txt -c copy $firstOutputFile"
Expand Down
1 change: 1 addition & 0 deletions src/danmakuBurning.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ assPath="${path}/${roomid}_${year}-${month}-${day}-${hour}.ass"
# use DanmakuFactory to convert the xml file
xmlPath="${filenameWithoutExt}.xml"
if [ -f "$xmlPath" ]; then
python $BILIVE_PATH/src/utils/adjustPrice.py $xmlPath
$BILIVE_PATH/src/utils/DanmakuFactory -o "$assPath" -i "$xmlPath" --msgboxfontsize 30 --ignore-warnings
rm $xmlPath
echo “danmaku convert success!”
Expand Down
33 changes: 33 additions & 0 deletions src/utils/adjustPrice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import xml.etree.ElementTree as ET
import argparse

def update_sc_prices(file_path):
# Parse the XML file
tree = ET.parse(file_path)
root = tree.getroot()

# Iterate over all 'sc' elements
for sc in root.findall('sc'):
# Get the current price
price = sc.get('price')
if price is not None:
# Convert price to integer, divide by 1000, and update the attribute
new_price = int(price) / 1000
sc.set('price', str(int(new_price)))

# Write the updated XML back to the file
tree.write(file_path, encoding='utf-8', xml_declaration=True)

def main():
# Set up argument parser
parser = argparse.ArgumentParser(description='Update sc prices in an XML file.')
parser.add_argument('file_path', type=str, help='Path to the XML file')

# Parse the arguments
args = parser.parse_args()

# Update sc prices
update_sc_prices(args.file_path)

if __name__ == '__main__':
main()