diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 5d394da..9add542 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -26,7 +26,7 @@ jobs: run: | git submodule update --remote - name: Run main.py - run: python main.py + run: python main.py github - name: Push changes run: | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" diff --git a/.gitmodules b/.gitmodules index da02870..71edf3e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,7 @@ path = static url = https://github.com/BA-OST-Index/ost_data_site_static.git branch = main +[submodule "dev-changelogs"] + path = dev_changelogs + url = https://github.com/BA-OST-Index/dev-changelogs.git + branch = main diff --git a/dev_changelogs b/dev_changelogs new file mode 160000 index 0000000..3a4a98f --- /dev/null +++ b/dev_changelogs @@ -0,0 +1 @@ +Subproject commit 3a4a98fa84c921e66a6fe492178b4e48e3413a2a diff --git a/index.html b/index.html index a5b4aea..4175e4d 100644 --- a/index.html +++ b/index.html @@ -88,7 +88,7 @@
{{ track.name.realname.en }} is the No. {{ track.no }} track in the {{ track_type_for_show(track) }}.
+{{ track.name.realname.en }} is the No. {{ track.no }} track in the {{ tracktype_to_name(track.track_type) }}.
{{ track.desc.en }}
+This track has been included in the following albums.
+Tips: In order to avoid potential copyright infringement, we're using third-party embedded web players to provide services. You can also manually visit them by clicking the links in the infobox.
By clicking the links below, you agree to the Terms of Services of the corresponding platforms/service providers.
{{ track_version_video_player(track.version) }} +This section shows instances where the song has been referenced.
+{{ ui.name.en }} is a part of the UI (user interface) in Blue Archive.
Description: {{ ui.desc.en }}
Track: {{ ui.track.no }}. {{ ui.track.name.realname.en }}
+Track: {{ generate_track_anchor(ui.track, 0, 0, 0, 0, 0) }}
Composer: {{ ui.track.composer.nickname }} ({{ get_social_for_composer(ui.track.composer) }})
{% endblock %} \ No newline at end of file diff --git a/page/en/ui_all.html b/page/en/ui_all.html index c12f55e..3e07a2e 100644 --- a/page/en/ui_all.html +++ b/page/en/ui_all.html @@ -2,7 +2,7 @@ {% block title %}{{ ui.name.en }}{% endblock title %} {% block article_content %} - {% from "template/en/_macro.html" import output_usedby_ui_for_all_ui, output_usedby_ui_list %} + {% from "template/en/_macro_page.html" import output_usedby_ui_for_all_ui, output_usedby_ui_list %}{{ ui.desc.en }}
{% if ui.filetype == -61 or ui.filetype == -45 %} diff --git a/page/en/video.html b/page/en/video.html index c268f72..49147d3 100644 --- a/page/en/video.html +++ b/page/en/video.html @@ -1,5 +1,5 @@ {% extends "template/en/base.html" %} -{% from 'template/en/_macro.html' import output_usedby_track_list, track_version_video_player %} +{% from 'template/en/_macro_page.html' import output_usedby_track_list, track_version_video_player %} {% block title %}Video/{{ video.name.en }}{% endblock title %} {% block other_head %} diff --git a/page/zh_cn/_index.html b/page/zh_cn/_index.html index 4793465..3eb3d3b 100644 --- a/page/zh_cn/_index.html +++ b/page/zh_cn/_index.html @@ -2,20 +2,46 @@ {% block title %}欢迎 {% endblock title %} {% block article_content %} -这是 BA OST Index,一个由sctop创建的项目,试图跟踪各个曲子与故事、战斗、背景、人物与UI之间的关系!
-当前本站对于文章数据已经基本支持完毕,图片相关内容预计将在之后更新。
- -您也可通过使用网页左侧的导航栏进行导航。
+BA OST Index是一个致力于追踪手机游戏《蔚蓝档案》(又名《碧蓝档案》)的出处与使用例、建立音乐—故事—背景—人物四项主要数据间关联的小型数据库项目。藉由自动生成的索引数据,您可在多个数据项间进行跳转、互查、对比等操作,助您更加深入地了解游戏的相关音乐。
+BA OST Index面向全体BA玩家开放。然而,如果您是想深入分析剧情者或为内容创作者,本项目网站所提供的数据与功能可能较其它网站更有帮助。本网站配备了以下特色功能:
+*主要页面:指音乐、故事、背景、人物四项数据的页面。
+*此处仅为列出玩家间常用的数据类网站以供查阅。除非注明,否则BA OST Index与列出的网站无任何关联。
+{{ album.name.zh_cn }}是由蔚蓝档案官方发行的一个专辑。
+{{ album.desc.zh_cn }}
+ +概览:本专辑中共有{{ album.track_num }}首曲子({{ album.disc_num }}碟片)。此专辑发行于{{ album.release_date_format }}。
+ {% for disc in album.tracks %} +此页显示所有可用的专辑。
+简介:{{ background.desc.zh_cn }}
此页显示所有可用的背景
+此页显示所有可用的背景。
本页面列出{{ changelog.repo_info.repo_name }}存储库的更新记录。本更新记录为人工维护,因而可能会出现记录更新不及时的情况;详细情况请单击上方链接查看。
+除非另有注明,否则以下更新记录中的时间都以 {{ changelog.repo_info.timezone }} 时区时间为准。
+ +本页列出 活动“{{ auto_zhcn_gen(event.parent_data.last_parent.name) }}” 的全部UI。
{{ output_usedby_ui_for_all_ui(event.include) }} diff --git a/page/zh_cn/npc.html b/page/zh_cn/npc.html index 8f152fb..37b9c9c 100644 --- a/page/zh_cn/npc.html +++ b/page/zh_cn/npc.html @@ -2,7 +2,8 @@ {% block title %}NPC/{{ char.name.zh_cn_jp }}{% endblock title %} {% block article_content %} - {% from "template/zh_cn/_macro.html" import output_usedby_story, output_usedby_track, auto_zhcn_gen, output_relatedto_character %} + {% from "template/zh_cn/_macro_page.html" import output_usedby_story, output_usedby_track, output_relatedto_character %} + {% from 'template/zh_cn/_macro.html' import auto_zhcn_gen %}“{{ auto_zhcn_gen(story.name) }}”是主线故事第{{ story.pos.volume }}篇第{{ story.pos.chapter }}章的第{{ story.pos.segment }}个故事。
@@ -26,7 +28,7 @@{{ auto_zhcn_gen(part.desc) }}
-{{ nothing_to_show }}
{% endfor %} diff --git a/page/zh_cn/student.html b/page/zh_cn/student.html index 20d854c..e07119b 100644 --- a/page/zh_cn/student.html +++ b/page/zh_cn/student.html @@ -1,5 +1,7 @@ {% extends "template/zh_cn/base.html" %} -{% from 'template/zh_cn/_macro.html' import output_usedby_story, output_usedby_track, auto_zhcn_gen, nothing_to_do, replace_newline_for_p, output_relatedto_character %} +{% from "template/zh_cn/_macro.html" import replace_newline_for_p %} +{% from 'template/zh_cn/_macro_page.html' import output_usedby_story, output_usedby_track, output_relatedto_character %} +{% from "template/zh_cn/_macro.html" import auto_zhcn_gen, nothing_to_show, generate_track_anchor %} {% block title %}学生/{{ char.student.name.name.zh_cn_jp }}{% endblock title %} {% block article_content %} @@ -33,7 +35,7 @@可在该故事中收集到回忆大厅。大厅BGM:{{ track.no }}. {{ track.name.realname.en }} ({{ track.name.realname.zh_cn }})
+可在该故事中收集到回忆大厅。大厅BGM:{{ generate_track_anchor(track, 0, 0, 0, 0, 0) }}
{% endif %} {% else %}{{ nothing_to_show }}
diff --git a/page/zh_cn/tag.html b/page/zh_cn/tag.html index 5092cf5..1883315 100644 --- a/page/zh_cn/tag.html +++ b/page/zh_cn/tag.html @@ -1,5 +1,5 @@ {% extends "template/zh_cn/base.html" %} -{% from 'template/zh_cn/_macro.html' import output_usedby_track, output_usedby_background %} +{% from 'template/zh_cn/_macro_page.html' import output_usedby_track, output_usedby_background %} {% block title %}标签/{{ tag.name.zh_cn }}{% endblock title %} {% block article_content %} diff --git a/page/zh_cn/track.html b/page/zh_cn/track.html index ecf1604..1fff889 100644 --- a/page/zh_cn/track.html +++ b/page/zh_cn/track.html @@ -5,12 +5,14 @@ {% endblock other_head %} {% block article_content %} - {% from "template/zh_cn/_macro.html" import track_type_for_show, output_usedby_background, output_usedby_story, output_usedby_battle, output_usedby_ui, output_usedby_video, nothing_to_show, output_usedby_character_dict, track_version_video_player %} + {% from "template/zh_cn/_macro_page.html" import output_usedby_background, output_usedby_story, output_usedby_battle, output_usedby_ui, output_usedby_video, output_usedby_character_dict, track_version_video_player %} + {% from "template/zh_cn/_macro.html" import tracktype_to_name, generate_album_anchor, generate_track_anchor, nothing_to_show %}{{ track.name.realname.en }} {% if track.name.realname.zh_cn %}({{ track.name.realname.zh_cn }}){% endif %} 是{{ track_type_for_show(track) }}中的第{{ track.no }}首曲子。
+{{ track.name.realname.en }} {% if track.name.realname.zh_cn %}({{ track.name.realname.zh_cn }}){% endif %} 是{{ tracktype_to_name(track.track_type) }}中的第{{ track.no }}首曲子。
{{ track.desc.zh_cn }}
+此曲子已被收录至以下专辑。
+提示:为避免潜在版权侵犯风险,我们此处使用的第三方嵌入式网页播放器来提供服务。你也可以在信息栏(infobox)中手动访问它们。
+提示:为避免潜在版权侵犯风险,我们此处使用第三方嵌入式网页播放器来提供服务。你也可以在信息栏(infobox)中手动访问它们。
单击下列链接时,您也同时同意各平台/服务提供商的对应服务条款。
{{ track_version_video_player(track.version) }} +此处显示引用了这首曲子的实例。
+{{ ui.name.zh_cn }} 为蔚蓝档案UI(用户界面)中的一部分。
描述:{{ ui.desc.zh_cn }}
曲子:{{ generate_track_anchor(ui.track, 0, 0, 0, 0, 0) }}
作曲者:{{ ui.track.composer.nickname }} ({{ get_social_for_composer(ui.track.composer) }})
{% endblock %} \ No newline at end of file diff --git a/page/zh_cn/ui_all.html b/page/zh_cn/ui_all.html index 53eef48..2c73f6b 100644 --- a/page/zh_cn/ui_all.html +++ b/page/zh_cn/ui_all.html @@ -2,7 +2,7 @@ {% block title %}{{ ui.name.zh_cn }}{% endblock title %} {% block article_content %} - {% from "template/zh_cn/_macro.html" import output_usedby_ui_for_all_ui, output_usedby_ui_list %} + {% from "template/zh_cn/_macro_page.html" import output_usedby_ui_for_all_ui, output_usedby_ui_list %}{{ ui.desc.zh_cn }}
{% if ui.filetype == -61 %} diff --git a/page/zh_cn/video.html b/page/zh_cn/video.html index b71d7f5..37eb455 100644 --- a/page/zh_cn/video.html +++ b/page/zh_cn/video.html @@ -1,5 +1,5 @@ {% extends "template/zh_cn/base.html" %} -{% from 'template/zh_cn/_macro.html' import output_usedby_track_list, track_version_video_player %} +{% from 'template/zh_cn/_macro_page.html' import output_usedby_track_list, track_version_video_player %} {% block title %}视频/{{ video.name.zh_cn }}{% endblock title %} {% block other_head %} diff --git a/single_template.py b/single_template.py new file mode 100644 index 0000000..6bdffc4 --- /dev/null +++ b/single_template.py @@ -0,0 +1,33 @@ +import json +import os +import urllib.parse +import webbrowser +from jinja2 import Environment, FileSystemLoader +from main_tool import JinjaTool + +environment = Environment(loader=FileSystemLoader(os.path.split(__file__)[0]), extensions=["jinja2.ext.loopcontrols", + "jinja2.ext.do"]) +environment.filters["js_string_safe"] = JinjaTool.js_string_safe +environment.filters["js_html_string_safe"] = JinjaTool.js_html_string_safe +environment.filters["is_list"] = lambda obj: isinstance(obj, list) +environment.filters["page_minify_html"] = JinjaTool.page_minify_html +environment.globals["get_current_utc"] = JinjaTool.get_current_utc +environment.globals["generate_tooltip_id"] = JinjaTool.generate_tooltip_id +environment.globals["get_outer_json"] = JinjaTool.get_outer_json +environment.globals["arg_check"] = JinjaTool.arg_check +environment.globals["urljoin"] = urllib.parse.urljoin + +path = "test.txt" +name = "test.html" +data_path = "exported_data/main/story/main/1/1/02.json" + +with open(data_path, mode="r", encoding="UTF-8") as file: + data = json.load(file) + +template = environment.get_template(path) +result = template.render(is_static="", story=data) +os.makedirs(os.path.split(os.path.join("data_html/", name))[0], exist_ok=True) +with open(os.path.join("data_html/", name), mode="w", encoding="UTF-8") as file: + file.write(result) + +webbrowser.open("http://localhost:9000/" + name) diff --git a/static b/static index 5610370..f805428 160000 --- a/static +++ b/static @@ -1 +1 @@ -Subproject commit 56103701a47ddd4e40f4f96180791867b9822894 +Subproject commit f80542839a8523ee7c72a14ad3cbe3db5409fb5e diff --git a/template/base/_macro.html b/template/base/_macro.html new file mode 100644 index 0000000..298f103 --- /dev/null +++ b/template/base/_macro.html @@ -0,0 +1,13 @@ +{% macro anchor_new_tab(flag) %}{% if arg_check(flag) %}target="_blank"{% endif %}{% endmacro %} + +{% macro replace_newline_for_p(text) %}{{ text|replace("\n\n", "")|replace("\n", "
") }}{% endmacro %} + +{% macro get_story_text_color_css(story) %}{% if story.is_memory %}text-momo{% elif story.is_battle %}text-danger{% else %}text-primary{% endif %}{% endmacro %} + +{% macro get_storypart_text_color_css(story_part) %}{% if story_part.is_memory %}text-momo{% elif story_part.is_battle %}text-danger{% elif story_part.is_momotalk %}text-black{% else %}text-primary{% endif %}{% endmacro %} + +{% macro get_stu_type_text_color_css(text) %}{% if text == "Explosion" or text == "LightArmor" %}text-damage-explosive{% elif text == "Pierce" or text == "HeavyArmor" %}text-damage-piercing{% elif text == "Mystic" or text == "Unarmed" %}text-damage-mystic{% elif text == "Main" %}text-role-striker{% elif text == "Support" %}text-role-special{% else %}text-damage-sonic{% endif %}{% endmacro %} + +{% macro word_case(text) %}{{ text[0]|upper }}{{ text[1:] }}{% endmacro %} + +{% macro generate_tooltip_anchor(tooltip_id) %}onmouseover="showTooltip(this)" data-tooltip="{{ tooltip_id }}"{% endmacro %} diff --git a/template/base/base.html b/template/base/base.html index 2aa6ccd..2711c6d 100644 --- a/template/base/base.html +++ b/template/base/base.html @@ -7,10 +7,10 @@