mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-10 08:33:39 +02:00
Merge branch 'issue195-rlm_filewrite' of https://github.com/deltecent/rivendell into deltecent-issue195-rlm_filewrite
This commit is contained in:
@@ -16,8 +16,10 @@
|
||||
|
||||
; Filename
|
||||
;
|
||||
; The full path to the file to be written. The user running RDAirPlay
|
||||
; must have write permissions for this location.
|
||||
; The full path to the file to be written. The filename may contain filepath
|
||||
; wildcards as defined in Appendix C of the Rivendell Operations and
|
||||
; Administration Guide. The user running RDAirPlay must have write
|
||||
; permissions for this location.
|
||||
Filename=/tmp/rlm_filewrite.txt
|
||||
|
||||
; Append Mode
|
||||
|
@@ -528,3 +528,15 @@ const char *RLMGetStringValue(void *ptr,const char *filename,
|
||||
delete p;
|
||||
return host->plugin_value_string;
|
||||
}
|
||||
|
||||
|
||||
const char *RLMDateTimeDecode(void *ptr, const char *format,
|
||||
const char *svc_name)
|
||||
{
|
||||
RLMHost *host=(RLMHost *)ptr;
|
||||
strncpy(host->plugin_value_string,
|
||||
RDDateTimeDecode(format,QDateTime::currentDateTime(),
|
||||
rdstation_conf,air_config,
|
||||
svc_name),1024);
|
||||
return host->plugin_value_string;
|
||||
}
|
||||
|
@@ -98,6 +98,8 @@ class RDRLMHost : public QObject
|
||||
friend const char *RLMGetStringValue(void *ptr,const char *filename,
|
||||
const char *section,const char *label,
|
||||
const char *default_value);
|
||||
friend const char *RLMDateTimeDecode(void *ptr, const char *format,
|
||||
const char *svc_name);
|
||||
char plugin_value_string[1024];
|
||||
};
|
||||
|
||||
|
@@ -351,6 +351,8 @@ extern "C" {
|
||||
const char *RLMGetStringValue(void *ptr,const char *filename,
|
||||
const char *section,const char *label,
|
||||
const char *default_value);
|
||||
const char *RLMDateTimeDecode(void *ptr, const char *format,
|
||||
const char *svc_name);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -346,6 +346,7 @@ void rlm_filewrite_RLMPadDataSent(void *ptr,const struct rlm_svc *svc,
|
||||
char str[8192];
|
||||
char msg[1500];
|
||||
FILE *f;
|
||||
const char *filename;
|
||||
|
||||
for(i=0;i<rlm_filewrite_devs;i++) {
|
||||
switch(log->log_mach) {
|
||||
@@ -446,22 +447,26 @@ void rlm_filewrite_RLMPadDataSent(void *ptr,const struct rlm_svc *svc,
|
||||
rlm_filewrite_formats+8192*i,
|
||||
rlm_filewrite_encodings[i]),8192);
|
||||
rlm_filewrite_ProcessString(str);
|
||||
if ((filename=RLMDateTimeDecode(ptr,rlm_filewrite_filenames+256*i,svc->svc_name))==NULL) {
|
||||
RLMLog(ptr,LOG_WARNING,"rlm_filewrite: RLMDateTimeDecode failure");
|
||||
return;
|
||||
}
|
||||
if(rlm_filewrite_appends[i]==0) {
|
||||
f=fopen(rlm_filewrite_filenames+256*i,"w");
|
||||
f=fopen(filename,"w");
|
||||
}
|
||||
else {
|
||||
f=fopen(rlm_filewrite_filenames+256*i,"a");
|
||||
f=fopen(filename,"a");
|
||||
}
|
||||
if(f!=NULL) {
|
||||
snprintf(msg,1500,"rlm_filewrite: sending pad update: \"%s\" to \"%s\"",
|
||||
str,rlm_filewrite_filenames+256*i);
|
||||
str,filename);
|
||||
fprintf(f,"%s",str);
|
||||
fclose(f);
|
||||
RLMLog(ptr,LOG_INFO,msg);
|
||||
}
|
||||
else {
|
||||
snprintf(msg,1500,"rlm_filewrite: unable to open file \"%s\"",
|
||||
rlm_filewrite_filenames+256*i);
|
||||
filename);
|
||||
RLMLog(ptr,LOG_WARNING,msg);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user