Skip to content

alexnimo/cash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CASH (Compact Analysis System Hub)

A powerful AI-driven analysis platform featuring YouTube video processing and the DannyTrades Agent for automated stock market analysis and trading insights.

License Python Version FastAPI

Features

🎥 Video Processing

  • Single video upload and analysis
  • Multiple videos batch processing with sequential queue
  • YouTube playlist support
  • Automatic transcription and content extraction
  • File upload API for direct video uploads
  • Intelligent video processing queue management

📈 DannyTrades Agent

  • Multi-LLM Support: Claude, OpenAI, Gemini, Ollama, Groq, Mistral
  • Stock Data Processing: Automated analysis of stock market data
  • Notion Integration: Seamless MCP-based database updates
  • Real-time Monitoring: Live performance metrics and activity tracking
  • Web Dashboard: Modern UI with Shadcn components
  • Provider Management: Dynamic LLM provider switching
  • Performance Analytics: Request tracking, success rates, response times

🤖 AI-Powered Analysis

  • Advanced language model integration
  • Vector-based similarity search
  • Intelligent content summarization
  • Context-aware chat interface

🖥️ Enhanced User Interface

  • Modern, responsive web interface
  • Real-time processing status updates
  • Enhanced console log with scroll, color coding, and timestamps
  • Interactive chat with processed content
  • Video processing queue status monitoring
  • Easy-to-use upload forms
  • DannyTrades Agent dashboard with live metrics

⚙️ System Management

  • Automated file cleanup service (janitor) with cron scheduling
  • Configurable retention policies
  • Background maintenance tasks
  • Queue management and monitoring

🔌 API Integration

  • RESTful API for video upload and analysis
  • DannyTrades Agent endpoints for stock processing
  • Queue management endpoints
  • File cleanup management
  • Real-time status monitoring

Quick Start

Prerequisites

  • Python 3.8 or higher
  • UV package manager (recommended) or pip
  • Node.js and npm (for MCP servers)
  • YouTube Data API key (optional, for enhanced playlist features)
  • API keys for LLM providers (OpenAI, Anthropic, etc.) for DannyTrades Agent
  • Notion API key and database setup for DannyTrades integration

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/video-analyzer.git
cd video-analyzer
  1. Install dependencies using UV (recommended):
# Install UV if not already installed
pip install uv

# Install project dependencies
uv sync

# Activate the virtual environment
source .venv/bin/activate  # On Linux/Mac
# OR
.venv\Scripts\activate  # On Windows

Alternatively, use pip:

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # On Linux/Mac or .venv\Scripts\activate on Windows

# Install dependencies
pip install -r requirements.txt
  1. Configure environment variables:
# Copy the example environment file
cp .env.example .env

# Edit .env with your API keys and configuration
# Required for DannyTrades Agent:
# - OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.
# - NOTION_API_KEY and NOTION_DATABASE_ID
  1. Install MCP servers (for DannyTrades Agent):
# Install the official Notion MCP server
npm install -g @modelcontextprotocol/server-notion

# Or install locally in your project
npm install @modelcontextprotocol/server-notion
  1. Start the server:
# Using UV
uv run python main.py

# Or with standard Python
python main.py

⚠️ Important: Always run the server from the project root directory, not from within the app directory.

Usage

Single Video Analysis

  1. Paste a YouTube video URL in the single video form
  2. Click "Upload Video"
  3. Monitor processing status in real-time
  4. Once complete, use the chat interface to interact with the video content

Playlist Processing

  1. Enter a YouTube playlist URL in the playlist form
  2. Click "Upload Playlist"
  3. Track progress of individual videos
  4. Chat with content from all processed videos

Multiple Videos

  1. Enter multiple YouTube URLs (one per line)
  2. Click "Upload Videos"
  3. Monitor batch processing status in the enhanced console
  4. Videos are processed sequentially to avoid rate limits
  5. Interact with combined content through chat

DannyTrades Agent Usage

Access the DannyTrades Agent dashboard at http://localhost:8000 and navigate to the "DannyTrades" tab.

Configuration

  1. LLM Provider Setup: Configure your preferred AI provider (Claude, OpenAI, Gemini, etc.)
  2. MCP Server Setup: The agent uses the official Notion MCP server via stdio transport
  3. Environment Variables: Ensure all required API keys are configured

MCP Server Configuration

The DannyTrades Agent supports flexible MCP server configuration:

# Default configuration uses official Notion MCP server
mcp_servers = [
    {
        "name": "notion",
        "transport_type": "stdio",
        "command": "npx",
        "args": ["-y", "@modelcontextprotocol/server-notion"],
        "env": {
            "NOTION_API_KEY": "your_notion_api_key",
            "NOTION_DATABASE_ID": "your_database_id"
        }
    }
]

You can also use:

  • Alternative MCP servers: Any MCP-compatible server
  • MCP Proxy servers: For advanced routing and management
  • SSE Transport: For server-sent events based communication

Stock Data Processing

# Process stock data via API
curl -X POST "http://localhost:8000/api/dannytrades/process" \
  -H "Content-Type: application/json" \
  -d '{
    "symbol": "AAPL",
    "price": 150.25,
    "volume": 1000000,
    "sentiment": "bullish"
  }'

Real-time Monitoring

  • View live performance metrics in the dashboard
  • Monitor processing activities and success rates
  • Track LLM provider performance and costs
  • Monitor MCP server connections and tool availability

File Upload API

Upload video files directly via API:

curl -X POST "http://localhost:8000/api/upload-video" \
  -H "accept: application/json" \
  -H "Content-Type: multipart/form-data" \
  -F "video_file=@your_video.mp4" \
  -F "title=My Video" \
  -F "description=Video description" \
  -F "priority=1"

Architecture

Components

  • FastAPI Backend

    • RESTful API endpoints
    • Async video processing
    • WebSocket support for real-time updates
    • Static file serving
    • DannyTrades Agent API endpoints
  • DannyTrades Agent System

    • Multi-LLM provider support (Claude, OpenAI, Gemini, Ollama, Groq, Mistral)
    • Agno AI framework integration
    • MCP (Model Context Protocol) tools for Notion
    • Performance monitoring and analytics
    • Real-time activity tracking
    • Async processing with retry mechanisms
  • Video Processing Pipeline

    • YouTube video download
    • Audio extraction
    • Transcription processing
    • Content analysis
  • Vector Store

    • Efficient similarity search
    • Content embedding storage
    • Fast query processing
  • LLM Service

    • Context-aware responses
    • Content summarization
    • Natural language understanding

Configuration

The system is configured via config.yaml. Key configuration sections:

File Cleanup (Janitor) Settings

janitor:
  enabled: true
  schedule: "0 1 * * *"  # Daily at 1:00 AM (cron syntax)
  cleanup_paths:
    - "downloads"
    - "temp"
    - "transcripts"
  file_patterns:
    - "*.mp4"
    - "*.wav"
    - "*.txt"
    - "*.json"
  retention_hours: 168  # 7 days
  dry_run: false
  max_file_size_mb: null  # Optional file size limit
  exclude_patterns: []  # Files to exclude from cleanup
  log_deletions: true  # Log each file deletion
  preserve_recent_files: true  # Keep files from last 24h regardless of retention

Storage Settings

storage:
  base_path: "./storage"
  downloads_path: "downloads"
  transcripts_path: "transcripts"

API Settings

api:
  host: "0.0.0.0"
  port: 8000
  cors_origins:
    - "http://localhost:3000"
    - "http://127.0.0.1:3000"

API Documentation

Access the interactive API documentation at:

http://localhost:8000/docs

Core Video Processing Endpoints

  • POST /analyze: Process single video
  • POST /analyze-playlist: Process YouTube playlist
  • POST /api/upload-video: Upload and analyze video file
  • POST /api/analyze-url: Analyze video from URL
  • POST /chat: Interact with processed content
  • GET /status/{video_id}: Check processing status

Queue Management Endpoints

  • GET /api/queue/status: Get video processing queue status
  • GET /api/queue/video/{video_id}: Get specific video queue info

File Cleanup (Janitor) Endpoints

  • GET /api/janitor/status: Get service status and configuration
  • POST /api/janitor/config: Update runtime configuration
  • POST /api/janitor/cleanup/manual: Trigger manual cleanup
  • GET /api/janitor/cleanup/preview: Preview cleanup without deletion
  • POST /api/janitor/start: Start the janitor service
  • POST /api/janitor/stop: Stop the janitor service

Enhanced Features

Enhanced Console Features

The web interface now includes an enhanced console log with:

  • Scrollable output: 300px height with smooth scrolling
  • Color-coded log levels: INFO (blue), SUCCESS (green), WARNING (yellow), ERROR (red), DEBUG (purple)
  • Timestamps: ISO format timestamps for all entries
  • Auto-scroll toggle: Enable/disable auto-scrolling to latest entries
  • Clear console: Button to clear all log entries
  • Queue monitoring: Real-time queue status display
  • Memory management: Automatic cleanup of old entries (max 1000)

Video Processing Queue

Videos are now processed sequentially to avoid:

  • Rate limiting issues
  • System resource bottlenecks
  • Parallel processing conflicts

Queue features:

  • Priority processing: Higher priority videos processed first
  • Status tracking: Real-time status updates for each video
  • Error handling: Failed videos don't block the queue
  • Progress monitoring: Track position and processing time

Automated File Cleanup (Janitor)

The janitor service automatically manages storage with advanced features:

  • Cron-based scheduling: Configurable cleanup schedules using cron syntax
  • Smart file filtering: Exclusion patterns, size limits, and recent file preservation
  • Retention policies: Keep files for configurable time periods
  • Web UI management: Full control panel with real-time status and configuration
  • Preview mode: Safe cleanup preview before actual deletion
  • Runtime configuration: Update settings without restarting the service
  • Detailed logging: Comprehensive deletion tracking and error reporting
  • Manual triggers: API endpoints for on-demand cleanup

Janitor Web Interface Features

  • Service Controls: Start/stop service with one click
  • Configuration Panel: Adjust retention hours, file size limits, and cleanup schedule
  • Cleanup Options: Preview what would be deleted or run manual cleanup
  • Status Display: Real-time service status and last cleanup results
  • Results Visualization: Detailed statistics showing files deleted, space freed, and errors

File Upload Support

Direct file upload capabilities:

  • Multi-format support: Accept various video file formats
  • API integration: RESTful endpoints for programmatic uploads
  • Priority queuing: Set processing priority for uploaded files
  • Metadata support: Add titles and descriptions during upload

Development

Project Structure

video-analyzer/
├── app/
│   ├── static/
│   │   ├── index.html
│   │   └── app.js
│   ├── services/
│   │   ├── video_processor.py
│   │   ├── llm_service.py
│   │   ├── vector_store.py
│   │   └── model_manager.py
│   └── main.py
├── requirements.txt
├── config.yaml
└── README.md

Adding New Features

  1. Create feature branch:
git checkout -b feature/your-feature-name
  1. Implement changes
  2. Update tests
  3. Submit pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgments

  • OpenAI for language model support
  • FastAPI for the web framework
  • CopilotKit for enhanced chat capabilities

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors