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