cc-4105: removed useless function. reformatted comments
This commit is contained in:
parent
a9819f54d5
commit
517730e012
|
@ -11,9 +11,9 @@ import media.monitor.pure as mmp
|
||||||
|
|
||||||
class Manager(Loggable):
|
class Manager(Loggable):
|
||||||
"""
|
"""
|
||||||
An abstraction over media monitors core pyinotify functions. These include
|
An abstraction over media monitors core pyinotify functions. These
|
||||||
adding watched,store, organize directories, etc. Basically composes over
|
include adding watched,store, organize directories, etc. Basically
|
||||||
WatchManager from pyinotify
|
composes over WatchManager from pyinotify
|
||||||
"""
|
"""
|
||||||
global_inst = None
|
global_inst = None
|
||||||
all_signals = set(['add_watch', 'remove_watch'])
|
all_signals = set(['add_watch', 'remove_watch'])
|
||||||
|
@ -157,9 +157,9 @@ class Manager(Loggable):
|
||||||
|
|
||||||
def add_watch_directory(self, new_dir):
|
def add_watch_directory(self, new_dir):
|
||||||
"""
|
"""
|
||||||
adds a directory to be "watched". "watched" directories are those that
|
adds a directory to be "watched". "watched" directories are
|
||||||
are being monitored by media monitor for airtime in this context and
|
those that are being monitored by media monitor for airtime in
|
||||||
not directories pyinotify calls watched
|
this context and not directories pyinotify calls watched
|
||||||
"""
|
"""
|
||||||
if self.has_watch(new_dir):
|
if self.has_watch(new_dir):
|
||||||
self.logger.info("Cannot add '%s' to watched directories. It's \
|
self.logger.info("Cannot add '%s' to watched directories. It's \
|
||||||
|
|
|
@ -369,15 +369,6 @@ def last_modified(path):
|
||||||
return os.path.getmtime(path)
|
return os.path.getmtime(path)
|
||||||
else: 0
|
else: 0
|
||||||
|
|
||||||
def import_organize(store):
|
|
||||||
# TODO : get rid of this later
|
|
||||||
"""
|
|
||||||
returns a tuple of organize and imported directory from an airtime store
|
|
||||||
directory
|
|
||||||
"""
|
|
||||||
store = os.path.normpath(store)
|
|
||||||
return os.path.join(store,'organize'), os.path.join(store,'imported')
|
|
||||||
|
|
||||||
def expand_storage(store):
|
def expand_storage(store):
|
||||||
"""
|
"""
|
||||||
A storage directory usually consists of 4 different subdirectories. This
|
A storage directory usually consists of 4 different subdirectories. This
|
||||||
|
|
|
@ -37,9 +37,9 @@ class RequestSync(threading.Thread,Loggable):
|
||||||
try: make_req()
|
try: make_req()
|
||||||
# most likely we did not get json response as we expected
|
# most likely we did not get json response as we expected
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.logger.info("Api Controller is a piece of shit\n \
|
self.logger.info("ApiController.php probably crashed, we \
|
||||||
it's not returning json when it should\n \
|
diagnose this from the fact that it did not return \
|
||||||
... will fix once I setup the damn debugger")
|
valid json")
|
||||||
self.logger.info("Trying again after %f seconds" %
|
self.logger.info("Trying again after %f seconds" %
|
||||||
self.request_wait)
|
self.request_wait)
|
||||||
time.sleep( self.request_wait )
|
time.sleep( self.request_wait )
|
||||||
|
@ -139,7 +139,9 @@ class WatchSyncer(ReportHandler,Loggable):
|
||||||
return len(self.__requests) > 0
|
return len(self.__requests) > 0
|
||||||
|
|
||||||
def flag_done(self):
|
def flag_done(self):
|
||||||
""" called by request thread when it finishes operating """
|
"""
|
||||||
|
called by request thread when it finishes operating
|
||||||
|
"""
|
||||||
self.request_running = False
|
self.request_running = False
|
||||||
self.__current_thread = None
|
self.__current_thread = None
|
||||||
# This call might not be necessary but we would like
|
# This call might not be necessary but we would like
|
||||||
|
@ -147,7 +149,9 @@ class WatchSyncer(ReportHandler,Loggable):
|
||||||
if self.requests_in_queue() > 0: self.request_do()
|
if self.requests_in_queue() > 0: self.request_do()
|
||||||
|
|
||||||
def request_do(self):
|
def request_do(self):
|
||||||
""" launches a request thread only if one is not running right now """
|
"""
|
||||||
|
launches a request thread only if one is not running right now
|
||||||
|
"""
|
||||||
if not self.request_running:
|
if not self.request_running:
|
||||||
self.request_running = True
|
self.request_running = True
|
||||||
self.__requests.pop()()
|
self.__requests.pop()()
|
||||||
|
|
Loading…
Reference in New Issue