Skip to content

Commit

Permalink
Update manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
Xzonn committed May 18, 2024
1 parent 645cce9 commit bc0f441
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 55 deletions.
Binary file added Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed dist/Jellyfin.Plugin.Douban.1.0.10.0.zip
Binary file not shown.
Binary file removed dist/Jellyfin.Plugin.Douban.2.0.1.0.zip
Binary file not shown.
Binary file removed dist/Jellyfin.Plugin.Douban.2.0.2.0.zip
Binary file not shown.
33 changes: 5 additions & 28 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"category": "Metadata",
"guid": "f962a752-15e8-4a43-b42a-6d9cfba35ce1",
"name": "Douban",
"description": "Provide Movie/TV metadata from Douban",
"description": "提供豆瓣电影/电视剧的元数据 Provide Movie/TV metadata from Douban",
"owner": "Xzonn",
"overview": "Douban Metadata Provider for Jellyfin",
"overview": "**Jellyfin 豆瓣元数据插件**\n\n请参阅 **[详细说明](https://xzonn.top/posts/Jellyfin-Plugin-Douban.html)**。\n\n----\n\n**Douban Metadata Provider for Jellyfin**\n\nPlease see **[detailed information](https://xzonn.top/posts/Jellyfin-Plugin-Douban.html)** (in Chinese).",
"imageUrl": "https://xzonn.top/JellyfinPluginDouban/Logo.png",
"versions": [
{
"checksum": "DDE6BD69F0CCA6A555163DA49071BC1C",
Expand All @@ -23,41 +24,17 @@
"timestamp": "2024-05-16T13:24:05Z",
"version": "2.0.0.0"
},
{
"checksum": "36FEB005387325A2E96A856B84B6E539",
"changelog": "- 修复了人物元数据获取失败的问题。\n- 移除了对Open Douban的兼容。",
"targetAbi": "10.8.0.0",
"sourceUrl": "https://xzonn.top/JellyfinPluginDouban/dist/Jellyfin.Plugin.Douban.1.0.10.0.zip",
"timestamp": "2024-05-17T09:26:25Z",
"version": "1.0.10.0"
},
{
"checksum": "D9709BD7E8AD37FEDE4A077CACDB31FC",
"changelog": "- 修复了人物元数据获取失败的问题。\n- 移除了对Open Douban的兼容。",
"targetAbi": "10.9.0.0",
"sourceUrl": "https://xzonn.top/JellyfinPluginDouban/dist/Jellyfin.Plugin.Douban.2.0.1.0.zip",
"timestamp": "2024-05-17T09:29:17Z",
"version": "2.0.1.0"
},
{
"checksum": "D9B31F02430BDB3E575753B6932D250D",
"changelog": "https://xzonn.top/posts/Jellyfin-Plugin-Douban.html#%E6%9B%B4%E6%96%B0%E6%97%A5%E5%BF%97",
"targetAbi": "10.9.0.0",
"sourceUrl": "https://xzonn.top/JellyfinPluginDouban/dist/Jellyfin.Plugin.Douban.2.0.2.0.zip",
"timestamp": "2024-05-17T10:38:41Z",
"version": "2.0.2.0"
},
{
"checksum": "85AD8CF5E8BCF3CD244D23CEA38C9822",
"changelog": "https://xzonn.top/posts/Jellyfin-Plugin-Douban.html#%E6%9B%B4%E6%96%B0%E6%97%A5%E5%BF%97",
"changelog": "- 修复了无法将标识符保存到.nfo文件的问题。 ([#3](https://github.com/Xzonn/JellyfinPluginDouban/issues/3))\n- 部分细节修正。",
"targetAbi": "10.8.0.0",
"sourceUrl": "https://xzonn.top/JellyfinPluginDouban/dist/Jellyfin.Plugin.Douban.1.1.0.0.zip",
"timestamp": "2024-05-18T11:11:43Z",
"version": "1.1.0.0"
},
{
"checksum": "392F75D8614A39C2A7E0AE245D485A85",
"changelog": "https://xzonn.top/posts/Jellyfin-Plugin-Douban.html#%E6%9B%B4%E6%96%B0%E6%97%A5%E5%BF%97",
"changelog": "- 修复了无法将标识符保存到.nfo文件的问题。 ([#3](https://github.com/Xzonn/JellyfinPluginDouban/issues/3))\n- 部分细节修正。",
"targetAbi": "10.9.0.0",
"sourceUrl": "https://xzonn.top/JellyfinPluginDouban/dist/Jellyfin.Plugin.Douban.2.1.0.0.zip",
"timestamp": "2024-05-18T11:22:24Z",
Expand Down
64 changes: 37 additions & 27 deletions update_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,48 @@
# -*- coding: UTF-8 -*-

import datetime
import json
import os
import re
import shutil

from hashlib import md5
import json, os, sys

os.chdir(os.path.dirname(__file__))
FILE_NAME_PATTERN = re.compile(r"Jellyfin.Plugin.Douban.(\d+).(\d+).(\d+).(\d+).zip")

basic_path = os.path.dirname(os.path.abspath(__file__))

with open("manifest.json", "r", -1, "utf8") as reader:
with open(f"{basic_path}/manifest.json", "r", -1, "utf8") as reader:
data = json.load(reader)

versions: list[dict[str, str]] = data[0]["versions"]
new_version = os.environ["XZ_VERSION"] or sys.argv[1]

if not new_version:
raise ValueError("version is empty")

for version in versions:
if version["version"] == f"{new_version}.0":
raise ValueError("version is existed")

major, minor, patch = new_version.split(".")

with open(f"dist/Jellyfin.Plugin.Douban.{new_version}.0.zip", "rb") as reader:
md5sum = md5(reader.read()).hexdigest()

versions.append({
"checksum": md5sum.upper(),
"changelog": f"https://xzonn.top/posts/Jellyfin-Plugin-Douban.html#%E6%9B%B4%E6%96%B0%E6%97%A5%E5%BF%97",
"targetAbi": f"10.{int(major) + 7}.0.0",
"sourceUrl": f"https://xzonn.top/JellyfinPluginDouban/dist/Jellyfin.Plugin.Douban.{new_version}.0.zip",
"timestamp": datetime.datetime.now(tz=datetime.timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z"),
"version": f"{new_version}.0",
})

with open("manifest.json", "w", -1, "utf8") as writer:
for dotnet_version in [
"net6.0",
"net8.0",
]:
path = f"{basic_path}/temp/build-{dotnet_version}"
for file_name in os.listdir(path):
new_version = FILE_NAME_PATTERN.search(file_name)
if not new_version:
continue

major, minor, patch, revision = new_version.groups()

with open(f"{path}/{file_name}", "rb") as reader:
md5sum = md5(reader.read()).hexdigest()

versions.append({
"checksum": md5sum.upper(),
"changelog": f"https://xzonn.top/posts/Jellyfin-Plugin-Douban.html#%E6%9B%B4%E6%96%B0%E6%97%A5%E5%BF%97",
"targetAbi": f"10.{int(major) + 7}.0.0",
"sourceUrl": f"https://xzonn.top/JellyfinPluginDouban/dist/{file_name}",
"timestamp": datetime.datetime.now(tz=datetime.timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z"),
"version": f"{major}.{minor}.{patch}.{revision}",
})

shutil.move(f"{path}/{file_name}", f"{basic_path}/dist/{file_name}")

with open(f"{basic_path}/manifest.json", "w", -1, "utf8") as writer:
json.dump(data, writer, indent=2, ensure_ascii=False)
writer.write("\n")
writer.write("\n")

0 comments on commit bc0f441

Please sign in to comment.