Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
18caafac48
airtime_mvc/application
python_apps/media-monitor
|
@ -42,4 +42,25 @@ class Application_Common_OsPath{
|
|||
else
|
||||
return '.';
|
||||
}
|
||||
|
||||
/* Similar to the os.path.join python method
|
||||
* http://stackoverflow.com/a/1782990/276949 */
|
||||
function join() {
|
||||
$args = func_get_args();
|
||||
$paths = array();
|
||||
|
||||
foreach($args as $arg) {
|
||||
$paths = array_merge($paths, (array)$arg);
|
||||
}
|
||||
|
||||
foreach($paths as &$path) {
|
||||
$path = trim($path, DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
if (substr($args[0], 0, 1) == DIRECTORY_SEPARATOR) {
|
||||
$paths[0] = DIRECTORY_SEPARATOR . $paths[0];
|
||||
}
|
||||
|
||||
return join(DIRECTORY_SEPARATOR, $paths);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ class Application_Model_ShowBuilder {
|
|||
$this->getScheduledStatus($startsEpoch, min($endsEpoch, $showEndEpoch), $row);
|
||||
|
||||
$row["id"] = intval($p_item["sched_id"]);
|
||||
$row["image"] = $p_item["file_exists"] == "t" ? true : false;
|
||||
$row["image"] = $p_item["file_exists"];
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
$row["starts"] = $schedStartDT->format("H:i:s");
|
||||
$row["ends"] = $schedEndDT->format("H:i:s");
|
||||
|
|
|
@ -841,8 +841,7 @@ Logging::log("getting media! - 2");
|
|||
//check to see if there is enough space in $stor to continue.
|
||||
$enough_space = Application_Model_StoredFile::checkForEnoughDiskSpaceToCopy($stor, $audio_file);
|
||||
if ($enough_space){
|
||||
$stor .= "/organize";
|
||||
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
|
||||
$audio_stor = Application_Common_OsPath::join($stor, "organize", $fileName);
|
||||
|
||||
Logging::log("copyFileToStor: moving file $audio_file to $audio_stor");
|
||||
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
|
||||
|
|
|
@ -5,6 +5,7 @@ import sys
|
|||
import os
|
||||
import signal
|
||||
import traceback
|
||||
import locale
|
||||
|
||||
from api_clients import api_client as apc
|
||||
from std_err_override import LogWriter
|
||||
|
@ -38,7 +39,16 @@ except Exception, e:
|
|||
|
||||
logger.info("\n\n*** Media Monitor bootup ***\n\n")
|
||||
|
||||
|
||||
try:
|
||||
fs_encoding = locale.getdefaultlocale()[1].lower()
|
||||
if fs_encoding not in ['utf-8', 'utf8']:
|
||||
logger.error("Filesystem encoding needs to be UTF-8. Currently '%s'. Exiting..." % fs_encoding)
|
||||
sys.exit(1)
|
||||
else:
|
||||
logger.debug("Filesystem encoding: '%s'" % fs_encoding)
|
||||
|
||||
|
||||
config = AirtimeMediaConfig(logger)
|
||||
api_client = apc.api_client_factory(config.cfg)
|
||||
api_client.register_component("media-monitor")
|
||||
|
|
Loading…
Reference in New Issue