mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
Update qbittorrent_worker.py
This commit is contained in:
@@ -112,25 +112,39 @@ class downloadBT(Thread):
|
|||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def ffmpeg(self, file=''):
|
def get_transfer_dir(self, to):
|
||||||
md5file = self.md5(file)
|
return FILE_TRANSFER_TO + '/' + to
|
||||||
m3u8_dir = FILE_TO + '/m3u8/' + md5file[0:6]
|
|
||||||
os.system('mkdir -p ' + m3u8_dir)
|
|
||||||
m3u8_file = m3u8_dir + '/' + md5file[0:6] + '.m3u8'
|
|
||||||
|
|
||||||
tofile = FILE_TO + '/m3u8/' + md5file[0:6] + '/%03d.ts'
|
def fg_transfer_cmd(self, file, to_file):
|
||||||
|
cmd = 'ffmpeg -y -i ' + file + \
|
||||||
|
' -vcodec copy -acodec copy -vbsf h264_mp4toannexb ' + to_file + '.ts'
|
||||||
|
return cmd
|
||||||
|
|
||||||
|
def fg_m3u8_cmd(self, ts_file, to_file):
|
||||||
cmd = 'ffmpeg -i ' + file + ' -c copy -map 0 -f segment -segment_list -bsf:v h264_mp4toannexb ' + \
|
cmd = 'ffmpeg -i ' + file + ' -c copy -map 0 -f segment -segment_list -bsf:v h264_mp4toannexb ' + \
|
||||||
m3u8_file + ' -segment_time 5 ' + tofile
|
m3u8_file + ' -segment_time 5 ' + tofile
|
||||||
print cmd
|
return cmd
|
||||||
data = self.execShell(cmd)
|
|
||||||
|
def ffmpeg(self, file=''):
|
||||||
|
md5file = self.md5(file)[0:6]
|
||||||
|
tdfile = self.get_transfer_dir(md5file)
|
||||||
|
|
||||||
|
m3u8_dir = FILE_TO + '/m3u8/' + md5file
|
||||||
|
self.execShell('mkdir -p ' + m3u8_dir)
|
||||||
|
|
||||||
|
cmd_tc = self.fg_transfer_cmd(file, tdfile)
|
||||||
|
data_tc = self.execShell(cmd_tc)
|
||||||
|
print 'tc:', data_tc
|
||||||
|
|
||||||
|
m3u8_file = m3u8_dir + '/' + md5file + '.m3u8'
|
||||||
|
tofile = FILE_TO + '/m3u8/' + md5file + '/%03d.ts'
|
||||||
|
cmd_mc = self.fg_m3u8_cmd(tdfile, tofile)
|
||||||
|
data_mc = self.execShell(cmd_tc)
|
||||||
|
print 'mc:', data_mc
|
||||||
|
|
||||||
self.execShell('chown -R ' + FILE_OWN + ':' +
|
self.execShell('chown -R ' + FILE_OWN + ':' +
|
||||||
FILE_GROUP + ' ' + m3u8_dir)
|
FILE_GROUP + ' ' + m3u8_dir)
|
||||||
|
|
||||||
print data
|
|
||||||
if data[0] != '':
|
|
||||||
print data
|
|
||||||
|
|
||||||
def file_arr(self, path, filters=['.DS_Store']):
|
def file_arr(self, path, filters=['.DS_Store']):
|
||||||
file_list = []
|
file_list = []
|
||||||
flist = os.listdir(path)
|
flist = os.listdir(path)
|
||||||
|
|||||||
Reference in New Issue
Block a user