


Self Cinema 是一个功能完善的私人影院系统,专为个人或小团体设计。它提供了优雅的管理界面和流畅的观看体验,支持多种视频格式,让你可以轻松管理自己的视频收藏并与朋友分享。
克隆项目
git clone https://github.com/zkeq/self-cinema.git
cd self-cinema
🔧 设置后端环境
cd backend
# 安装 Python 依赖
pip install -r requirements.txt
# 启动后端服务 🚀
python main.py
后端服务将在 http://localhost:8000 启动
http://localhost:8000/docsadmin / admin123🎨 设置前端环境
cd ../frontend
# 安装依赖
npm install
# 启动开发服务器 🚀
npm run dev
前端服务将在 http://localhost:3000 启动
🎉 开始使用
http://localhost:3000http://localhost:3000/admin/loginadmin / admin123self-cinema/ ├── 📂 backend/ # 后端代码 │ ├── 🐍 main.py # 主应用文件 │ ├── 🗄️ models.py # 数据库模型 │ ├── 🔐 auth.py # 认证功能 │ ├── 📝 requirements.txt # Python 依赖 │ └── 💾 database.db # SQLite 数据库 ├── 📂 frontend/ # 前端代码 │ ├── 📂 src/ │ │ ├── 📂 app/ # Next.js 页面 │ │ │ ├── 🏠 page.tsx # 首页 │ │ │ ├── 📂 admin/ # 管理后台 │ │ │ │ ├── 🔐 login/ # 登录页面 │ │ │ │ └── 📊 dashboard/ # 管理面板 │ │ │ └── 📂 watch/ # 播放页面 │ │ ├── 📂 components/ # React 组件 │ │ │ ├── 🎥 video-player.tsx # 视频播放器 │ │ │ ├── 🎨 ui/ # UI 组件库 │ │ │ └── 🛡️ error-boundary.tsx # 错误边界 │ │ ├── 📂 lib/ # 工具函数 │ │ │ ├── 🌐 api.ts # API 客户端 │ │ │ ├── 🔐 auth.ts # 认证工具 │ │ │ └── 💾 progress.ts # 进度管理 │ │ └── 📂 types/ # TypeScript 类型 │ ├── 📦 package.json # Node.js 依赖 │ └── ⚙️ next.config.ts # Next.js 配置 └── 📖 README.md # 项目文档
📺 添加电视剧
🎞️ 管理剧集
🔗 生成分享链接
🎬 观看视频
📱 移动端使用
后端配置 (在 backend/main.py 中):
init_default_admin() 创建database.db)前端配置 (在 frontend/src/lib/api.ts 中):
http://localhost:8000frontend/src/app/globals.css 中自定义颜色主题backend/update_admin.py 更新管理员信息| 方法 | 端点 | 描述 |
|---|---|---|
POST | /auth/login | 🔑 用户登录 |
| 方法 | 端点 | 描述 | 认证 |
|---|---|---|---|
GET | /series | 📋 获取所有电视剧 | ✅ |
GET | /series/{id} | 📖 获取电视剧详情 | ✅ |
POST | /series | ➕ 创建电视剧 | ✅ |
PUT | /series/{id} | ✏️ 更新电视剧 | ✅ |
DELETE | /series/{id} | 🗑️ 删除电视剧 | ✅ |
| 方法 | 端点 | 描述 | 认证 |
|---|---|---|---|
GET | /series/{id}/episodes | 📋 获取剧集列表 | ✅ |
GET | /episodes/{id} | 📖 获取剧集详情 | ✅ |
POST | /episodes | ➕ 创建剧集 | ✅ |
PUT | /episodes/{id} | ✏️ 更新剧集 | ✅ |
DELETE | /episodes/{id} | 🗑️ 删除剧集 | ✅ |
| 方法 | 端点 | 描述 | 认证 |
|---|---|---|---|
POST | /series/{id}/share | 🔗 生成分享链接 | ✅ |
GET | /watch/{hash} | 👀 通过分享链接观看 | ❌ |
❓ 后端启动失败
❓ 前端样式异常
npm cache clean --forcerm -rf node_modules && npm install❓ 视频播放失败
❓ 登录认证问题
前端生产构建:
cd frontend
npm run build
npm start
后端生产运行:
cd backend
python main.py
将 backend 文件夹上传至服务器 \root 即可

修改 jwt secret 为一串随机字符串 auth.py

修改默认管理员账号,默认管理员密码 models.py

打开宝塔 网站 -> Ptython项目 -> 新建站点
新建一个虚拟环境

表单按如下填写

点击确定后项目会进行创建虚拟环境和安装,等待安装完毕 即可
点击设置可查看项目日志

在这一步如果提示找不到某个依赖,点击 操作 中的 终端,自行输入 pip install xxx(包名) 即可,若提示端口被占用 (更改一个没有被占用的端口即可 main.py)

请求服务端口,查看运行情况 (看到这个字符串,说明服务正常运行)


我们欢迎所有形式的贡献!💪
本项目采用 MIT License 许可证。
MIT License Copyright (c) 2024 Self Cinema Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
感谢以下开源项目的支持: