Giter Club home page Giter Club logo

notion_sync_umadb's Introduction

Notion sync umadb

Sync data from local Umamusume game resources to Notion database. Facilitate pointing content to detailed data when writing articles, use offical Notion API.

介绍

可以通过Notion复制数据库页面HERE

使用数据库的效果展示如下:

如何在Notion中实现以上效果

可以参看这个内容:使用数据库优化赛马娘文章内容展示

使用说明

  1. 使用pipenv安装依赖,在项目根目录执行:
    pipenv install --dev
  2. Notion integrations创建一个应用,记下APIKEY
  3. Notion上建一个Page,并在这个Page上关联2.创建的应用,之后记录这个页面的ID。 页面ID可以通过copy当前页面的链接获得,链接尾的字符串就是id。之后需要根据8-4-4-4-12的方式加入中线即可.
    0dfc38fea6f24fc4beba4985b7206031
    ------
    0dfc38fe-a6f2-4fc4b-eba4-985b7206031
    
  4. 本地创建.env文件把相关信息填入
    NOTION_API_KEY=""
    ROOT_PAGE_ID=""
    
  5. 运行run_local.py即可在Notion上建立对应的数据库。可以适当修改该文件的参数,需要注意的参数:
    • local_properties: 该参数内容对应一个配置文件,如果文件不存在,会创建新的数据库。文件存在,则会根据文件信息选择更新已有的数据库或创建数据库
      [database_id]
      #技能数据库
      skill = d60a258b-ede7-4cd7-bdf6-8248bcb88152
      #人物数据库
      character_card = bf1bde80-14b7-4a52-982a-73af2e94a475
      #支援卡数据库
      support_card = 7718ef63-967f-4c87-a7d8-9c99156a3d6a

更新数据库

在游戏更新加入新卡时需要更新数据库,目前支持两种数据源

本地数据源

数据来源于DMM客户端,需要本地生成新数据然后再执行上传操作

UraraWin数据源

可以借助Github WorkFlow自动更新数据,操作步骤如下:

  1. Fork该项目
  2. 在项目settings->Secrets and variables -> Actions中创建两个Repository Secrets
    # Notion申请的API KEY
    NOTION_API_KEY= 
    # 需要创建数据库的根页面
    ROOT_PAGE_ID=
  3. 到Github Actions 中选择Create database use urarawin data 然后执行,该任务执行完成后会创建数据库。之后需要记录生成好的Database id用于后续更新使用,这个id可以在Notion上获取,也可以在刚刚创建数据库的工作流的输出信息里看到,查看check created database id里面会有如下内容:
    [database_id]
    skill = 58b7e69d-f3cc-4c57-9dde-14efa2da1ce1
    character_card = c37ea0dc-795d-49bd-8a56-130539117177
    support_card = fc4540b7-08f7-4917-b33a-d14f2f2bf323
  4. 在项目settings->Secrets and variables -> Actions中,这次选择Variables。创建3个Repository variable
    # 技能数据库id
    SKILL_DATABASE_ID=
    # 角色数据库id
    CHARA_DATABASE_ID=
    # 支援卡数据库id
    SUPPORT_CARD_DATABASE_ID=

默认更新计划是在周3和周6的5:30进行(0时区时间)。

其他

资源获取

关于游戏图标获取以及图片上传参考以下目录:tools/ 以及 scripts/

全量更新

默认只会在当前数据库基础上创建新页面,如果需要更新已有的页面可以设置更新模式为Full,如果使用GithubAction可以使用Full(Force) update database的工作流。全量更新运行耗时很长,如果当前没有大量文章关联到数据库,建议使用创建新的数据库的方式。

notion_sync_umadb's People

Contributors

alphaboom avatar xulai1001 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.