Merge branch '2.2.x' of dev.sourcefabric.org:airtime into 2.2.x

This commit is contained in:
Martin Konecny 2012-11-05 11:53:52 -05:00
commit fffaf7788a
28 changed files with 164 additions and 76 deletions

View file

@ -148,6 +148,9 @@ class BaseEvent(Loggable):
owners.remove_file_owner(self.path)
return ret
except BadSongFile as e: return [e]
except Exception as e:
self.unexpected_exception(e)
return[e]
# nothing to see here, please move along
def morph_into(self, evt):

View file

@ -202,6 +202,12 @@ class Manager(Loggable):
organize.
"""
store_paths = mmp.expand_storage(store)
# First attempt to make sure that all paths exist before adding any
# watches
for path_type, path in store_paths.iteritems():
try: mmp.create_dir(path)
except mmp.FailedToCreateDir as e: self.unexpected_exception(e)
self.set_problem_files_path(store_paths['problem_files'])
self.set_imported_path(store_paths['imported'])
self.set_recorded_path(store_paths['recorded'])

View file

@ -104,6 +104,9 @@ def main(global_config, api_client_config, log_config,
airtime_notifier = AirtimeNotifier(config, airtime_receiver)
store = apiclient.setup_media_monitor()
log.info("Initing with the following airtime response:%s" % str(store))
airtime_receiver.change_storage({ 'directory':store[u'stor'] })
for watch_dir in store[u'watched_dirs']:
@ -115,6 +118,7 @@ def main(global_config, api_client_config, log_config,
(given from the database)." % watch_dir)
if os.path.exists(watch_dir):
airtime_receiver.new_watch({ 'directory':watch_dir }, restart=True)
else: log.info("Failed to add watch on %s" % str(watch_dir))
bs = Bootstrapper( db=sdb, watch_signal='watch' )