CC-3561: Add button to automatically rescan watched folders.

-done
This commit is contained in:
denise 2012-06-15 12:16:19 -04:00
parent 70bfe031ef
commit d02607ed94
6 changed files with 32 additions and 11 deletions

View file

@ -109,9 +109,9 @@ class AirtimeMediaMonitorBootstrap():
if os.path.exists(self.mmc.timestamp_file):
"""find files that have been modified since the last time media-monitor process started."""
time_diff_sec = time.time() - os.path.getmtime(self.mmc.timestamp_file)
command = "find %s -iname '*.ogg' -o -iname '*.mp3' -type f -readable -mmin -%d" % (dir, time_diff_sec/60+1)
command = "find '%s' -iname '*.ogg' -o -iname '*.mp3' -type f -readable -mmin -%d" % (dir, time_diff_sec/60+1)
else:
command = "find %s -iname '*.ogg' -o -iname '*.mp3' -type f -readable" % dir
command = "find '%s' -iname '*.ogg' -o -iname '*.mp3' -type f -readable" % dir
self.logger.debug(command)
stdout = self.mmc.exec_command(command)

View file

@ -84,6 +84,9 @@ class AirtimeNotifier(Notifier):
self.logger.info("Removing watch on: %s wd %s", watched_directory, wd)
mm.wm.rm_watch(wd, rec=True)
elif m['event_type'] == "rescan_watch":
self.bootstrap.sync_database_to_filesystem(str(m['id']), m['directory'])
elif m['event_type'] == "change_stor":
storage_directory = self.config.storage_directory
new_storage_directory = m['directory']