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:
parent
c74af05f18
commit
e369ab8dee
|
@ -120,11 +120,14 @@ class AirtimeNotifier(Notifier):
|
||||||
# -data
|
# -data
|
||||||
# -is_recorded_show
|
# -is_recorded_show
|
||||||
def update_airtime(self, d):
|
def update_airtime(self, d):
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.logger.info("updating filepath: %s ", d['filepath'])
|
||||||
filepath = d['filepath']
|
filepath = d['filepath']
|
||||||
mode = d['mode']
|
mode = d['mode']
|
||||||
|
|
||||||
md = {}
|
md = {}
|
||||||
md['MDATA_KEY_FILEPATH'] = filepath.encode("utf_8")
|
md['MDATA_KEY_FILEPATH'] = filepath
|
||||||
|
|
||||||
if 'data' in d:
|
if 'data' in d:
|
||||||
file_md = d['data']
|
file_md = d['data']
|
||||||
|
@ -160,6 +163,10 @@ class AirtimeNotifier(Notifier):
|
||||||
elif (mode == self.config.MODE_DELETE):
|
elif (mode == self.config.MODE_DELETE):
|
||||||
self.api_client.update_media_metadata(md, mode)
|
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.
|
#define which directories the pyinotify WatchManager should watch.
|
||||||
def watch_directory(self, directory):
|
def watch_directory(self, directory):
|
||||||
return self.wm.add_watch(directory, self.mask, rec=True, auto_add=True)
|
return self.wm.add_watch(directory, self.mask, rec=True, auto_add=True)
|
||||||
|
|
|
@ -228,7 +228,7 @@ class MediaMonitorCommon:
|
||||||
open(self.timestamp_file, "w")
|
open(self.timestamp_file, "w")
|
||||||
|
|
||||||
def organize_new_file(self, pathname):
|
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)
|
file_md = self.md_manager.get_md_from_file(pathname)
|
||||||
|
|
||||||
if file_md is not None:
|
if file_md is not None:
|
||||||
|
@ -236,7 +236,7 @@ class MediaMonitorCommon:
|
||||||
# file_md['MDATA_KEY_CREATOR'] == "AIRTIMERECORDERSOURCEFABRIC".encode('utf-8')
|
# file_md['MDATA_KEY_CREATOR'] == "AIRTIMERECORDERSOURCEFABRIC".encode('utf-8')
|
||||||
filepath = self.create_file_path(pathname, file_md)
|
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)
|
self.move_file(pathname, filepath)
|
||||||
else:
|
else:
|
||||||
filepath = None
|
filepath = None
|
||||||
|
|
Loading…
Reference in New Issue