Merge branch '2.4.x' into 2.4.x-saas

This commit is contained in:
Naomi Aro 2013-09-02 15:46:25 -04:00
commit 60bf334aeb
35 changed files with 2310 additions and 147 deletions

View file

@ -16,7 +16,7 @@ import base64
import traceback
from configobj import ConfigObj
AIRTIME_VERSION = "2.4.0"
AIRTIME_VERSION = "2.4.1"
# TODO : Place these functions in some common module. Right now, media

View file

@ -93,7 +93,6 @@ class Metadata(Loggable):
# little bit messy. Some of the handling is in m.m.pure while the rest is
# here. Also interface is not very consistent
# TODO : what is this shit? maybe get rid of it?
@staticmethod
def fix_title(path):
# If we have no title in path we will format it

View file

@ -474,20 +474,28 @@ def truncate_to_value(item, value):
return str(item)
def format_length(mutagen_length):
""" Convert mutagen length to airtime length """
t = float(mutagen_length)
h = int(math.floor(t / 3600))
t = t % 3600
m = int(math.floor(t / 60))
s = t % 60
# will be ss.uuu
s = str('{0:f}'.format(s))
seconds = s.split(".")
s = seconds[0]
# have a maximum of 6 subseconds.
if len(seconds[1]) >= 6: ss = seconds[1][0:6]
else: ss = seconds[1][0:]
return "%s:%s:%s.%s" % (h, m, s, ss)
if convert_format(mutagen_length):
""" Convert mutagen length to airtime length """
t = float(mutagen_length)
h = int(math.floor(t / 3600))
t = t % 3600
m = int(math.floor(t / 60))
s = t % 60
# will be ss.uuu
s = str('{0:f}'.format(s))
seconds = s.split(".")
s = seconds[0]
# have a maximum of 6 subseconds.
if len(seconds[1]) >= 6: ss = seconds[1][0:6]
else: ss = seconds[1][0:]
return "%s:%s:%s.%s" % (h, m, s, ss)
def convert_format(value):
regCompiled = re.compile("^[0-9][0-9]:[0-9][0-9]:[0-9][0-9](\.\d+)?$")
if re.search(regCompiled, str(value)) is None:
return True
else:
return False
if __name__ == '__main__':
import doctest

View file

@ -238,8 +238,7 @@ s = switch(id="schedule_noise_switch",
)
s = if dj_live_stream_port != 0 and dj_live_stream_mp != "" then
dj_live = mksafe(
id="dj_live_mksafe",
dj_live =
audio_to_stereo(
input.harbor(id="live_dj_harbor",
dj_live_stream_mp,
@ -247,7 +246,7 @@ s = if dj_live_stream_port != 0 and dj_live_stream_mp != "" then
auth=check_dj_client,
max=40.,
on_connect=live_dj_connect,
on_disconnect=live_dj_disconnect)))
on_disconnect=live_dj_disconnect))
ignore(output.dummy(dj_live, fallible=true))
@ -261,8 +260,7 @@ else
end
s = if master_live_stream_port != 0 and master_live_stream_mp != "" then
master_dj = mksafe(
id="master_dj_mksafe",
master_dj =
audio_to_stereo(
input.harbor(id="master_harbor",
master_live_stream_mp,
@ -270,7 +268,7 @@ s = if master_live_stream_port != 0 and master_live_stream_mp != "" then
auth=check_master_dj_client,
max=40.,
on_connect=master_dj_connect,
on_disconnect=master_dj_disconnect)))
on_disconnect=master_dj_disconnect))
ignore(output.dummy(master_dj, fallible=true))

View file

@ -10,6 +10,7 @@ import pytz
import signal
import math
import traceback
import re
from configobj import ConfigObj
@ -17,6 +18,7 @@ from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
from subprocess import Popen
from subprocess import PIPE
from threading import Thread
import mutagen
@ -93,12 +95,16 @@ class ShowRecorder(Thread):
self.logger.info("starting record")
self.logger.info("command " + command)
self.p = Popen(args)
self.p = Popen(args,stdout=PIPE)
#blocks at the following line until the child process
#quits
self.p.wait()
outmsgs = self.p.stdout.readlines()
for msg in outmsgs:
m = re.search('^ERROR',msg)
if not m == None:
self.logger.info('Recording error is found: %s', msg)
self.logger.info("finishing record, return code %s", self.p.returncode)
code = self.p.returncode