Plex Pinyin Sorting, Pinyin Search and Type Chinese Script Usage Tutorial

As a global application, Plex has been trying its best to localize adaptations for various languages, but due to various reasons, Plex's support for Chinese can only be said to be okay at present, not perfect.

First of all, there are many mistakes or awkward translations in translation. This is because Plex does not have an official translation team. Plex's translations of languages ​​​​other than English are all created by users after creating projects on the integrated translation platform of transifex. Translators, users who have the ability to translate and are willing to help Plex localize for free can become translators by joining the translation project of Plex, and then they can translate the content of each platform of Plex. Since all translations are spontaneous, plus Some entries do not have a clear description of the usage scenarios, and there are no professional verification personnel, so the translation level is uneven, and the unverified content can be modified at any time, but there are already some projects that have been verified earlier. The wrong translations of , and cannot be changed for the time being, it is a bit awkward to see these translations.

In addition, because the data scraped by Plex mainly comes from TMDB and some other foreign platforms, although most of the film and television information has Chinese versions, there are also some untranslated contents, such as some too niche film and television content or some film and television content Detailed information does not have a corresponding Chinese translation. At this time, there will be some mixed Chinese and English in our database. For example, in the genre information in the picture below, Chinese tags and English tags are mixed together, and tags with the same meaning are not included. There is no two in one.

In addition to the translation problem, Plex also lacks a very important functional support, which is the pinyin sorting function. When you choose to sort by title, if your content is all Chinese titles, you will definitely see a text in the quick search column on the right. Arranged in Chinese (as shown in the picture below), they are the first word of the title. When you check your content, you will find that the order is very chaotic and seems to be completely irregular.

有很多人都误以为中文标题排序就是没有顺序、是乱序的,其实不然,Plex 的标题是按照首字符的 Unicode 编码顺序排列的,所有语言默认使用的都是这种排序方式,对于大部分西方语言文字或者拼音文字来说,他们的文字是由字母组成的,日常就是使用字母顺序,而他们的的字母顺序和 Unicode 编码顺序是一致的,所以这样排序很正常。

但是 Unicode 编码顺序对中文使用者来说基本上是毫无意义的,下图就是 GB2312 的中文字符 Unicode 排序,也就是你在 Plex 中看到的中文标题排序标准,这个顺序对中文使用者是完全起不到任何作用的。

上述问题给中文用户造成了很大的不便,有些问题官方是无法解决的,有些问题官方暂时没有更好的解决办法,但你要相信高手在民间,国内的大佬 timmy0209 通过自己写的脚本把上面两个问题都解决了,timmy0209 先后发布了 plex-chinese-genreplex-pinyin-sort 两个脚本,之后 sqkkyzx 在 timmy0209 的基础上把两个脚本合二为一制作了 plex_localization_zhcn 脚本,这个脚本主要有三个功能:

  1. 实现电影及电视剧类型的媒体库按标题拼音首字母排序,并支持按标题拼音缩写搜索。

  1. 实现电影类型的媒体库类别标签汉化。

  1. 实现电视剧类型的媒体库类别标签汉化。

经过测试,我觉得这个脚本确实很实用,所以在这里分享给大家,如果不懂怎么使用脚本请继续查看下面的操作指南。(以 macOS 为例)

01. 请在 plex_localization_zhcn 下载脚本,解压文件后你会得到一个「plex_localization_zhcn.py」脚本文件。

02. 打开终端(Windows 打开 cmd),输入「python3 --version」按回车,如果出现 python 版本号例如「Python 3.11.0」请直接进行下一步;如果未出现版本号,或者版本低于 3.0 请至 python 官网下载最新版的 python 并安装后再操作。

03. 请输入「pip --version」按回车,如果出现 pip 版本号例如「pip 23.0」请直接进行下一步;如果未出现版本号,例如报错「SyntaxError: invalid syntax」,请输入「curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

python3 get-pip.py」按回车安装 pip,安装完成后再输入「pip --version」按回车,如果出现 pip 版本号例如「pip 23.0」请进行下一步。

04. 请输入「pip install plexapi」按回车安装 plexapi 模块,请输入「pip install pypinyin」按回车安装 pypinyin 模块,分别出现「Successfully installed...」则表示安装成功,请进行下一步。

05. 请输入「cd 脚本存储文件夹路径」按回车,例如「cd /Users/x1ao4/Downloads/plex_localization_zhcn-main」,可输入 cd、空格然后直接将文件夹拖入终端,再按回车。

06. 请输入「python3 plex_localization_zhcn.py」按回车。

07. 请输入「你的 Plex 服务器地址」按回车,例如「http://127.0.0.1:32400」。

08. 请输入你的 Token,按回车。获取 Token 请使用「你的 Plex 服务器地址」也就是上一步的地址在浏览器中打开 Plex Web,如果使用的是 Chrome 浏览器请直接在页面空白处右击选择「检查」,然后在顶部找到「网络」,刷新页面后在第一行就可以看到你的 Token,右击复制链接地址后只保留 Token 即可。

09. 选择要操作的库的类型,输入数字代码按回车。

10. 选择要操作的库,输入数字代码按回车。

11. 这时候脚本就会自动帮你修改这个库内项目的排序名称了,会将所有标题的排序名称修改为标题每个字的拼音首字母缩写,这样资料库将使用中文标题的拼音首字母进行排序,并且可以使用标题的拼音缩写在服务器进行搜索。项目类型标签为英文的会根据脚本设置为你修改为对应的中文标签。

若要继续为其他库进行修改请重复「06-10」选择其他库即可,若日后资料库内新增了项目,需要对新增的项目重新执行脚本,此时只要打开终端执行「05-10」即可。

从上图可以看出这个脚本实际上就是用于自动修改「标题排序」和「类型标签」的,如果没有脚本是需要手动修改的,现在有了脚本就方便多啦。

关于「类型标签」的汉化如果你对作者提供的翻译不满意也可以自己使用文本编辑或者记事本打开「plex_localization_zhcn.py」脚本文件,修改中文翻译,如果你的库中存在脚本里没有的标签,理论上你是可以按照脚本中的格式自行增加新的标签对应关系的,修改后保存脚本,重新执行脚本就会按照新的设置处理了。

用完脚本果然整个资料库整齐多了,方便实用,感谢大佬的脚本,大家都赶紧用起来吧!

Guess you like

Origin blog.csdn.net/u010567698/article/details/129211173