mirror of
https://github.com/iluvcapra/wavinfo.git
synced 2026-01-02 18:00:41 +00:00
Update test_wave_parsing.py
2.7 test support
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import os.path
|
import os.path
|
||||||
|
import sys
|
||||||
import json
|
import json
|
||||||
import subprocess
|
import subprocess
|
||||||
from subprocess import PIPE
|
from subprocess import PIPE
|
||||||
@@ -14,6 +15,17 @@ def ffprobe(path):
|
|||||||
|
|
||||||
arguments = [ FFPROBE , "-of", "json" , "-show_format", "-show_streams", path ]
|
arguments = [ FFPROBE , "-of", "json" , "-show_format", "-show_streams", path ]
|
||||||
|
|
||||||
|
if int(sys.version[0]) < 3:
|
||||||
|
process = subprocess.Popen(arguments, stdout=PIPE)
|
||||||
|
process.wait()
|
||||||
|
if process.returncode == 0:
|
||||||
|
output = process.communicate()[0]
|
||||||
|
if output:
|
||||||
|
output_str = output.decode('utf-8')
|
||||||
|
return json.loads(output_str)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
process = subprocess.run(arguments, stdin=None, stdout=PIPE, stderr=PIPE)
|
process = subprocess.run(arguments, stdin=None, stdout=PIPE, stderr=PIPE)
|
||||||
|
|
||||||
if process.returncode == 0:
|
if process.returncode == 0:
|
||||||
@@ -22,7 +34,6 @@ def ffprobe(path):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class TestWaveInfo(TestCase):
|
class TestWaveInfo(TestCase):
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user