Plex Auto Collections 项目教程
plex-autocollections项目地址:https://gitcode.com/gh_mirrors/pl/plex-autocollections
1. 项目的目录结构及介绍
Plex Auto Collections 是一个用于自动化管理 Plex 媒体服务器上收藏集的 Python 脚本。以下是该项目的目录结构及其介绍:
plex-autocollections/
├── app/
│ ├── config/
│ │ └── config.yaml
│ ├── dockerignore
│ ├── gitignore
│ ├── CHANGELOG.md
│ ├── Dockerfile
│ ├── README.md
│ ├── requirements.txt
│ └── main.py
└── .github/
└── workflows/
└── ci.yml
app/
: 包含项目的主要代码和配置文件。config/
: 存放配置文件的目录。config.yaml
: 项目的配置文件。
dockerignore
: Docker 忽略文件。gitignore
: Git 忽略文件。CHANGELOG.md
: 项目更新日志。Dockerfile
: Docker 构建文件。README.md
: 项目说明文档。requirements.txt
: 项目依赖文件。main.py
: 项目的启动文件。
.github/
: 包含 GitHub 相关配置。workflows/
: 存放 GitHub Actions 工作流文件。ci.yml
: 持续集成配置文件。
2. 项目的启动文件介绍
项目的启动文件是 main.py
,它位于 app/
目录下。该文件负责启动整个应用程序,并根据配置文件执行相应的任务。以下是 main.py
的简要介绍:
# main.py
import os
import yaml
from collections import CollectionManager
def load_config(config_path):
with open(config_path, 'r') as file:
return yaml.safe_load(file)
def main():
config_path = os.path.join('config', 'config.yaml')
config = load_config(config_path)
manager = CollectionManager(config)
manager.run()
if __name__ == "__main__":
main()
load_config(config_path)
: 加载配置文件的函数。main()
: 主函数,负责加载配置并启动CollectionManager
。CollectionManager
: 管理收藏集的主要类。
3. 项目的配置文件介绍
项目的配置文件是 config.yaml
,它位于 app/config/
目录下。该文件包含了项目运行所需的所有配置信息。以下是 config.yaml
的简要介绍:
# config.yaml
plex:
url: http://localhost:32400
token: your_plex_token
collections:
- name: Example Collection
type: movie
criteria:
genre: Action
- name: Another Collection
type: tvshow
criteria:
year: 2020
plex
: Plex 服务器的配置信息。url
: Plex 服务器的 URL。token
: Plex 服务器的访问令牌。
collections
: 收藏集的配置信息。name
: 收藏集的名称。type
: 收藏集的类型(电影或电视剧)。criteria
: 收藏集的筛选条件。
通过以上配置文件,可以灵活地定义和管理 Plex 媒体服务器上的收藏集。
plex-autocollections项目地址:https://gitcode.com/gh_mirrors/pl/plex-autocollections