Tim,

I have modified the ANDO rlm to work with the Arctic Palm system.

It is set up to mimic the standard output of a Simian System.  If you use
it one would need to select Simian as the music format, and assign Music
and Commercial categories.

I have attached the rlm c file and configuration file, you would need to
compile the rlm as usual for your system.

T.J. Misilo
WFIT
Melbourne, FL

On Mon, Jun 17, 2019 at 4:52 PM Tim Camp <[email protected]> wrote:

> Greetings,
>
> According to Artic Palm they have several stations using their software
> who are running Rivendell.
>
> If anyone is? What rlm are you using?
> Specifically trying to get around (once again) send duration in the format
> they desire which is either total seconds or mm:as
>
> Now and next of course outputs duration in milliseconds.
>
> Trying to not have to add a script into this process to convert.
>
> Tim Camp
> WZEW-FM
> Mobile, Al
>
> _______________________________________________
> Rivendell-dev mailing list
> [email protected]
> http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
>
/* rlm_centerstage.c
 *
 *   (C) Copyright 2009 Fred Gleason <[email protected]>
 * 
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License version 2
 *   as published by the Free Software Foundation.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public
 *   License along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * This is a Rivendell Loadable Module.  It sends Now&Next PAD data to a
 * Artic Palm Center Stage RDS Middlewere system.  Options are specified in the 
configuration 
 * file pointed to by the plugin argument.
 *
 * To compile this module, just do:
 * 
 *   gcc -shared -o rlm_centerstage.rlm rlm_centerstage.c
 *                         */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <rlm/rlm.h>

int rlm_centerstage_devs;
char *rlm_centerstage_addresses;
uint16_t *rlm_centerstage_ports;
char *rlm_centerstage_titles;
char *rlm_centerstage_artists;
char *rlm_centerstage_albums;
char *rlm_centerstage_labels;
int *rlm_centerstage_masters;
int *rlm_centerstage_aux1s;
int *rlm_centerstage_aux2s;

int rlm_centerstage_GetLogStatus(void *ptr,const char *arg,const char *section,
                            const char *logname)
{
  const char *tag=RLMGetStringValue(ptr,arg,section,logname,"");
  if(strcasecmp(tag,"yes")==0) {
    return 1;
  }
  if(strcasecmp(tag,"on")==0) {
    return 1;
  }
  if(strcasecmp(tag,"true")==0) {
    return 1;
  }
  if(strcasecmp(tag,"no")==0) {
    return 0;
  }
  if(strcasecmp(tag,"off")==0) {
    return 0;
  }
  if(strcasecmp(tag,"false")==0) {
    return 0;
  }
  if(strcasecmp(tag,"onair")==0) {
    return 2;
  }  
  return 0;
}


void rlm_centerstage_RLMStart(void *ptr,const char *arg)
{
  char address[17];
  char section[256];
  char errtext[256];
  int i=1;

  rlm_centerstage_devs=0;
  rlm_centerstage_addresses=NULL;
  rlm_centerstage_ports=NULL;
  rlm_centerstage_masters=NULL;
  rlm_centerstage_aux1s=NULL;
  rlm_centerstage_aux2s=NULL;

  sprintf(section,"System%d",i++);
  strncpy(address,RLMGetStringValue(ptr,arg,section,"IpAddress",""),15);
  if(strlen(address)==0) {
    RLMLog(ptr,LOG_WARNING,"rlm_centerstage: no centerstage destinations 
specified");
    return;
  }
  while(strlen(address)>0) {
    rlm_centerstage_addresses=
      
realloc(rlm_centerstage_addresses,(rlm_centerstage_devs+1)*(rlm_centerstage_devs+1)*16);
    strcpy(rlm_centerstage_addresses+16*rlm_centerstage_devs,address);
    
rlm_centerstage_ports=realloc(rlm_centerstage_ports,(rlm_centerstage_devs+1)*sizeof(uint16_t));
    rlm_centerstage_ports[rlm_centerstage_devs]=
      RLMGetIntegerValue(ptr,arg,section,"UdpPort",0);
    
rlm_centerstage_titles=realloc(rlm_centerstage_titles,(rlm_centerstage_devs+1)*256);
    strncpy(rlm_centerstage_titles+256*rlm_centerstage_devs,
            RLMGetStringValue(ptr,arg,section,"Title",""),256);
    
rlm_centerstage_artists=realloc(rlm_centerstage_artists,(rlm_centerstage_devs+1)*256);
    strncpy(rlm_centerstage_artists+256*rlm_centerstage_devs,
            RLMGetStringValue(ptr,arg,section,"Artist",""),256);
    
rlm_centerstage_albums=realloc(rlm_centerstage_albums,(rlm_centerstage_devs+1)*256);
    strncpy(rlm_centerstage_albums+256*rlm_centerstage_devs,
            RLMGetStringValue(ptr,arg,section,"Album",""),256);
    
rlm_centerstage_labels=realloc(rlm_centerstage_labels,(rlm_centerstage_devs+1)*256);
    strncpy(rlm_centerstage_labels+256*rlm_centerstage_devs,
            RLMGetStringValue(ptr,arg,section,"Label",""),256);
    rlm_centerstage_masters=realloc(rlm_centerstage_masters,
                            (rlm_centerstage_devs+1)*sizeof(int));
    rlm_centerstage_masters[rlm_centerstage_devs]=
      rlm_centerstage_GetLogStatus(ptr,arg,section,"MasterLog");
    rlm_centerstage_aux1s=realloc(rlm_centerstage_aux1s,
                          (rlm_centerstage_devs+1)*sizeof(int));
    rlm_centerstage_aux1s[rlm_centerstage_devs]=
      rlm_centerstage_GetLogStatus(ptr,arg,section,"Aux1Log");
    rlm_centerstage_aux2s=realloc(rlm_centerstage_aux2s,
                          (rlm_centerstage_devs+1)*sizeof(int));
    rlm_centerstage_aux2s[rlm_centerstage_devs]=
      rlm_centerstage_GetLogStatus(ptr,arg,section,"Aux2Log");
    sprintf(errtext,"rlm_centerstage: configured destination \"%s:%d\"",address,
            rlm_centerstage_ports[rlm_centerstage_devs]);
    rlm_centerstage_devs++;
    RLMLog(ptr,LOG_INFO,errtext);
    sprintf(section,"System%d",i++);
    strncpy(address,RLMGetStringValue(ptr,arg,section,"IpAddress",""),15);
  }
}


void rlm_centerstage_RLMFree(void *ptr)
{
  free(rlm_centerstage_addresses);
  free(rlm_centerstage_ports);
  free(rlm_centerstage_titles);
  free(rlm_centerstage_artists);
  free(rlm_centerstage_albums);
  free(rlm_centerstage_labels);
  free(rlm_centerstage_masters);
  free(rlm_centerstage_aux1s);
  free(rlm_centerstage_aux2s);
}


void rlm_centerstage_RLMPadDataSent(void *ptr,const struct rlm_svc *svc,
                             const struct rlm_log *log,
                             const struct rlm_pad *now,
                             const struct rlm_pad *next)
{
  int i;
  int flag=0;
  char fmt[1024];
  char msg[1500];
  int seconds;
  int minutes;

  for(i=0;i<rlm_centerstage_devs;i++) {
    switch(log->log_mach) {
      case 0:
        flag=rlm_centerstage_masters[i];
        break;

      case 1:
        flag=rlm_centerstage_aux1s[i];
        break;

      case 2:
        flag=rlm_centerstage_aux2s[i];
        break;
    }
    if((flag==1)||((flag==2)&&(log->log_onair!=0))) {
      if(strlen(rlm_centerstage_labels+256*i)==0) {  // Original format
        
//[***TITLE***],[***ARTIST***],[***LTIME***],[***CATEGORY***],[***ALBUM***],[AUDIO]
 |
        //snprintf(fmt,1024,"[%s],[%s],[%03d],[%%g],[%s],[AUDIO]|",
        snprintf(fmt,1024,"[%s],[%s],[%02d:%02d],[%%g],[%s],[AUDIO]|",
                 rlm_centerstage_titles+256*i,
                 rlm_centerstage_artists+256*i,
                 now->rlm_len/60000,(now->rlm_len%60000)/1000,
                 rlm_centerstage_albums+256*i);
      }
      else {  // Enhanced format
        seconds=(now->rlm_len/1000);
        snprintf(fmt,1024,"[%s],[%s],[%03d],[%%g],[%s],[AUDIO]|",
                 rlm_centerstage_titles+256*i,
                 rlm_centerstage_artists+256*i,
                 seconds,
                 rlm_centerstage_albums+256*i);
      }
      const char *str=RLMResolveNowNext(ptr,now,next,fmt);
      
RLMSendUdp(ptr,rlm_centerstage_addresses+i*16,rlm_centerstage_ports[i],str,strlen(str));
      snprintf(msg,1500,"rlm_centerstage: sending pad update: \"%s\"",
               (const char *)str);
      RLMLog(ptr,LOG_INFO,msg);
    }
  }
}


Attachment: rlm_centerstage.conf
Description: Binary data

_______________________________________________
Rivendell-dev mailing list
[email protected]
http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev

Reply via email to