老规矩,废话不多说,先简单介绍下Plex-Meta-Manager 能干什么,也就是我们今天要讲的工具。
项目地址:Plex-Meta-Manager
Plex-Meta-Manager

      1. Plex Meta Manager can

Create and maintain collections in Plex libraries using external lists, Plex searches, or filters.

Create, maintain, and share playlists on Plex servers using the same or similar criteria.

Manage metadata [artwork, titles, summaries, release year, etc.] for anything on your Plex server.

Add overlays to item artwork to display various details [ratings, resolution, edition, etc.].

Send missing items from external lists [for example the IMDB 250] to Radarr or Sonarr for download.

and more.

是英文,随便翻译看看就行,反正简单概括就是给你的媒体资源封面加上酷炫的音频、top、imdb、tmdb、烂番茄、分辨率等等标签。
当然还有其他作用请各位自行前往wiki查阅。今天仅仅要做的只是打标签,嘿嘿~

使用前安装的准备工作

大致步骤

    1. 1.验证是否安装了 Python 3.7 或更高版本,如果没有安装请安装
    1. 2.验证Git工具是否安装,如果没有安装请安装
    1. 3.用于git检索代码
    1. 4.安装要求 [PMM 需要额外的代码]
    1. 5.TMDb API 密钥 ps:网上教程都有
    1. 6.Plex URL 和令牌 ps:网上教程都有
    1. 7.用python运行脚本
    1. 8.使用文本编辑器修改几个文件,直到获得一个可用的配置文件和一个可用的元数据文件。

ps:
大佬略过,以上如有实在不懂的,不再赘述,请看相关教程:
教程篇 篇三:影视刮削必备神器——TMDB API申请攻略
可能是全网最详细的 Python 安装教程(windows)
Windows系统Git安装教程(详解Git安装过程)
查找身份验证令牌/X-Plex-Token

git稍微复杂点,不懂的话一路点点点就行,(小声哔哔:我就是~)

测试安装环境

PowerShell终端键入

python3 --version

如果没有返回3.7.0或更高版本,则需要重新安装Python

git --version

如果这没有返回版本号,则您需要安装 git

检索 Plex-Meta-Manager 代码终端键入

cd ~
git clone https://github.com/meisnate12/Plex-Meta-Manager
cd Plex-Meta-Manager

注意:本测试的其余部分假设您位于这个终端/Powershell 窗口中的目录下。

重要提示:后续,当您想在命令行运行 PMM 时,您必须在这目录下运行。

设置虚拟环境

python -m venv pmm-venv

如果该命令有效,则不会产生任何输出;如果出现问题,它将显示错误。如果一切正常,您将看到如下内容:

> python -m venv pmm-venv
>

如果报错提示如下

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

您显然没有在安装 Python时选中上面的“添加到路径”复选框。“修复”你的 Python 安装并选中“将 python 添加到环境变量”,请自行网上寻找手动添加环境变量的办法。

如果您没有看到错误,则可以继续。

.\pmm-venv\Scripts\activate

如果报错

.\pmm-venv\Scripts\activate : File C:\Users\mroche\Plex-Meta-Manager\pmm-venv\Scripts\Activate.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink LinkID=135170.
At line:1 char:1
+ .\pmm-venv\Scripts\activate
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

您显然跳过了上面为 Windows安装 Python时的“在 Powershell 中启用脚本”步骤。
在继续之前,您需要解决这个问题。完成此操作后,请再次尝试激活步骤。
如果该命令有效,则不会产生任何输出;如果出现问题,它将显示错误。
您可能会看到提示发生变化,如下所示:

➜  Plex-Meta-Manager git:(master) ✗ source pmm-venv/bin/activate
(pmm-venv) ➜  Plex-Meta-Manager git:(master) ✗

提示现在显示虚拟环境的名称。你可能看不到这个;它取决于您的终端配置,与 Python 或 PMM 无关
在虚拟环境中执行此操作的一个优点是,如果这部分设置出现问题,您可以删除该 pmm-venv 目录并再次进行设置。
重要提示:将来,当您想要运行脚本时,每次都需要执行此“激活”步骤。不是 venv 创建,只需要激活:

.\pmm-venv\Scripts\activate

Plex-Meta-Manager 与其他 Python 脚本一样,依赖于支持库来管理 Plex 连接、从互联网获取内容或写入文件等事务。
这些支持库称为“依赖”,它们在名为requirements.txt. 要安装它们,请输入以下命令[在终端中输入]:

python -m pip install -r requirements.txt

你应该看到类似这样的内容 [我删除了几行以节省空间,并且自安装以来特定版本可能已更改]无需理会。

Collecting PlexAPI==4.7.0
  Downloading PlexAPI-4.7.0-py3-none-any.whl (133 kB)
     |████████████████████████████████| 133 kB 821 kB/s
Collecting tmdbv3api==1.7.6
  Downloading tmdbv3api-1.7.6-py2.py3-none-any.whl (17 kB)
...
Installing collected packages: urllib3, idna, charset-normalizer, certifi, six, ruamel.yaml.clib, requests, tmdbv3api, schedule, ruamel.yaml, retrying, PlexAPI, pillow, pathvalidate, lxml, arrapi
    Running setup.py install for retrying ... done
    Running setup.py install for arrapi ... done
Successfully installed PlexAPI-4.7.0 arrapi-1.1.3 certifi-2021.10.8 charset-normalizer-2.0.7 idna-3.3 lxml-4.6.3 pathvalidate-2.4.1 pillow-8.3.2 requests-2.26.0 retrying-1.3.3 ruamel.yaml-0.17.10 ruamel.yaml.clib-0.2.6 schedule-1.1.0 six-1.16.0 tmdbv3api-1.7.6 urllib3-1.26.7
WARNING: You are using pip version 21.1.3; however, version 21.3 is available.
You should consider upgrading via the '/Users/mroche/Plex-Meta-Manager/pmm-venv/bin/python -m pip install --upgrade pip' command.

编辑配置

python plex_meta_manager.py -r

你应该看到这样的输出:

Config Error: config not found at /Users/mroche/Plex-Meta-Manager/config

该错误意味着您没有配置文件,但我们至少知道环境配置已到位并且脚本可以运行啦啦啦~

继续

mkdir config\assets

接下来把前面准备的tmdb-api、plex-url&token填入对应位置

copy .\config\config.yml.template .\config\config.yml
notepad .\config\config.yml

我在这里使用它notepad只是因为它内置于 Windows 中。你可以使用任何其他您想要的文本编辑器,只要它将文件保存为config.yml即可。
以下展示默认两种配置电影和电视剧。我演示这里只打了视频分辨率和音频标签。
向下滚动一点并找到你刚刚准备的三个需求值填入;Plex URL、Plex 令牌和 TMDb API 密钥。
4 与 14 行这里改成你的实际的库名字,11、12行就是你想打啥标签就加上。多个库就复制对应配置添加即可,其他不需要的库请注释掉。以#开头或者删除对应不需要打标签的库。
api与url大概在第80行之后的位置。
其他的标签,请自行研究下wiki标签代码

配置:

## This file is a template remove the .template to use the file

libraries:                       # This is called out once within the config.yml file
  '这里填plex里面电影库的名字':                        # These are names of libraries in your Plex
    metadata_path:
      - pmm: basic               # This is a file within PMM's defaults folder
      - pmm: imdb                # This is a file within PMM's defaults folder
      # see the wiki for how to use local files, folders, URLs, or files from git
    overlay_path:
    - remove_overlays: false     # Set this to true to remove all overlays
    - pmm: resolution                # This is a file within PMM's defaults folder
    - pmm: audio_codec
      # see the wiki for how to use local files, folders, URLs, or files from git
  '这里填plex里面电视剧库的名字':
    metadata_path:
      - pmm: basic               # This is a file within PMM's defaults folder
      - pmm: imdb                # This is a file within PMM's defaults folder
      # see the wiki for how to use local files, folders, URLs, or files from git
    overlay_path:
    - remove_overlays: false     # Set this to true to remove all overlays
    - pmm: resolution                # This is a file within PMM's defaults folder
    - pmm: audio_codec
      # see the wiki for how to use local files, folders, URLs, or files from git
#  Anime:
#    metadata_path:
#      - pmm: basic               # This is a file within PMM's defaults folder
#      - pmm: anilist             # This is a file within PMM's defaults folder
      # see the wiki for how to use local files, folders, URLs, or files from git
#  Music:
#    metadata_path:
#      - file: config/Music.yml   # This is a local file THAT YOU MIGHT CREATE
#playlist_files:
#- pmm: playlist                  # This is a file within PMM's defaults folder
  # see the wiki for how to use local files, folders, URLs, or files from git
settings:
  cache: true
  cache_expiration: 60
  asset_directory: config/assets
  asset_folders: true
  asset_depth: 0
  create_asset_folders: false
  prioritize_assets: false
  dimensional_asset_rename: false
  download_url_assets: false
  show_missing_season_assets: false
  show_missing_episode_assets: false
  show_asset_not_needed: true
  sync_mode: append
  minimum_items: 1
  default_collection_order:
  delete_below_minimum: true
  delete_not_scheduled: false
  run_again_delay: 2
  missing_only_released: false
  only_filter_missing: false
  show_unmanaged: true
  show_unconfigured: true
  show_filtered: false
  show_options: false
  show_missing: true
  show_missing_assets: true
  save_report: false
  tvdb_language: eng
  ignore_ids:
  ignore_imdb_ids:
  item_refresh_delay: 0
  playlist_sync_to_user: all
  playlist_exclude_users:
  playlist_report: false
  verify_ssl: true
  custom_repo:
  check_nightly: false
webhooks:                        # Can be individually specified per library as well
  error:
  version:
  run_start:
  run_end:
  changes:
  delete:
plex:                            # Can be individually specified per library as well; REQUIRED for the script to run
  url: http://xxxxxxxxxxxxxxxxx:32400
  token: xxxxxxxxxxxxxxxxxxxxxxxx
  timeout: 60
  clean_bundles: false
  empty_trash: false
  optimize: false
tmdb:                            # REQUIRED for the script to run
  apikey: xxxxxxxxxxxxxxxxxxxxxxxx
  language: zh
  cache_expiration: 60
  region:
tautulli:                        # Can be individually specified per library as well
  url: http://192.168.1.12:8181
  apikey: ################################
omdb:
  apikey: ########
  cache_expiration: 60
mdblist:
  apikey: #########################
  cache_expiration: 60
notifiarr:
  apikey: ####################################
anidb:                           # Not required for AniDB builders unless you want mature content
  username: ######
  password: ######
  language: en
  client:
radarr:                          # Can be individually specified per library as well
  url: http://192.168.1.12:7878
  token: ################################
  add_missing: false
  add_existing: false
  root_folder_path: S:/Movies
  monitor: true
  availability: announced
  quality_profile: HD-1080p
  tag:
  search: false
  radarr_path:
  plex_path:
  upgrade_existing: false
  ignore_cache: false
sonarr:                          # Can be individually specified per library as well
  url: http://192.168.1.12:8989
  token: ################################
  add_missing: false
  add_existing: false
  root_folder_path: S:/TV Shows
  monitor: all
  quality_profile: HD-1080p
  language_profile: English
  series_type: standard
  season_folder: true
  tag:
  search: false
  cutoff_search: false
  sonarr_path:
  plex_path:
  upgrade_existing: false
  ignore_cache: false
trakt:
  client_id: ####################
  client_secret: ####################
  pin:
  authorization:
    # everything below is autofilled by the script
    access_token:
    token_type:
    expires_in:
    refresh_token:
    scope: public
    created_at:
mal:
  client_id: ####################
  client_secret: ####################
  authorization:
    # everything below is autofilled by the script
    access_token:
    token_type:
    expires_in:
    refresh_token:

配置保存完毕运行脚本键入

python plex_meta_manager.py -r

根据库的大小,这可能需要一段时间。我的测试304部电影花了22分钟。如果可以,请创建少数目录资源以达到快速测试效果的目的。
运行中可能会看到类似代码运行

运行完毕结果

效果:

其他模版配置请移步:

      https://metamanager.wiki/en/latest/defaults/overlays.html
      https://github.com/meisnate12/Plex-Meta-Manager-Configs

我的配置:
仅配置了电影部分
配置需求字体请放到对应config/custom_fonts文件夹

下载信息

资源来源于网络如有侵权,请联系删除

libraries:
  Movies:
    overlay_path:
      - remove_overlays: false
      - reapply_overlay: true
      - pmm: resolution                                                    # 1, 4
      - pmm: audio_codec                                                   # 2
      - pmm: mediastinger                                                  # 3
      - pmm: ratings                                                       # 5, 6, 7
        template_variables:
          rating1: user                                                    # 5 as this is user and mass_user_rating_update: mdb_tomatoes
          rating1_image: rt_tomato                                         # 5 as this is user and mass_user_rating_update: mdb_tomatoes
          rating1_font: C:\Users\15104\Plex-Meta-Manager\config\custom_fonts\Adlib.ttf                      # 5 local font accessible to PMM
          rating1_font_size: 63                                            # 5 adjusted font size to fit rating
  
          rating2: critic                                                  # 6 as this is critic and mass_critic_rating_update: imdb
          rating2_image: imdb                                              # 6 as this is critic and mass_critic_rating_update: imdb
          rating2_font: C:\Users\15104\Plex-Meta-Manager\config\custom_fonts\Impact.ttf                     # 6 local font accessible to PMM
          rating2_font_size: 70                                            # 6 adjusted font size to fit rating
  
          rating3: audience                                                # 7 as this is audience and mass_audience_rating_update: tmdb
          rating3_image: tmdb                                              # 7 as this is audience and mass_audience_rating_update: tmdb
          rating3_font: C:\Users\15104\Plex-Meta-Manager\config\custom_fonts\Avenir_95_Black.ttf            # 7 local font accessible to PMM
          rating3_font_size: 70                                            # 7 adjusted font size to fit rating
  
          horizontal_position: right                                       # the set of ratings is on the right of the poster
      - pmm: streaming                                                     # 8
      - pmm: video_format                                                  # 9
      - pmm: language_count                                                # 10
      - pmm: ribbon                                                        # 11, 12 Bottom right sash is used by more than one overlay so a weight for priority can be applied 
    operations:
      mass_user_rating_update: mdb_tomatoes                              # 5 This operation will update the user rating in plex with Rotten Tomatoes ratings information gathered through mdblist.com (mdblist config required)
      mass_critic_rating_update: imdb                                    # 6 This operation will update the critic rating in plex with IMDb ratings information
      mass_audience_rating_update: tmdb                                  # 7 This operation will update the audience rating in plex with TMDb ratings information
settings:
  cache: true
  cache_expiration: 60
  asset_directory: config/assets
  asset_folders: true
  asset_depth: 0
  create_asset_folders: false
  prioritize_assets: false
  dimensional_asset_rename: false
  download_url_assets: false
  show_missing_season_assets: false
  show_missing_episode_assets: false
  show_asset_not_needed: true
  sync_mode: append
  minimum_items: 1
  default_collection_order:
  delete_below_minimum: true
  delete_not_scheduled: false
  run_again_delay: 2
  missing_only_released: false
  only_filter_missing: false
  show_unmanaged: true
  show_unconfigured: true
  show_filtered: false
  show_options: false
  show_missing: true
  show_missing_assets: true
  save_report: false
  tvdb_language: eng
  ignore_ids:
  ignore_imdb_ids:
  item_refresh_delay: 0
  playlist_sync_to_user: all
  playlist_exclude_users:
  playlist_report: false
  verify_ssl: true
  custom_repo:
  check_nightly: false
webhooks:                        # Can be individually specified per library as well
  error:
  version:
  run_start:
  run_end:
  changes:
  delete:
plex:                            # Can be individually specified per library as well; REQUIRED for the script to run
  url: http://xxxxxxxx:32400
  token: xxxxxxxxxxxxxxx
  timeout: 60
  clean_bundles: false
  empty_trash: false
  optimize: false
tmdb:                            # REQUIRED for the script to run
  apikey: xxxxxxxxxxxxxxxxxx
  language: zh
  cache_expiration: 60
  region:
tautulli:                        # Can be individually specified per library as well
  url: http://192.168.1.12:8181
  apikey: ################################
omdb:
  apikey: ########
  cache_expiration: 60
mdblist:
  apikey: #########################
  cache_expiration: 60
notifiarr:
  apikey: ####################################
anidb:                           # Not required for AniDB builders unless you want mature content
  username: ######
  password: ######
  language: en
  client:
radarr:                          # Can be individually specified per library as well
  url: http://192.168.1.12:7878
  token: ################################
  add_missing: false
  add_existing: false
  root_folder_path: S:/Movies
  monitor: true
  availability: announced
  quality_profile: HD-1080p
  tag:
  search: false
  radarr_path:
  plex_path:
  upgrade_existing: false
  ignore_cache: false
sonarr:                          # Can be individually specified per library as well
  url: http://192.168.1.12:8989
  token: ################################
  add_missing: false
  add_existing: false
  root_folder_path: S:/TV Shows
  monitor: all
  quality_profile: HD-1080p
  language_profile: English
  series_type: standard
  season_folder: true
  tag:
  search: false
  cutoff_search: false
  sonarr_path:
  plex_path:
  upgrade_existing: false
  ignore_cache: false
trakt:
  client_id: ####################
  client_secret: ####################
  pin:
  authorization:
    # everything below is autofilled by the script
    access_token:
    token_type:
    expires_in:
    refresh_token:
    scope: public
    created_at:
mal:
  client_id: ####################
  client_secret: ####################
  authorization:
    # everything below is autofilled by the script
    access_token:
    token_type:
    expires_in:
    refresh_token: