From e3a4ea6d73913c16da7732693f63514cf0e69c80 Mon Sep 17 00:00:00 2001 From: cxfksword <718792+cxfksword@users.noreply.github.com> Date: Sat, 16 Dec 2023 15:11:34 +0800 Subject: [PATCH] tweak: revert back cn domain. close #57 --- .github/workflows/publish.yaml | 30 +++++++------------ .../Providers/PersonImageProvider.cs | 5 +++- README.md | 8 ++++- scripts/generate_manifest.py | 19 +++++++----- 4 files changed, 33 insertions(+), 29 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 5d0c783..14c97c7 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -44,18 +44,10 @@ jobs: dotnet publish --nologo --no-restore --configuration=Release --framework=net6.0 -p:Version=${{steps.vars.outputs.VERSION}} ${{ env.project }} mkdir -p artifacts zip -j ./artifacts/${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ./Jellyfin.Plugin.MetaShark/bin/Release/net6.0/Jellyfin.Plugin.MetaShark.dll - cp ./doc/logo.png ./artifacts/logo.png - name: Generate manifest - run: cd artifacts && python3 ../scripts/generate_manifest.py ${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ${GITHUB_REF#refs/*/} - - name: Deploy to jellyfin release repo - uses: peaceiris/actions-gh-pages@v3 - with: - personal_token: ${{ secrets.PAT }} - external_repository: cxfksword/jellyfin-release - destination_dir: ${{ env.artifact }} - publish_branch: master - publish_dir: ./artifacts - keep_files: true + run: python3 ./scripts/generate_manifest.py ./artifacts/${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ${GITHUB_REF#refs/*/} + env: + CN_DOMAIN: ${{ vars.CN_DOMAIN }} - name: Publish release uses: svenstaro/upload-release-action@v2 with: @@ -63,11 +55,11 @@ jobs: file: ./artifacts/${{ env.artifact }}_*.zip tag: ${{ github.ref }} file_glob: true - # - name: Publish manifest - # uses: svenstaro/upload-release-action@v2 - # with: - # repo_token: ${{ secrets.GITHUB_TOKEN }} - # file: ./artifacts/manifest*.json - # tag: "manifest" - # overwrite: true - # file_glob: true + - name: Publish manifest + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./manifest*.json + tag: "manifest" + overwrite: true + file_glob: true diff --git a/Jellyfin.Plugin.MetaShark/Providers/PersonImageProvider.cs b/Jellyfin.Plugin.MetaShark/Providers/PersonImageProvider.cs index f853762..7e00397 100644 --- a/Jellyfin.Plugin.MetaShark/Providers/PersonImageProvider.cs +++ b/Jellyfin.Plugin.MetaShark/Providers/PersonImageProvider.cs @@ -72,7 +72,10 @@ namespace Jellyfin.Plugin.MetaShark.Providers }); } - this.Log($"Got images failed because the images of \"{item.Name}\" is empty!"); + if (list.Count == 0) + { + this.Log($"Got images failed because the images of \"{item.Name}\" is empty!"); + } return list; } diff --git a/README.md b/README.md index 9994524..74c6534 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,13 @@ jellyfin电影元数据插件,影片信息只要从豆瓣获取,并由TheMov 只支持最新的`jellyfin 10.8.x`版本 -添加插件存储库:https://jellyfin-plugin-release.pages.dev/metashark/manifest.json +添加插件存储库: + +国内加速:https://mirror.ghproxy.com/https://github.com/cxfksword/jellyfin-plugin-metashark/releases/download/manifest/manifest_cn.json + +国外访问:https://github.com/cxfksword/jellyfin-plugin-metashark/releases/download/manifest/manifest.json + +> 如果无法访问,可以直接从 [Release](https://github.com/cxfksword/jellyfin-plugin-metashark/releases) 页面下载,并解压到 jellyfin 插件中目录使用 ## 如何使用 diff --git a/scripts/generate_manifest.py b/scripts/generate_manifest.py index 759cbce..448a00e 100755 --- a/scripts/generate_manifest.py +++ b/scripts/generate_manifest.py @@ -18,7 +18,7 @@ def generate_manifest(): "overview": "jellyfin电影元数据插件", "owner": "cxfksword", "category": "Metadata", - "imageUrl": "https://jellyfin-plugin-release.pages.dev/metashark/logo.png", + "imageUrl": "https://github.com/cxfksword/jellyfin-plugin-metashark/raw/main/doc/logo.png", "versions": [] }] @@ -27,7 +27,7 @@ def generate_version(filepath, version, changelog): 'version': f"{version}.0", 'changelog': changelog, 'targetAbi': '10.8.0.0', - 'sourceUrl': f'https://jellyfin-plugin-release.pages.dev/metashark/metashark_{version}.0.zip', + 'sourceUrl': f'https://github.com/cxfksword/jellyfin-plugin-metashark/releases/download/v{version}/metashark_{version}.0.zip', 'checksum': md5sum(filepath), 'timestamp': datetime.now().strftime('%Y-%m-%dT%H:%M:%S') } @@ -47,7 +47,7 @@ def main(): # 解析旧 manifest try: - with urlopen('https://raw.githubusercontent.com/cxfksword/jellyfin-release/master/metashark/manifest.json') as f: + with urlopen('https://github.com/cxfksword/jellyfin-plugin-metashark/releases/download/manifest/manifest.json') as f: manifest = json.load(f) except HTTPError as err: if err.code == 404: @@ -63,11 +63,14 @@ def main(): json.dump(manifest, f, indent=2) # # 国内加速 - # with open('manifest_cn.json', 'w') as f: - # manifest_cn = json.dumps(manifest, indent=2) - # manifest_cn = re.sub('https://github.com/cxfksword/jellyfin-plugin-metashark/raw/main/doc/logo.png', "https://jellyfin-plugin-release.pages.dev/metashark/logo.png", manifest_cn) - # manifest_cn = re.sub('https://github.com/cxfksword/jellyfin-plugin-metashark/releases/download/v[0-9.]+', "https://jellyfin-plugin-release.pages.dev/metashark", manifest_cn) - # f.write(manifest_cn) + cn_domain = 'https://mirror.ghproxy.com/' + if 'CN_DOMAIN' in os.environ: + cn_domain = os.environ["CN_DOMAIN"] + cn_domain = cn_domain.rstrip('/') + with open('manifest_cn.json', 'w') as f: + manifest_cn = json.dumps(manifest, indent=2) + manifest_cn = re.sub('https://github.com', f'{cn_domain}/https://github.com', manifest_cn) + f.write(manifest_cn) if __name__ == '__main__':