/usr/lib/python2.7/dist-packages/kdj/demuxer.py is in libkate-tools 0.4.1-7build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | import sys
import os
import tempfile
from tools import Tools
class Demuxer:
def __init__(self,tools,filename,type):
if not self.CreateDirectory():
raise Exception, 'Failed to create directory'
self.Demux(tools,filename,type)
def GetDirectory(self):
return self.directory
def CreateDirectory(self):
try:
self.directory=tempfile.mkdtemp(dir='.',prefix='katedj-tmp-extract-')
except OSError,e:
return False
return True
def GetCodecs(self,tools):
cmdline=tools.codecs_command
if cmdline!=None:
try:
popen=subprocess.Popen(cmdline,stdin=None,stderr=subprocess.PIPE,stdout=subprocess.PIPE,universal_newlines=True,shell=True)
if popen.stdout:
list=[]
line=popen.stdout.readline()
while line:
line=line.split('\n')[0]
if line and 'Kate' not in line:
list.append(line)
line=popen.stdout.readline()
popen.stdout.close()
return list
except:
pass
return ['theora','vorbis','dirac','speex','flac','cmml']
def DemuxMisc(self,tools,filename):
params=[]
params+=['-o',os.path.join(self.directory,'misc.ogg')]
for codec in self.GetCodecs(tools):
params+=['-c',codec]
params+=[filename]
tools.run_demux(params)
def DemuxKate(self,tools,filename,type):
params=[]
params+=['-o',os.path.join(self.directory,'kate.%l.%c.%i.%s.kate')]
params+=['-t',type]
params+=[filename]
tools.run_katedec(params)
def Demux(self,tools,filename,type):
self.DemuxMisc(tools,filename)
self.DemuxKate(tools,filename,type)
if __name__=='__main__':
tools=Tools()
file='../../built-streams/demo.ogg'
if len(sys.argv)>1:
file=sys.argv[1];
demuxer=Demuxer(tools,file)
|