From bc55c06eee21dc43188bceee9721565622039a69 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Tue, 21 Feb 2017 11:29:16 -0500 Subject: [PATCH] 2017-02-21 Fred Gleason * Removed the 'CategoryGapLookup=' parameter from rlm_tagstation.conf(5). * Added a 'CategoryPromotion=' parameter to rlm_tagstation.conf(5). * Changed the behavior of the TagStation RLM as to not send an update if its group is not explicitly listed in one of the TagStation categories. --- ChangeLog | 7 +++++ conf/rlm_tagstation.conf | 10 +++---- rlm/rlm_tagstation.c | 60 +++++++++++++++++++++------------------- 3 files changed, 44 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b2e7db6..473abf2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15593,3 +15593,10 @@ 2017-02-21 Fred Gleason * Renamed the 'CustomerID' parameter in 'rlm/rlm_tagstation.c' to 'ClientID'. +2017-02-21 Fred Gleason + * Removed the 'CategoryGapLookup=' parameter from + rlm_tagstation.conf(5). + * Added a 'CategoryPromotion=' parameter to rlm_tagstation.conf(5). + * Changed the behavior of the TagStation RLM as to not send an update + if its group is not explicitly listed in one of the TagStation + categories. diff --git a/conf/rlm_tagstation.conf b/conf/rlm_tagstation.conf index 9486afd1..0b210a36 100644 --- a/conf/rlm_tagstation.conf +++ b/conf/rlm_tagstation.conf @@ -50,11 +50,10 @@ ArtistString=%a AlbumString=%l ; TagStation Categories. Each update to TagStation must be labeled as being -; one of four possible categories. Each Rivendell Group can be assigned -; one of the four categories here. The four categories are: +; one of three possible categories. Each Rivendell Group can be assigned +; one of the three categories here. The categories are: ; ; Advertisements -; Gap Lookup ; Music ; Promotions ; @@ -64,9 +63,9 @@ AlbumString=%l ; Multiple groups may be assigned to each category, separated by commas. ; No whitespace! ; -CategoryAdvertisement=TRAFFIC,PROMOS -CategoryGapLookup= +CategoryAdvertisement=TRAFFIC CategoryMusic=MUSIC +CategoryPromotion=PROMOS ; Log Selection @@ -75,6 +74,7 @@ CategoryMusic=MUSIC ; state changes on that log should be output to this instance. If set ; to 'Onair', then output will be generated only if RDAirPlays OnAir flag ; is active. +; MasterLog=Yes Aux1Log=Yes Aux2Log=Yes diff --git a/rlm/rlm_tagstation.c b/rlm/rlm_tagstation.c index 16eff330..d2ce36c6 100644 --- a/rlm/rlm_tagstation.c +++ b/rlm/rlm_tagstation.c @@ -39,7 +39,7 @@ char *rlm_tagstation_titles; char *rlm_tagstation_artists; char *rlm_tagstation_albums; char *rlm_tagstation_adps; -char *rlm_tagstation_etos; +char *rlm_tagstation_pros; char *rlm_tagstation_muss; int *rlm_tagstation_masters; int *rlm_tagstation_aux1s; @@ -65,13 +65,13 @@ char *rlm_tagstation_GetCategory(const char *grp_name,int num) { static char ret[3]; - strncpy(ret,"PRO",3); + memset(ret,0,3); if(strlen(grp_name)!=0) { if(rlm_tagstation_ContainsString(rlm_tagstation_adps+256*num,grp_name)>0) { strncpy(ret,"ADP",3); } - if(rlm_tagstation_ContainsString(rlm_tagstation_etos+256*num,grp_name)>0) { - strncpy(ret,"ETO",3); + if(rlm_tagstation_ContainsString(rlm_tagstation_pros+256*num,grp_name)>0) { + strncpy(ret,"PRO",3); } if(rlm_tagstation_ContainsString(rlm_tagstation_muss+256*num,grp_name)>0) { strncpy(ret,"MUS",3); @@ -124,7 +124,7 @@ void rlm_tagstation_RLMStart(void *ptr,const char *arg) rlm_tagstation_artists=NULL; rlm_tagstation_albums=NULL; rlm_tagstation_adps=NULL; - rlm_tagstation_etos=NULL; + rlm_tagstation_pros=NULL; rlm_tagstation_muss=NULL; rlm_tagstation_masters=NULL; rlm_tagstation_aux1s=NULL; @@ -163,9 +163,9 @@ void rlm_tagstation_RLMStart(void *ptr,const char *arg) strncpy(rlm_tagstation_adps+256*rlm_tagstation_devs, RLMGetStringValue(ptr,arg,section,"CategoryAdvertisement",""),256); - rlm_tagstation_etos=realloc(rlm_tagstation_etos,(rlm_tagstation_devs+1)*256); - strncpy(rlm_tagstation_etos+256*rlm_tagstation_devs, - RLMGetStringValue(ptr,arg,section,"CategoryGapLookup",""),256); + rlm_tagstation_pros=realloc(rlm_tagstation_pros,(rlm_tagstation_devs+1)*256); + strncpy(rlm_tagstation_pros+256*rlm_tagstation_devs, + RLMGetStringValue(ptr,arg,section,"CategoryPromotion",""),256); rlm_tagstation_muss=realloc(rlm_tagstation_muss,(rlm_tagstation_devs+1)*256); strncpy(rlm_tagstation_muss+256*rlm_tagstation_devs, @@ -203,7 +203,7 @@ void rlm_tagstation_RLMFree(void *ptr) free(rlm_tagstation_artists); free(rlm_tagstation_albums); free(rlm_tagstation_adps); - free(rlm_tagstation_etos); + free(rlm_tagstation_pros); free(rlm_tagstation_muss); free(rlm_tagstation_masters); free(rlm_tagstation_aux1s); @@ -222,6 +222,7 @@ void rlm_tagstation_RLMPadDataSent(void *ptr,const struct rlm_svc *svc, char fmt[1024]; char url[4096]; char msg[1500]; + char category[4]; for(i=0;ilog_mach) { @@ -238,28 +239,31 @@ void rlm_tagstation_RLMPadDataSent(void *ptr,const struct rlm_svc *svc, break; } if((flag==1)||((flag==2)&&(log->log_onair!=0))) { - snprintf(fmt,1024,"https://tsl.tagstation.com/tsl.ashx?CID=%s&Title=%s&Artist=%s&Album=%s&EventCategory=%s&EventID=%%n&Duration=%%h&LookAhead=False", - rlm_tagstation_clientids+256*i, - rlm_tagstation_titles+256*i, - rlm_tagstation_artists+256*i, - rlm_tagstation_albums+256*i, - rlm_tagstation_GetCategory(now->rlm_group,i)); + strncpy(category,rlm_tagstation_GetCategory(now->rlm_group,i),3); + if(category[0]!=0) { + snprintf(fmt,1024,"https://tsl.tagstation.com/tsl.ashx?CID=%s&Title=%s&Artist=%s&Album=%s&EventCategory=%s&EventID=%%n&Duration=%%h&LookAhead=False", + rlm_tagstation_clientids+256*i, + rlm_tagstation_titles+256*i, + rlm_tagstation_artists+256*i, + rlm_tagstation_albums+256*i, + category); - strncpy(url,RLMResolveNowNextEncoded(ptr,now,next,fmt,RLM_ENCODE_URL), - 4096); - snprintf(account,1024,"%s:%s",rlm_tagstation_clientids+256*i, - rlm_tagstation_passwords+256*i); - if(strlen(now->rlm_title)!=0) { - if(fork()==0) { - execlp("curl","curl","-u",account,"-o","/dev/null","-s", - url,(char *)NULL); - RLMLog(ptr,LOG_WARNING,"rlm_tagstation: unable to execute curl(1)"); - exit(0); + strncpy(url,RLMResolveNowNextEncoded(ptr,now,next,fmt,RLM_ENCODE_URL), + 4096); + snprintf(account,1024,"%s:%s",rlm_tagstation_clientids+256*i, + rlm_tagstation_passwords+256*i); + if(strlen(now->rlm_title)!=0) { + if(fork()==0) { + execlp("curl","curl","-u",account,"-o","/dev/null","-s", + url,(char *)NULL); + RLMLog(ptr,LOG_WARNING,"rlm_tagstation: unable to execute curl(1)"); + exit(0); + } } + snprintf(msg,1500,"rlm_tagstation: sending pad update: \"%s\"", + (const char *)url); + RLMLog(ptr,LOG_INFO,msg); } - snprintf(msg,1500,"rlm_tagstation: sending pad update: \"%s\"", - (const char *)url); - RLMLog(ptr,LOG_INFO,msg); } } }