PHPackages                             hisune/emby\_pinyin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hisune/emby\_pinyin

ActiveProject[Utility &amp; Helpers](/categories/utility)

hisune/emby\_pinyin
===================

Let emby support pinyin sorting

1.0.3(3y ago)15710517[12 issues](https://github.com/hisune/emby_pinyin/issues)Apache-2.0PHPPHP &gt;=7.2.0

Since Jun 1Pushed 1y ago5 watchersCompare

[ Source](https://github.com/hisune/emby_pinyin)[ Packagist](https://packagist.org/packages/hisune/emby_pinyin)[ Docs](https://hisune.com)[ RSS](/packages/hisune-emby-pinyin/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)DependenciesVersions (16)Used By (0)

Emby Pinyin
===========

[](#emby-pinyin)

此工具能使emby或jellyfin支持电影、电视剧和音乐的拼音首字母排序和搜索，如果觉得此工具帮到你，可以点个Star⭐️！

目录
--

[](#目录)

- [Emby Pinyin](#emby-pinyin)
    - [目录](#%E7%9B%AE%E5%BD%95)
    - [特性](#%E7%89%B9%E6%80%A7)
    - [已支持的内容类型](#%E5%B7%B2%E6%94%AF%E6%8C%81%E7%9A%84%E5%86%85%E5%AE%B9%E7%B1%BB%E5%9E%8B)
    - [使用方法](#%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95)
        - [windows系统使用方法](#windows%E7%B3%BB%E7%BB%9F%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95)
        - [windows、linux及mac等系统通用php环境使用方法](#windowslinux%E5%8F%8Amac%E7%AD%89%E7%B3%BB%E7%BB%9F%E9%80%9A%E7%94%A8php%E7%8E%AF%E5%A2%83%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95)
        - [Docker](#docker)
        - [Docker Webhook and Cron](#docker-webhook-and-cron)
        - [拼音排序方式](#%E6%8B%BC%E9%9F%B3%E6%8E%92%E5%BA%8F%E6%96%B9%E5%BC%8F)
        - [拼音搜索](#%E6%8B%BC%E9%9F%B3%E6%90%9C%E7%B4%A2)
        - [参数化执行](#%E5%8F%82%E6%95%B0%E5%8C%96%E6%89%A7%E8%A1%8C)
        - [Webhooks Server](#webhooks-server)
    - [运行截图](#%E8%BF%90%E8%A1%8C%E6%88%AA%E5%9B%BE)
    - [使用效果](#%E4%BD%BF%E7%94%A8%E6%95%88%E6%9E%9C)

特性
--

[](#特性)

- 自动保存历史服务器配置，方便下次执行
- 一键处理所有媒体库或自定义媒体库
- 同时支持emby和jellyfin

已支持的内容类型
--------

[](#已支持的内容类型)

- 电影
- 音乐
- 电视节目
- 有声读物
- 书籍
- 游戏
- 音乐视频
- 家庭视频与照片
- 混合内容

使用方法
----

[](#使用方法)

### windows系统使用方法

[](#windows系统使用方法)

为方便没有windows php环境的用户，直接打包了exe程序执行：

1. 下载：[release](https://github.com/hisune/emby_pinyin/releases)
2. 解压后打开文件夹里面的EmbyPinyin.exe
3. 输入你的emby或jellyfin服务器地址、API密钥（首次输入后，下次可不用输入，直接选择）
4. 选择排序方式及要处理的媒体库（如不确定此工具对你的媒体库产生的影响，可自行选择一个媒体库处理，确认没问题后再处理所有媒体库，而不是一开始就处理所有媒体库）
5. 等待处理完成

### windows、linux及mac等系统通用php环境使用方法

[](#windowslinux及mac等系统通用php环境使用方法)

> 需要`PHP7.2`及以上版本环境，并修改`php.ini`的`phar.readonly`配置项为`Off`

首次执行：

```
composer create-project hisune/emby_pinyin
cd emby_pinyin
composer pre-install
composer start
```

二次执行：

```
composer start
```

执行完毕以上命令后的操作步骤和windows版本一致

### Docker

[](#docker)

Build image:

```
docker build -t emby_pinyin .
```

运行：

```
docker run --rm -it emby_pinyin
```

### Docker Webhook and Cron

[](#docker-webhook-and-cron)

镜像支持监听webhook服务，或通过crond定时执行排序

Build image:

```
docker build -t emby_pinyin.webhook -f Dockerfile.webhook .
```

环境变量：

ENV默认值说明WEBHOOK\_ENABLED0是否开启webhook，默认关闭CRON\_ENABLED0是否开启cron，默认关闭CRON\_SCHEDULE0 \* \* \* \*cron执行周期，默认每个整点执行HOSTjellyfin的host，必须改为自己的地址API\_KEY\*\*\*\*\*jellyfin的key，必须改为自己的值SORT\_TYPE1排序方式，参考[参数化执行](#%E5%8F%82%E6%95%B0%E5%8C%96%E6%89%A7%E8%A1%8C)webhook监听80端口，请自行映射到host

```
docker run -d \
    -e WEBHOOK_ENABLED=1 \
    -e CRON_ENABLED=1 \
    -e CRON_SCHEDULE="0 * * * *" \
    -e HOST="http://example:8096" \
    -e API_KEY="*****" \
    -e SORT_TYPE=1 \
    -p 8080:80 \
    --name emby_pinyin emby_pinyin.webhook
```

执行`docker logs -f emby_pinyin`以及`docker exec -it emby_pinyin tail -f /var/log/cron`可查看cron执行日志

### 拼音排序方式

[](#拼音排序方式)

以“测试”俩字为例，不同排序方式的最终结果如下(默认为首字母方式)：

1. 首字母：cs
2. 全拼：ceshi
3. 前置字母：c测试
4. emby默认：测试

### 拼音搜索

[](#拼音搜索)

指定originaltitle参数，将修改OriginalTitle（即原标题）字段，从而实现拼音搜索。 originaltitle参数的取值和type参数一致，当传入值`4`时，会将OriginalTitle修改为和标题相同的值。

> 注意：originaltitle参数修改后无法还原为原系统默认值，如你需要保留你媒体的原标题，请谨慎修改。

### 参数化执行

[](#参数化执行)

通过对程序传入一定的固定参数能实现：

- 配合计划任务执行实现自动化的拼音转换功能（例如每隔n小时自动执行转换拼音任务）
- 可以实现快速命令执行，例如每次运行的时候将server参数和type参数进行固定，而无需执行程序后手动选取

当前可用参数：

参数全称参数缩写说明servers服务器编号hosth指定服务器地址，配合key参数使用，例如：keyk指定服务器API密钥，配合host参数使用typet排序方式，1：首字母，2：全拼，3：前置字母，4：服务器默认alla是否处理所有媒体库，y是，n否mediam媒体库编号originaltitleo修改OriginalTitle的方式，值参考type参数，默认不修改helpH获取帮助windows exe举例：

> windows可以使用创建快捷方式或创建bat脚本的方式传递参数值

```
# 参数缩写方式举例
.\EmbyPinyin.exe -s 1 -t 3 -a n -m 2
```

linux&amp;mac&amp;windows等系统通用php环境举例：

```
# 参数全称方式举例
comopser start -- --server=1 --type=3 --all=n --media=2
```

### Webhooks Server

[](#webhooks-server)

Emby Server从4.7.9.0开始支持“新媒体已添加”的webhook事件，emby\_pinyin也从1.0.0版本开始支持，使用webhooks server功能能实现添加媒体库内容后自动执行新内容的拼音排序，做到无人值守，无需手动运行。

> 推荐在linux环境下执行webhooks server

1. 开启服务：通过以下命令开启webhooks server: ```
    # 安装emby_pinyin
    composer create-project hisune/emby_pinyin
    cd emby_pinyin
    composer pre-install
    # 启动http服务
    php -S localhost:9091
    ```

    如果你想监听局域网请求，可以将localhost换成当前执行命令的本机局域网ip，另外监听端口9091也可以自定义。
2. 确定请求参数：如果你执行且保存过服务器信息，使用server参数即可，例如：`?server=1`；你也可以直接使用host和key参数，指定服务器信息，例如：`?host=192.168.1.168&key=服务器API密钥`。两种方式必选一种。
3. emby设置Webhooks：打开emby管理后台，定位到`服务器`-&gt;`Webhooks`-&gt;`添加Webhooks`，输入自定义名称，url填写`http://localhost:9091/run.php`和第2步的请求参数组装的字符串，例如：`http://localhost:9091/run.php?server=1`
4. jellyfin设置Webhooks：打开jellyfin管理后台定位到`控制台`-&gt;`插件`，安装weebhook插件，点击`Webhooks`-&gt;`Add Generic Destination`，输入自名称及url同emby;`Notification Type`选择`Item Added`，勾选`Send All Properties`

推荐使用supervisor来管理你的webhooks server，安装supervisor的方法以centos为例：

```
# 安装supervisor
yum update -y
yum -y install epel-release
yum -y install supervisor
systemctl start supervisord
systemctl enable supervisord
# 配置supervisor
cd /etc/supervisord.d
vim emby_pinyin.ini
```

示例ini配置如下，请自行修改emby\_pinyin所在路径，及监听的IP和端口：

```
[program:emby_pinyin]
command=/usr/bin/php -S localhost:9091
stderr_logfile=/home/wwwroot/emby_pinyin/err.log
stdout_logfile=/home/wwwroot/emby_pinyin/out.log
directory=/home/wwwroot/emby_pinyin/
autostart=true
user=root
```

最后启动emby\_pinyin：

```
supervisorctl update
# 查看状态
supervisorctl status
```

贡献
--

[](#贡献)

感谢以下的小伙伴们对于 emby\_pinyin 项目的代码贡献，让这个项目变得越来越好！

[![Contributors](https://camo.githubusercontent.com/fdad8382cbbaa884a6865e1dafde0dbaca12931a537b31919df765787841eb2a/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f656d62795f70696e79696e2f636f6e7472696275746f72732e7376673f77696474683d38393026627574746f6e3d66616c7365)](https://github.com/hisune/emby_pinyin/graphs/contributors)

运行截图
----

[](#运行截图)

[![](https://raw.githubusercontent.com/hisune/images/master/emby_pinyin_2.jpg)](https://raw.githubusercontent.com/hisune/images/master/emby_pinyin_2.jpg)

使用效果
----

[](#使用效果)

[![](https://raw.githubusercontent.com/hisune/images/master/emby_pinyin_1.jpg)](https://raw.githubusercontent.com/hisune/images/master/emby_pinyin_1.jpg)

Sponsor
-------

[](#sponsor)

Thanks to [zmto](https://www.zmto.com/) for providing VPS sponsorship.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~30 days

Recently: every ~85 days

Total

14

Last Release

1097d ago

Major Versions

0.1.4 → 1.0.02022-11-08

### Community

Maintainers

![](https://www.gravatar.com/avatar/7a4ef0906f517b5dcc4658de9d066e7661a6267adcaff49c0cff77278d254e94?d=identicon)[hisune](/maintainers/hisune)

---

Top Contributors

[![hisune](https://avatars.githubusercontent.com/u/7941669?v=4)](https://github.com/hisune "hisune (112 commits)")[![dyf991645](https://avatars.githubusercontent.com/u/37744291?v=4)](https://github.com/dyf991645 "dyf991645 (8 commits)")[![aleung](https://avatars.githubusercontent.com/u/271538?v=4)](https://github.com/aleung "aleung (1 commits)")[![libook](https://avatars.githubusercontent.com/u/3395610?v=4)](https://github.com/libook "libook (1 commits)")

---

Tags

Pinyinemby

### Embed Badge

![Health badge](/badges/hisune-emby-pinyin/health.svg)

```
[![Health](https://phpackages.com/badges/hisune-emby-pinyin/health.svg)](https://phpackages.com/packages/hisune-emby-pinyin)
```

###  Alternatives

[overtrue/pinyin

Chinese to pinyin translator.

4.5k6.9M78](/packages/overtrue-pinyin)[thl/pinyin

Romanization tool for Traditional Chinese

2520.1k](/packages/thl-pinyin)[xiaodi/think-pinyin

ThinkPHP 中文转拼音扩展包

344.8k](/packages/xiaodi-think-pinyin)[lokielse/laravel-pinyin

Chinese Pinyin Bundle For Laravel

1413.9k](/packages/lokielse-laravel-pinyin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
