mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-29 03:26:37 +08:00
8824638efb
Backend
- service/transcoder.go: encoder selector (software / nvenc / qsv /
vaapi) with proper hwaccel + scale_* filters per encoder; configurable
bitrate/preset/height/segment-seconds via transcoder.* config; new
Active() snapshot + ActiveJob struct for the Tasks panel; unit-tested
via buildFFmpegArgs(...).
- service/thetvdb.go: TheTVDB v4 provider — login() caches the JWT for
24h, SearchSeries() returns Match struct.
- service/fanart.go: Fanart.tv provider — high-res movie artwork keyed
by TMDb id; used to upgrade poster/backdrop after a successful match.
- service/scraper.go: provider chain reworked — anime → Bangumi, tv →
TheTVDB, default → TMDb, with optional Fanart upgrade post-match.
- service/discover.go: TMDb /trending/movie/day + /movie/popular for
the Discover rail.
- service/ai.go: OpenAI-compatible client. SmartSearch() turns a free-
form query into a structured SearchIntent JSON; Recommend() emits a
short list of titles given the user's history. Disabled when
ai.api_key is empty.
- service/nfo.go: per-movie .nfo writer (Kodi/Jellyfin schema) +
library-scope batch exporter.
- service/media.go: SoftDelete / Restore / Purge / ListRecycleBin
helpers backed by gorm Unscoped().
- service/service.go: container wires Fanart, TheTVDB, Discover, AI,
NFO; everything still tears down cleanly via Close().
- config: new transcoder.* section (encoder, preset, video_bitrate,
max_rate, buf_size, max_height, segment_seconds) with sensible
defaults.
Handlers / routes
- new files: discover.go, recycle.go, nfo.go, ai.go, tasks.go.
- registers GET /tasks, /discover/{trending,popular},
/ai/{status,search,recommend}; admin-only GET /recycle and
DELETE/POST /media/:id (soft delete / restore / purge); admin-only
POST /media/:id/nfo and /libraries/:id/nfo.
Frontend
- new pages: DiscoverPage, TasksPage, RecycleBinPage; SearchPage gains
an optional AI smart-search toggle that calls /api/ai/search.
- MediaDetailPage gains admin actions for 导出 NFO and 移至回收站.
- new api/ helpers: ai.ts, discover.ts, recycle.ts, tasks.ts.
- App.tsx routes /discover, /tasks, /recycle (last two admin-only).
- Layout sidebar groups now include Discover + Tasks + Recycle Bin.
Docker / config
- Dockerfile: adds intel-media-driver / libva-utils / mesa-va-gallium
so QSV + VAAPI work out of the box on Intel iGPUs.
- docker-compose.yml: documents devices + group_add + nvidia runtime
overrides for hardware transcoding.
Verified: go build, go vet, go test (incl. new TestBuildFFmpegArgs across
software / nvenc / qsv / vaapi encoder profiles); tsc -b && vite build
emits 22 route chunks plus the deferred hls chunk; main bundle 248 KB /
83 KB gzipped.
89 lines
2.5 KiB
YAML
89 lines
2.5 KiB
YAML
# ============================================================================
|
|
# MediaStationGo configuration template.
|
|
#
|
|
# Loading priority (low -> high):
|
|
# 1. Built-in defaults
|
|
# 2. config.yaml (this file, copied to the working directory)
|
|
# 3. config/*.yaml shard files (per-module)
|
|
# 4. Environment variables prefixed with MEDIASTATION_, e.g.
|
|
# MEDIASTATION_APP_PORT=8080
|
|
# MEDIASTATION_SECRETS_JWT_SECRET=...
|
|
#
|
|
# Copy this file to `config.yaml` and edit the values you actually need.
|
|
# ============================================================================
|
|
|
|
app:
|
|
port: 8080
|
|
debug: false
|
|
env: production
|
|
data_dir: ./data
|
|
web_dir: ./web/dist
|
|
ffmpeg_path: ffmpeg
|
|
ffprobe_path: ffprobe
|
|
vaapi_device: /dev/dri/renderD128
|
|
cors_origins: [] # leave empty to allow * in dev; set strict allow-list in prod
|
|
server_url: "" # public URL of the server (used for DLNA / casting)
|
|
|
|
database:
|
|
db_path: ./data/mediastation.db
|
|
wal_mode: true
|
|
busy_timeout: 5000
|
|
cache_size: -20000 # KB (negative)
|
|
max_open_conns: 1
|
|
max_idle_conns: 1
|
|
|
|
secrets:
|
|
# When empty, a 32-byte random secret is generated on first start and
|
|
# persisted to {data_dir}/.jwt_secret so existing sessions survive restarts.
|
|
jwt_secret: ""
|
|
tmdb_api_key: ""
|
|
tmdb_api_proxy: "" # e.g. https://api.tmdb-mirror.example
|
|
tmdb_image_proxy: "" # e.g. https://image.tmdb-mirror.example/t/p
|
|
bangumi_access_token: ""
|
|
thetvdb_api_key: ""
|
|
fanart_tv_api_key: ""
|
|
|
|
logging:
|
|
level: info # debug | info | warn | error
|
|
format: console # console | json
|
|
output_path: "" # empty = stdout
|
|
enable_rotation: false
|
|
max_size_mb: 100
|
|
max_age_days: 30
|
|
max_backups: 10
|
|
|
|
cache:
|
|
cache_dir: ./cache
|
|
max_disk_usage_mb: 0 # 0 = unlimited
|
|
ttl_hours: 0
|
|
auto_cleanup: false
|
|
cleanup_interval_min: 60
|
|
|
|
media:
|
|
movies_dir: ""
|
|
tv_dir: ""
|
|
anime_dir: ""
|
|
|
|
transcoder:
|
|
# Hardware encoder for HLS transcodes.
|
|
# "" software libx264 (default; runs anywhere)
|
|
# nvenc h264_nvenc (NVIDIA GPU, requires --gpus all)
|
|
# qsv h264_qsv (Intel iGPU, requires /dev/dri)
|
|
# vaapi h264_vaapi (Intel/AMD VAAPI, requires /dev/dri)
|
|
encoder: ""
|
|
preset: veryfast
|
|
video_bitrate: 1500k
|
|
max_rate: 1800k
|
|
buf_size: 3000k
|
|
max_height: 720
|
|
segment_seconds: 4
|
|
|
|
ai:
|
|
enabled: false
|
|
provider: openai # openai | deepseek | qwen | ollama
|
|
api_base: https://api.openai.com/v1
|
|
api_key: ""
|
|
model: gpt-4o-mini
|
|
timeout: 30
|
|
max_concurrent: 3
|