-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathFileParser.py
More file actions
41 lines (31 loc) · 870 Bytes
/
FileParser.py
File metadata and controls
41 lines (31 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import sys
sys.path.append("../")
from vad import Vad
from util import read_file_data
import os
import threading
SUCCESS = 0
FAIL = 1
class FileParser(Vad):
def __init__(self):
self.block_size = 256
Vad.__init__(self)
def read_file(self, filename):
if not os.path.isfile(filename):
print "文件%s不存在" % filename
return FAIL
datas = read_file_data(filename)[-1]
self.add(datas, False)
if __name__ == "__main__":
#from audio import Audio
#play = Audio()
_file = sys.argv[1]
stream_test = FileParser()
stream_test.read_file(_file)
t = threading.Thread(target=stream_test.run)
#t = threading.Thread(target=stream_test.run, kwargs={"fun":play.play_stream})
#t.setDaemon(True)
t.start()
t.join()