-better logging.

-Also moved "-type f" argument to end of find command so that it doesn't
 need to do a "stat" on non ogg/mp3 files.
This commit is contained in:
Martin Konecny 2012-05-08 14:57:16 -04:00
parent a895c3a354
commit ad7964899c
2 changed files with 12 additions and 7 deletions

View file

@ -284,12 +284,13 @@ class MediaMonitorCommon:
"""
stdout = stdout.decode("UTF-8")
except Exception, e:
stdout = None
self.logger.error("Could not decode %s using UTF-8" % stdout)
return stdout
def scan_dir_for_new_files(self, dir):
command = 'find "%s" -type f -iname "*.ogg" -o -iname "*.mp3" -readable' % dir.replace('"', '\\"')
command = 'find "%s" -iname "*.ogg" -o -iname "*.mp3" -type f -readable' % dir.replace('"', '\\"')
self.logger.debug(command)
stdout = self.exec_command(command)