removed toFloat()

This commit is contained in:
Andreas Preikschat 2012-05-19 17:25:39 +02:00
parent 01db1d34d8
commit 1fe4e0a56a

View File

@ -406,23 +406,21 @@ class WebkitPlayer(MediaPlayer):
def update_ui(self, display): def update_ui(self, display):
controller = display.controller controller = display.controller
if controller.media_info.is_flash: if controller.media_info.is_flash:
currentTime = display.frame.evaluateJavaScript( \ currentTime = display.frame.evaluateJavaScript(
u'show_flash("currentTime");') u'show_flash("currentTime");')
length = display.frame.evaluateJavaScript( \ length = display.frame.evaluateJavaScript( u'show_flash("length");')
u'show_flash("length");')
else: else:
if display.frame.evaluateJavaScript( \ if display.frame.evaluateJavaScript(
u'show_video("isEnded");') == 'true': u'show_video("isEnded");') == 'true':
self.stop(display) self.stop(display)
(currentTime, ok) = display.frame.evaluateJavaScript( \ currentTime = display.frame.evaluateJavaScript(
u'show_video("currentTime");').toFloat() u'show_video("currentTime");')
# check if conversion was ok and value is not 'NaN' # check if conversion was ok and value is not 'NaN'
if ok and currentTime != float('inf'): if isinstance(currentTime, float) and currentTime != float('inf'):
currentTime = int(currentTime * 1000) currentTime = int(currentTime * 1000)
(length, ok) = display.frame.evaluateJavaScript( \ length = display.frame.evaluateJavaScript( u'show_video("length");')
u'show_video("length");').toFloat()
# check if conversion was ok and value is not 'NaN' # check if conversion was ok and value is not 'NaN'
if ok and length != float('inf'): if isinstance(length, float) and length != float('inf'):
length = int(length * 1000) length = int(length * 1000)
if currentTime > 0: if currentTime > 0:
controller.media_info.length = length controller.media_info.length = length