CC-2505 : Media monitor doesn't delete some tracks from the Airtime server due to weird characters in file names

seems to fix unicode problems I was having.
This commit is contained in:
Naomi Aro 2011-07-18 12:05:16 +02:00
parent c74af05f18
commit e369ab8dee
2 changed files with 59 additions and 52 deletions

View File

@ -120,11 +120,14 @@ class AirtimeNotifier(Notifier):
# -data
# -is_recorded_show
def update_airtime(self, d):
try:
self.logger.info("updating filepath: %s ", d['filepath'])
filepath = d['filepath']
mode = d['mode']
md = {}
md['MDATA_KEY_FILEPATH'] = filepath.encode("utf_8")
md['MDATA_KEY_FILEPATH'] = filepath
if 'data' in d:
file_md = d['data']
@ -160,6 +163,10 @@ class AirtimeNotifier(Notifier):
elif (mode == self.config.MODE_DELETE):
self.api_client.update_media_metadata(md, mode)
except Exception, e:
self.logger.error("failed updating filepath: %s ", d['filepath'])
self.logger.error('Exception: %s', e)
#define which directories the pyinotify WatchManager should watch.
def watch_directory(self, directory):
return self.wm.add_watch(directory, self.mask, rec=True, auto_add=True)

View File

@ -228,7 +228,7 @@ class MediaMonitorCommon:
open(self.timestamp_file, "w")
def organize_new_file(self, pathname):
self.logger.info(u"Organizing new file: %s", pathname)
self.logger.info("Organizing new file: %s", pathname)
file_md = self.md_manager.get_md_from_file(pathname)
if file_md is not None:
@ -236,7 +236,7 @@ class MediaMonitorCommon:
# file_md['MDATA_KEY_CREATOR'] == "AIRTIMERECORDERSOURCEFABRIC".encode('utf-8')
filepath = self.create_file_path(pathname, file_md)
self.logger.debug(u"Moving from %s to %s", pathname, filepath)
self.logger.debug("Moving from %s to %s", pathname, filepath)
self.move_file(pathname, filepath)
else:
filepath = None