Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import datetime
- import os
- import subprocess
- path = '/opt/data/encoding/'
- tv = ["joj", "stv", "markiza", "ta3"]
- now = datetime.datetime.now()
- def media_detect(filename):
- for tv_station in tv:
- if tv_station in filename.lower():
- return "TV"
- for subdir, dirs, files in os.walk(path):
- for file in files:
- file_name = os.path.splitext(file)[0]
- outfile_name = path + file_name + ".mp3"
- # assert file.lower().endswith( '.ts' )
- print "#####################"
- print "Start Time: " + now.strftime("%Y-%m-%d %H:%M")
- print file
- if media_detect(file) == "TV":
- print file_name
- print "Televizia"
- # subprocess.call(["ls", "-l", path + file])
- else:
- print file_name
- print "Radio"
- cmd = 'ffmpeg -i %s -ab 32k %s' % (path + file, outfile_name)
- print cmd
- subprocess.call([cmd, "-y"], shell=True)
- print "Stop Time: " + now.strftime("%Y-%m-%d %H:%M")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement