Skip to content

Commit 39c440a

Browse files
authored
feat: add gift filter (#242)
1 parent f70928f commit 39c440a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# f"{date}-{artist}直播回放" - 20250328-Streamer直播回放
1717
DESC = "{artist}直播回放,直播间地址:{source_link} 内容仅供娱乐,直播中主播的言论、观点和行为均由主播本人负责,不代表录播员的观点或立场。"
1818
# You can change the description as you like.
19+
GIFT_PRICE_FILTER = 1 # The gift whose price is less than this value will be filtered, unit: RMB
1920
# ============================ The video slice configuration ==================
2021
AUTO_SLICE = False
2122
SLICE_DURATION = 60 # better not exceed 300 seconds

src/danmaku/adjust_price.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import argparse
44
import xml.etree.ElementTree as ET
5+
from src.config import GIFT_PRICE_FILTER
56

67
def update_danmaku_prices(file_path):
78
"""Adjust the price of sc and guard, see this:
@@ -41,7 +42,8 @@ def update_danmaku_prices(file_path):
4142
# Remove 'gift' elements with price less than 1000
4243
for gift in root.findall('gift'):
4344
price_gift = gift.get('price')
44-
if int(price_gift) < 1000:
45+
converted_price = int(GIFT_PRICE_FILTER * 1000)
46+
if int(price_gift) < converted_price:
4547
root.remove(gift)
4648

4749
# Write the updated XML back to the file

0 commit comments

Comments
 (0)