#encoding: Utf-8?
Import CSV
Import OS
Dataconvert = []
Datastitch? = []
Voicefrom = "/home/mylinux/dengcong/"
Voicetar =? "/home/mylinux/dengcong/tar/"
Os.system ("Mkdir-p" +voicetar)
Csvstitch = open ("/home/mylinux/dengcong/stitch.csv", "R")
Readerstitch = Csv.reader (Csvstitch)
Csvconvert = open ("/home/mylinux/dengcong/convert.csv", "R")
Readerconvert = Csv.reader (Csvconvert)
For item1 in Readerconvert:
??? Dataconvert.append (ITEM1)
For item2 in Readerstitch:
??? Datastitch.append (ITEM2)
def onepis (tmpid):
??? Dataarr = []
??? For line in Datastitch:
??????? i = CMP (Tmpid,line[0].strip ())
??????? #print (Tmpid,line[0].strip (), i)
??????? If i = = 0:
??????????? Dataarr.append (line)
??? Dataarr.sort (Key=lambda x:x[2])
??? return Dataarr;
For item in Dataconvert:
??? Orderarr = []
??? Tmpstr = item[2]+ "0" +item[3]
??? Tmpstr = Tmpstr.strip ()
??? Orderarr.append (Tmpstr.strip ())
??? #print (TMPSTR)
??? xxx = Onepis (TMPSTR)
??? For line in XXX:
??????? Orderarr.append (Line[1].strip ())
??? #print (Orderarr)
??? Ffmstr = "FFmpeg"
??? For one in Orderarr:
??????? Ffmstr = Ffmstr + "-i" + voicefrom + one + ". wav"
??? Ffmstr = ffmstr + "-filter_complex"
??? Count = 0
??? While Count<len (Orderarr):
??????? Ffmstr = Ffmstr + "[" + str (count) + ": 0]"
??????? Count = Count + 1
??? Ffmstr = ffmstr + "concat=n=" + str (len (orderarr)) + ": v=0:a=1 '" + Voicetar +? Tmpstr + "Done.wav"
??? #print (FFMSTR)
??? Os.system (FFMSTR)
Csvstitch.close ()
Csvconvert.close ()
Python2 find the corresponding recording clips according to the index table splicing recording