Merge branch 'deltecent-issue195-rlm_filewrite' into stable

This commit is contained in:
Fred Gleason
2018-05-25 21:57:01 +00:00
6 changed files with 32 additions and 6 deletions

View File

@@ -16912,3 +16912,6 @@
2018-05-25 Fred Gleason <fredg@paravelsystems.com>
* Merged pull request #000194, "Fixed bug in GetStream() where
return value from HPI_OutStreamOpen was ignored".
2018-05-25 Fred Gleason <fredg@paravelsystems.com>
* Merged pull request #000197, "Issue 195 rlm_filewrite filename
wildcards".

View File

@@ -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

View File

@@ -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)
{
RDRLMHost *host=(RDRLMHost *)ptr;
strncpy(host->plugin_value_string,
RDDateTimeDecode(format,QDateTime::currentDateTime(),
rda->station(),rda->config(),
svc_name),1024);
return host->plugin_value_string;
}

View File

@@ -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];
};

View File

@@ -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

View File

@@ -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);
}
}