CC-2716: Moving Directory->Media Monitor exception
-fixed
This commit is contained in:
parent
8e884baefc
commit
ca65c32e1c
|
@ -44,29 +44,6 @@ if (PEAR::isError($CC_DBC)) {
|
||||||
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
$sql = "SELECT valstr FROM cc_pref WHERE keystr = 'system_version'";
|
|
||||||
$version = $CC_DBC->GetOne($sql);
|
|
||||||
|
|
||||||
if (PEAR::isError($version)) {
|
|
||||||
$version = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$version){
|
|
||||||
|
|
||||||
$sql = "SELECT * FROM cc_show_rebroadcast LIMIT 1";
|
|
||||||
$result = $CC_DBC->GetOne($sql);
|
|
||||||
if (!PEAR::isError($result)) {
|
|
||||||
$version = "1.7.0";
|
|
||||||
echo "Airtime Version: ".$version." ".PHP_EOL;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$version = "1.6";
|
|
||||||
echo "Airtime Version: ".$version." ".PHP_EOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$version = AirtimeInstall::GetVersionInstalled();
|
$version = AirtimeInstall::GetVersionInstalled();
|
||||||
|
|
||||||
echo "******************************** Update Begin *********************************".PHP_EOL;
|
echo "******************************** Update Begin *********************************".PHP_EOL;
|
||||||
|
|
|
@ -30,7 +30,6 @@ class AirtimeNotifier(Notifier):
|
||||||
self.wm = watch_manager
|
self.wm = watch_manager
|
||||||
self.mask = pyinotify.ALL_EVENTS
|
self.mask = pyinotify.ALL_EVENTS
|
||||||
|
|
||||||
|
|
||||||
while not self.init_rabbit_mq():
|
while not self.init_rabbit_mq():
|
||||||
self.logger.error("Error connecting to RabbitMQ Server. Trying again in few seconds")
|
self.logger.error("Error connecting to RabbitMQ Server. Trying again in few seconds")
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
|
@ -102,6 +102,8 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
#we don't care about moved_from events from the organize dir.
|
#we don't care about moved_from events from the organize dir.
|
||||||
if self.mmc.is_audio_file(event.name):
|
if self.mmc.is_audio_file(event.name):
|
||||||
self.cookies_IN_MOVED_FROM[event.cookie] = (event, time.time())
|
self.cookies_IN_MOVED_FROM[event.cookie] = (event, time.time())
|
||||||
|
else:
|
||||||
|
self.cookies_IN_MOVED_FROM[event.cookie] = event.pathname
|
||||||
|
|
||||||
|
|
||||||
#Some weird thing to note about this event: it seems that if a file is moved to a newly
|
#Some weird thing to note about this event: it seems that if a file is moved to a newly
|
||||||
|
@ -141,17 +143,23 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
#When we move a directory into a watched_dir, we only get a notification that the dir was created,
|
#When we move a directory into a watched_dir, we only get a notification that the dir was created,
|
||||||
#and no additional information about files that came along with that directory.
|
#and no additional information about files that came along with that directory.
|
||||||
#need to scan the entire directory for files.
|
#need to scan the entire directory for files.
|
||||||
|
|
||||||
|
if event.cookie in self.cookies_IN_MOVED_FROM:
|
||||||
|
del self.cookies_IN_MOVED_FROM[event.cookie]
|
||||||
|
mode = self.config.MODE_MOVED
|
||||||
|
else:
|
||||||
|
mode = self.config.MODE_CREATE
|
||||||
|
|
||||||
files = self.mmc.scan_dir_for_new_files(event.pathname)
|
files = self.mmc.scan_dir_for_new_files(event.pathname)
|
||||||
if self.mmc.is_parent_directory(event.pathname, self.config.organize_directory):
|
if self.mmc.is_parent_directory(event.pathname, self.config.organize_directory):
|
||||||
for file in files:
|
for file in files:
|
||||||
self.mmc.organize_new_file(file)
|
filepath = self.mmc.organize_new_file(file)
|
||||||
|
if (filepath is not None):
|
||||||
|
self.file_events.append({'mode': mode, 'filepath': filepath})
|
||||||
else:
|
else:
|
||||||
for file in files:
|
for file in files:
|
||||||
if self.mmc.is_parent_directory(pathname, self.config.recorded_directory):
|
self.file_events.append({'mode': mode, 'filepath': file})
|
||||||
is_recorded = True
|
|
||||||
else :
|
|
||||||
is_recorded = False
|
|
||||||
self.file_events.append({'mode': self.config.MODE_CREATE, 'filepath': file, 'is_recorded_show': is_recorded})
|
|
||||||
|
|
||||||
def process_IN_DELETE(self, event):
|
def process_IN_DELETE(self, event):
|
||||||
self.logger.info("process_IN_DELETE: %s", event)
|
self.logger.info("process_IN_DELETE: %s", event)
|
||||||
|
|
Loading…
Reference in New Issue