Merge pull request #1122 from thsrite/main
This commit is contained in:
commit
7921dcd86b
@ -105,6 +105,7 @@ MoviePilot需要配套下载器和媒体服务器配合使用。
|
|||||||
---
|
---
|
||||||
- **OCR_HOST:** OCR识别服务器地址,格式:`http(s)://ip:port`,用于识别站点验证码实现自动登录获取Cookie等,不配置默认使用内建服务器`https://movie-pilot.org`,可使用 [这个镜像](https://hub.docker.com/r/jxxghp/moviepilot-ocr) 自行搭建。
|
- **OCR_HOST:** OCR识别服务器地址,格式:`http(s)://ip:port`,用于识别站点验证码实现自动登录获取Cookie等,不配置默认使用内建服务器`https://movie-pilot.org`,可使用 [这个镜像](https://hub.docker.com/r/jxxghp/moviepilot-ocr) 自行搭建。
|
||||||
- **PLUGIN_MARKET:** 插件市场仓库地址,多个地址使用`,`分隔,保留最后的/,默认为官方插件仓库:`https://raw.githubusercontent.com/jxxghp/MoviePilot-Plugins/main/`。
|
- **PLUGIN_MARKET:** 插件市场仓库地址,多个地址使用`,`分隔,保留最后的/,默认为官方插件仓库:`https://raw.githubusercontent.com/jxxghp/MoviePilot-Plugins/main/`。
|
||||||
|
- **GITHUB_TOKEN:** Github token,提高请求api限流阈值 ghp_****(仅支持环境变量配置)
|
||||||
---
|
---
|
||||||
- **❗MESSAGER:** 消息通知渠道,支持 `telegram`/`wechat`/`slack`/`synologychat`,开启多个渠道时使用`,`分隔。同时还需要配置对应渠道的环境变量,非对应渠道的变量可删除,推荐使用`telegram`
|
- **❗MESSAGER:** 消息通知渠道,支持 `telegram`/`wechat`/`slack`/`synologychat`,开启多个渠道时使用`,`分隔。同时还需要配置对应渠道的环境变量,非对应渠道的变量可删除,推荐使用`telegram`
|
||||||
|
|
||||||
|
@ -163,7 +163,13 @@ def latest_version(_: schemas.TokenPayload = Depends(verify_token)):
|
|||||||
"""
|
"""
|
||||||
查询Github所有Release版本
|
查询Github所有Release版本
|
||||||
"""
|
"""
|
||||||
version_res = RequestUtils().get_res(f"https://api.github.com/repos/jxxghp/MoviePilot/releases")
|
headers = {}
|
||||||
|
if settings.GITHUB_TOKEN:
|
||||||
|
headers = {
|
||||||
|
"Authorization": f"Bearer {settings.GITHUB_TOKEN}"
|
||||||
|
}
|
||||||
|
version_res = RequestUtils(proxies=settings.PROXY, headers=headers).get_res(
|
||||||
|
f"https://api.github.com/repos/jxxghp/MoviePilot/releases")
|
||||||
if version_res:
|
if version_res:
|
||||||
ver_json = version_res.json()
|
ver_json = version_res.json()
|
||||||
if ver_json:
|
if ver_json:
|
||||||
|
@ -87,7 +87,12 @@ class SystemChain(ChainBase, metaclass=Singleton):
|
|||||||
"""
|
"""
|
||||||
获取最新版本
|
获取最新版本
|
||||||
"""
|
"""
|
||||||
version_res = RequestUtils(proxies=settings.PROXY).get_res(
|
headers = {}
|
||||||
|
if settings.GITHUB_TOKEN:
|
||||||
|
headers = {
|
||||||
|
"Authorization": f"Bearer {settings.GITHUB_TOKEN}"
|
||||||
|
}
|
||||||
|
version_res = RequestUtils(proxies=settings.PROXY, headers=headers).get_res(
|
||||||
"https://api.github.com/repos/jxxghp/MoviePilot/releases/latest")
|
"https://api.github.com/repos/jxxghp/MoviePilot/releases/latest")
|
||||||
if version_res:
|
if version_res:
|
||||||
ver_json = version_res.json()
|
ver_json = version_res.json()
|
||||||
|
@ -212,6 +212,8 @@ class Settings(BaseSettings):
|
|||||||
BIG_MEMORY_MODE: bool = False
|
BIG_MEMORY_MODE: bool = False
|
||||||
# 插件市场仓库地址,多个地址使用,分隔,地址以/结尾
|
# 插件市场仓库地址,多个地址使用,分隔,地址以/结尾
|
||||||
PLUGIN_MARKET: str = "https://raw.githubusercontent.com/jxxghp/MoviePilot-Plugins/main/"
|
PLUGIN_MARKET: str = "https://raw.githubusercontent.com/jxxghp/MoviePilot-Plugins/main/"
|
||||||
|
# Github token,提高请求api限流阈值 ghp_****
|
||||||
|
GITHUB_TOKEN: str = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def INNER_CONFIG_PATH(self):
|
def INNER_CONFIG_PATH(self):
|
||||||
|
@ -34,6 +34,7 @@ class MetaVideo(MetaBase):
|
|||||||
_name_no_begin_re = r"^\[.+?]"
|
_name_no_begin_re = r"^\[.+?]"
|
||||||
_name_no_chinese_re = r".*版|.*字幕"
|
_name_no_chinese_re = r".*版|.*字幕"
|
||||||
_name_se_words = ['共', '第', '季', '集', '话', '話', '期']
|
_name_se_words = ['共', '第', '季', '集', '话', '話', '期']
|
||||||
|
_name_movie_words = ['剧场版', '劇場版', '电影版', '電影版']
|
||||||
_name_nostring_re = r"^PTS|^JADE|^AOD|^CHC|^[A-Z]{1,4}TV[\-0-9UVHDK]*" \
|
_name_nostring_re = r"^PTS|^JADE|^AOD|^CHC|^[A-Z]{1,4}TV[\-0-9UVHDK]*" \
|
||||||
r"|HBO$|\s+HBO|\d{1,2}th|\d{1,2}bit|NETFLIX|AMAZON|IMAX|^3D|\s+3D|^BBC\s+|\s+BBC|BBC$|DISNEY\+?|XXX|\s+DC$" \
|
r"|HBO$|\s+HBO|\d{1,2}th|\d{1,2}bit|NETFLIX|AMAZON|IMAX|^3D|\s+3D|^BBC\s+|\s+BBC|BBC$|DISNEY\+?|XXX|\s+DC$" \
|
||||||
r"|[第\s共]+[0-9一二三四五六七八九十\-\s]+季" \
|
r"|[第\s共]+[0-9一二三四五六七八九十\-\s]+季" \
|
||||||
@ -182,8 +183,9 @@ class MetaVideo(MetaBase):
|
|||||||
if not self.cn_name:
|
if not self.cn_name:
|
||||||
self.cn_name = token
|
self.cn_name = token
|
||||||
elif not self._stop_cnname_flag:
|
elif not self._stop_cnname_flag:
|
||||||
if not re.search("%s" % self._name_no_chinese_re, token, flags=re.IGNORECASE) \
|
if re.search("%s" % self._name_movie_words, token, flags=re.IGNORECASE) \
|
||||||
and not re.search("%s" % self._name_se_words, token, flags=re.IGNORECASE):
|
or (not re.search("%s" % self._name_no_chinese_re, token, flags=re.IGNORECASE)
|
||||||
|
and not re.search("%s" % self._name_se_words, token, flags=re.IGNORECASE)):
|
||||||
self.cn_name = "%s %s" % (self.cn_name, token)
|
self.cn_name = "%s %s" % (self.cn_name, token)
|
||||||
self._stop_cnname_flag = True
|
self._stop_cnname_flag = True
|
||||||
else:
|
else:
|
||||||
|
@ -49,7 +49,12 @@ class PluginHelper(metaclass=Singleton):
|
|||||||
获取插件的文件列表
|
获取插件的文件列表
|
||||||
"""
|
"""
|
||||||
file_api = f"https://api.github.com/repos/{user}/{repo}/contents/plugins/{_p.lower()}"
|
file_api = f"https://api.github.com/repos/{user}/{repo}/contents/plugins/{_p.lower()}"
|
||||||
r = RequestUtils(proxies=settings.PROXY).get_res(file_api)
|
headers = {}
|
||||||
|
if settings.GITHUB_TOKEN:
|
||||||
|
headers = {
|
||||||
|
"Authorization": f"Bearer {settings.GITHUB_TOKEN}"
|
||||||
|
}
|
||||||
|
r = RequestUtils(proxies=settings.PROXY, headers=headers).get_res(file_api)
|
||||||
if not r or r.status_code != 200:
|
if not r or r.status_code != 200:
|
||||||
return None, f"连接仓库失败:{r.status_code} - {r.reason}"
|
return None, f"连接仓库失败:{r.status_code} - {r.reason}"
|
||||||
ret = r.json()
|
ret = r.json()
|
||||||
|
11
update
11
update
@ -5,7 +5,7 @@ download_and_unzip() {
|
|||||||
url="$1"
|
url="$1"
|
||||||
target_dir="$2"
|
target_dir="$2"
|
||||||
echo "正在下载 ${url}..."
|
echo "正在下载 ${url}..."
|
||||||
curl ${CURL_OPTIONS} "$url" | busybox unzip -d /tmp -
|
curl ${CURL_OPTIONS} "$url" ${CURL_HEADERS} | busybox unzip -d /tmp -
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
if [ -e /tmp/MoviePilot-* ]; then
|
if [ -e /tmp/MoviePilot-* ]; then
|
||||||
mv /tmp/MoviePilot-* /tmp/${target_dir}
|
mv /tmp/MoviePilot-* /tmp/${target_dir}
|
||||||
@ -30,7 +30,7 @@ install_backend_and_download_resources() {
|
|||||||
download_and_unzip "https://github.com/jxxghp/MoviePilot-Resources/archive/refs/heads/main.zip" "Resources"
|
download_and_unzip "https://github.com/jxxghp/MoviePilot-Resources/archive/refs/heads/main.zip" "Resources"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "资源包下载成功"
|
echo "资源包下载成功"
|
||||||
frontend_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases/latest" | jq -r .tag_name)
|
frontend_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases/latest" ${CURL_HEADERS} | jq -r .tag_name)
|
||||||
if [[ "${frontend_version}" == *v* ]]; then
|
if [[ "${frontend_version}" == *v* ]]; then
|
||||||
download_and_unzip "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${frontend_version}/dist.zip" "dist"
|
download_and_unzip "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${frontend_version}/dist.zip" "dist"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
@ -83,6 +83,11 @@ if [[ "${MOVIEPILOT_AUTO_UPDATE}" = "true" ]] || [[ "${MOVIEPILOT_AUTO_UPDATE}"
|
|||||||
CURL_OPTIONS="-sL"
|
CURL_OPTIONS="-sL"
|
||||||
echo "不使用代理更新程序"
|
echo "不使用代理更新程序"
|
||||||
fi
|
fi
|
||||||
|
if [ -n "${GITHUB_TOKEN}" ]; then
|
||||||
|
CURL_HEADERS="--header 'Authorization: Bearer ${GITHUB_TOKEN}'"
|
||||||
|
else
|
||||||
|
CURL_HEADERS=""
|
||||||
|
fi
|
||||||
if [ "${MOVIEPILOT_AUTO_UPDATE}" = "dev" ]; then
|
if [ "${MOVIEPILOT_AUTO_UPDATE}" = "dev" ]; then
|
||||||
echo "Dev 更新模式"
|
echo "Dev 更新模式"
|
||||||
install_backend_and_download_resources "heads/main.zip"
|
install_backend_and_download_resources "heads/main.zip"
|
||||||
@ -92,7 +97,7 @@ if [[ "${MOVIEPILOT_AUTO_UPDATE}" = "true" ]] || [[ "${MOVIEPILOT_AUTO_UPDATE}"
|
|||||||
if [[ "${old_version}" == *APP_VERSION* ]]; then
|
if [[ "${old_version}" == *APP_VERSION* ]]; then
|
||||||
current_version=v$(echo ${old_version} | sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp")
|
current_version=v$(echo ${old_version} | sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp")
|
||||||
echo "当前版本号:${current_version}"
|
echo "当前版本号:${current_version}"
|
||||||
new_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot/releases/latest" | jq -r .tag_name)
|
new_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot/releases/latest" ${CURL_HEADERS} | jq -r .tag_name)
|
||||||
if [[ "${new_version}" == *v* ]]; then
|
if [[ "${new_version}" == *v* ]]; then
|
||||||
release_version=${new_version}
|
release_version=${new_version}
|
||||||
echo "最新版本号:${release_version}"
|
echo "最新版本号:${release_version}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user