Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
martin 2011-10-04 13:50:16 -04:00
commit e80a9330f5
4 changed files with 16 additions and 4 deletions

View File

@ -112,6 +112,10 @@ Non-linked code:
- Web site: http://code.google.com/p/jq-serverbrowse/ - Web site: http://code.google.com/p/jq-serverbrowse/
- License: BSD 2-Clause - License: BSD 2-Clause
* meioMask
- Web site: http://www.meiocodigo.com/
- License: MIT
------------- -------------
Media-Monitor Media-Monitor
------------- -------------

View File

@ -21,7 +21,7 @@
</dd> </dd>
<dt class="block-display info-text"> <dt class="block-display info-text">
Click the box below to advertise your station on Click the box below to advertise your station on
<a id="link_to_whos_using" href="http://sourcefabric.org/en/products/airtime_whosusing" onclick="window.open(this.href); return false">Sourcefabric.org</a>. <a id="link_to_whos_using" href="http://sourcefabric.org/en/airtime/whosusing" onclick="window.open(this.href); return false">Sourcefabric.org</a>.
In order to promote your station, "Send support feedback" must be enabled. This data will be collected in addition to the support feedback. In order to promote your station, "Send support feedback" must be enabled. This data will be collected in addition to the support feedback.
</dt> </dt>
<dd id="publicize-element" class="block-display"> <dd id="publicize-element" class="block-display">

View File

@ -17,7 +17,7 @@
</dd> </dd>
<dd id="publicize-element" style="width:90%;"> <dd id="publicize-element" style="width:90%;">
<div class="info-text">Click the box below to advertise your station on <div class="info-text">Click the box below to advertise your station on
<a id="link_to_whos_using" href="http://sourcefabric.org/en/products/airtime_whosusing" onclick="window.open(this.href); return false">Sourcefabric.org</a>. <a id="link_to_whos_using" href="http://sourcefabric.org/en/airtime/whosusing" onclick="window.open(this.href); return false">Sourcefabric.org</a>.
In order to promote your station, "Send support feedback" must be enabled. This data will be collected in addition to the support feedback.</div> In order to promote your station, "Send support feedback" must be enabled. This data will be collected in addition to the support feedback.</div>
<label class="optional" for="Publicise"> <label class="optional" for="Publicise">
<?php echo $this->element->getElement('Publicise') ?> <?php echo $this->element->getElement('Publicise') ?>

View File

@ -93,6 +93,7 @@ class AirtimeProcessEvent(ProcessEvent):
if not event.dir: if not event.dir:
if self.mmc.is_parent_directory(event.pathname, self.config.recorded_directory): if self.mmc.is_parent_directory(event.pathname, self.config.recorded_directory):
self.file_events.append({'mode': self.config.MODE_CREATE, 'filepath': event.pathname, 'is_recorded_show': True}) self.file_events.append({'mode': self.config.MODE_CREATE, 'filepath': event.pathname, 'is_recorded_show': True})
# record the timestamp of the time on IN_CREATE event
self.create_dict[event.pathname] = time.time() self.create_dict[event.pathname] = time.time()
@ -104,7 +105,9 @@ class AirtimeProcessEvent(ProcessEvent):
def process_IN_CLOSE_WRITE(self, event): def process_IN_CLOSE_WRITE(self, event):
self.logger.info("event: %s", event) self.logger.info("event: %s", event)
self.logger.info("create_dict: %s", self.create_dict) self.logger.info("create_dict: %s", self.create_dict)
if event.pathname in self.create_dict: if event.pathname in self.create_dict:
# detele corresponding entry from create_dict
self.create_dict.pop(event.pathname) self.create_dict.pop(event.pathname)
self.handle_created_file(event.dir, event.pathname, event.name) self.handle_created_file(event.dir, event.pathname, event.name)
@ -144,6 +147,9 @@ class AirtimeProcessEvent(ProcessEvent):
self.handle_modified_file(event.dir, event.pathname, event.name) self.handle_modified_file(event.dir, event.pathname, event.name)
def handle_modified_file(self, dir, pathname, name): def handle_modified_file(self, dir, pathname, name):
# 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): if not dir and not self.mmc.is_parent_directory(pathname, self.config.organize_directory):
self.logger.info("Modified: %s", pathname) self.logger.info("Modified: %s", pathname)
if self.mmc.is_audio_file(name): if self.mmc.is_audio_file(name):
@ -267,9 +273,11 @@ class AirtimeProcessEvent(ProcessEvent):
del self.cookies_IN_MOVED_FROM[k] del self.cookies_IN_MOVED_FROM[k]
self.handle_removed_file(False, event.pathname) self.handle_removed_file(False, event.pathname)
# we don't want create_dict grow infinitely
# this part is like a garbage collector
for k, t in self.create_dict.items(): for k, t in self.create_dict.items():
now = time.time() now = time.time()
if now - t > 5: if now - t > 300:
del self.create_dict[k] del self.create_dict[k]
#check for any events received from Airtime. #check for any events received from Airtime.