MCPcopy
hub / github.com/Jack-Cherish/python-spider / GetPosition

Function GetPosition

2020/bilibili/xml2ass.py:245–259  ·  view source on GitHub ↗
(InputPos, isHeight)

Source from the content-addressed store, hash-verified

243 ZoomFactor = GetZoomFactor(BiliPlayerSize, (width, height))
244
245 def GetPosition(InputPos, isHeight):
246 isHeight = int(isHeight) # True -> 1
247 if isinstance(InputPos, int):
248 return ZoomFactor[0]*InputPos+ZoomFactor[isHeight+1]
249 elif isinstance(InputPos, float):
250 if InputPos > 1:
251 return ZoomFactor[0]*InputPos+ZoomFactor[isHeight+1]
252 else:
253 return BiliPlayerSize[isHeight]*ZoomFactor[0]*InputPos+ZoomFactor[isHeight+1]
254 else:
255 try:
256 InputPos = int(InputPos)
257 except ValueError:
258 InputPos = float(InputPos)
259 return GetPosition(InputPos, isHeight)
260
261 try:
262 comment_args = safe_list(json.loads(c[3]))

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected