import os
import urllib
+import loggable
import urlparse
import subprocess
def _get_position(test):
- position = duration = 0
+ position = duration = -1
test.reporter.out.seek(0)
m = None
break
if m is None:
+ loggable.debug("utils", "Could not fine any positionning info")
return position, duration
for j in m.split("\r"):
position, duration = _get_position(test)
if position > duration + max_passed_stop:
- return 0
+ loggable.warning("utils", "Position > duration -> Returning -1")
+ return -1
return position
def get_current_size(test):
position = get_current_position(test)
- if position is Result.FAILED:
- return position
+ if position is -1:
+ return -1
+
+ size = os.stat(urlparse.urlparse(test.dest_file).path).st_size
+ loggable.debug("utils", "Size: %s" % size)
+ return size
- return os.stat(urlparse.urlparse(test.dest_file).path).st_size
def get_duration(media_file):
duration = 0
+
def parse_gsttimeargs(time):
stime = time.split(":")
sns = stime[2].split(".")
return duration
+
def compare_rendered_with_original(orig_duration, dest_file, tolerance=DURATION_TOLERANCE):
duration = get_duration(dest_file)