Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
db0f6260c7
|
@ -274,20 +274,24 @@ def organized_path(old_path, root_path, orig_md):
|
|||
if key in dictionary: return len(dictionary[key]) == 0
|
||||
else: return True
|
||||
# We set some metadata elements to a default "unknown" value because we use
|
||||
# these fields to create a path hence they cannot be empty
|
||||
# Here "normal" means normalized only for organized path
|
||||
# these fields to create a path hence they cannot be empty Here "normal"
|
||||
# means normalized only for organized path
|
||||
|
||||
# MDATA_KEY_BITRATE is in bytes/second i.e. (256000) we want to turn this
|
||||
# into 254kbps
|
||||
normal_md = default_to_f(orig_md, path_md, unicode_unknown, default_f)
|
||||
if normal_md['MDATA_KEY_BITRATE']:
|
||||
formatted = str(int(normal_md['MDATA_KEY_BITRATE']) / 1000)
|
||||
normal_md['MDATA_KEY_BITRATE'] = formatted + 'kbps'
|
||||
else: normal_md['MDATA_KEY_BITRATE'] = unicode_unknown
|
||||
|
||||
if is_airtime_recorded(normal_md):
|
||||
title_re = re.match("(?P<show>\w+)-(?P<date>\d+-\d+-\d+-\d+:\d+:\d+)$",
|
||||
normal_md['MDATA_KEY_TITLE'])
|
||||
show_name, = title_re.group('show'),
|
||||
date = title_re.group('date').replace(':','-')
|
||||
show_name, = title_re.group('show'),
|
||||
date = title_re.group('date').replace(':','-')
|
||||
yyyy, mm, _ = normal_md['MDATA_KEY_YEAR'].split('-',2)
|
||||
fname_base = '%s-%s-%s.%s' % \
|
||||
fname_base = '%s-%s-%s.%s' % \
|
||||
(date, show_name, normal_md['MDATA_KEY_BITRATE'], ext)
|
||||
filepath = os.path.join(root_path, yyyy, mm, fname_base)
|
||||
elif len(normal_md['MDATA_KEY_TRACKNUMBER']) == 0:
|
||||
|
|
|
@ -127,6 +127,8 @@ def main(global_config, api_client_config, log_config,
|
|||
tt = ToucherThread(path=config['index_path'],
|
||||
interval=int(config['touch_interval']))
|
||||
|
||||
apiclient.register_component('media-monitor')
|
||||
|
||||
pyi = manager.pyinotify()
|
||||
pyi.loop()
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import sys
|
|||
import pytz
|
||||
import signal
|
||||
import math
|
||||
import traceback
|
||||
|
||||
from configobj import ConfigObj
|
||||
|
||||
|
@ -310,6 +311,7 @@ class Recorder(Thread):
|
|||
self.logger.error(e)
|
||||
try: self.handle_message()
|
||||
except Exception, e:
|
||||
self.logger.error( traceback.format_exc() )
|
||||
self.logger.error('Pypo Recorder Exception: %s', e)
|
||||
time.sleep(PUSH_INTERVAL)
|
||||
self.loops += 1
|
||||
|
|
Loading…
Reference in New Issue