cc-2419: media monitor import on startup
-fixed syntax errors, added more logging.
This commit is contained in:
parent
ddb5e8e383
commit
c67e711a05
|
@ -25,7 +25,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns Airtime version. i.e "1.7.0 alpha"
|
* Returns Airtime version. i.e "1.7.0-beta"
|
||||||
*
|
*
|
||||||
* First checks to ensure the correct API key was
|
* First checks to ensure the correct API key was
|
||||||
* supplied, then returns AIRTIME_VERSION as defined
|
* supplied, then returns AIRTIME_VERSION as defined
|
||||||
|
|
|
@ -59,10 +59,10 @@ class AirtimeMediaMonitorBootstrap():
|
||||||
all_files_set.add(file_path)
|
all_files_set.add(file_path)
|
||||||
|
|
||||||
|
|
||||||
if os.path.exists("/var/tmp/airtime/media_monitor_boot"):
|
if os.path.exists("/var/tmp/airtime/.media_monitor_boot"):
|
||||||
#find files that have been modified since the last time
|
#find files that have been modified since the last time
|
||||||
#media-monitor process started.
|
#media-monitor process started.
|
||||||
time_diff_sec = time.time() - os.path.getmtime("/var/tmp/airtime/media_monitor_boot")
|
time_diff_sec = time.time() - os.path.getmtime("/var/tmp/airtime/.media_monitor_boot")
|
||||||
command = "find %s -type f -iname '*.ogg' -o -iname '*.mp3' -readable -mmin -%d" % (dir, time_diff_sec/60+1)
|
command = "find %s -type f -iname '*.ogg' -o -iname '*.mp3' -readable -mmin -%d" % (dir, time_diff_sec/60+1)
|
||||||
else:
|
else:
|
||||||
command = "find %s -type f -iname '*.ogg' -o -iname '*.mp3' -readable" % dir
|
command = "find %s -type f -iname '*.ogg' -o -iname '*.mp3' -readable" % dir
|
||||||
|
@ -91,7 +91,7 @@ class AirtimeMediaMonitorBootstrap():
|
||||||
self.logger.info("Modified files: \n%s\n\n"%modified_files_set)
|
self.logger.info("Modified files: \n%s\n\n"%modified_files_set)
|
||||||
|
|
||||||
#"touch" file timestamp
|
#"touch" file timestamp
|
||||||
open("/var/tmp/airtime/media_monitor_boot","w")
|
open("/var/tmp/airtime/.media_monitor_boot","w")
|
||||||
|
|
||||||
for file_path in deleted_files_set:
|
for file_path in deleted_files_set:
|
||||||
self.pe.handle_removed_file(file_path)
|
self.pe.handle_removed_file(file_path)
|
||||||
|
|
|
@ -113,6 +113,7 @@ class AirtimeMetadata:
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.logger.error("failed getting metadata from %s", filepath)
|
self.logger.error("failed getting metadata from %s", filepath)
|
||||||
|
self.logger.error("Exception %s", e)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -289,7 +289,7 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
if self.is_parent_directory(event.pathname, storage_directory):
|
if self.is_parent_directory(event.pathname, storage_directory):
|
||||||
file_md = self.md_manager.get_md_from_file(event.pathname)
|
file_md = self.md_manager.get_md_from_file(event.pathname)
|
||||||
if file_md is not None:
|
if file_md is not None:
|
||||||
filepath, is_recorded_show = self.create_file_path(event.pathname)
|
filepath, is_recorded_show = self.create_file_path(event.pathname, file_md)
|
||||||
self.move_file(event.pathname, filepath)
|
self.move_file(event.pathname, filepath)
|
||||||
self.renamed_files[event.pathname] = filepath
|
self.renamed_files[event.pathname] = filepath
|
||||||
self.file_events.append({'mode': self.config.MODE_CREATE, 'filepath': filepath, 'data': file_md, 'is_recorded_show': False})
|
self.file_events.append({'mode': self.config.MODE_CREATE, 'filepath': filepath, 'data': file_md, 'is_recorded_show': False})
|
||||||
|
|
Loading…
Reference in New Issue