CC-1630 : Automatic recording of shows

not going to use ECI python bindings, has deprecated code in the ubuntu package currently
also simpler just to call a subprocess
This commit is contained in:
Naomi 2011-03-18 15:33:23 -04:00
parent 28b7d8e882
commit 5ddd670979
412 changed files with 6 additions and 148340 deletions

View file

@ -6,13 +6,14 @@ import time
import datetime
import os
from eci import *
from configobj import ConfigObj
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
import urllib2
from subprocess import call
# loading config file
try:
config = ConfigObj('config.cfg')
@ -29,25 +30,9 @@ def record_show(filelength, filename, filetype="mp3"):
filename = filename.replace(" ", "-")
filepath = "%s%s.%s" % (config["base_recorded_files"], filename, filetype)
e = ECI()
command = "ecasound -i alsa -o %s -t:%s" % (filepath, filelength)
e("cs-add play_chainsetup")
e("c-add 1st_chain")
e("ai-add alsa")
e("ao-add "+filepath)
e("cs-set-length "+length)
e("cop-select 1")
e("cs-connect")
e("start")
while 1:
time.sleep(1)
if e("engine-status") != "running":
break
e("stop")
e("cs-disconnect")
call(command, shell=True)
return filepath
@ -92,6 +77,7 @@ def get_shows():
url = config["base_url"] + config["show_schedule_url"]
response = urllib.urlopen(url)
data = response.read()
print data
response_json = json.loads(data)
shows = response_json[u'shows']