database-operation
Skill này làm gì
Skill cho phép AI truy vấn và bảo trì cơ sở dữ liệu MoviePilot qua một trợ giúp đi kèm, mà không đưa mật khẩu vào cuộc trò chuyện. Skill dành cho quản trị viên MoviePilot cần kiểm tra dữ liệu hoặc dọn dẹp.
Khi nào nên dùng
- ✓Khi bạn muốn đếm hoặc xem thống kê từ cơ sở dữ liệu MoviePilot.
- ✓Khi một bản ghi bị kẹt cần kiểm tra, hoặc một việc dọn dẹp cụ thể cần làm.
- ✓Khi bạn muốn AI kiểm tra nội dung bảng trước khi bất kỳ thay đổi nào được thực hiện.
Liên kết skill
https://github.com/jxxghp/MoviePilot/blob/v3/skills/database-operation/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể đếm số bản ghi trong cơ sở dữ liệu MoviePilot và liệt kê các bảng không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
AI chạy một script trợ giúp đi kèm, đọc cài đặt cục bộ của chính MoviePilot, kết nối đến cơ sở dữ liệu và trả về kết quả.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Database Operation
All script paths are relative to this skill file.
Use scripts/mp-db.py for all database access. Do not extract database passwords, API tokens, or full PostgreSQL DSNs from the prompt. The script reads MoviePilot local settings and connects to SQLite or PostgreSQL internally.
Scope And Boundaries
This skill is the direct SQL boundary. It is implemented as a Python script and is appropriate when the agent must inspect records, run data statistics, repair stuck state, or perform an explicitly requested database update.
Run the bundled copy from the MoviePilot program directory with its project runtime, for example:
cd <MOVIEPILOT_ROOT>
python skills/database-operation/scripts/mp-db.py tables
The Agent command environment routes python to the project-specific moviepilot-python
entry when available and falls back to the project or Docker VENV_PATH Python otherwise.
The runtime sets MOVIEPILOT_ROOT for copied skills. If you run a copied
script directly from <CONFIG_PATH>/agent/skills/, set that variable to the
program directory first; otherwise the helper reports how to relocate it.
Use the project runtime instead of a system python3.
Prefer safer product surfaces first:
| Request | Preferred skill |
|---|---|
| Normal MoviePilot product operation | moviepilot-api structured operations |
| Operation outside the structured API catalog | A more specific Skill or explicit unsupported result |
| Slash commands or plugin/system command dispatch | command-dispatch |
| Manual file organization | organize-files |
| Retry failed transfer history records | transfer-failed-retry |
Use this skill as the final fallback for data access or mutation. It may run
SELECT, INSERT, UPDATE, DELETE, and schema-changing statements through
the bundled script, but broad or destructive writes still require explicit user
authorization.
System settings have two managed sources and should not normally be edited here:
- Runtime
Settingsvariables are queried and updated bymoviepilot-apioperationsconfig.system.get/config.system.update; updates perform type conversion and persist toapp.env. SystemConfigKeyvalues are stored in the databasesystemconfigtable, but the same API operations must be preferred because they enforce registered keys, plugin mutation admission, value normalization, secret redaction, and configuration-change events.
Use direct SQL against systemconfig only for an explicitly authorized repair
when the managed API cannot complete the operation. The script blocks any
statement that references systemconfig until you pass --show-secrets, so
inspect the exact row first, avoid broad writes, and verify the managed API can
read the repaired value.
Commands
List tables:
python scripts/mp-db.py tables
Show table schema:
python scripts/mp-db.py schema downloadhistory
Run a read query:
python scripts/mp-db.py query "SELECT COUNT(*) AS total FROM downloadhistory"
Read SQL from stdin or a file:
python scripts/mp-db.py query --file /path/to/query.sql
Run a write statement:
python scripts/mp-db.py write "UPDATE subscribe SET state = 'S' WHERE id = 123"
query --write is also supported for compatibility, but prefer the write subcommand for INSERT, UPDATE, DELETE, and schema changes.
SQLite also checks the actual table accesses while executing each statement, including single-quoted table names and reads through views. The temporary authorizer is removed when that statement finishes. PostgreSQL retains the identifier check described below.
Statements that reference systemconfig are rejected until you add
--show-secrets, in read and write mode alike:
python scripts/mp-db.py query "SELECT key, value FROM systemconfig WHERE key = 'TMDB_API_KEY'" --show-secrets
The gate is per table, not per column, so even a count or key listing over
systemconfig needs the flag. Read normal settings through
moviepilot-api config.system.get instead, which redacts secrets for you,
and pass the flag only for an explicitly authorized repair.
Workflow
- Prefer existing MoviePilot tools or APIs for normal product workflows.
- Use this skill for direct database inspection only when no existing tool covers the request.
- For unknown schema, run
tablesfirst, thenschema <table>. - For
SELECTqueries, execute directly with a narrow project
Câu hỏi thường gặp
Nó có cần mật khẩu cơ sở dữ liệu của tôi không?
Không. Trợ giúp tự đọc cài đặt cục bộ của MoviePilot, nên mật khẩu không cần được đưa vào prompt.
Nó hỗ trợ những cơ sở dữ liệu nào?
Nó kết nối đến SQLite hoặc PostgreSQL, tùy theo cách MoviePilot được thiết lập.
Tôi có nên dùng nó cho tác vụ thông thường không?
Không. Skill khuyên dùng các công cụ MoviePilot an toàn hơn trước, và chỉ truy cập cơ sở dữ liệu trực tiếp khi chúng không làm được việc.
Chi tiết
Mô tả gốc của tác giả
Use this skill when you need to inspect, query, maintain, or carefully modify the MoviePilot database. This skill uses the bundled scripts/mp-db.py helper, which reads MoviePilot local settings itself and never requires database passwords or full PostgreSQL DSNs in the agent prompt. Applicable scenarios include data statistics, counts, aggregations, inspecting or fixing records, cleanup requests, and questions like "how many downloads", "show site stats", "delete old records", or "why is this subscription stuck".
repo: jxxghp/MoviePilot
Độ phổ biến
- Sao GitHub
- 12k
- Vị trí xếp hạng
- #11481
- Giấy phép
- GPL-3.0
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
anysearch
12kGiúp agent của bạn tìm kiếm web theo thời gian thực, truy vấn các nguồn chuyên biệt như tài chính hoặc học thuật và đọc toàn văn trang web.
browser-use
12kGiúp agent của bạn mở trang web, đọc nội dung, nhấp nút, điền biểu mẫu và chụp màn hình để kiểm tra kết quả.
command-dispatch
12kGiúp agent của bạn tìm và chạy các lệnh hệ thống hoặc plugin của MoviePilot từ một yêu cầu, sau khi kiểm tra lệnh nào tồn tại.
create-moviepilot-plugin
12kGiúp agent của bạn tạo hoặc sửa plugin MoviePilot, dùng đúng bố cục file và thiết lập cho phiên bản MoviePilot.
Skill tương tự
discrawl
394kCho phép agent của bạn tìm kiếm và tóm tắt kho lưu trữ tin nhắn Discord trên máy, kiểm tra độ mới của dữ liệu và đọc tin nhắn trực tiếp.
clickhouse-io
280kGiúp agent của bạn tối ưu truy vấn và schema trong ClickHouse theo thực hành tốt nhất cho phân tích dữ liệu hiệu năng cao khi truy vấn chậm.
scientific-db-pubmed-database
280kGiúp agent của bạn tìm bài báo khoa học trong lĩnh vực y sinh. Hữu ích cho nghiên cứu cần thông tin y khoa cụ thể.