Files
MyClub/scripts/start_tamagotchi.py
T
Tomas Dvorak dfc079288f hot fix #1
2026-01-26 08:13:18 +01:00

94 lines
3.4 KiB
Python

#!/usr/bin/env python3
"""
Project Tamagotchi - Browser Terminal
Single launcher for the browser-based terminal tamagotchi
"""
import os
import sys
import subprocess
def main():
print("=" * 60)
print("🐣 PROJECT TAMAGOTCHI - BROWSER TERMINAL")
print("=" * 60)
print("Features:")
print(" • Terminal interface in your browser")
print(" • Real-time file monitoring (every 2 seconds)")
print(" • ASCII display (no emojis)")
print(" • Activity detection when you edit files")
print(" • Command history (use arrow keys)")
print(" • Terminal effects and animations")
print()
print("🎮 Controls in browser:")
print(" • f - Feed the tamagotchi")
print(" • p - Play with the tamagotchi")
print(" • r - Refresh stats (automatic)")
print(" • q - Quit session")
print()
print("🔧 How it works:")
print(" • Scans your project for code files")
print(" • Detects file changes in real-time")
print(" • Updates tamagotchi mood based on activity")
print(" • Shows project statistics")
print()
# Check dependencies
script_dir = os.path.dirname(os.path.abspath(__file__))
venv_python = os.path.join(script_dir, 'tamagotchi_env', 'bin', 'python')
if not os.path.exists(venv_python):
print("📦 Setting up environment...")
try:
subprocess.run([sys.executable, '-m', 'venv', 'tamagotchi_env'],
cwd=script_dir, check=True, capture_output=True)
print("✅ Virtual environment created")
except subprocess.CalledProcessError:
print("❌ Failed to create virtual environment")
return 1
# Install dependencies if needed
print("📦 Checking dependencies...")
try:
venv_pip = os.path.join(script_dir, 'tamagotchi_env', 'bin', 'pip')
result = subprocess.run([venv_pip, 'install', 'flask', 'flask-socketio'],
cwd=script_dir, check=True, capture_output=True)
print("✅ Dependencies ready")
except subprocess.CalledProcessError:
print("✅ Dependencies already installed")
# Get project name
project_name = "MyClub"
if len(sys.argv) > 1:
project_name = sys.argv[1]
print(f"📊 Project: {project_name}")
print("🌐 Starting browser terminal...")
print("-" * 60)
print("🌐 OPEN YOUR BROWSER TO: http://localhost:5000")
print("⌨️ Terminal interface with real-time updates!")
print("🔥 Edit files to see activity detection!")
print("📱 Works on mobile too!")
print("🛑 Press Ctrl+C to stop the server")
print("=" * 60)
# Launch browser terminal
terminal_script = os.path.join(script_dir, 'browser_terminal_tamagotchi.py')
if os.path.exists(terminal_script):
try:
subprocess.run([venv_python, terminal_script, project_name])
except KeyboardInterrupt:
print("\n👋 Browser terminal stopped! Thanks for playing!")
return 0
else:
print(f"❌ Error: {terminal_script} not found!")
return 1
if __name__ == '__main__':
exit(main())
# Testing file tracking Mon Jan 12 17:44:15 CET 2026
# Testing stable terminal Mon Jan 12 17:46:45 CET 2026
# Testing bigger terminal Mon Jan 12 17:50:30 CET 2026
# Testing much bigger UI Mon Jan 12 17:51:32 CET 2026