def test_string_decode_encode(self): from QGIS_FMV.klvdata.common import bytes_to_str from QGIS_FMV.klvdata.common import str_to_bytes self.assertEqual( str_to_bytes(bytes_to_str(b'\x50\x72\x65\x64\x61\x74\x6F\x72')), b'\x50\x72\x65\x64\x61\x74\x6F\x72')
def getLengthOfMovie(filename): result = Popen([ffprobe_path, '-i', filename], stdout=PIPE, stderr=STDOUT, stdin=PIPE) result = [x for x in result.stdout.readlines() if "Duration" in x.decode()] result = _time_to_seconds( ((bytes_to_str(result[0])).split("Duration: ")[1]).split(",")[0]) return result
def __init__(self, value): try: self.value = bytes_to_str(value) except TypeError: self.value = value