Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
c6ab540120
|
@ -454,6 +454,8 @@ class ApiController extends Zend_Controller_Action
|
|||
$showCanceled = true;
|
||||
}
|
||||
|
||||
// TODO : the following is inefficient because it calls save on both
|
||||
// fields
|
||||
$file->setMetadataValue('MDATA_KEY_CREATOR', "Airtime Show Recorder");
|
||||
$file->setMetadataValue('MDATA_KEY_TRACKNUMBER', $show_instance_id);
|
||||
|
||||
|
@ -513,11 +515,11 @@ class ApiController extends Zend_Controller_Action
|
|||
$file->setMetadata($md);
|
||||
}
|
||||
} elseif ($mode == "moved") {
|
||||
$md5 = $md['MDATA_KEY_MD5'];
|
||||
$file = Application_Model_StoredFile::RecallByMd5($md5);
|
||||
$file = Application_Model_StoredFile::RecallByFilepath(
|
||||
$md['MDATA_KEY_ORIGINAL_PATH']);
|
||||
|
||||
if (is_null($file)) {
|
||||
return "File doesn't exist in Airtime.";
|
||||
$return_hash['error'] = 'File does not exist in Airtime';
|
||||
} else {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
//$filepath = str_replace("\\", "", $filepath);
|
||||
|
@ -661,6 +663,7 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
} elseif ($mode == "moved") {
|
||||
$md5 = $md['MDATA_KEY_MD5'];
|
||||
Logging::info("Original path: {$md['MDATA_KEY_ORIGINAL_PATH']}");
|
||||
$file = Application_Model_StoredFile::RecallByMd5($md5);
|
||||
|
||||
if (is_null($file)) {
|
||||
|
|
|
@ -226,6 +226,7 @@ class Application_Model_StoredFile
|
|||
return;
|
||||
}
|
||||
if (isset($this->_dbMD[$p_category])) {
|
||||
// TODO : fix this crust -- RG
|
||||
$propelColumn = $this->_dbMD[$p_category];
|
||||
$method = "set$propelColumn";
|
||||
$this->_file->$method($p_value);
|
||||
|
@ -315,12 +316,13 @@ class Application_Model_StoredFile
|
|||
*/
|
||||
public function getPlaylists()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$sql = "SELECT playlist_id "
|
||||
." FROM cc_playlist"
|
||||
." WHERE file_id = :file_id";
|
||||
$sql = <<<SQL
|
||||
SELECT playlist_id
|
||||
FROM cc_playlist
|
||||
WHERE file_id = :file_id
|
||||
SQL;
|
||||
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindParam(':file_id', $this->id, PDO::PARAM_INT);
|
||||
|
@ -332,14 +334,13 @@ class Application_Model_StoredFile
|
|||
throw new Exception("Error: $msg");
|
||||
}
|
||||
|
||||
$playlists = array();
|
||||
if (is_array($ids) && count($ids) > 0) {
|
||||
foreach ($ids as $id) {
|
||||
$playlists[] = Application_Model_Playlist::Recall($id);
|
||||
}
|
||||
return array_map( function ($id) {
|
||||
return Application_Model_Playlist::Recall($id);
|
||||
}, $ids);
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
|
||||
return $playlists;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -593,7 +594,6 @@ class Application_Model_StoredFile
|
|||
public function getName()
|
||||
{
|
||||
$info = pathinfo($this->getFilePath());
|
||||
|
||||
return $info['filename'];
|
||||
}
|
||||
|
||||
|
@ -1024,11 +1024,8 @@ class Application_Model_StoredFile
|
|||
|
||||
public static function getFileCount()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$sql = "SELECT count(*) as cnt FROM cc_files WHERE file_exists";
|
||||
|
||||
return $con->query($sql)->fetchColumn(0);
|
||||
}
|
||||
|
||||
|
@ -1101,10 +1098,14 @@ class Application_Model_StoredFile
|
|||
try {
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$sql = "SELECT soundcloud_id as id, soundcloud_upload_time"
|
||||
." FROM CC_FILES"
|
||||
." WHERE (id != -2 and id != -3) and"
|
||||
." (soundcloud_upload_time >= (now() - (INTERVAL '1 day')))";
|
||||
$sql = <<<SQL
|
||||
SELECT soundcloud_id AS id,
|
||||
soundcloud_upload_time
|
||||
FROM CC_FILES
|
||||
WHERE (id != -2
|
||||
AND id != -3)
|
||||
AND (soundcloud_upload_time >= (now() - (INTERVAL '1 day')))
|
||||
SQL;
|
||||
|
||||
$rows = $con->query($sql)->fetchAll();
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
|||
$di = new DateInterval("PT{$hours}H{$min}M{$sec}S");
|
||||
|
||||
return $di->format("%Hh %Im");
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ class AirtimeMessageReceiver(Loggable):
|
|||
msg['directory'])
|
||||
self.new_watch(msg)
|
||||
else:
|
||||
self.__reFalsequest_now_bootstrap( directory=msg['directory'],
|
||||
self.__request_now_bootstrap( directory=msg['directory'],
|
||||
all_files=restart)
|
||||
self.manager.add_watch_directory(msg['directory'])
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ class BaseEvent(Loggable):
|
|||
# nothing to see here, please move along
|
||||
def morph_into(self, evt):
|
||||
self.logger.info("Morphing %s into %s" % ( str(self), str(evt) ) )
|
||||
self._raw_event = evt
|
||||
self._raw_event = evt._raw_event
|
||||
self.path = evt.path
|
||||
self.__class__ = evt.__class__
|
||||
# Clean up old hook and transfer the new events hook
|
||||
|
@ -181,11 +181,14 @@ class MoveFile(BaseEvent, HasMetaData):
|
|||
"""
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(MoveFile, self).__init__(*args, **kwargs)
|
||||
def old_path(self):
|
||||
return self._raw_event.src_pathname
|
||||
def pack(self):
|
||||
req_dict = {}
|
||||
req_dict['mode'] = u'moved'
|
||||
req_dict = {}
|
||||
req_dict['mode'] = u'moved'
|
||||
req_dict['MDATA_KEY_ORIGINAL_PATH'] = self.old_path()
|
||||
req_dict['MDATA_KEY_FILEPATH'] = unicode( self.path )
|
||||
req_dict['MDATA_KEY_MD5'] = self.metadata.extract()['MDATA_KEY_MD5']
|
||||
req_dict['MDATA_KEY_FILEPATH'] = unicode( self.path )
|
||||
return [req_dict]
|
||||
|
||||
class ModifyFile(BaseEvent, HasMetaData):
|
||||
|
|
|
@ -231,6 +231,8 @@ class Manager(Loggable):
|
|||
else:
|
||||
self.logger.info("'%s' is not being watched, hence cannot be \
|
||||
removed" % watch_dir)
|
||||
self.logger.info("The directories we are watching now are:")
|
||||
self.logger.info( self.__wd_path )
|
||||
|
||||
def loop(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue