updated to generate trip
This commit is contained in:
81
junk_files/test_relive_animation.py
Normal file
81
junk_files/test_relive_animation.py
Normal file
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script for the improved Relive-style GPS animation
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
# Add the project directory to the path
|
||||
sys.path.append('/home/pi/Desktop/traccar_animation')
|
||||
|
||||
from py_scripts.advanced_3d_generator import Advanced3DGenerator
|
||||
|
||||
def test_relive_animation():
|
||||
"""Test the new Relive-style animation"""
|
||||
|
||||
# Find a project with GPS data
|
||||
resources_folder = "/home/pi/Desktop/traccar_animation/resources"
|
||||
projects_folder = os.path.join(resources_folder, "projects")
|
||||
|
||||
if not os.path.exists(projects_folder):
|
||||
print("No projects folder found")
|
||||
return
|
||||
|
||||
# Look for projects with positions.json
|
||||
for project_name in os.listdir(projects_folder):
|
||||
project_path = os.path.join(projects_folder, project_name)
|
||||
positions_file = os.path.join(project_path, "positions.json")
|
||||
|
||||
if os.path.exists(positions_file):
|
||||
print(f"🎬 Testing Relive-style animation with project: {project_name}")
|
||||
|
||||
# Check if positions file has data
|
||||
try:
|
||||
with open(positions_file, 'r') as f:
|
||||
positions = json.load(f)
|
||||
|
||||
if len(positions) < 5:
|
||||
print(f"❌ Project {project_name} has only {len(positions)} GPS points - skipping")
|
||||
continue
|
||||
|
||||
print(f"📍 Found {len(positions)} GPS points")
|
||||
|
||||
# Create generator
|
||||
generator = Advanced3DGenerator(project_path)
|
||||
|
||||
# Progress callback
|
||||
def progress_callback(progress, message):
|
||||
print(f"Progress: {progress:.1f}% - {message}")
|
||||
|
||||
# Generate animation
|
||||
output_video = os.path.join(project_path, f"relive_animation_{datetime.now().strftime('%Y%m%d_%H%M%S')}.mp4")
|
||||
|
||||
print(f"🚀 Starting Relive-style animation generation...")
|
||||
success = generator.generate_3d_animation(
|
||||
positions_file,
|
||||
output_video,
|
||||
style='advanced',
|
||||
progress_callback=progress_callback
|
||||
)
|
||||
|
||||
if success:
|
||||
print(f"✅ SUCCESS! Relive-style animation created: {output_video}")
|
||||
print(f"📁 You can find your video at: {output_video}")
|
||||
else:
|
||||
print("❌ Failed to generate animation")
|
||||
|
||||
return # Exit after first successful project
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Error testing project {project_name}: {e}")
|
||||
continue
|
||||
|
||||
print("❌ No suitable projects found for testing")
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("🎬 Testing Improved Relive-Style GPS Animation")
|
||||
print("=" * 50)
|
||||
test_relive_animation()
|
||||
Reference in New Issue
Block a user