93 lines
3.5 KiB
Python
93 lines
3.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
import sys
|
|
|
|
def normalize_file(filepath):
|
|
with open(filepath, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
content = content.lstrip('\ufeff')
|
|
lines = [line.rstrip() for line in content.splitlines()]
|
|
norm_lines = []
|
|
prev_blank = False
|
|
for line in lines:
|
|
if line == '':
|
|
if not prev_blank:
|
|
norm_lines.append(line)
|
|
prev_blank = True
|
|
else:
|
|
norm_lines.append(line)
|
|
prev_blank = False
|
|
result = '\r\n'.join(norm_lines) + '\r\n'
|
|
with open(filepath, 'wb') as f:
|
|
f.write(b'\xef\xbb\xbf' + result.encode('utf-8'))
|
|
|
|
normalize_file('raids/ridorana.html')
|
|
|
|
with open('raids/index.html', 'r', encoding='utf-8') as f:
|
|
text = f.read()
|
|
|
|
# リドルアナ更新
|
|
target_ridorana = """ <tr>
|
|
<td><strong>封じられた聖塔 リドルアナ</strong></td>
|
|
<td>Lv70 (紅蓮4.x)</td>
|
|
<td>24人 (A/B/C)</td>
|
|
<td>ファムフリート、ベリアス(時間停止)、労働八号(算数ギミック素数計算)、鬼龍ヤズマット。</td>
|
|
<td>準備中</td>
|
|
</tr>"""
|
|
|
|
replacement_ridorana = """ <tr>
|
|
<td><strong>封じられた聖塔 リドルアナ</strong></td>
|
|
<td>Lv70 (紅蓮4.x)</td>
|
|
<td>24人 (A/B/C)</td>
|
|
<td>ファムフリート、ベリアス(時間停止)、労働八号(算数ギミック素数計算)、鬼龍ヤズマット。</td>
|
|
<td><a href="ridorana.html">攻略を見る ➜</a></td>
|
|
</tr>"""
|
|
|
|
# クルーザー級・ヘビー級更新
|
|
target_cruiser = """ <tr>
|
|
<td><strong>クルーザー級(1〜4層)</strong></td>
|
|
<td>Lv100 (パッチ7.2)</td>
|
|
<td>ノーマル / 零式</td>
|
|
<td>パッチ7.2実装予定。第2弾レイドシリーズ。</td>
|
|
<td>準備中</td>
|
|
</tr>
|
|
<tr>
|
|
<td><strong>ヘビー級(1〜4層)</strong></td>
|
|
<td>Lv100 (パッチ7.4)</td>
|
|
<td>ノーマル / 零式</td>
|
|
<td>パッチ7.4実装予定。アルカディア完結編。</td>
|
|
<td>準備中</td>
|
|
</tr>"""
|
|
|
|
replacement_cruiser = """ <tr>
|
|
<td><strong>クルーザー級(1〜4層)</strong></td>
|
|
<td>Lv100 (パッチ7.2)</td>
|
|
<td>ノーマル / 零式</td>
|
|
<td>パッチ7.2実装予定。第2弾レイドシリーズ。</td>
|
|
<td><span style="color: #666;">パッチ7.2実装予定</span></td>
|
|
</tr>
|
|
<tr>
|
|
<td><strong>ヘビー級(1〜4層)</strong></td>
|
|
<td>Lv100 (パッチ7.4)</td>
|
|
<td>ノーマル / 零式</td>
|
|
<td>パッチ7.4実装予定。アルカディア完結編。</td>
|
|
<td><span style="color: #666;">パッチ7.4実装予定</span></td>
|
|
</tr>"""
|
|
|
|
if target_ridorana in text:
|
|
text = text.replace(target_ridorana, replacement_ridorana)
|
|
print("SUCCESS: Target ridorana found and replaced")
|
|
else:
|
|
print("ERROR: target_ridorana not found")
|
|
|
|
if target_cruiser in text:
|
|
text = text.replace(target_cruiser, replacement_cruiser)
|
|
print("SUCCESS: Target cruiser found and replaced")
|
|
else:
|
|
print("ERROR: target_cruiser not found")
|
|
|
|
with open('raids/index.html', 'w', encoding='utf-8') as f:
|
|
f.write(text)
|
|
|
|
normalize_file('raids/index.html')
|
|
print("Successfully processed raids/index.html")
|