From f3144807bd4d25e07f99c4d5d5e331f8c174ca7d Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 22 Oct 2024 12:09:57 +0800 Subject: [PATCH 1/6] build v2 beta --- .github/workflows/build.yml | 11 ++++++++--- Dockerfile | 5 +++-- update | 21 ++++++++++++--------- version.py | 3 ++- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3ee9f3a6..a7a7d1c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,9 +1,14 @@ -name: MoviePilot Builder +name: MoviePilot Builder v2 on: workflow_dispatch: push: branches: - - dev + - v2 + paths: + - '.github/workflows/build.yml' + - 'Dockerfile' + - 'version.py' + - 'requirements.in' jobs: Docker-build: @@ -23,7 +28,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ${{ secrets.DOCKER_USERNAME }}/moviepilot + images: ${{ secrets.DOCKER_USERNAME }}/moviepilot-v2 tags: | type=raw,value=${{ env.app_version }} diff --git a/Dockerfile b/Dockerfile index effeb7c4..cdcaf619 100644 --- a/Dockerfile +++ b/Dockerfile @@ -79,7 +79,8 @@ RUN cp -f /app/nginx.conf /etc/nginx/nginx.template.conf \ && echo 'fs.inotify.max_user_watches=5242880' >> /etc/sysctl.conf \ && echo 'fs.inotify.max_user_instances=5242880' >> /etc/sysctl.conf \ && locale-gen zh_CN.UTF-8 \ - && curl -sL "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/dev_v2.0.0-alpha/dist.zip" | busybox unzip -d / - \ + && FRONTEND_VERSION=$(grep -oP "(?<=FRONTEND_VERSION\s*=\s*')[^']+" /app/version.py) \ + && curl -sL "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${FRONTEND_VERSION}/dist.zip" | busybox unzip -d / - \ && mv /dist /public \ && curl -sL "https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip" | busybox unzip -d /tmp - \ && mv -f /tmp/MoviePilot-Plugins-main/plugins.v2/* /app/app/plugins/ \ @@ -90,4 +91,4 @@ RUN cp -f /app/nginx.conf /etc/nginx/nginx.template.conf \ && rm -rf /tmp/* EXPOSE 3000 VOLUME [ "/config" ] -ENTRYPOINT [ "/entrypoint" ] +ENTRYPOINT [ "/entrypoint" ] \ No newline at end of file diff --git a/update b/update index 7050ffbb..454ace02 100644 --- a/update +++ b/update @@ -65,7 +65,8 @@ function install_backend_and_download_resources() { return 1 fi INFO "安装依赖成功" - frontend_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases/latest" ${CURL_HEADERS} | jq -r .tag_name) + # 从后端文件中读取前端版本号 + frontend_version=$(grep -oP "(?<=FRONTEND_VERSION\s*=\s*')[^']+" /tm/App/version.py) if [[ "${frontend_version}" != *v* ]]; then WARN "前端最新版本号获取失败,继续启动..." return 1 @@ -289,21 +290,23 @@ if [[ "${MOVIEPILOT_AUTO_UPDATE}" = "true" ]] || [[ "${MOVIEPILOT_AUTO_UPDATE}" fi if [ "${MOVIEPILOT_AUTO_UPDATE}" = "dev" ]; then INFO "Dev 更新模式" - install_backend_and_download_resources "heads/main.zip" + install_backend_and_download_resources "heads/v2.zip" else INFO "Release 更新模式" old_version=$(grep -m -1 "^\s*APP_VERSION\s*=\s*" /app/version.py | tr -d '\r\n' | awk -F'#' '{print $1}' | sed 's/^[[:space:]]*//; s/[[:space:]]*$//') if [[ "${old_version}" == *APP_VERSION* ]]; then current_version=$(echo "${old_version}" | sed -rn "s/APP_VERSION\s*=\s*['\"](.*)['\"]/\1/gp") INFO "当前版本号:${current_version}" - new_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot/releases/latest" ${CURL_HEADERS} | jq -r .tag_name | tr -d '\r\n') - if [[ "${new_version}" == *v* ]]; then - release_version=${new_version} - INFO "最新版本号:${release_version}" - # 使用版本号比较函数进行比较 - compare_versions "${current_version}" "${release_version}" + # 获取所有发布的版本列表,并筛选出以v2开头的版本号 + releases=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot/releases" ${CURL_HEADERS} | jq -r '.[].tag_name' | grep "^v2\.") + if [ -z "$releases" ]; then + WARN "未找到任何v2.x版本,继续启动..." else - WARN "最新版本号获取失败,继续启动..." + # 找到最新的v2版本 + latest_v2=$(echo "$releases" | sort -V | tail -n 1) + INFO "最新的v2.x版本号:${latest_v2}" + # 使用版本号比较函数进行比较,并下载最新版本 + compare_versions "${current_version}" "${latest_v2}" fi else WARN "当前版本号获取失败,继续启动..." diff --git a/version.py b/version.py index 02d6855c..4a3ec2dd 100644 --- a/version.py +++ b/version.py @@ -1 +1,2 @@ -APP_VERSION = 'v2.0.0-alpha' +APP_VERSION = 'v2.0.0-beta' +FRONTEND_VERSION = 'v2.0.0-beta' From 6869708e8ee80d96797d7a2faeb32a8df4c35ed3 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 22 Oct 2024 12:20:23 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cdcaf619..1d1c12b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -79,7 +79,7 @@ RUN cp -f /app/nginx.conf /etc/nginx/nginx.template.conf \ && echo 'fs.inotify.max_user_watches=5242880' >> /etc/sysctl.conf \ && echo 'fs.inotify.max_user_instances=5242880' >> /etc/sysctl.conf \ && locale-gen zh_CN.UTF-8 \ - && FRONTEND_VERSION=$(grep -oP "(?<=FRONTEND_VERSION\s*=\s*')[^']+" /app/version.py) \ + && FRONTEND_VERSION=$(sed -n "s/^FRONTEND_VERSION\s*=\s*'\([^']*\)'/\1/p" /app/version.py) \ && curl -sL "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${FRONTEND_VERSION}/dist.zip" | busybox unzip -d / - \ && mv /dist /public \ && curl -sL "https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip" | busybox unzip -d /tmp - \ From 7cfa315529cac780c1a7e428adfaaa0f86f19354 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 22 Oct 2024 12:47:18 +0800 Subject: [PATCH 3/6] build v2 latest --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7a7d1c4..86b35942 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,7 @@ jobs: images: ${{ secrets.DOCKER_USERNAME }}/moviepilot-v2 tags: | type=raw,value=${{ env.app_version }} + type=raw,value=latest - name: Set Up QEMU uses: docker/setup-qemu-action@v3 From 5eaffd9797714ed4fff4d2974d49dbe84228f8d5 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 22 Oct 2024 12:58:58 +0800 Subject: [PATCH 4/6] make release --- .github/workflows/build.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 86b35942..9b18c92b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,3 +58,21 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha, scope=${{ github.workflow }}-docker cache-to: type=gha, scope=${{ github.workflow }}-docker + + - name: Delete Release + uses: dev-drprasad/delete-tag-and-release@v1.1 + with: + tag_name: ${{ env.app_version }} + delete_release: true + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Generate Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ env.app_version }} + name: ${{ env.app_version }} + draft: false + prerelease: false + make_latest: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7a0b0d114eca0da643dd5db5976624bf3683bd6b Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 22 Oct 2024 13:03:30 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix=20=E4=BA=8C=E7=BA=A7=E5=88=86=E7=B1=BBb?= =?UTF-8?q?ug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/modules/filemanager/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/modules/filemanager/__init__.py b/app/modules/filemanager/__init__.py index f7cb0351..eb45890c 100644 --- a/app/modules/filemanager/__init__.py +++ b/app/modules/filemanager/__init__.py @@ -786,12 +786,18 @@ class FileManagerModule(_ModuleBase): if not target_dir.media_type and target_dir.library_type_folder: # 一级自动分类 library_dir = Path(target_dir.library_path) / mediainfo.type.value + elif target_dir.media_type and target_dir.library_type_folder: + # 一级手动分类 + library_dir = Path(target_dir.library_path) / target_dir.media_type else: library_dir = Path(target_dir.library_path) if not target_dir.media_category and target_dir.library_category_folder and mediainfo.category: # 二级自动分类 library_dir = library_dir / mediainfo.category + elif target_dir.media_category and target_dir.library_category_folder: + # 二级手动分类 + library_dir = library_dir / target_dir.media_category return library_dir From 5c5182941f4bf2dd5d212c9b078dbd0e48821d7e Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 22 Oct 2024 13:49:53 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix=20=E4=BA=8C=E7=BA=A7=E5=88=86=E7=B1=BBb?= =?UTF-8?q?ug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/monitor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/app/monitor.py b/app/monitor.py index c15dfee6..51e91276 100644 --- a/app/monitor.py +++ b/app/monitor.py @@ -415,7 +415,6 @@ class Monitor(metaclass=Singleton): mediainfo=mediainfo, transfer_type=dir_info.transfer_type, target_storage=dir_info.library_storage, - target_path=Path(dir_info.library_path), episodes_info=episodes_info, scrape=dir_info.scraping)