# Wallpaper Studio Automation Setup
# Automated daily generation with review reminders

## Quick Setup

### 1. Test the automation
```bash
bash /workspace/group/neoncyber/scripts/auto-daily.sh
```

### 2. Set up cron job
```bash
crontab -e
```

Add this line:
```bash
0 9 * * * /workspace/group/neoncyber/scripts/auto-daily.sh
```

This runs every day at 9 AM.

### 3. Set up review reminder (optional)
Add another cron line 4 hours later:
```bash
0 13 * * * echo "🎨 Review your wallpapers: http://localhost:8765"
```

## Automation Features

### Auto Daily Rotation
- **Monday:** Glitch aesthetics
- **Tuesday:** Color palettes
- **Wednesday:** B/W selective color
- **Thursday:** Impossible geometry
- **Friday:** Bedroom POVs
- **Saturday:** Chaos surrealism
- **Sunday:** ComfyUI classics

### Smart Limit Handling
- Checks Cloudflare availability before starting
- Skips if daily limit reached (429 error)
- Logs all activity to daily log files

### Weekly Cycle
Each week generates all 7 themed batches:
- 85+ wallpapers per week
- Automatic theme variety
- Covers all proven ComfyUI aesthetics

## Manual Controls

### Generate specific theme today
```bash
bash /workspace/group/neoncyber/scripts/auto-daily.sh  # Uses today's theme
```

### Generate with keyword override
```bash
bash /workspace/group/neoncyber/scripts/daily-generation.sh glitch
bash /workspace/group/neoncyber/scripts/daily-generation.sh bedroom
```

### Check today's theme
```bash
date +%u  # Day of week (1-7)
# 1=Monday (glitch), 7=Sunday (classics)
```

## Logs

All activity logged to:
```
/workspace/group/neoncyber/logs/daily-YYYYMMDD.log
```

Check today's log:
```bash
tail -f /workspace/group/neoncyber/logs/daily-$(date +%Y%m%d).log
```

## Review Workflow

### Daily (5 min)
1. Morning: Check gallery at http://localhost:8765
2. Rate new wallpapers (click stars)
3. Note any 4+ star winners

### Weekly (30 min)
1. Review entire week's results
2. Identify winning themes/techniques
3. Update strategy for next week

### Monthly (1 hour)
1. Assess progress against success criteria
2. Decide: continue theme or pivot
3. Adjust rotation if needed

## Cron Configuration

### Daily at 9 AM
```bash
0 9 * * * /workspace/group/neoncyber/scripts/auto-daily.sh
```

### Daily at 9 PM
```bash
0 21 * * * /workspace/group/neoncyber/scripts/auto-daily.sh
```

### Weekdaily at 9 AM (skip weekends)
```bash
0 9 * * 1-5 /workspace/group/neoncyber/scripts/auto-daily.sh
```

### Every 6 hours (4x daily)
```bash
0 */6 * * * /workspace/group/neoncyber/scripts/auto-daily.sh
```

## Reminder Options

### Local notification
Add to crontab:
```bash
0 13 * * * notify-send "Wallpaper Review" "Review at: http://localhost:8atsapp:8765"
```

### Webhook notification
Set environment variable:
```bash
export WEBHOOK_URL="your_webhook_url"
```

Script will send status updates.

## Testing

### Test before scheduling
```bash
# Test auto-daily script
bash /workspace/group/neoncyber/scripts/auto-daily.sh

# Check logs
cat /workspace/group/neoncyber/logs/daily-$(date +%Y%m%d).log
```

### Test cron job
```bash
# Test cron (runs in 1 minute)
echo "* * * * * /workspace/group/neoncyber/scripts/auto-daily.sh" | crontab -

# Check it scheduled
crontab -l
```

## Monitoring

### See what's scheduled
```bash
crontab -l
```

### See recent logs
```bash
# Last 7 days
find /workspace/group/neoncyber/logs/ -name "daily-*.log" -mtime -7 -exec tail -20 {} \;

# Today's log
cat /workspace/group/neoncyber/logs/daily-$(date +%Y%m%d).log
```

### See total generated
```bash
# This week
find /workspace/group/neoncyber/renders/daily-*/ -type f -mtime -7 | wc -l

# All time
find /workspace/group/neoncyber/renders/ -type f | wc -l
```

## Removing Automation

To stop automated generation:
```bash
crontab -e
# Delete the lines starting with auto-daily
```

To re-enable:
```bash
crontab -e
# Add the lines back
```

## Success Metrics

Week 1 target:
- ✅ Automation running smoothly
- ✅ 7 batches generated (85 wallpapers)
- ✅ Gallery dashboard tracking all
- ✅ You've rated 70%+ of wallpapers

Week 2 target:
- ✅ 4+ star rate identified
- ✅ Winning themes selected
- ✅ Next week's strategy adjusted

Week 3 target:
- ✅ Consistent 4+ star rate >25%
- ✅ 10+ golden wallpapers curated
- ✅ Steam Workshop folder populated

## Troubleshooting

### Cron not running
```bash
# Check cron service
sudo systemctl status cron

# Check crontab
crontab -l

# Test cron manually
/usr/bin/crontab -l
```

### Script failing
```bash
# Run manually to see errors
bash /workspace/group/neoncyber/scripts/auto-daily.sh

# Check permissions
ls -la /workspace/group/neoncyber/scripts/auto-daily.sh

# Check logs
cat /workspace/group/neoncyber/logs/daily-$(date +%Y%m%d).log
```

### Gallery not updating
```bash
# Restart gallery server
# (Use your homelab setup)

# Clear browser cache
# Refresh http://localhost:8765
```

## Next Steps

1. Test auto-daily.sh manually
2. Set up cron job (daily 9 AM)
3. Optional: Add review reminder (1 PM)
4. Check gallery next morning
5. Start reviewing and rating wallpapers
6. Let automation build your portfolio