This Script gets a list of every manga available on your Komga instance, looks it up one after another on Bangumi and gets the metadata for the specific series. This metadata then gets converted to be compatible to Komga and then gets sent to the server instance and added to the manga entry.
处理逻辑见DESIGN
Warning:
Executing this program will result in the loss of old metadata for series and books
执行此程序将导致书籍系列及单册的旧元数据丢失
Install the requirements using
# prepare the environment on your own
conda install --file env_conda.txt
pip install -r env_pip.txt
# or use docker compose
version: '3'
services:
bangumikomga:
image: chu1shen/bangumikomga:main
container_name: bangumikomga
volumes:
- /path/BangumiKomga/config.py:/app/config/config.py # see step.2
- /path/BangumiKomga/recordsRefreshed.db:/app/recordsRefreshed.db
- /path/BangumiKomga/refreshMetadata.log:/app/refreshMetadata.log
Rename config/config.template.py
to config/config.py
and edit the url, email and password to match the ones of your komga instance (User needs to have permission to edit the metadata).
BANGUMI_ACCESS_TOKEN
(可选)用于读取NSFW条目,在 https://next.bgm.tv/demo/access-token 创建个人令牌
KOMGA_LIBRARY_LIST
处理指定库中的书籍系列。komga界面点击库(对应链接)即可获得,形如:'0B79XX3NP97K9'
,对应地址:http://IP:PORT/libraries/0B79XX3NP97K9/series
。填写时以英文引号''
包裹,英文逗号,
分割。与KOMGA_COLLECTION_LIST
不能同时使用
KOMGA_COLLECTION_LIST
处理指定收藏中的书籍系列。komga界面点击收藏(对应链接)即可获得,形如:'0B79XX3NP97K9'
。填写时以英文引号''
包裹,英文逗号,
分割。与KOMGA_LIBRARY_LIST
不能同时使用
Tips: 可以搭配`同步阅读进度`实现仅同步部分书籍系列的进度
Run the script using python refreshMetadata.py
Tips:
如果漫画系列数量上千,请考虑使用bangumi/Archive离线数据代替联网查询
消息通知支持Gotify、Webhook(如:飞书)、Healthchecks(定时任务监控)
NOTIF_TYPE_ENABLE
: 启用的消息通知类型
Gotify
NOTIF_GOTIFY_ENDPOINT
: Gotify base URLNOTIF_GOTIFY_TOKEN
: Application tokenWebhook
NOTIF_WEBHOOK_ENDPOINT
: URL of the HTTP request. 如飞书中创建自定义机器人时的 webhook 地址Healthchecks
NOTIF_HEALTHCHECKS_ENDPOINT
: URL of the HTTP request将CREATE_FAILED_COLLECTION
配置为True
,程序会在刷新完成后,将所有刷新失败的系列添加到指定收藏(默认名:FAILED_COLLECTION
)。
每次运行都会根据本次运行数据重新创建此收藏(无失败则跳过)。
Tips:
在此收藏中按照如何修正错误元数据操作,启用RECHECK_FAILED_SERIES
,然后填入cbl
治疗强迫症
如果要将所有失败的系列都添加至收藏,则需要将RECHECK_FAILED_SERIES
配置为True
RECHECK_FAILED_SERIES
: 重新检查刷新元数据失败的系列
cbl
使用False
,可缩短程序运行时间RECHECK_FAILED_BOOKS
: 重新检查刷新元数据失败的书
False
,可缩短程序运行时间USE_BANGUMI_THUMBNAIL
: 设置为True
且未曾上传过系列海报时,使用 Bangumi 封面替换系列海报
Komga 服务器设置->缩略图尺寸(默认 300px,超大 1200px)
来获得更清晰的封面USE_BANGUMI_THUMBNAIL_FOR_BOOK
: 设置为True
且未曾上传过单册海报时,使用 Bangumi 封面替换单册海报人工修正错误元数据可以使用cbl(Correct Bangumi Link)
,只需在系列元数据的链接中填入cbl
和该漫画系列的 bangumi 地址。此链接将在匹配时最先使用。
下面分三种情况说明具体操作:
自此系列添加至 komga 后还未运行过此程序:
python refreshMetadata.py
系列元数据更新失败,即「标题」与「排序标题」一样:
RECHECK_FAILED_SERIES
配置为True
,重新匹配失败的系列python refreshMetadata.py
系列元数据更新错误,即匹配错误:
FORCE_REFRESH_LIST
,强制刷新此系列所有元数据。id 可在 komga 界面点击书籍系列(对应链接)获得,形如:'0B79XX3NP97K9'
。填写时以英文引号''
包裹,英文逗号,
分割。python refreshMetadata.py
Komga 并没有区分漫画与小说。
可以尝试修改代码,使其只应用于 Komga 的小说库:将bangumiApi.py
中的manga_metadata["platform"] != "小说"
修改为manga_metadata["platform"] == "小说"
注意:当前仅为komga至bangumi单向同步
Tips:
推荐使用Tachiyomi更新阅读进度👉Tracking | Tachiyomi
同步内容:
刷新元数据
步骤同刷新元数据
注意:
FORCE_REFRESH_LIST
,则仅同步此列表配置的漫画系列进度FORCE_REFRESH_LIST
,则同步当前获取的所有系列的漫画进度(当前有3种范围:所有、仅指定库、仅指定收藏)。为避免污染时间线,请谨慎操作python updateReadProgress.py
[漫画名称][作者][出版社][卷数][其他1][其他2]
[漫画名称]:以漫画封面实际名称为准,繁体不必转简体。
[作者]:作者名字亦以单行本所给名字为准
×
或&
符号连接各作者(注意:不是英文x
),将作画作者列于最后,如[矢立肇×有贺ヒトシ]、[手塚治虫×浦沢直树]、[堀田由美×小畑健]。[出版社]:例如[玉皇朝]、[青文]。
[卷数]:例如[Vol.01-Vol.12]。
[其他1]、[其他2]:其他信息。例如[完结]、[来源]。
例如:
[碧蓝之海][井上堅二×吉岡公威][Vol.01-Vol.18]
[相合之物][浅野伦][Vol.01-Vol.13]
[海王但丁][皆川亮二×泉福朗][Vol.01-Vol.13][境外版]
命名建议修改自某喵
欢迎提交新规则、问题、功能……
本项目部分代码及思路来自Pfuenzle/AnisearchKomga,部分代码生成自chatgpt,在此表示感谢!
语料库数据来源,感谢公开:
bangumi_person.txt
文件提取自bangumi/ArchiveJapanese_Names_Corpus(18W).txt
文件来自wainshine/Chinese-Names-Corpus另外,也感谢以下优秀项目: