Browse Source

support moderator

kumaneru 1 week ago
parent
commit
0172cd88eb
1 changed files with 6 additions and 6 deletions
  1. 6 6
      ytbchat2ass.py

+ 6 - 6
ytbchat2ass.py

@@ -87,15 +87,15 @@ def chat2ass(link, name, delay, cookies):
             continue
         currunt_name = message['author']['name'][1:]
         if 'badges' in message['author'].keys():
-            if message['author']['badges'][0]['title'] == 'Owner':
-                owner_check = True
+            if message['author']['badges'][0]['title'] == 'Owner' or message['author']['badges'][0]['title'] == 'Moderator':
+                sp_check = True
             else:
-                owner_check = False
+                sp_check = False
         else:
-            owner_check = False
-        if currunt_name in names or owner_check: # 特定账号的弹幕放上面并加上背景
+            sp_check = False
+        if currunt_name in names or sp_check: # 特定账号的弹幕放上面并加上背景
             f.write('Dialogue: 4,'+sec2hms(vpos)+','+sec2hms(vpos_end)+',Office,,0,0,0,,{\\an5\\p1\\pos('+str(videoWidth/2)+','+str(math.floor(OfficeBgHeight/2))+')\\bord0\\1c&H000000&\\1a&H78&}'+'m 0 0 l '+str(videoWidth)+' 0 l '+str(videoWidth) + ' '+str(OfficeBgHeight)+' l 0 '+str(OfficeBgHeight)+'\n')
-            f.write('Dialogue: 5,'+sec2hms(vpos)+','+sec2hms(vpos_end)+',Office,,0,0,0,,{\\an5\\pos('+str(videoWidth/2)+','+str(math.floor(OfficeBgHeight/2))+')\\bord0\\fsp0}'+text+'\n')
+            f.write('Dialogue: 5,'+sec2hms(vpos)+','+sec2hms(vpos_end)+',Office,,0,0,0,,{\\an5\\pos('+str(videoWidth/2)+','+str(math.floor(OfficeBgHeight/2))+')\\bord0\\fsp0}'+currunt_name+':'+text+'\n')
             count += 1
         else:  # 其他人的弹幕放滚动
             vpos_next_min = float('inf')