Skip to content

Commit 4e16a63

Browse files
author
Maxe
committed
Updated to 3.12
1 parent b1f24d5 commit 4e16a63

File tree

7 files changed

+53
-33
lines changed

7 files changed

+53
-33
lines changed

addon/doc/zh_TW/changelog.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# 更新日誌
22

3+
## V3.12, 2025.3.21
4+
5+
版本代號:Diamond City Lights
6+
7+
Video source:
8+
https://youtu.be/BZzP_k3cLao
9+
10+
### 修正項目
11+
12+
1. 修正 Prime Video 無法閱讀字幕的錯誤(感謝 Franco Hong 提供測試帳號)。
13+
2. 修正 Youtube 聊天室改版,導致取得意見調查出現錯誤,連帶導致無法自動閱讀聊天室。
14+
3. 修正 Youtube 聊天室改版,導致閱讀聊天橫幅內容為空的錯誤。
15+
聊天橫幅改為移動焦點時自動朗讀一次,之後出現的橫幅不會被自動朗讀,除非再次移動焦點。
16+
4. 聯絡開發者:刪除 Skype 並新增 WhatsApp 聯絡方式。
17+
18+
---
19+
20+
21+
322
## V3.11, 2025.1.5
423

524
版本代號:煦日 Apricity

addon/globalPlugins/subtitle_reader/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(self, *args, **kwargs):
5858
'.+ - YouTube': Youtube(self),
5959
'^Disney\+ \| ': DisneyPlus(self),
6060
'.*?Netflix': Netflix(self),
61-
'^Prime Video: .+': PrimeVideo(self),
61+
'^Prime Video.+': PrimeVideo(self),
6262
'.+ Apple TV\+': AppleTVPlus(self),
6363
'.+ - Wikimedia Commons': WKMediaCommons(self),
6464
'.+ \| KKTV': Kktv(self),
@@ -102,7 +102,7 @@ def initMenu(self):
102102
gui.tray.Bind(gui.wx.EVT_MENU, self.update.openChangeLog, menu.openChangeLog)
103103
gui.tray.Bind(gui.wx.EVT_MENU, self.update.toggleCheckAutomatic, menu.checkUpdateAutomatic)
104104
# 聯絡開發者
105-
gui.tray.Bind(gui.wx.EVT_MENU, self.contactUseSkype, menu.contactUseSkype)
105+
gui.tray.Bind(gui.wx.EVT_MENU, self.contactUseWhatsApp, menu.contactUseWhatsApp)
106106
gui.tray.Bind(gui.wx.EVT_MENU, self.contactUseFacebook, menu.contactUseFacebook)
107107
gui.tray.Bind(gui.wx.EVT_MENU, self.contactUseQq, menu.contactUseQq)
108108
gui.tray.Bind(gui.wx.EVT_MENU, self.contactUseLine, menu.contactUseLine)
@@ -381,8 +381,8 @@ def toggleInfoCardPrompt(self, evt):
381381
self.menu.infoCardPrompt.Check(conf['infoCardPrompt'])
382382

383383
# 聯絡開發者
384-
def contactUseSkype(self, evt):
385-
webbrowser.open('https://join.skype.com/invite/VnIdifjym1OR')
384+
def contactUseWhatsApp(self, evt):
385+
webbrowser.open('https://wa.me/+886925285060')
386386

387387
def contactUseLine(self, evt):
388388
api.copyToClip('Maxe0310', notify=True)

addon/globalPlugins/subtitle_reader/gui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(self, main):
6464
self.contactDeveloper = wx.Menu()
6565
self.contactDeveloperMenuItem = self.AppendSubMenu(self.contactDeveloper, _('聯絡開發者 (&C)'))
6666

67-
self.contactUseSkype = self.contactDeveloper.Append(wx.ID_ANY, 'Skype, id:p15937a')
67+
self.contactUseWhatsApp = self.contactDeveloper.Append(wx.ID_ANY, 'WhatsApp, id:+886925285060')
6868
self.contactUseFacebook = self.contactDeveloper.Append(wx.ID_ANY, _('Facebook 個人檔案'))
6969
self.contactUseQq = self.contactDeveloper.Append(wx.ID_ANY, _('QQ, id:2231691423'))
7070
self.contactUseLine = self.contactDeveloper.Append(wx.ID_ANY, 'Line, id:Maxe0310 ' + _('點此複製到剪貼簿'))

addon/globalPlugins/subtitle_reader/primeVideo.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,20 @@ class PrimeVideo(SubtitleAlg):
88
def getVideoPlayer(self):
99
obj = self.main.focusObject
1010
appName = obj.appModule.appName
11-
videoPlayer = find(obj, 'parent', 'class', 'atvwebplayersdk-overlays-container fpqiyer')
12-
if videoPlayer:
13-
videoPlayer = obj.parent.parent.parent.parent
11+
videoPlayer = find(obj, 'parent', 'role', role('document'))
12+
videoPlayer = videoPlayer.firstChild
13+
if videoPlayer.IA2Attributes.get('class') != 'webPlayerSDKContainer':
14+
videoPlayer = videoPlayer.lastChild.firstChild
1415

15-
return videoPlayer
16+
return videoPlayer if videoPlayer.IA2Attributes.get('class') == 'webPlayerSDKContainer' else None
1617

1718
def getSubtitleContainer(self):
1819
videoPlayer = self.main.videoPlayer
19-
container = videoPlayer.next.firstChild.firstChild
20+
container = videoPlayer.lastChild.firstChild.firstChild.lastChild.previous.previous.firstChild.firstChild.firstChild
2021
return container
2122

2223
def getSubtitle(self):
2324
obj = self.main.subtitleContainer
25+
obj = obj.next
2426
return super(PrimeVideo, self).getSubtitle(obj)
2527

addon/globalPlugins/subtitle_reader/youtube.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def __init__(self, *args, **kwargs):
2828
self.chatSenderIsVerified = ''
2929
self.chat = ''
3030
self.voting = False
31-
self.chatBanner = ''
3231
self.chatContainerSearchObject = None
32+
self.chatBannerSearchObject = None
3333
self.chatSearchObject = None
3434

3535
def getVideoPlayer(self):
@@ -64,35 +64,37 @@ def getChatContainer(self):
6464
self.chatContainer = None
6565
self.chatObject = None
6666
self.voting = None
67-
self.chatBanner = ''
6867
if self.chatContainerSearchObject:
6968
self.chatContainerSearchObject.cancel()
7069

7170
self.chatContainerSearchObject = search(obj, lambda obj: ('yt-live-chat-item-list-renderer' in obj.IA2Attributes.get('class') and obj.IA2Attributes.get('id') == 'items') or obj.IA2Attributes.get('id') == 'chat', self.onFoundChatContainer, continueOnFound=True)
7271

72+
if self.chatBannerSearchObject:
73+
self.chatBannerSearchObject.cancel()
74+
7375
if self.chatSearchObject:
7476
self.chatSearchObject.cancel()
7577

7678

7779
def onFoundChatContainer(self, obj):
78-
if obj.IA2Attributes.get('id') == 'chat':
80+
id = obj.IA2Attributes.get('id')
81+
if id == 'chat':
7982
self.chatRoom = obj
80-
else:
83+
elif id == 'items':
8184
self.chatContainer = obj
8285
self.chatContainerSearchObject.cancel()
86+
self.readChatBanner()
8387

8488

8589
def getSubtitle(self):
8690
'''
8791
取得字幕
8892
'''
89-
9093
self.promptInfoCard()
9194

9295
self.get_subtitle_object()
9396

9497
self.readVoting()
95-
self.readChatBanner()
9698
self.readChat()
9799

98100
def get_subtitle_object(self):
@@ -300,29 +302,26 @@ def readChatBanner(self):
300302
if not self.chatContainer:
301303
return
302304

303-
banner = self.chatContainer.parent.previous
304-
text = ''
305-
while banner:
306-
obj = banner.firstChild
307-
while obj:
308-
if obj.name:
309-
text += obj.name
310-
break
311-
312-
obj = obj.firstChild
305+
obj = self.chatContainer.parent.previous
306+
banner = None
307+
while obj:
308+
banner = find(obj, 'firstChild', 'id', 'banner-container')
309+
if banner:
310+
break
313311

314-
banner = banner.previous
312+
obj = obj.previous
315313

316-
if text and not self.chatBanner:
317-
ui.message(text)
314+
if not banner:
315+
return
318316

319-
self.chatBanner = text
317+
self.chatBannerSearchObject = search(banner, lambda obj: bool(obj.name) and obj.role != role('LINK'), lambda banner: ui.message(banner.name if banner.role != role('BUTTON') else '聊天室橫幅'), continueOnFound=True)
320318

321319
def readVoting(self):
322320
if not self.chatRoom:
323321
return
324322

325-
votingObj = self.chatRoom.firstChild.next.next
323+
votingObj = self.chatRoom.lastChild
324+
votingObj = find(votingObj, 'firstChild', 'class', 'style-scope yt-live-chat-poll-renderer')
326325
if bool(votingObj) != self.voting:
327326
self.voting = bool(votingObj)
328327
if self.voting:

addon/manifest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ summary = "字幕閱讀器"
33
description = """當焦點位於網頁上的影片播放器時,讓 NVDA 讀出字幕。"""
44
author = "福恩 <maxe@mail.batol.net>"
55
url = https://github.com/maxe-hsieh/subtitle_reader
6-
version = 3.11
6+
version = 3.12
77
docFileName = readme.html
88
minimumNVDAVersion = 2019.2.1
99
lastTestedNVDAVersion = 2024.1

buildVars.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def _(arg):
2525
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
2626
"addon_description": _("當焦點位於網頁上的影片播放器時,讓 NVDA 讀出字幕。"),
2727
# version
28-
"addon_version": "3.11",
28+
"addon_version": "3.12",
2929
# Author(s)
3030
"addon_author": "福恩 <maxe@mail.batol.net>",
3131
# URL for the add-on documentation support

0 commit comments

Comments
 (0)