mirror of
https://github.com/iluvcapra/wavinfo.git
synced 2025-12-31 08:50: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 sys
|
||||
import json
|
||||
import subprocess
|
||||
from subprocess import PIPE
|
||||
@@ -14,6 +15,17 @@ def ffprobe(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)
|
||||
|
||||
if process.returncode == 0:
|
||||
@@ -22,7 +34,6 @@ def ffprobe(path):
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
class TestWaveInfo(TestCase):
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user