Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Martin Konecny 2012-08-29 11:05:14 -04:00
commit 8b5f94fa9f
10 changed files with 87 additions and 21 deletions

View file

@ -79,9 +79,16 @@ class Manager(Loggable):
watch_dir)
self.remove_watch_directory(normpath(watch_dir))
def watch_signal(self): return self.watch_listener.signal
def watch_signal(self):
"""
Return the signal string our watch_listener is reading events from
"""
return self.watch_listener.signal
def __remove_watch(self,path):
"""
Remove path from being watched (first will check if 'path' is watched)
"""
# only delete if dir is actually being watched
if path in self.__wd_path:
wd = self.__wd_path[path]
@ -89,11 +96,16 @@ class Manager(Loggable):
del(self.__wd_path[path])
def __add_watch(self,path,listener):
"""
Start watching 'path' using 'listener'. First will check if directory
is being watched before adding another watch
"""
self.logger.info("Adding listener '%s' to '%s'" %
( listener.__class__.__name__, path) )
wd = self.wm.add_watch(path, pyinotify.ALL_EVENTS, rec=True,
auto_add=True, proc_fun=listener)
self.__wd_path[path] = wd.values()[0]
if not self.has_watch(path):
wd = self.wm.add_watch(path, pyinotify.ALL_EVENTS, rec=True,
auto_add=True, proc_fun=listener)
if wd: self.__wd_path[path] = wd.values()[0]
def __create_organizer(self, target_path, recorded_path):
"""

View file

@ -14,8 +14,8 @@ from configobj import ConfigObj
from media.monitor.exceptions import FailedToSetLocale, FailedToCreateDir
supported_extensions = [u"mp3", u"ogg", u"oga"]
#supported_extensions = [u"mp3", u"ogg", u"oga", u"flac", u"aac", u"bwf"]
#supported_extensions = [u"mp3", u"ogg", u"oga"]
supported_extensions = [u"mp3", u"ogg", u"oga", u"flac", u"aac", u"bwf"]
unicode_unknown = u'unknown'
path_md = ['MDATA_KEY_TITLE', 'MDATA_KEY_CREATOR', 'MDATA_KEY_SOURCE',
@ -285,11 +285,11 @@ def organized_path(old_path, root_path, orig_md):
# 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']:
try:
formatted = str(int(normal_md['MDATA_KEY_BITRATE']) / 1000)
normal_md['MDATA_KEY_BITRATE'] = formatted + 'kbps'
else: normal_md['MDATA_KEY_BITRATE'] = unicode_unknown
except:
normal_md['MDATA_KEY_BITRATE'] = unicode_unknown
if is_airtime_recorded(normal_md):
title_re = re.match("(?P<show>.+)-(?P<date>\d+-\d+-\d+-\d+:\d+:\d+)$",