This is my 'automated radio recording' python script.
To run this script, python /path/path/ebs.py Name 1190(length)
And when I type it on terminal, it works perfectly. But When I do it on Crontab.
40 6 * * 1-6 python /Users/myname/Dropbox/ebs/ebs.py Ears 10
I have error report like this.
Traceback (most recent call last):
File "ebs.py", line 31, in <module>
recording()
File "ebs.py", line 23, in recording
p = subprocess.Popen(rtmpdump)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
#
This is my original script
# coding: utf8
'''
Created on 2015. 9. 5.
'''
import subprocess
import datetime
import sys
import os
def recording() :
radio_addr = "rtmp://ebsandroid.ebs.co.kr/fmradiofamilypc/familypc1m"
program_name = sys.argv[1]
record_mins = sys.argv[2]
date = datetime.date.today()
ori_file = '/Users/kimheungbeom/Dropbox/ebs/temp' + str(date) + '_' + program_name
m4a_file = '/Users/kimheungbeom/Dropbox/ebs/ebs' + str(date) + '_' + program_name + '.m4a'
rtmpdump = ['rtmpdump', '-r', radio_addr, '-B', record_mins, '-o', ori_file]
ffmpeg = ['ffmpeg', '-i', ori_file, '-vn', '-acodec', 'copy', m4a_file]
rm = ['rm', '-rf', ori_file]
p = subprocess.Popen(rtmpdump)
p.communicate()
p = subprocess.Popen(ffmpeg)
p.communicate()
p = subprocess.Popen(rm)
p.communicate()
if __name__ == "__main__":
recording()