Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sleikang committed Dec 3, 2022
2 parents 03a91a0 + af58599 commit 7e7b6fb
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 24 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# MediaServerTools
Emby/Jellyfin 媒体标题自动同步
Emby/Jellyfin/Plex 媒体中文自动同步
1. 中文标题
2. 媒体概述
3. 中文人名
4. 中文扮演
3. 中文人名(Plex暂时不支持)
4. 中文扮演(Plex暂时不支持)
5. 剧集概述评分图片同步
6. 剧集组自定义同步
7. 媒体搜刮检查是否正确(配合NasTools)


* 注意使用本工具需要emby本身刮削了tmdb的完整数据,工具只是获取原有的数据进行替换
* 注意使用本工具需要媒体服务器本身刮削了tmdb的完整数据,工具只是获取原有的数据进行替换
1. 配置文件config/config.yaml
2. win下使用安装Python3安装过程连续点击下一步
3. 安装依赖模块
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine:3.16

ENV WORK_DIR=/MediaServerTools \
EMBYTOOLS_CONFIG=/config \
MEDIASERVERTOOLS_CONFIG=/config \
LANG="C.UTF-8" \
PS1="\u@\h:\w \$ " \
TZ=Asia/Shanghai \
Expand Down
8 changes: 4 additions & 4 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

## 简介

Emby/Jellyfin 媒体标题自动同步
Emby/Jellyfin/Plex 媒体中文自动同步
1. 中文标题
2. 媒体概述
3. 中文人名
4. 中文扮演
3. 中文人名(Plex暂时不支持)
4. 中文扮演(Plex暂时不支持)
5. 剧集概述评分图片同步
6. 剧集组自定义同步
7. 媒体搜刮检查是否正确(配合NasTools)

- Dockerhub: https://hub.docker.com/r/ddsderek/mediaservertools
- Github: https://github.com/sleikang/MediaServerTools

* 注意使用本工具需要emby本身刮削了tmdb的完整数据,工具只是获取原有的数据进行替换
* 注意使用本工具需要媒体服务器本身刮削了tmdb的完整数据,工具只是获取原有的数据进行替换

## 部署

Expand Down
4 changes: 3 additions & 1 deletion docker/package_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ py3-pip
bash
su-exec
git
tzdata
tzdata
zip
unzip
53 changes: 40 additions & 13 deletions docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,25 @@ function package_list_update {
apk add --no-cache $(echo $(cat docker/package_list.txt))
}

function backup_config {
echo -e "${Green}备份config文件中...${Font}"
if [ -f /config/config_backup.zip ]; then
rm -rf /config/config_backup.zip
fi
if [ -f /config/log.txt ]; then
zip -r /config/config_backup.zip /config -x='/config/log.txt'
else
zip -r /config/config_backup.zip /config
fi
if [ -f /config/config_backup.zip ]; then
if [[ "$(stat -c '%u' /config/config_backup.zip)" != "${PUID}" ]] || [[ "$(stat -c '%g' /config/config_backup.zip)" != "${PGID}" ]]; then
chown ${PUID}:${PGID} /config/config_backup.zip
fi
fi
}

if [ "${MediaServerTools_AUTO_UPDATE}" = "true" ]; then
backup_config
if [ ! -s /tmp/requirement.txt.sha256sum ]; then
sha256sum requirement.txt > /tmp/requirement.txt.sha256sum
fi
Expand All @@ -63,17 +81,17 @@ if [ "${MediaServerTools_AUTO_UPDATE}" = "true" ]; then
else
echo -e "${Green}依赖安装成功...${Font}"
sha256sum requirement.txt > /tmp/requirement.txt.sha256sum
hash_old=$(cat /tmp/package_list.txt.sha256sum)
hash_new=$(sha256sum docker/package_list.txt)
if [ "$hash_old" != "$hash_new" ]; then
package_list_update
if [ $? -ne 0 ]; then
echo -e "${Red}无法更新软件包,请更新镜像...${Font}"
else
echo -e "${Green}软件包安装成功...${Font}"
sha256sum docker/package_list.txt > /tmp/package_list.txt.sha256sum
fi
fi
fi
fi
hash_old=$(cat /tmp/package_list.txt.sha256sum)
hash_new=$(sha256sum docker/package_list.txt)
if [ "$hash_old" != "$hash_new" ]; then
package_list_update
if [ $? -ne 0 ]; then
echo -e "${Red}无法更新软件包,请更新镜像...${Font}"
else
echo -e "${Green}软件包安装成功...${Font}"
sha256sum docker/package_list.txt > /tmp/package_list.txt.sha256sum
fi
fi
else
Expand All @@ -86,8 +104,17 @@ fi
# 权限设置
chown -R ${PUID}:${PGID} ${WORK_DIR}

if [[ "$(stat -c '%u' ${EMBYTOOLS_CONFIG})" != "${PUID}" ]] || [[ "$(stat -c '%g' ${EMBYTOOLS_CONFIG})" != "${PGID}" ]]; then
chown ${PUID}:${PGID} ${EMBYTOOLS_CONFIG}
# 兼容旧环境变量
if [[ -n "${MEDIASERVERTOOLS_CONFIG}" ]]; then
if [[ "$(stat -c '%u' ${MEDIASERVERTOOLS_CONFIG})" != "${PUID}" ]] || [[ "$(stat -c '%g' ${MEDIASERVERTOOLS_CONFIG})" != "${PGID}" ]]; then
chown ${PUID}:${PGID} ${MEDIASERVERTOOLS_CONFIG}
fi
fi
if [[ -n "${EMBYTOOLS_CONFIG}" ]]; then
echo -e "${Green}使用旧Config路径环境变量${Font}"
if [[ "$(stat -c '%u' ${EMBYTOOLS_CONFIG})" != "${PUID}" ]] || [[ "$(stat -c '%g' ${EMBYTOOLS_CONFIG})" != "${PGID}" ]]; then
chown ${PUID}:${PGID} ${EMBYTOOLS_CONFIG}
fi
fi

if [[ "$(stat -c '%A' ${WORK_DIR}/docker/start.sh)" != "-rwxr-xr-x" ]]; then
Expand Down
3 changes: 2 additions & 1 deletion requirement.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ zhconv
requests
pyjson
pyyaml
html2text
html2text
plexapi

0 comments on commit 7e7b6fb

Please sign in to comment.