Skip to content

Commit 62011bb

Browse files
chore: release v0.1.0
(cherry picked from commit 82525f8)
1 parent 13cfbce commit 62011bb

390 files changed

Lines changed: 18892 additions & 621 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
* text=auto
22
*.sh text eol=lf
33
*.stl filter=lfs diff=lfs merge=lfs -text
4+
*.STL filter=lfs diff=lfs merge=lfs -text
45
*.obj filter=lfs diff=lfs merge=lfs -text
56
*.pickle filter=lfs diff=lfs merge=lfs -text
67
*.png filter=lfs diff=lfs merge=lfs -text
78
*.mp4 filter=lfs diff=lfs merge=lfs -text
89
*.jpg filter=lfs diff=lfs merge=lfs -text
10+
*.hfield filter=lfs diff=lfs merge=lfs -text
11+
*.ktx2 filter=lfs diff=lfs merge=lfs -text

docs/gen_poster.sh

Lines changed: 70 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
# Extracts the first frame from all videos in source/_static/videos/
55
# and saves them as poster images in source/_static/images/poster/
66

7-
set -e
8-
97
# Define directories
108
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
119
SOURCE_DIR="$SCRIPT_DIR/source/_static/videos"
@@ -22,6 +20,17 @@ if ! command -v ffmpeg &> /dev/null; then
2220
exit 1
2321
fi
2422

23+
# Check if timeout command is available
24+
if ! command -v timeout &> /dev/null; then
25+
echo "Warning: 'timeout' command not found. Script may hang on problematic videos."
26+
echo "On Ubuntu/Debian: sudo apt-get install coreutils"
27+
echo "On macOS: brew install coreutils"
28+
FFMPEG_TIMEOUT=""
29+
else
30+
# Timeout for ffmpeg command (in seconds)
31+
FFMPEG_TIMEOUT="timeout 30"
32+
fi
33+
2534
# Check if source directory exists
2635
if [ ! -d "$SOURCE_DIR" ]; then
2736
echo "Error: Source directory '$SOURCE_DIR' does not exist."
@@ -35,6 +44,7 @@ echo "Created target directory: $TARGET_DIR"
3544
# Counter for processed files
3645
processed=0
3746
skipped=0
47+
failed=0
3848

3949
# Process all video files
4050
echo "Processing videos in: $SOURCE_DIR"
@@ -53,36 +63,79 @@ for video_file in "$SOURCE_DIR"/*; do
5363
if [[ " ${VIDEO_EXTENSIONS[*]} " =~ " ${extension,,} " ]]; then
5464
output_file="$TARGET_DIR/${filename_noext}.jpg"
5565

56-
# Check if output file already exists
66+
# Check if output file already exists and is valid
5767
if [ -f "$output_file" ]; then
58-
echo "� Skipping '$filename' (poster already exists)"
59-
((skipped++))
60-
continue
68+
# Verify the existing poster is valid (not empty and is an image)
69+
if [ -s "$output_file" ]; then
70+
echo "✓ Skipping '$filename' (poster already exists)"
71+
((skipped++))
72+
continue
73+
else
74+
echo "⚠ Removing invalid poster for '$filename'"
75+
rm -f "$output_file"
76+
fi
6177
fi
6278

63-
echo "<� Processing '$filename'..."
79+
echo " Processing '$filename'..."
6480

65-
# Extract first frame using ffmpeg
66-
if ffmpeg -i "$video_file" -vframes 1 -q:v 2 "$output_file" -y -loglevel error; then
67-
echo " Created poster: ${filename_noext}.jpg"
68-
((processed++))
81+
# Extract first frame using ffmpeg with timeout
82+
if [ -n "$FFMPEG_TIMEOUT" ]; then
83+
# Use timeout if available
84+
if timeout 30 ffmpeg -i "$video_file" -vframes 1 -q:v 2 "$output_file" -y -loglevel error 2>&1; then
85+
ffmpeg_success=true
86+
else
87+
ffmpeg_success=false
88+
fi
6989
else
70-
echo "L Failed to process '$filename'"
90+
# No timeout available, run ffmpeg directly
91+
if ffmpeg -i "$video_file" -vframes 1 -q:v 2 "$output_file" -y -loglevel error 2>&1; then
92+
ffmpeg_success=true
93+
else
94+
ffmpeg_success=false
95+
fi
96+
fi
97+
98+
if $ffmpeg_success; then
99+
# Verify the output file was created and is valid
100+
if [ -f "$output_file" ] && [ -s "$output_file" ]; then
101+
echo "✓ Created poster: ${filename_noext}.jpg"
102+
((processed++))
103+
else
104+
echo "✗ Failed to create valid poster for '$filename'"
105+
rm -f "$output_file" # Remove any partial output
106+
((failed++))
107+
fi
108+
else
109+
# ffmpeg failed
110+
exit_code=$?
111+
if [ $exit_code -eq 124 ]; then
112+
echo "✗ Timeout processing '$filename' (after 30s)"
113+
else
114+
echo "✗ Failed to process '$filename' (exit code: $exit_code)"
115+
fi
71116
rm -f "$output_file" # Remove any partial output
117+
((failed++))
72118
fi
73119
else
74-
echo " Skipping '$filename' (not a supported video format)"
120+
echo " Skipping '$filename' (not a supported video format)"
75121
((skipped++))
76122
fi
77123
done
78124

79125
echo "------------------------------------------------"
80126
echo "Poster generation completed!"
81-
echo "=� Summary:"
82-
echo " Processed: $processed videos"
83-
echo " Skipped: $skipped files"
127+
echo "📊 Summary:"
128+
echo " ✓ Processed: $processed videos"
129+
echo " → Skipped: $skipped files"
130+
if [ $failed -gt 0 ]; then
131+
echo " ✗ Failed: $failed videos"
132+
fi
84133
echo " Posters saved to: $TARGET_DIR"
85134

86135
if [ $processed -eq 0 ]; then
87-
echo "� No new posters were created."
136+
if [ $failed -eq 0 ]; then
137+
echo "ℹ No new posters were created."
138+
else
139+
echo "⚠ Some posters failed to generate. Please check the error messages above."
140+
fi
88141
fi
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)