diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py b/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py index cab57381c..1cef988b1 100644 --- a/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py +++ b/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py @@ -88,17 +88,16 @@ class AirtimeMetadata: try: airtime_file = mutagen.File(m['MDATA_KEY_FILEPATH'], easy=True) - for key in m.keys() : + for key in m: if key in self.airtime2mutagen: value = m[key] - if (value is not None): - self.logger.debug("Saving %s to file", key) - self.logger.debug(value) - if isinstance(value, basestring) and (len(value) > 0): - airtime_file[self.airtime2mutagen[key]] = api_client.encode_to(value, 'utf-8') - elif isinstance(value, int): - airtime_file[self.airtime2mutagen[key]] = str(value) - + + if value is not None: + value = unicode(value) + + if len(value) > 0: + self.logger.debug("Saving key '%s' with value '%s' to file", key, value) + airtime_file[self.airtime2mutagen[key]] = value airtime_file.save() except Exception, e: diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimenotifier.py b/python_apps/media-monitor/airtimefilemonitor/airtimenotifier.py index 8986ffc6f..e527d56cb 100644 --- a/python_apps/media-monitor/airtimefilemonitor/airtimenotifier.py +++ b/python_apps/media-monitor/airtimefilemonitor/airtimenotifier.py @@ -62,7 +62,7 @@ class AirtimeNotifier(Notifier): message.ack() self.logger.info("Received md from RabbitMQ: " + body) - m = json.loads(message.body) + m = json.loads(message.body) if m['event_type'] == "md_update": self.logger.info("AIRTIME NOTIFIER md update event") diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py b/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py index 019f460e0..419bbd685 100644 --- a/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py +++ b/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py @@ -173,7 +173,7 @@ class AirtimeProcessEvent(ProcessEvent): # update timestamp on create_dict for the entry with pathname as the key if pathname in self.create_dict: self.create_dict[pathname] = time.time() - if not dir and not self.mmc.is_parent_directory(pathname, self.config.organize_directory) and self.mmc.is_readable(pathname, False): + if not dir and not self.mmc.is_parent_directory(pathname, self.config.organize_directory): self.logger.info("Modified: %s", pathname) if self.mmc.is_audio_file(name): self.file_events.append({'filepath': pathname, 'mode': self.config.MODE_MODIFY})