cc-4105: minor code formatting. refactored replaygain a little bit

This commit is contained in:
Rudi Grinberg 2012-08-08 17:56:46 -04:00
parent e98eda144a
commit ce89d53ea0
4 changed files with 34 additions and 35 deletions

View file

@ -8,7 +8,8 @@ from media.monitor.log import get_logger, setup_logging
from media.monitor.config import MMConfig
from media.monitor.toucher import ToucherThread
from media.monitor.syncdb import AirtimeDB
from media.monitor.exceptions import FailedToObtainLocale, FailedToSetLocale, NoConfigFile
from media.monitor.exceptions import FailedToObtainLocale, FailedToSetLocale, \
NoConfigFile
from media.monitor.airtime import AirtimeNotifier, AirtimeMessageReceiver
from media.monitor.watchersyncer import WatchSyncer
from media.monitor.eventdrainer import EventDrainer
@ -16,8 +17,9 @@ import media.monitor.pure as mmp
from api_clients import api_client as apc
global_config = u'/home/rudi/Airtime/python_apps/media-monitor2/tests/live_client.cfg'
api_client_config = u'/home/rudi/Airtime/python_apps/media-monitor2/tests/live_client.cfg'
base_path = u'/home/rudi/Airtime/python_apps/media-monitor2/tests'
global_config = os.path.join(base_path,u'live_client.cfg')
api_client_config = global_config
# MMConfig is a proxy around ConfigObj instances. it does not allow itself
# users of MMConfig instances to modify any config options directly through the
@ -43,7 +45,8 @@ except FailedToSetLocale as e:
log.info("Failed to set the locale...")
sys.exit(1)
except FailedToObtainLocale as e:
log.info("Failed to obtain the locale form the default path: '/etc/default/locale'")
log.info("Failed to obtain the locale form the default path: \
'/etc/default/locale'")
sys.exit(1)
except Exception as e:
log.info("Failed to set the locale for unknown reason. Logging exception.")
@ -73,7 +76,8 @@ for watch_dir in store[u'watched_dirs']:
# Create the watch_directory here
try: os.makedirs(watch_dir)
except Exception as e:
log.error("Could not create watch directory: '%s' (given from the database)." % watch_dir)
log.error("Could not create watch directory: '%s' \
(given from the database)." % watch_dir)
if os.path.exists(watch_dir):
airtime_receiver.new_watch({ 'directory':watch_dir })
@ -82,11 +86,13 @@ bs = Bootstrapper( db=sdb, watch_signal='watch' )
#bs.flush_all( config.last_ran() )
ed = EventDrainer(airtime_notifier.connection,interval=float(config['rmq_event_wait']))
ed = EventDrainer(airtime_notifier.connection,
interval=float(config['rmq_event_wait']))
# Launch the toucher that updates the last time when the script was ran every
# n seconds.
tt = ToucherThread(path=config['index_path'], interval=int(config['touch_interval']))
# Launch the toucher that updates the last time when the script was ran every n
# seconds.
tt = ToucherThread(path=config['index_path'],
interval=int(config['touch_interval']))
pyi = manager.pyinotify()
pyi.loop()