Revert "Merge branch 'ryerson-history'"

This reverts commit a554c6f72c, reversing
changes made to 2a0c9769aa.
This commit is contained in:
Naomi Aro 2013-09-23 11:00:43 +02:00
parent a554c6f72c
commit c8b73850b9
200 changed files with 5491 additions and 41784 deletions

View file

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

View file

@ -93,6 +93,7 @@ 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,28 +474,20 @@ def truncate_to_value(item, value):
return str(item)
def format_length(mutagen_length):
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
""" 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 __name__ == '__main__':
import doctest

View file

@ -41,9 +41,9 @@ source_id = ref 0
def create_source()
l = request.equeue(id="s#{!source_id}", length=0.5)
l = cue_cut(l)
l = audio_to_stereo(id="queue_src", l)
l = cue_cut(l)
l = amplify(1., override="replay_gain", l)
# the crossfade function controls fade in/out
@ -238,7 +238,8 @@ s = switch(id="schedule_noise_switch",
)
s = if dj_live_stream_port != 0 and dj_live_stream_mp != "" then
dj_live =
dj_live = mksafe(
id="dj_live_mksafe",
audio_to_stereo(
input.harbor(id="live_dj_harbor",
dj_live_stream_mp,
@ -246,7 +247,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))
@ -260,7 +261,8 @@ else
end
s = if master_live_stream_port != 0 and master_live_stream_mp != "" then
master_dj =
master_dj = mksafe(
id="master_dj_mksafe",
audio_to_stereo(
input.harbor(id="master_harbor",
master_live_stream_mp,
@ -268,7 +270,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,7 +10,6 @@ import pytz
import signal
import math
import traceback
import re
from configobj import ConfigObj
@ -18,7 +17,6 @@ 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
@ -95,16 +93,12 @@ class ShowRecorder(Thread):
self.logger.info("starting record")
self.logger.info("command " + command)
self.p = Popen(args,stdout=PIPE)
self.p = Popen(args)
#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

View file

@ -217,8 +217,7 @@ class PypoFetch(Thread):
except Exception, e:
self.logger.error(e)
finally:
if self.telnet_lock.locked():
self.telnet_lock.release()
self.telnet_lock.release()
"""
TODO: This function needs to be way shorter, and refactored :/ - MK