remove everthing thats no qf, add logging
This commit is contained in:
@@ -55,18 +55,27 @@ jobs:
|
|||||||
- name: Move necessary files to Danser directory
|
- name: Move necessary files to Danser directory
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
echo "Moving necessary files to Danser directory..."
|
||||||
mkdir -p "$DANSER_SKINS_DIR"
|
mkdir -p "$DANSER_SKINS_DIR"
|
||||||
mv "$SKINS_DIR"/* "$DANSER_SKINS_DIR"
|
mv "$SKINS_DIR"/* "$DANSER_SKINS_DIR"
|
||||||
mkdir -p "$DANSER_MAPS_DIR"
|
mkdir -p "$DANSER_MAPS_DIR"
|
||||||
find "$MAPS_DIR" -type f -name '*.osz' -exec mv -t "$DANSER_MAPS_DIR" {} +
|
find "$MAPS_DIR" -type f -name '*.osz' -exec mv -t "$DANSER_MAPS_DIR" {} +
|
||||||
|
echo "Files moved."
|
||||||
|
|
||||||
- name: Generate Danser videos
|
- name: Generate Danser videos
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
set +e
|
||||||
|
|
||||||
JSON_FILE="$TIMESTAMPS_JSON"
|
JSON_FILE="$TIMESTAMPS_JSON"
|
||||||
mapfile -t REPLAYS < <(find "$REPLAY_DIR" -type f -name "*.osr")
|
mapfile -t REPLAYS < <(find "$REPLAY_DIR" -type f -name "*.osr")
|
||||||
|
|
||||||
[ ! -f "$JSON_FILE" ] && exit 0
|
if [ ! -f "$JSON_FILE" ]; then
|
||||||
|
echo "WARNING: Timestamps JSON file not found at $JSON_FILE - skipping video generation"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Found $(echo "${REPLAYS[@]}" | wc -w) replay files"
|
||||||
|
|
||||||
choose_skin() {
|
choose_skin() {
|
||||||
local name="$1"
|
local name="$1"
|
||||||
@@ -81,71 +90,132 @@ jobs:
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processed=0
|
||||||
|
skipped=0
|
||||||
|
|
||||||
for REPLAY in "${REPLAYS[@]}"; do
|
for REPLAY in "${REPLAYS[@]}"; do
|
||||||
[ ! -f "$REPLAY" ] && continue
|
if [ ! -f "$REPLAY" ]; then
|
||||||
|
echo "WARNING: Replay file not found: $REPLAY"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
REPLAY_NAME=$(basename "$REPLAY" .osr)
|
REPLAY_NAME=$(basename "$REPLAY" .osr)
|
||||||
STAGE="${REPLAY_NAME%%_*}"
|
STAGE="${REPLAY_NAME%%_*}"
|
||||||
|
|
||||||
|
echo "Processing replay: $REPLAY_NAME"
|
||||||
|
|
||||||
ENTRY=$(jq -c --arg name "$REPLAY_NAME" '
|
ENTRY=$(jq -c --arg name "$REPLAY_NAME" '
|
||||||
.[] | map(select(.name == $name)) | .[]' "$JSON_FILE")
|
.[] | map(select(.name == $name)) | .[]' "$JSON_FILE" 2>/dev/null)
|
||||||
|
|
||||||
if [ -z "$ENTRY" ]; then
|
if [ -z "$ENTRY" ]; then
|
||||||
|
echo " No timestamp entry found for $REPLAY_NAME - skipping"
|
||||||
|
((skipped++))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DONE=$(echo "$ENTRY" | jq -r '.done')
|
DONE=$(echo "$ENTRY" | jq -r '.done' 2>/dev/null)
|
||||||
if [ "$DONE" = "true" ]; then
|
if [ "$DONE" = "true" ]; then
|
||||||
|
echo " Already processed $REPLAY_NAME - skipping"
|
||||||
|
((skipped++))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
START=$(echo "$ENTRY" | jq -r '.start')
|
START=$(echo "$ENTRY" | jq -r '.start' 2>/dev/null)
|
||||||
END=$(echo "$ENTRY" | jq -r '.end')
|
END=$(echo "$ENTRY" | jq -r '.end' 2>/dev/null)
|
||||||
|
|
||||||
|
if ! [[ "$START" =~ ^[0-9]+$ ]] || ! [[ "$END" =~ ^[0-9]+$ ]]; then
|
||||||
|
echo " Invalid timestamp format for $REPLAY_NAME - skipping"
|
||||||
|
((skipped++))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$START" -eq 0 ] && [ "$END" -eq 0 ]; then
|
||||||
|
echo " Invalid timestamps (0,0) for $REPLAY_NAME - skipping"
|
||||||
|
((skipped++))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
OUT_VIDEO_DIR="$OUTPUT_DIR/$STAGE"
|
OUT_VIDEO_DIR="$OUTPUT_DIR/$STAGE"
|
||||||
OUT_VIDEO_FILE="$OUT_VIDEO_DIR/$REPLAY_NAME.mp4"
|
OUT_VIDEO_FILE="$OUT_VIDEO_DIR/$REPLAY_NAME.mp4"
|
||||||
|
|
||||||
mkdir -p "$OUT_VIDEO_DIR"
|
mkdir -p "$OUT_VIDEO_DIR" 2>/dev/null
|
||||||
|
|
||||||
SKIN=$(choose_skin "$REPLAY_NAME")
|
SKIN=$(choose_skin "$REPLAY_NAME")
|
||||||
|
echo " Using skin: $SKIN"
|
||||||
|
echo " Timestamps: ${START}s - ${END}s"
|
||||||
|
echo " Generating video with danser-cli..."
|
||||||
|
|
||||||
xvfb-run -a "$DANSER_DIR/danser-cli" \
|
if ! xvfb-run -a "$DANSER_DIR/danser-cli" \
|
||||||
-replay "$REPLAY" -record -skip -settings="tourneypreview" -skin="$SKIN" -start=$START -end=$END -noupdatecheck \
|
-replay "$REPLAY" -record -skip -settings="tourneypreview" -skin="$SKIN" -start=$START -end=$END -noupdatecheck \
|
||||||
-out="$REPLAY_NAME"
|
-out="$REPLAY_NAME" >/dev/null 2>&1; then
|
||||||
|
echo " ERROR: Danser failed for $REPLAY_NAME"
|
||||||
|
((skipped++))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f "$DANSER_VIDEO_DIR/$REPLAY_NAME.mp4" ]; then
|
if [ -f "$DANSER_VIDEO_DIR/$REPLAY_NAME.mp4" ]; then
|
||||||
mv "$DANSER_VIDEO_DIR/$REPLAY_NAME.mp4" "$OUT_VIDEO_FILE"
|
echo " Moving video to output directory..."
|
||||||
|
mv "$DANSER_VIDEO_DIR/$REPLAY_NAME.mp4" "$OUT_VIDEO_FILE" 2>/dev/null
|
||||||
|
|
||||||
ffmpeg -hide_banner -loglevel error \
|
echo " Post-processing with ffmpeg..."
|
||||||
|
ffmpeg_output=$(ffmpeg -hide_banner -loglevel error \
|
||||||
-ss 5 \
|
-ss 5 \
|
||||||
-i "$OUT_VIDEO_FILE" \
|
-i "$OUT_VIDEO_FILE" \
|
||||||
-c:v h264_nvenc -preset slow -rc vbr -cq 19 -b:v 10M -maxrate 20M \
|
-c:v h264_nvenc -preset slow -rc vbr -cq 19 -b:v 10M -maxrate 20M \
|
||||||
-c:a aac -b:a 192k \
|
-c:a aac -b:a 192k \
|
||||||
"${OUT_VIDEO_FILE}.tmp.mp4"
|
"${OUT_VIDEO_FILE}.tmp.mp4" 2>&1)
|
||||||
|
|
||||||
mv "${OUT_VIDEO_FILE}.tmp.mp4" "$OUT_VIDEO_FILE"
|
if [ $? -ne 0 ]; then
|
||||||
|
echo " ERROR: FFmpeg failed for $REPLAY_NAME:"
|
||||||
|
echo "$ffmpeg_output"
|
||||||
|
((skipped++))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
mv "${OUT_VIDEO_FILE}.tmp.mp4" "$OUT_VIDEO_FILE" 2>/dev/null
|
||||||
|
|
||||||
|
echo " Marking as completed in timestamps..."
|
||||||
tmp=$(mktemp)
|
tmp=$(mktemp)
|
||||||
jq --arg name "$REPLAY_NAME" '
|
jq --arg name "$REPLAY_NAME" '
|
||||||
(.. | objects | select(has("name")) | select(.name == $name))
|
(.. | objects | select(has("name")) | select(.name == $name))
|
||||||
|= (.done = true)' "$JSON_FILE" > "$tmp" && mv "$tmp" "$JSON_FILE"
|
|= (.done = true)' "$JSON_FILE" > "$tmp" && mv "$tmp" "$JSON_FILE" 2>/dev/null
|
||||||
|
|
||||||
|
echo " Successfully generated: $OUT_VIDEO_FILE"
|
||||||
|
((processed++))
|
||||||
|
else
|
||||||
|
echo " Failed to generate video for $REPLAY_NAME"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Summary:"
|
||||||
|
echo " Videos processed: $processed"
|
||||||
|
echo " Files skipped: $skipped"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
- name: Configure Git
|
- name: Configure Git
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
echo "Configuring Git user settings..."
|
||||||
git config user.email "arlind@sulej.ch"
|
git config user.email "arlind@sulej.ch"
|
||||||
git config user.name "ci-bot"
|
git config user.name "ci-bot"
|
||||||
|
echo "Git user configured."
|
||||||
|
|
||||||
- name: Add and Commit changes
|
- name: Add and Commit changes
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
echo "Configuring Git settings..."
|
||||||
git config advice.addIgnoredFile false
|
git config advice.addIgnoredFile false
|
||||||
|
|
||||||
|
echo "Adding output files to Git..."
|
||||||
git add outputs/
|
git add outputs/
|
||||||
|
|
||||||
|
echo "Committing changes..."
|
||||||
git commit -m "[ci skip] push back from pipeline" -q || echo "No changes to commit"
|
git commit -m "[ci skip] push back from pipeline" -q || echo "No changes to commit"
|
||||||
|
|
||||||
- name: Push changes and create tag
|
- name: Push changes and create tag
|
||||||
shell: bash
|
shell: bash
|
||||||
run: git push origin main || echo "No changes to push"
|
run: |
|
||||||
|
echo "Pushing changes to repository..."
|
||||||
|
git push origin main || echo "No changes to push"
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
{ "name": "GF_HD2", "start": 0, "end": 0, "done": false },
|
{ "name": "GF_HD2", "start": 0, "end": 0, "done": false },
|
||||||
{ "name": "GF_HR1", "start": 0, "end": 0, "done": false },
|
{ "name": "GF_HR1", "start": 0, "end": 0, "done": false },
|
||||||
{ "name": "GF_HR2", "start": 0, "end": 0, "done": false },
|
{ "name": "GF_HR2", "start": 0, "end": 0, "done": false },
|
||||||
{ "name": "GF_HR3", "start": 100, "end": 120, "done": false },
|
{ "name": "GF_HR3", "start": 0, "end": 0, "done": false },
|
||||||
{ "name": "GF_DT1", "start": 0, "end": 0, "done": false },
|
{ "name": "GF_DT1", "start": 0, "end": 0, "done": false },
|
||||||
{ "name": "GF_DT2", "start": 0, "end": 0, "done": false },
|
{ "name": "GF_DT2", "start": 0, "end": 0, "done": false },
|
||||||
{ "name": "GF_DT3", "start": 0, "end": 0, "done": false },
|
{ "name": "GF_DT3", "start": 0, "end": 0, "done": false },
|
||||||
|
|||||||
BIN
maps/GF/GF_HR3.osz
LFS
BIN
maps/GF/GF_HR3.osz
LFS
Binary file not shown.
BIN
maps/QF/QF_DT1.osz
LFS
Normal file
BIN
maps/QF/QF_DT1.osz
LFS
Normal file
Binary file not shown.
BIN
maps/QF/QF_DT2.osz
LFS
Normal file
BIN
maps/QF/QF_DT2.osz
LFS
Normal file
Binary file not shown.
BIN
maps/QF/QF_DT3.osz
LFS
Normal file
BIN
maps/QF/QF_DT3.osz
LFS
Normal file
Binary file not shown.
BIN
maps/QF/QF_FM1.osz
LFS
Normal file
BIN
maps/QF/QF_FM1.osz
LFS
Normal file
Binary file not shown.
BIN
maps/QF/QF_FM2.osz
LFS
Normal file
BIN
maps/QF/QF_FM2.osz
LFS
Normal file
Binary file not shown.
BIN
maps/QF/QF_FM3.osz
LFS
Normal file
BIN
maps/QF/QF_FM3.osz
LFS
Normal file
Binary file not shown.
BIN
maps/QF/QF_FM4.osz
LFS
Normal file
BIN
maps/QF/QF_FM4.osz
LFS
Normal file
Binary file not shown.
BIN
maps/QF/QF_FM5.osz
LFS
Normal file
BIN
maps/QF/QF_FM5.osz
LFS
Normal file
Binary file not shown.
BIN
maps/QF/QF_HD1.osz
LFS
Normal file
BIN
maps/QF/QF_HD1.osz
LFS
Normal file
Binary file not shown.
BIN
maps/QF/QF_HD2.osz
LFS
Normal file
BIN
maps/QF/QF_HD2.osz
LFS
Normal file
Binary file not shown.
BIN
maps/QF/QF_HR1.osz
LFS
Normal file
BIN
maps/QF/QF_HR1.osz
LFS
Normal file
Binary file not shown.
BIN
maps/QF/QF_HR2.osz
LFS
Normal file
BIN
maps/QF/QF_HR2.osz
LFS
Normal file
Binary file not shown.
BIN
outputs/GF/GF_HR3.mp4
LFS
Normal file
BIN
outputs/GF/GF_HR3.mp4
LFS
Normal file
Binary file not shown.
0
replays/GF/.gitkeep
Normal file
0
replays/GF/.gitkeep
Normal file
BIN
replays/GF/GF_FM1.osr
LFS
BIN
replays/GF/GF_FM1.osr
LFS
Binary file not shown.
BIN
replays/GF/GF_HR3.osr
LFS
BIN
replays/GF/GF_HR3.osr
LFS
Binary file not shown.
BIN
replays/QF/QF_FM3.osr
LFS
Normal file
BIN
replays/QF/QF_FM3.osr
LFS
Normal file
Binary file not shown.
0
replays/Ro16/.gitkeep
Normal file
0
replays/Ro16/.gitkeep
Normal file
BIN
replays/Ro16/Ro16_EZ1.osr
LFS
BIN
replays/Ro16/Ro16_EZ1.osr
LFS
Binary file not shown.
BIN
replays/Ro16/Ro16_FM2.osr
LFS
BIN
replays/Ro16/Ro16_FM2.osr
LFS
Binary file not shown.
BIN
replays/Ro16/Ro16_FM6.osr
LFS
BIN
replays/Ro16/Ro16_FM6.osr
LFS
Binary file not shown.
0
replays/SF/.gitkeep
Normal file
0
replays/SF/.gitkeep
Normal file
BIN
replays/SF/SF_EZ1.osr
LFS
BIN
replays/SF/SF_EZ1.osr
LFS
Binary file not shown.
Reference in New Issue
Block a user