mirror of
https://github.com/cxfksword/jellyfin-plugin-danmu.git
synced 2026-04-23 18:12:00 +08:00
tweak: replace ghproxy
This commit is contained in:
4
.github/workflows/beta.yaml
vendored
4
.github/workflows/beta.yaml
vendored
@@ -20,8 +20,12 @@ jobs:
|
||||
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v3
|
||||
id: dotnet
|
||||
with:
|
||||
dotnet-version: ${{ env.dotnet-version }}
|
||||
- name: Change default dotnet version
|
||||
run: |
|
||||
echo '{"sdk":{"version": "${{ steps.dotnet.outputs.dotnet-version }}"}}' > ./global.json
|
||||
- name: Initialize workflow variables
|
||||
id: vars
|
||||
run: |
|
||||
|
||||
6
.github/workflows/build.yaml
vendored
6
.github/workflows/build.yaml
vendored
@@ -12,11 +12,15 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-dotnet@v3
|
||||
id: dotnet
|
||||
with:
|
||||
dotnet-version: 6.0.x
|
||||
- name: Change default dotnet version
|
||||
run: |
|
||||
echo '{"sdk":{"version": "${{ steps.dotnet.outputs.dotnet-version }}"}}' > ./global.json
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build --configuration Release --no-restore
|
||||
run: dotnet build --no-restore
|
||||
# - name: Test
|
||||
# run: dotnet test --no-restore --verbosity normal
|
||||
|
||||
15
.github/workflows/issue_close_inactive.yml
vendored
15
.github/workflows/issue_close_inactive.yml
vendored
@@ -10,12 +10,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: close-issues
|
||||
uses: actions-cool/issues-helper@v3
|
||||
uses: actions/stale@v7
|
||||
with:
|
||||
actions: "close-issues"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
inactive-day: 30
|
||||
exclude-labels: "enhancement,bug"
|
||||
close-reason: "not_planned"
|
||||
body: |
|
||||
This issue was closed due to inactive more than 30 days. You can reopen it if you think it should continue.
|
||||
stale-issue-message: "This issue was closed due to inactive more than 30 days. You can reopen it if you think it should continue."
|
||||
exempt-issue-labels: "FAQ,question,bug,enhancement"
|
||||
days-before-stale: 30
|
||||
days-before-close: 0
|
||||
days-before-pr-stale: -1
|
||||
days-before-pr-close: -1
|
||||
|
||||
52
.github/workflows/publish.yaml
vendored
52
.github/workflows/publish.yaml
vendored
@@ -21,8 +21,16 @@ jobs:
|
||||
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v3
|
||||
id: dotnet
|
||||
with:
|
||||
dotnet-version: ${{ env.dotnet-version }}
|
||||
- name: Change default dotnet version
|
||||
run: |
|
||||
echo '{"sdk":{"version": "${{ steps.dotnet.outputs.dotnet-version }}"}}' > ./global.json
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ env.python-version }}
|
||||
- name: Initialize workflow variables
|
||||
id: vars
|
||||
run: |
|
||||
@@ -35,34 +43,30 @@ jobs:
|
||||
dotnet restore ${{ env.project }} --no-cache
|
||||
dotnet publish --nologo --no-restore --configuration=Release --framework=net6.0 -p:Version=${{steps.vars.outputs.VERSION}} ${{ env.project }}
|
||||
mkdir -p artifacts
|
||||
cp ./Jellyfin.Plugin.Danmu/bin/Release/net6.0/Jellyfin.Plugin.Danmu.dll ./artifacts/
|
||||
- name: Compress build files
|
||||
uses: thedoctor0/zip-release@main
|
||||
zip -j ./artifacts/${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ./Jellyfin.Plugin.Danmu/bin/Release/net6.0/Jellyfin.Plugin.Danmu.dll
|
||||
cp ./doc/logo.png ./artifacts/logo.png
|
||||
- name: Generate manifest
|
||||
run: cd artifacts && python3 ../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:
|
||||
type: "zip"
|
||||
directory: "artifacts"
|
||||
filename: "artifacts.zip"
|
||||
exclusions: "*.json *.pdb"
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ env.python-version }}
|
||||
- name: Install JPRM
|
||||
run: python -m pip install jprm
|
||||
- name: Run JPRM
|
||||
run: chmod +x ./build.sh && ./build.sh ${{ env.artifact }} ${{steps.vars.outputs.VERSION}} ${GITHUB_REF#refs/*/}
|
||||
personal_token: ${{ secrets.PAT }}
|
||||
external_repository: cxfksword/jellyfin-release
|
||||
destination_dir: ${{ env.artifact }}
|
||||
publish_branch: master
|
||||
publish_dir: ./artifacts
|
||||
- name: Publish release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ./${{ env.artifact }}/${{ env.artifact }}_*.zip
|
||||
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: ./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: ./artifacts/manifest*.json
|
||||
# tag: "manifest"
|
||||
# overwrite: true
|
||||
# file_glob: true
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,3 +4,4 @@ obj/
|
||||
.idea/
|
||||
artifacts
|
||||
**/.DS_Store
|
||||
*.json
|
||||
@@ -19,11 +19,7 @@ jellyfin弹幕自动下载插件,已支持的弹幕来源:b站,弹弹play
|
||||
|
||||
只支持最新的`jellyfin 10.8.x`版本
|
||||
|
||||
添加插件存储库:
|
||||
|
||||
国内加速:https://gh-proxy.com/https://github.com/cxfksword/jellyfin-plugin-danmu/releases/download/manifest/manifest_cn.json
|
||||
|
||||
国外访问:https://github.com/cxfksword/jellyfin-plugin-danmu/releases/download/manifest/manifest.json
|
||||
添加插件存储库:https://jellyfin-plugin-release.pages.dev/danmu/manifest.json
|
||||
|
||||
## 如何使用
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"category": "Metadata",
|
||||
"changelog": "NA",
|
||||
"description": "jellyfin的b站弹幕自动下载插件,会匹配b站番剧/电影视频,自动下载对应弹幕,并定时更新。",
|
||||
"guid": "5B39DA44-5314-4940-8E26-54C821C17F86",
|
||||
"imageUrl": "https://github.com/cxfksword/jellyfin-plugin-danmu/raw/main/doc/logo.png",
|
||||
"name": "Danmu",
|
||||
"overview": "jellyfin弹幕下载插件",
|
||||
"owner": "cxfksword",
|
||||
"targetAbi": "10.8.0.0",
|
||||
"timestamp": "1970-01-01T00:00:00Z",
|
||||
"version": "1.0.0.0"
|
||||
}
|
||||
43
build.sh
43
build.sh
@@ -1,43 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# $1 from github action
|
||||
ARTIFACT=$1
|
||||
VERSION=$2
|
||||
TAG=$3
|
||||
|
||||
CURRENT_DATE=$(date +'%Y-%m-%dT%H:%M:%S')
|
||||
WORK_DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
||||
ARTIFACT_ZIP_FILE="${WORK_DIR}/artifacts/artifacts.zip"
|
||||
ARTIFACT_META="${WORK_DIR}/build.meta.json"
|
||||
|
||||
JELLYFIN_REPO_URL="https://github.com/cxfksword/jellyfin-plugin-danmu/releases/download"
|
||||
JELLYFIN_MANIFEST="${WORK_DIR}/manifest.json"
|
||||
JELLYFIN_MANIFEST_CN="${WORK_DIR}/manifest_cn.json"
|
||||
JELLYFIN_MANIFEST_OLD="https://github.com/cxfksword/jellyfin-plugin-danmu/releases/download/manifest/manifest.json"
|
||||
|
||||
# download old manifest
|
||||
wget -q -O "$JELLYFIN_MANIFEST" "$JELLYFIN_MANIFEST_OLD"
|
||||
if [ $? -ne 0 ]; then
|
||||
rm -rf $JELLYFIN_MANIFEST
|
||||
jprm repo init $WORK_DIR
|
||||
fi
|
||||
|
||||
# update meta json message
|
||||
cp -f "${ARTIFACT_META}" "${ARTIFACT_ZIP_FILE}.meta.json"
|
||||
CHANGELOG=$(git tag -l --format='%(contents)' ${TAG})
|
||||
sed -i "s@NA@$CHANGELOG@" "${ARTIFACT_ZIP_FILE}.meta.json"
|
||||
sed -i "s@1.0.0.0@$VERSION@" "${ARTIFACT_ZIP_FILE}.meta.json"
|
||||
sed -i "s@1970-01-01T00:00:00Z@$CURRENT_DATE@" "${ARTIFACT_ZIP_FILE}.meta.json"
|
||||
|
||||
|
||||
# generate new manifest
|
||||
jprm --verbosity=debug repo add --url=${JELLYFIN_REPO_URL} "${JELLYFIN_MANIFEST}" "${ARTIFACT_ZIP_FILE}"
|
||||
|
||||
# fix menifest download url
|
||||
sed -i "s@/${ARTIFACT}/@/$TAG/@" "$JELLYFIN_MANIFEST"
|
||||
|
||||
# 国内加速
|
||||
cp -f "$JELLYFIN_MANIFEST" "$JELLYFIN_MANIFEST_CN"
|
||||
sed -i "s@github.com@gh-proxy.com/https://github.com@g" "$JELLYFIN_MANIFEST_CN"
|
||||
|
||||
exit $?
|
||||
74
generate_manifest.py
Executable file
74
generate_manifest.py
Executable file
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import sys
|
||||
import re
|
||||
import os
|
||||
import subprocess
|
||||
from datetime import datetime
|
||||
from urllib.request import urlopen
|
||||
from urllib.error import HTTPError
|
||||
|
||||
|
||||
def generate_manifest():
|
||||
return [{
|
||||
"guid": "5B39DA44-5314-4940-8E26-54C821C17F86",
|
||||
"name": "Danmu",
|
||||
"description": "jellyfin的b站弹幕自动下载插件,会匹配b站番剧/电影视频,自动下载对应弹幕,并定时更新。",
|
||||
"overview": "jellyfin弹幕下载插件",
|
||||
"owner": "cxfksword",
|
||||
"category": "Metadata",
|
||||
"imageUrl": "https://jellyfin-plugin-release.pages.dev/danmu/logo.png",
|
||||
"versions": []
|
||||
}]
|
||||
|
||||
def generate_version(filepath, version, changelog):
|
||||
return {
|
||||
'version': f"{version}.0",
|
||||
'changelog': changelog,
|
||||
'targetAbi': '10.8.0.0',
|
||||
'sourceUrl': f'https://jellyfin-plugin-release.pages.dev/danmu/danmu_{version}.0.zip',
|
||||
'checksum': md5sum(filepath),
|
||||
'timestamp': datetime.now().strftime('%Y-%m-%dT%H:%M:%S')
|
||||
}
|
||||
|
||||
def md5sum(filename):
|
||||
with open(filename, 'rb') as f:
|
||||
return hashlib.md5(f.read()).hexdigest()
|
||||
|
||||
|
||||
def main():
|
||||
filename = sys.argv[1]
|
||||
tag = sys.argv[2]
|
||||
version = tag.lstrip('v')
|
||||
filepath = os.path.join(os.getcwd(), filename)
|
||||
result = subprocess.run(['git', 'tag','-l','--format=%(contents)', tag, '-l'], stdout=subprocess.PIPE)
|
||||
changelog = result.stdout.decode('utf-8').strip()
|
||||
|
||||
# 解析旧 manifest
|
||||
try:
|
||||
with urlopen('https://raw.githubusercontent.com/cxfksword/jellyfin-release/master/danmu/manifest.json') as f:
|
||||
manifest = json.load(f)
|
||||
except HTTPError as err:
|
||||
if err.code == 404:
|
||||
manifest = generate_manifest()
|
||||
else:
|
||||
raise
|
||||
|
||||
# 追加新版本/覆盖旧版本
|
||||
manifest[0]['versions'] = list(filter(lambda x: x['version'] == version, manifest[0]['versions']))
|
||||
manifest[0]['versions'].insert(0, generate_version(filepath, version, changelog))
|
||||
|
||||
with open('manifest.json', 'w') as f:
|
||||
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-danmu/raw/main/doc/logo.png', "https://jellyfin-plugin-release.pages.dev/danmu/logo.png", manifest_cn)
|
||||
# manifest_cn = re.sub('https://github.com/cxfksword/jellyfin-plugin-danmu/releases/download/v[0-9.]+', "https://jellyfin-plugin-release.pages.dev/danmu", manifest_cn)
|
||||
# f.write(manifest_cn)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user