ShukeBta 3a2db6bdd9 feat: Emby 兼容层完整实现 + 多模块功能增强
## Emby/Jellyfin 兼容层 (emby_compat.go / emby.go)
- 新增 SystemInfoPublic、FindUser、Items、Item、LatestItems、ResumeItems
- 新增 SetFavorite、MarkPlayed、RecordProgress 用户播放状态同步
- 新增 itemPayload、mediaSource、mediaStreams 媒体信息组装
- 双前缀路由 /emby/* 和 / 根路径,兼容 Infuse/Yamby/Senplayer/Kodi
- 新增 Ping、SystemEndpoint、AuthByName 端点
- emby.go 扩展对应 handler 函数

## 站点适配器 (site_adapter.go / site.go)
- SiteConfig 扩展 UserAgent/Timeout/Extra/FlareSolverrURL 字段
- doRequest() GET 请求支持 FlareSolverr 代理绕过 Cloudflare/WAF
- MTeam api_key 认证改为 Authorization: Bearer 格式
- Search() 重构为 sync.WaitGroup 并发执行,提升多站搜索性能
- siteModelToConfig() 改为 SiteService 方法,按 BrowserEmulation 填充 FlareSolverrURL

## 图片代理 (image_proxy.go)
- 重构图片代理服务,支持更多来源和缓存策略

## 下载管理 (downloads.go / download_clients.go / qbittorrent.go)
- 下载任务增强:状态管理、进度追踪优化
- qBittorrent 客户端连接稳定性改进

## 刮削与数据库 (scraper.go / tmdb.go / repository.go)
- 刮削器增强 TMDB 集成,补全元数据字段
- repository 扩展查询方法

## 前端 (web/src/)
- HomePage: 首页布局重构,按媒体库分组展示,系列聚合优化
- DiscoverPage: 发现页增强,错误处理改进(API key 缺失/网络错误分离)
- PosterWallPage: 海报墙优化,系列聚合展示
- MediaCard: 媒体卡片优化
- PlayerPage: 播放器改进
- 新增 utils/groupSeries.ts: 系列聚合工具函数
- .gitignore: 添加 .tmp_* 临时文件排除规则
2026-05-26 16:09:13 +08:00
@
2026-05-17 23:13:26 +08:00

A Go rewrite of MediaStation

Lightweight · Fast · Single Binary · NAS Ready

Chinese

Go React TypeScript SQLite Docker GPL v3


📖 Why  ·  🚀 Quick Start  ·  ✨ Features  ·  🏗️ Layout  ·  ⚙️ Config  ·  🗺️ Roadmap


🤔 Why MediaStationGo?

MediaStationGo is a from-scratch Go rewrite of MediaStation — same full-featured media center experience, radically simpler deployment.

Original MediaStation

  • 🐍 Python / FastAPI + Vue
  • 📦 Requires Python runtime & virtualenv
  • 🐳 Docker mandatory or complex Python setup
  • 📊 Deployment footprint > 500 MB
  • 🔧 pip + npm dual build chains

MediaStationGo ✨

  • 🚀 Go 1.25 + React 18
  • 📦 Single static binary (~30 MB)
  • 🐳 Docker optional — runs natively bare-metal
  • 🔥 Zero external dependencies (CGO off)
  • ⚡ One-command build: go build
Metric Original MediaStationGo
Binary size — ≈ 30 MB
Memory (idle) ~200 MB ~30 MB
Cold start ~3s ~0.3s
Deploy steps 5+ 1
Frontend (gzip) ~250 KB ~83 KB

✨ Features

🔐 Authentication & Users
Feature Description
JWT dual-role auth admin / user with refresh token support
One-click admin bootstrap Auto-seeded admin / admin123 on first run
Profile management Email, avatar, password change
User admin panel Role promotion / demotion, enable / disable
Audit log Login, library ops, downloads — all tracked
📚 Library Management
Feature Description
Library CRUD movie / tv / anime / music types supported
Recursive scanning Filesystem walk + ffprobe metadata extraction
Smart filename parsing Year + season/episode auto-detection
Multi-source scraping TMDb → TheTVDB → Bangumi chain
HD poster upgrade Optional Fanart.tv high-res fallback
Image proxy TMDb / Bangumi / Douban / Fanart with disk cache
TV grouping Season grouping with episode listing
Live fs watching fsnotify-powered, 5-second coalesced debounce
🎬 Playback
Feature Description
Direct streaming HTTP Range support for instant seeking
HLS on-demand Per-media ffmpeg job with HW acceleration
External subtitles .srt / .vtt / .ass / .ssa → real-time WebVTT
Resume playback Auto-saved every 10s + Continue Watching on home
Favorites & playlists One-tap toggle / ordered playlists (CRUD)
🌐 PT Site Management
Feature Description
6 site types nexusphp · gazelle · unit3d · mteam · discuz · custom_rss
3 auth methods Cookie / API Key / Auth Header
Site config Full CRUD + connection test + enable toggle
Cross-site search One-click search across all configured trackers
Extended config Extra JSON: UA / RSS URL / timeout / priority / proxy / downloader
🤖 Automation
Feature Description
Download client qBittorrent Web UI API (add / list / delete)
RSS subscriptions Regex filter + GUID dedup + 10-min polling
File organizer Auto-categorize downloads: move / copy / hardlink / symlink
📊 Operations & Monitoring
Feature Description
Live events WebSocket push for scan / scrape / transcode / download / subscribe
Dashboard CPU / Memory / Disk / Library counts / Goroutines
Task panel Real-time ffmpeg jobs + qBittorrent torrents
NFO export Kodi / Jellyfin compatible — single media or whole library
HW acceleration Software / NVENC / Intel QSV / VAAPI encoder profiles
CI/CD GitHub Actions + multi-arch GHCR release
🧠 AI & Discovery
Feature Description
TMDb Discover Trending / popular rails on homepage
AI smart search OpenAI-compatible → natural language → structured query
AI recommendations Personalized picks from your watch history

🚀 Quick Start

git clone https://github.com/ShukeBta/MediaStationGo.git
cd MediaStationGo

# Edit docker-compose.yml to mount your media at /media
docker compose up -d

🌐 The server auto-detects both your local network IP and public IP on startup (NAS / VPS supported):

{"msg":"server is ready","local":"http://192.168.1.4:8080","public":"http://1.2.3.4:8080"}

Log in with admin / admin123.

💻 Bare Metal

Prerequisite Version
Go ≥ 1.25
Node.js ≥ 20
FFmpeg Any
git clone https://github.com/ShukeBta/MediaStationGo.git
cd MediaStationGo

# Build backend + frontend
make build

# Start the server
./bin/mediastation-go

🛠️ Local Development

# Terminal 1: Go backend (port 8080, DEBUG mode)
make dev

# Terminal 2: Vite frontend (port 3000, proxies API calls)
make dev-web

⚙️ Configuration

Config precedence: defaults < config.yaml < config/*.yaml < env vars (prefix MEDIASTATION_)

Key Environment Variables

Variable Default Purpose
MEDIASTATION_APP_PORT 8080 HTTP listen port
MEDIASTATION_APP_DATA_DIR ./data Data root (DB / cache / JWT)
MEDIASTATION_APP_WEB_DIR ./web/dist SPA bundle directory
MEDIASTATION_DATABASE_DB_PATH ./data/mediastation.db SQLite file path
MEDIASTATION_SECRETS_JWT_SECRET (auto) JWT signing key
MEDIASTATION_SECRETS_TMDB_API_KEY (empty) TMDb scraping (required)
MEDIASTATION_SECRETS_BANGUMI_ACCESS_TOKEN (empty) Bangumi rate limit boost
MEDIASTATION_APP_CORS_ORIGINS (empty) Allow-list (JSON array)
ADMIN_INITIAL_PASSWORD admin123 Initial admin password

Runtime Settings

Admin panel → Settings tab, stored in the settings table:

Key Purpose
qbittorrent.url qBittorrent Web UI URL
qbittorrent.username Username
qbittorrent.password Password
qbittorrent.savepath Default save path (optional)

💡 After editing, hit Downloads → Reload Config or POST /api/downloads/reload.

📖 Full config template: config.example.yaml


🏗️ Project Layout

MediaStationGo/
├── cmd/server/main.go          ← Entry point
├── internal/
│   ├── config/                 ← Viper configuration layer
│   ├── database/               ← GORM + SQLite (WAL) bootstrap
│   ├── model/                  ← Data models + AutoMigrate registry
│   ├── repository/             ← Data access layer
│   ├── service/                ← Business logic (core)
│   │   ├── auth.go             login / register / JWT
│   │   ├── media.go            library + media CRUD
│   │   ├── scanner.go          filesystem walker + ffprobe
│   │   ├── scraper.go          scrape orchestrator + filename cleaner
│   │   ├── tmdb.go / bangumi.go  third-party providers
│   │   ├── site.go             site CRUD + cross-site search
│   │   ├── site_adapter.go     6 PT site adapters
│   │   ├── stream.go           direct play + HLS
│   │   ├── transcoder.go       per-media ffmpeg job manager
│   │   ├── subtitle.go         external subs → WebVTT
│   │   ├── image_proxy.go      cached image proxy
│   │   ├── playback.go         history / favorites / playlists
│   │   ├── watcher.go          fsnotify debouncer
│   │   ├── qbittorrent.go      qBittorrent v2 API client
│   │   ├── downloads.go        download orchestrator
│   │   ├── subscription.go     RSS poller
│   │   ├── organizer.go        media file organizer
│   │   ├── stats.go            dashboard snapshot
│   │   ├── profile.go          user profile mutations
│   │   ├── audit.go            audit log writer
│   │   └── ws_hub.go           WebSocket pub/sub broker
│   ├── middleware/             ← JWT / CORS / admin middleware
│   └── handler/                ← HTTP route definitions (by concern)
├── web/                        ← React 18 + Vite + Tailwind CSS
│   ├── src/api/                axios service wrappers
│   ├── src/components/         Card / Layout / APIConfigsPanel / etc.
│   ├── src/hooks/              useWebSocket & friends
│   ├── src/pages/              Home · Library · Search · Player · Downloads · Admin · Sites
│   ├── src/stores/             Zustand (auth)
│   └── src/types/              TypeScript domain types
├── Dockerfile                  ← Multi-stage, multi-arch build
├── docker-compose.yml          ← NAS-friendly one-command deploy
├── Makefile                    ← build / dev / docker / test
├── config.example.yaml         ← Full configuration reference
└── .github/workflows/          ← CI + GHCR publish

🗺️ Roadmap

Feature Status
Jellyfin / Emby compatibility layer 🔨 In Progress
DLNA / Chromecast casting 📋 Planned
Online subtitle search providers 📋 Planned
Multi-bitrate ABR transcode 📋 Planned
STRM direct streaming (WebDAV / Alist / S3) ✅ Complete

🤝 Contributing

Issues and PRs are welcome! Please read the Contribution Guidelines before submitting.


📄 License

GNU General Public License v3.0

⚠️ License activation/validation is handled by a separate server: MediaStationLicenseServer. This project contains no license generation or validation logic.


Made with ❤️ by MediaStationGo Team

S
Description
No description provided
Readme 76 MiB
Languages
Go 74.3%
TypeScript 25.6%