From f38541cb0eab3f95d0ea5ff13af191aa8a4ea56f Mon Sep 17 00:00:00 2001 From: naomiaro Date: Thu, 24 Mar 2011 23:46:55 -0400 Subject: [PATCH] CC-2097 : Show-recorder: Use RabbitMQ, api_client, and the structure of pypofetch --- .../install/recorder-daemontools.sh | 2 +- python_apps/show-recorder/testrecordscript.py | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/python_apps/show-recorder/install/recorder-daemontools.sh b/python_apps/show-recorder/install/recorder-daemontools.sh index 36510dfde..6f3664139 100644 --- a/python_apps/show-recorder/install/recorder-daemontools.sh +++ b/python_apps/show-recorder/install/recorder-daemontools.sh @@ -1,7 +1,7 @@ #!/bin/sh recorder_user="pypo" export HOME="/home/pypo/" -export TERM=xterm + # Location of pypo_cli.py Python script recorder_path="/opt/recorder/bin/" recorder_script="testrecordscript.py" diff --git a/python_apps/show-recorder/testrecordscript.py b/python_apps/show-recorder/testrecordscript.py index 3b005835b..1c0c036f6 100644 --- a/python_apps/show-recorder/testrecordscript.py +++ b/python_apps/show-recorder/testrecordscript.py @@ -6,6 +6,7 @@ import json import time import datetime import os +import sys from configobj import ConfigObj @@ -13,8 +14,7 @@ from poster.encode import multipart_encode from poster.streaminghttp import register_openers import urllib2 -#from subprocess import call -from subprocess import Popen, PIPE +from subprocess import call from threading import Thread # For RabbitMQ @@ -24,7 +24,11 @@ from kombu.messaging import Exchange, Queue, Consumer, Producer from api_clients import api_client # configure logging -logging.config.fileConfig("logging.cfg") +try: + logging.config.fileConfig("logging.cfg") +except Exception, e: + print 'Error configuring logging: ', e + sys.exit() # loading config file try: @@ -57,10 +61,8 @@ class ShowRecorder(Thread): filename = self.filename.replace(" ", "-") filepath = "%s%s.%s" % (config["base_recorded_files"], filename, self.filetype) - command = ("ecasound -i alsa -o %s -t:%s" % (filepath, length)).split(' ') - print(command) - Popen(command, stdout=PIPE) - #call(command, shell=False) + command = "ecasound -i alsa -o %s -t:%s" % (filepath, length) + call(command, shell=True) return filepath