add: 刮削演员信息并生成相应目录结构和演员图片
7
.gitignore
vendored
|
@ -160,3 +160,10 @@ cython_debug/
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
|
/.idea/.gitignore
|
||||||
|
/.idea/misc.xml
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/inspectionProfiles/profiles_settings.xml
|
||||||
|
/.idea/inspectionProfiles/Project_Default.xml
|
||||||
|
/.idea/tmdb-person.iml
|
||||||
|
/.idea/vcs.xml
|
||||||
|
|
65
README.md
|
@ -1,22 +1,73 @@
|
||||||
# tmdb-person
|
# tmdb-person
|
||||||
|
|
||||||
|
![](https://img.shields.io/badge/Python-3.8-green)
|
||||||
|
![](https://img.shields.io/badge/TMDB-V3-blue)
|
||||||
|
|
||||||
根据nfo文件信息刮削相关演员信息及图片
|
根据nfo文件信息刮削相关演员信息及图片
|
||||||
|
|
||||||
## example
|
## 数据
|
||||||
|
### example
|
||||||
> emby 存储于metadata/peopel 中的数据示例
|
> emby 存储于metadata/peopel 中的数据示例
|
||||||
|
|
||||||
> 电视剧tvs 和 电影movies 的保存 `.nfo` 命名格式不一样。movies的 `.nfo` 文件以电影名为前缀, tvs 统一以 `tvshow.nfo` 命名
|
> 电视剧tvs 和 电影movies 的保存 `.nfo` 命名格式不一样。movies的 `.nfo` 文件以电影名为前缀, tvs 统一以 `tvshow.nfo` 命名
|
||||||
|
|
||||||
* a: 英文演员信息
|
* example/metadata/person/a: 英文演员信息
|
||||||
* 张: 中文演员信息
|
* example/metadata/person/张: 中文演员信息
|
||||||
* person.nfo
|
* example/metadata/person/person.nfo: 演员元数据
|
||||||
* tvshow.nfo
|
* example/tvs/一生一世/tvshow.nfo: 电视剧元数据
|
||||||
|
* example/movies/神出鬼没 (2023) - 2160p.nfo: 电影元数据
|
||||||
|
|
||||||
## data
|
### data
|
||||||
> 实际刮削的演员信息存放路径
|
> 实际刮削的演员信息存放路径
|
||||||
|
|
||||||
## 接口
|
## 接口
|
||||||
> https://developer.themoviedb.org/
|
> https://developer.themoviedb.org/
|
||||||
|
|
||||||
1. 演员信息刮削:https://developer.themoviedb.org/reference/person-details
|
1. 演员信息刮削:https://developer.themoviedb.org/reference/person-details
|
||||||
2. 图片统一前缀路径:https://www.themoviedb.org/t/p/original
|
2. 图片统一前缀路径:https://www.themoviedb.org/t/p/original
|
||||||
|
|
||||||
|
## 使用
|
||||||
|
* 环境:Python3.8
|
||||||
|
|
||||||
|
### 安装相关pip依赖包
|
||||||
|
|
||||||
|
```python
|
||||||
|
pip3 install requests
|
||||||
|
pip3 install os
|
||||||
|
pip3 install xml
|
||||||
|
pip3 install json
|
||||||
|
```
|
||||||
|
|
||||||
|
### 说明
|
||||||
|
|
||||||
|
**`参数说明`**
|
||||||
|
* __dir_path: 目标文件夹路径。
|
||||||
|
* 例如电影存放于 `./movies/` 下,则该路径填写 `./movies` 的完整路径。
|
||||||
|
* 为了兼容 `电视剧` 中不刮削 `季` 中的 `.nfo` 内容,因此只刮削 `__dir_path` 路径下一层文件夹及当前层下的 `.nfo` 文件(兼容./movies 下同级存放的视频及.nfo文件)
|
||||||
|
|
||||||
|
**`目录结构说明`**
|
||||||
|
- ./movies
|
||||||
|
- 流浪地球.mkv (不刮削)
|
||||||
|
- 流浪地球.nfo (刮削)
|
||||||
|
- 流浪地球2
|
||||||
|
- 流浪地球2.mkv (不刮削)
|
||||||
|
- 流浪地球2.nfo (刮削)
|
||||||
|
|
||||||
|
- ./tvs
|
||||||
|
- 三体
|
||||||
|
- tvshow.nfo (刮削)
|
||||||
|
- Season 1 (不刮削)
|
||||||
|
|
||||||
|
### 运行
|
||||||
|
**`方法一:`**
|
||||||
|
|
||||||
|
修改 `person.py` 文件中 `if __name__ == '__main__':` 方法中 `__dir_path` 参数值
|
||||||
|
|
||||||
|
**`方法二:`**
|
||||||
|
|
||||||
|
> 通过命令行方式设置参数
|
||||||
|
|
||||||
|
```python
|
||||||
|
python3 person.py /volume1/video/movies
|
||||||
|
```
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 242 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 442 KiB After Width: | Height: | Size: 442 KiB |
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 124 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
44
person.py
|
@ -60,16 +60,34 @@ class Tmdb:
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
__nfo_data = Analyze(file_path="example/神出鬼没 (2023) - 2160p.nfo").analyze()
|
__dir_path = "example/tvs"
|
||||||
for __actor in __nfo_data["actors"]:
|
__output = "example/metadata/person"
|
||||||
__tmdbid = __actor["tmdbid"]
|
__file_paths = []
|
||||||
__actor_name = __actor["name"]
|
for folder in os.listdir(__dir_path):
|
||||||
__name = __actor_name[1].lower()
|
__folder2 = os.path.join(__dir_path, folder)
|
||||||
__path_dir = os.path.join("data", __name, __actor_name)
|
# 判断是否文件夹
|
||||||
if not os.path.exists(__path_dir):
|
if os.path.isdir(__folder2):
|
||||||
os.makedirs(__path_dir)
|
for nfo_file in os.listdir(__folder2):
|
||||||
if ".nfo" not in os.listdir(__path_dir):
|
__child_file_path = os.path.join(__folder2, nfo_file)
|
||||||
__actor_info = Tmdb(tmdb_id=__tmdbid, actor_path=__path_dir).get_actor_info()
|
if ".nfo" in os.path.basename(__child_file_path):
|
||||||
print(__actor_info)
|
__file_paths.append(__child_file_path)
|
||||||
if "folder" not in os.listdir(__path_dir):
|
elif os.path.isfile(__folder2):
|
||||||
Tmdb(tmdb_id=__tmdbid, actor_path=__path_dir).get_actor_image()
|
__file_name = os.path.basename(__folder2)
|
||||||
|
if ".nfo" in __file_name:
|
||||||
|
__file_paths.append(__folder2)
|
||||||
|
print(__file_paths)
|
||||||
|
for __file_path in __file_paths:
|
||||||
|
# __file_path = "example/神出鬼没 (2023) - 2160p.nfo"
|
||||||
|
__nfo_data = Analyze(file_path=__file_path).analyze()
|
||||||
|
for __actor in __nfo_data["actors"]:
|
||||||
|
__tmdbid = __actor["tmdbid"]
|
||||||
|
__actor_name = __actor["name"]
|
||||||
|
__name = __actor_name[1].lower()
|
||||||
|
__path_dir = os.path.join(__output, __name, __actor_name)
|
||||||
|
if not os.path.exists(__path_dir):
|
||||||
|
os.makedirs(__path_dir)
|
||||||
|
if ".nfo" not in os.listdir(__path_dir):
|
||||||
|
__actor_info = Tmdb(tmdb_id=__tmdbid, actor_path=__path_dir).get_actor_info()
|
||||||
|
print(__actor_info)
|
||||||
|
if "folder" not in os.listdir(__path_dir):
|
||||||
|
Tmdb(tmdb_id=__tmdbid, actor_path=__path_dir).get_actor_image()
|
||||||
|
|