Advertisement
Guest User

Untitled

a guest
Mar 28th, 2015
768
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. import shutil
  2. import re
  3. import os
  4.  
  5. """
  6. filelist = 'chunklist.m3u8'
  7. link = 'http://82.80.192.30/walla_vod/_definst_/mp4:media/015/032/1503200-40.mp4/'
  8.  
  9. with open('%s' % filelist, 'r') as playlist:
  10.    ts_filenames = [line.rstrip() for line in playlist
  11.        if line.rstrip().endswith('.ts')]
  12.  
  13.  
  14. count = 0
  15. fo = open("filelist.txt", "wb")
  16. for ts_file in ts_filenames:
  17.    count = count + 1
  18.    fo.write(link + ts_file)
  19.    fo.write("\n")
  20. fo.close()
  21.  
  22. print 'Total files : %d' %count
  23.  
  24. if not os.path.exists('temp'):
  25.        os.makedirs('temp')
  26. """
  27.  
  28. """
  29. filelist = 'chunklist.m3u8'
  30. with open('%s' % filelist, 'r') as playlist:
  31.    ts_filenames = [line.rstrip() for line in playlist
  32.        if line.rstrip().endswith('.ts')]
  33.  
  34. newname = 'newfile.ts'
  35.  
  36. with open(newname, 'wb') as merged:
  37.        for ts_file in ts_filenames:
  38.            with open("temp/%s" %(ts_file), 'rb') as mergefile:
  39.                shutil.copyfileobj(mergefile, merged)
  40. print "Done"
  41. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement