diff --git a/Dockerfile b/Dockerfile index 13480ba9..7ec3958a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,6 @@ ENV LANG="C.UTF-8" \ PGID=0 \ UMASK=000 \ MOVIEPILOT_AUTO_UPDATE=true \ - MOVIEPILOT_CN_UPDATE=false \ NGINX_PORT=3000 \ CONFIG_DIR="/config" \ API_TOKEN="moviepilot" \ @@ -47,6 +46,7 @@ RUN apt-get update \ curl \ busybox \ dumb-init \ + jq \ && \ if [ "$(uname -m)" = "x86_64" ]; \ then ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1; \ diff --git a/README.md b/README.md index 446b36d6..942b20df 100644 --- a/README.md +++ b/README.md @@ -51,13 +51,12 @@ docker pull jxxghp/moviepilot:latest - **PUID**:运行程序用户的`uid`,默认`0` - **PGID**:运行程序用户的`gid`,默认`0` - **UMASK**:掩码权限,默认`000`,可以考虑设置为`022` -- **MOVIEPILOT_AUTO_UPDATE**:重启更新,`true`/`false`,默认`true` -- **MOVIEPILOT_CN_UPDATE**:重启更新是否使用国内加速,`true`/`false`,默认`false ` +- **MOVIEPILOT_AUTO_UPDATE**:重启更新,`true`/`false`,默认`true` **注意:如果出现网络问题可以配置`PROXY_HOST`,具体看下方`PROXY_HOST`解释** - **NGINX_PORT:** WEB服务端口,默认`3000`,可自行修改,但不能为`3001` - **SUPERUSER:** 超级管理员用户名,默认`admin`,安装后使用该用户登录后台管理界面 - **SUPERUSER_PASSWORD:** 超级管理员初始密码,默认`password`,建议修改为复杂密码 - **API_TOKEN:** API密钥,默认`moviepilot`,在媒体服务器Webhook、微信回调等地址配置中需要加上`?token=`该值,建议修改为复杂字符串 -- **PROXY_HOST:** 网络代理(可选),访问themoviedb需要使用代理访问,格式为`http(s)://ip:port` +- **PROXY_HOST:** 网络代理(可选),访问themoviedb或者重启更新需要使用代理访问,格式为`http(s)://ip:port` - **TMDB_API_DOMAIN:** TMDB API地址,默认`api.themoviedb.org`,也可配置为`api.tmdb.org`或其它中转代理服务地址,能连通即可 - **DOWNLOAD_PATH:** 下载保存目录,**注意:需要将`moviepilot`及`下载器`的映射路径保持一致**,否则会导致下载文件无法转移 - **DOWNLOAD_MOVIE_PATH:** 电影下载保存目录,**必须是`DOWNLOAD_PATH`的下级路径**,不设置则下载到`DOWNLOAD_PATH` @@ -71,7 +70,7 @@ docker pull jxxghp/moviepilot:latest - **LIBRARY_MOVIE_NAME:** 电影媒体库目录名,默认`电影` - **LIBRARY_TV_NAME:** 电视剧媒体库目录名,默认`电视剧` - **LIBRARY_CATEGORY:** 媒体库二级分类开关,`true`/`false`,默认`false`,开启后会根据配置`category.yaml`自动在媒体库目录下建立二级目录分类 -- **TRANSFER_TYPE:** 转移方式,支持`link`/`copy`/`move`/`softlink` +- **TRANSFER_TYPE:** 转移方式,支持`link`/`copy`/`move`/`softlink` **注意:在`link`和`softlink`转移方式下,转移后的文件会继承源文件的权限掩码,不受`UMASK`影响** - **COOKIECLOUD_HOST:** CookieCloud服务器地址,格式:`http://ip:port`,必须配置,否则无法添加站点 - **COOKIECLOUD_KEY:** CookieCloud用户KEY - **COOKIECLOUD_PASSWORD:** CookieCloud端对端加密密码 diff --git a/app/plugins/mediasyncdel/__init__.py b/app/plugins/mediasyncdel/__init__.py index 77e56ec2..4294a26f 100644 --- a/app/plugins/mediasyncdel/__init__.py +++ b/app/plugins/mediasyncdel/__init__.py @@ -493,7 +493,7 @@ class MediaSyncDel(_PluginBase): # 判断种子是否被删除完 self.handle_torrent(history_id=transferhis.id, src=transferhis.src, - torrent_hash=history.download_hash) + torrent_hash=transferhis.download_hash) except Exception as e: logger.error("删除种子失败,尝试删除源文件:%s" % str(e)) del_source = True @@ -641,7 +641,7 @@ class MediaSyncDel(_PluginBase): # 判断种子是否被删除完 self.handle_torrent(history_id=transferhis.id, src=transferhis.src, - torrent_hash=history.download_hash) + torrent_hash=transferhis.download_hash) except Exception as e: logger.error("删除种子失败,尝试删除源文件:%s" % str(e)) del_source = True diff --git a/app/utils/string.py b/app/utils/string.py index f4b866f4..a6d31dde 100644 --- a/app/utils/string.py +++ b/app/utils/string.py @@ -242,7 +242,10 @@ class StringUtils: return 'u2.dmhy.org' _, netloc = StringUtils.get_url_netloc(url) if netloc: - return ".".join(netloc.split(".")[-2:]) + locs = netloc.split(".") + if len(locs) > 3: + return netloc + return ".".join(locs[-2:]) return "" @staticmethod diff --git a/entrypoint b/entrypoint index 5dda7d15..3e3e5975 100644 --- a/entrypoint +++ b/entrypoint @@ -4,7 +4,9 @@ envsubst '${NGINX_PORT}' < /etc/nginx/nginx.template.conf > /etc/nginx/nginx.conf # 自动更新 if [ "${MOVIEPILOT_AUTO_UPDATE}" = "true" ]; then + cd / /usr/local/bin/mp_update + cd /app else echo "程序自动升级已关闭,如需自动升级请在创建容器时设置环境变量:MOVIEPILOT_AUTO_UPDATE=true" fi diff --git a/update b/update index e70d6177..3d62dadc 100644 --- a/update +++ b/update @@ -1,27 +1,27 @@ #!/bin/bash -if [ "${MOVIEPILOT_CN_UPDATE}" = "true" ]; then - GITHUB_URL="https://ghproxy.com/https://github.com" - GITHUBUSERCONTENT_URL="https://ghproxy.com/https://raw.githubusercontent.com" +if [ -n "${PROXY_HOST}" ]; then + CURL_OPTIONS="-sL -x ${PROXY_HOST}" + echo "使用代理更新程序" else - GITHUB_URL="https://github.com" - GITHUBUSERCONTENT_URL="https://raw.githubusercontent.com" + CURL_OPTIONS="-sL" + echo "不使用代理更新程序" fi old_version=$(cat /app/version.py) if [[ "${old_version}" == *APP_VERSION* ]]; then current_version=v$(echo ${old_version} | sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp") echo "当前版本号:${current_version}" - new_version=$(curl -sL "${GITHUBUSERCONTENT_URL}/jxxghp/MoviePilot/main/version.py") - if [[ "${new_version}" == *APP_VERSION* ]]; then - release_version=v$(echo ${new_version} | sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp") + new_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot/releases/latest" | jq -r .tag_name) + if [[ "${new_version}" == *v* ]]; then + release_version=${new_version} echo "最新版本号:${release_version}" - if [ "${old_version}" != "${new_version}" ]; then + if [ "${current_version}" != "${release_version}" ]; then echo "发现新版本,开始更新程序..." - curl -sL "${GITHUB_URL}/jxxghp/MoviePilot/archive/refs/tags/${release_version}.zip" | busybox unzip -d /tmp - + curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot/archive/refs/tags/${release_version}.zip" | busybox unzip -d /tmp - if [ $? -eq 0 ]; then echo "后端下载成功" - curl -sL "${GITHUB_URL}/jxxghp/MoviePilot-Frontend/releases/download/${release_version}/dist.zip" | busybox unzip -d /tmp - + curl ${CURL_OPTIONS} "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${release_version}/dist.zip" | busybox unzip -d /tmp - if [ $? -eq 0 ]; then echo "前端下载成功" rm -rf /app