-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Maxe
committed
Mar 21, 2022
1 parent
4d43137
commit abff34e
Showing
10 changed files
with
96 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#coding=utf-8 | ||
|
||
from .subtitle_alg import SubtitleAlg | ||
from .object_finder import find | ||
|
||
class Netflix(SubtitleAlg): | ||
def getVideoPlayer(self): | ||
obj = self.main.focusObject | ||
return find(obj, 'parent', 'role', 52) | ||
|
||
def getSubtitleContainer(self): | ||
videoPlayer = self.main.videoPlayer | ||
appName = videoPlayer.appModule.appName | ||
return getattr(self, appName + 'GetSubtitleContainer')() | ||
|
||
def chromeGetSubtitleContainer(self): | ||
obj = self.main.videoPlayer | ||
obj = find(obj, 'firstChild', 'role', 56) | ||
return obj | ||
|
||
def firefoxGetSubtitleContainer(self): | ||
obj = self.main.videoPlayer | ||
obj = find(obj, 'firstChild', 'role', 56) | ||
return obj | ||
|
||
def getSubtitle(self): | ||
subtitle = '' | ||
obj = self.main.subtitleContainer | ||
obj = obj.next | ||
while obj and not obj.name: | ||
try: | ||
obj = obj.firstChild | ||
except: | ||
obj = None | ||
|
||
|
||
while obj: | ||
if obj.name: | ||
subtitle += obj.name + '\r\n' | ||
|
||
obj = obj.next | ||
|
||
return subtitle | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
from logHandler import log | ||
|
||
def find(obj, nextAttr, attrName, attrValue): | ||
o = obj | ||
while o: | ||
value = getattr(o, attrName, None) | ||
if not value: | ||
try: | ||
value = o.IA2Attributes[attrName] | ||
value = o.IA2Attributes.get(attrName) | ||
except: | ||
pass | ||
|
||
|
||
if value == attrValue: | ||
log.debug(attrName + ' = ' + str(attrValue) + ' found. ') | ||
return o | ||
|
||
o = getattr(o, nextAttr) | ||
|
||
log.debug(attrName + ' = ' + str(attrValue) + ' not found. ') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ summary = 字幕閱讀器 | |
description = "當焦點位於網頁上的影片撥放器時,讓 NVDA 讀出字幕。" | ||
author = "謝福恩 <[email protected]>" | ||
url = https://github.com/maxe-hsieh/subtitle_reader | ||
version = 2.11 | ||
version = 2.2 | ||
docFileName = readme.html | ||
lastTestedNVDAVersion = 2021.3.1 |