diff --git a/python_apps/media-monitor2/media/monitor/pure.py b/python_apps/media-monitor2/media/monitor/pure.py index c8add6875..960d0c8a4 100644 --- a/python_apps/media-monitor2/media/monitor/pure.py +++ b/python_apps/media-monitor2/media/monitor/pure.py @@ -284,7 +284,7 @@ def last_modified(path): exist we set this time 0 so that any files on the filesystem were modified after it """ if os.path.exists(path): - os.path.gmtime(path) + return os.path.getmtime(path) else: 0 if __name__ == '__main__': diff --git a/python_apps/media-monitor2/media/monitor/toucher.py b/python_apps/media-monitor2/media/monitor/toucher.py index 39c6d159b..485f19677 100644 --- a/python_apps/media-monitor2/media/monitor/toucher.py +++ b/python_apps/media-monitor2/media/monitor/toucher.py @@ -13,9 +13,7 @@ class Toucher(Loggable): self.logger.info("Failed to touch file: '%s'. Logging exception." % self.path) self.logger.info(str(e)) -""" -http://code.activestate.com/lists/python-ideas/8982/ -""" +#http://code.activestate.com/lists/python-ideas/8982/ from datetime import datetime import threading @@ -61,7 +59,6 @@ class RepeatTimer(threading.Thread): class ToucherThread(Loggable): - """docstring for ToucherThread""" def __init__(self, path, interval=5): if not os.path.exists(path): try: @@ -72,5 +69,6 @@ class ToucherThread(Loggable): raise CouldNotCreateIndexFile(path,e) cb = Toucher(path) t = RepeatTimer(interval, cb) + t.daemon = True # thread terminates once process is done t.start() diff --git a/python_apps/media-monitor2/mm2.py b/python_apps/media-monitor2/mm2.py index 5060b03c3..919584d17 100644 --- a/python_apps/media-monitor2/mm2.py +++ b/python_apps/media-monitor2/mm2.py @@ -2,6 +2,7 @@ import pyinotify import sys import os + from media.monitor.listeners import OrganizeListener, StoreWatchListener from media.monitor.organizer import Organizer from media.monitor.events import PathChannel @@ -15,6 +16,7 @@ from media.monitor.syncdb import SyncDB from media.monitor.exceptions import FailedToObtainLocale, FailedToSetLocale, NoConfigFile from media.monitor.airtime import AirtimeNotifier, AirtimeMessageReceiver import media.monitor.pure as mmp + from api_clients import api_client as apc log = get_logger()