Skip to content

Commit

Permalink
tweak: revert back cn domain. close #57
Browse files Browse the repository at this point in the history
  • Loading branch information
cxfksword committed Dec 16, 2023
1 parent a1b8533 commit e3a4ea6
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 29 deletions.
30 changes: 11 additions & 19 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,22 @@ 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:
repo_token: ${{ secrets.GITHUB_TOKEN }}
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
5 changes: 4 additions & 1 deletion Jellyfin.Plugin.MetaShark/Providers/PersonImageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, Cancell
});
}

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;
}

Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 插件中目录使用
## 如何使用

Expand Down
19 changes: 11 additions & 8 deletions scripts/generate_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": []
}]

Expand All @@ -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')
}
Expand All @@ -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:
Expand All @@ -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__':
Expand Down

0 comments on commit e3a4ea6

Please sign in to comment.