mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-25 16:58:04 +02:00
2019-01-02 Fred Gleason <fredg@paravelsystems.com>
* Added a 'lineNumber' parameter to the 'padUpdate' structure. * Added a 'FIELD_LINE_NUMBER' data value to PyPAD. * Defined the '%z' metadata wildcard to refer to log line number. * Added a 'lineId' parameter to the 'padUpdate' structure. * Added 'FIELD_LINE_ID' data value to PyPAD. * Defined the '%x' metadata wildcard to refer to log line ID.
This commit is contained in:
parent
b3846cd08c
commit
af9a155965
@ -18259,3 +18259,10 @@
|
||||
2018-12-20 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added a 'pypad_serial.py' PyPAD script.
|
||||
* Removed the 'rlm_serial' RLM.
|
||||
2019-01-02 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added a 'lineNumber' parameter to the 'padUpdate' structure.
|
||||
* Added a 'FIELD_LINE_NUMBER' data value to PyPAD.
|
||||
* Defined the '%z' metadata wildcard to refer to log line number.
|
||||
* Added a 'lineId' parameter to the 'padUpdate' structure.
|
||||
* Added 'FIELD_LINE_ID' data value to PyPAD.
|
||||
* Defined the '%x' metadata wildcard to refer to log line ID.
|
||||
|
@ -46,6 +46,8 @@ TYPE_NEXT='next'
|
||||
# Field Names
|
||||
#
|
||||
FIELD_START_DATETIME='startDateTime'
|
||||
FIELD_LINE_NUMBER='lineNumber'
|
||||
FIELD_LINE_ID='lineId'
|
||||
FIELD_CART_NUMBER='cartNumber'
|
||||
FIELD_CART_TYPE='cartType'
|
||||
FIELD_CUT_NUMBER='cutNumber'
|
||||
@ -393,9 +395,9 @@ class Update(object):
|
||||
string=self.__replaceWildcardPair('u','userDefined',string,esc)
|
||||
#string=self.__replaceWildcardPair('v',sfield,string,esc) # Length, rounded down
|
||||
#string=self.__replaceWildcardPair('w',sfield,string,esc) # Unassigned
|
||||
#string=self.__replaceWildcardPair('x',sfield,string,esc) # Unassigned
|
||||
string=self.__replaceWildcardPair('x','lineId',string,esc) # Log Line ID
|
||||
string=self.__replaceWildcardPair('y','year',string,esc)
|
||||
#string=self.__replaceWildcardPair('z',sfield,string,esc) # Unassigned
|
||||
string=self.__replaceWildcardPair('z','lineNumber',string,esc) # Log Line #
|
||||
string=string.replace('\\b','\b')
|
||||
string=string.replace('\\f','\f')
|
||||
string=string.replace('\\n','\n')
|
||||
@ -480,6 +482,8 @@ class Update(object):
|
||||
PyPAD.FIELD_ISCI - The 'ISCI' field (string)
|
||||
PyPAD.FIELD_LABEL - The 'Label' field (string)
|
||||
PyPAD.FIELD_LENGTH - The 'Length' field (integer)
|
||||
PyPAD.FIELD_LINE_ID - The log line ID (integer)
|
||||
PyPAD.FIELD_LINE_NUMBER - The log line number (integer)
|
||||
PyPAD.FIELD_OUTCUE - The 'Outcue' field (string)
|
||||
PyPAD.FIELD_PUBLISHER - The 'Publisher' field (string)
|
||||
PyPAD.FIELD_SONG_ID - The 'Song ID' field (string)
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# now_and_next.py
|
||||
#
|
||||
# Example PyPAD script for Rivendell
|
||||
# Barebones example PyPAD script for Rivendell
|
||||
#
|
||||
# (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
#
|
||||
@ -35,15 +35,21 @@ import PyPAD
|
||||
# the PAD information is supplied as the single argument.
|
||||
#
|
||||
def ProcessPad(update):
|
||||
print
|
||||
print()
|
||||
if update.hasPadType(PyPAD.TYPE_NOW):
|
||||
print("Log %03d NOW: " % update.machine()+update.resolvePadFields("%a - %t",PyPAD.ESCAPE_NONE))
|
||||
msg='%03d:' % update.machine()
|
||||
msg+='%04d ' % update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_LINE_NUMBER)
|
||||
msg+='NOW: '+update.resolvePadFields('%a - %t',PyPAD.ESCAPE_NONE)
|
||||
print(msg)
|
||||
else:
|
||||
print("Log %03d NOW: [none]" % update.machine())
|
||||
print("%03d:xxxx NOW: [none]" % update.machine())
|
||||
if update.hasPadType(PyPAD.TYPE_NEXT):
|
||||
print("Log %03d NEXT: " % update.machine()+update.resolvePadFields("%A - %T",PyPAD.ESCAPE_NONE))
|
||||
msg='%03d:' % update.machine()
|
||||
msg+='%04d ' % update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_LINE_NUMBER)
|
||||
msg+='NEXT: '+update.resolvePadFields('%A - %T',PyPAD.ESCAPE_NONE)
|
||||
print(msg)
|
||||
else:
|
||||
print("Log %03d NEXT: [none]" % update.machine())
|
||||
print("%03d:xxxx NEXT: [none]" % update.machine())
|
||||
|
||||
#
|
||||
# Create an instance of 'PyPADReceiver'
|
||||
|
@ -59,6 +59,8 @@ def ProcessPad(update):
|
||||
print(' startDateTime(): '+update.startDateTime(PyPAD.TYPE_NOW).isoformat(' '))
|
||||
except AttributeError:
|
||||
print(' startDateTime(): None')
|
||||
print(' lineNumber(): '+str(update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_LINE_NUMBER))+'/'+update.resolvePadFields('%z',PyPAD.ESCAPE_NONE))
|
||||
print(' lineId(): '+str(update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_LINE_ID))+'/'+update.resolvePadFields('%x',PyPAD.ESCAPE_NONE))
|
||||
print(' cartType(): '+update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_CART_TYPE))
|
||||
print(' cartNumber(): %u / ' % update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_CART_NUMBER)+update.resolvePadFields("%n",PyPAD.ESCAPE_NONE))
|
||||
print(' cutNumber(): %u / ' % update.padField(PyPAD.TYPE_NOW,PyPAD.FIELD_CUT_NUMBER)+update.resolvePadFields("%j",PyPAD.ESCAPE_NONE))
|
||||
@ -96,6 +98,8 @@ def ProcessPad(update):
|
||||
print(' startDateTime(): '+update.startDateTime(PyPAD.TYPE_NEXT).isoformat(' '))
|
||||
except AttributeError:
|
||||
print(' startDateTime(): None')
|
||||
print(' lineNumber(): '+str(update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_LINE_NUMBER))+'/'+update.resolvePadFields('%Z',PyPAD.ESCAPE_NONE))
|
||||
print(' lineId(): '+str(update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_LINE_ID))+'/'+update.resolvePadFields('%X',PyPAD.ESCAPE_NONE))
|
||||
print(' cartType(): '+update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_CART_TYPE))
|
||||
print(' cartNumber(): %u / ' % update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_CART_NUMBER)+update.resolvePadFields("%N",PyPAD.ESCAPE_NONE))
|
||||
print(' cutNumber(): %u / ' % update.padField(PyPAD.TYPE_NEXT,PyPAD.FIELD_CUT_NUMBER)+update.resolvePadFields("%J",PyPAD.ESCAPE_NONE))
|
||||
|
@ -38,9 +38,9 @@
|
||||
<row><entry><userinput>%u</userinput></entry><entry><userinput>%U</userinput></entry><entry>User Definied</entry></row>
|
||||
<row><entry><userinput>%v</userinput></entry><entry><userinput>%V</userinput></entry><entry>Event length (seconds, rounded down)</entry></row>
|
||||
<row><entry><userinput>%w</userinput></entry><entry><userinput>%W</userinput></entry><entry>[Unassigned]</entry></row>
|
||||
<row><entry><userinput>%x</userinput></entry><entry><userinput>%X</userinput></entry><entry>[Unassigned]</entry></row>
|
||||
<row><entry><userinput>%x</userinput></entry><entry><userinput>%X</userinput></entry><entry>Log line ID (numeric)</entry></row>
|
||||
<row><entry><userinput>%y</userinput></entry><entry><userinput>%Y</userinput></entry><entry>Release Year</entry></row>
|
||||
<row><entry><userinput>%z</userinput></entry><entry><userinput>%Z</userinput></entry><entry>[Unassigned]</entry></row>
|
||||
<row><entry><userinput>%z</userinput></entry><entry><userinput>%Z</userinput></entry><entry>Log line number (numeric)</entry></row>
|
||||
<row><entry><userinput>\r</userinput></entry><entry><userinput>\r</userinput></entry><entry>Literal Carriage Return (ASCII 13)</entry></row>
|
||||
<row><entry><userinput>\n</userinput></entry><entry><userinput>\n</userinput></entry><entry>Literal Linefeed (ASCII 10)</entry></row>
|
||||
</tbody>
|
||||
|
@ -3002,7 +3002,8 @@ void RDLogPlay::SendNowNext()
|
||||
QDateTime(QDate::currentDate(),logline[0]->startTime(RDLogLine::Actual));
|
||||
}
|
||||
play_pad_socket->
|
||||
write(GetPadJson("now",logline[0],start_datetime,8,false).toUtf8());
|
||||
write(GetPadJson("now",logline[0],start_datetime,now_line,8,false).
|
||||
toUtf8());
|
||||
|
||||
//
|
||||
// Next
|
||||
@ -3012,7 +3013,7 @@ void RDLogPlay::SendNowNext()
|
||||
next_datetime=start_datetime.addSecs(logline[0]->forcedLength()/1000);
|
||||
}
|
||||
play_pad_socket->write(GetPadJson("next",logline[1],
|
||||
next_datetime,8,true).toUtf8());
|
||||
next_datetime,nextLine(),8,true).toUtf8());
|
||||
|
||||
//
|
||||
// Commit the update
|
||||
@ -3031,12 +3032,12 @@ void RDLogPlay::SendNowNext()
|
||||
//
|
||||
// Premordial integrated interface
|
||||
//
|
||||
RDResolveNowNext(&cmd,logline,0);
|
||||
RDResolveNowNext(&cmd,logline,now_line,0);
|
||||
play_nownext_socket->
|
||||
writeBlock(cmd,cmd.length(),play_nownext_address,play_nownext_port);
|
||||
|
||||
cmd=play_nownext_rml;
|
||||
RDResolveNowNext(&cmd,logline,0);
|
||||
RDResolveNowNext(&cmd,logline,now_line,0);
|
||||
play_event_player->exec(cmd);
|
||||
|
||||
//
|
||||
@ -3052,8 +3053,8 @@ void RDLogPlay::SendNowNext()
|
||||
|
||||
|
||||
QString RDLogPlay::GetPadJson(const QString &name,RDLogLine *ll,
|
||||
const QDateTime &start_datetime,int padding,
|
||||
bool final) const
|
||||
const QDateTime &start_datetime,int line,
|
||||
int padding,bool final) const
|
||||
{
|
||||
QString ret;
|
||||
|
||||
@ -3068,6 +3069,8 @@ QString RDLogPlay::GetPadJson(const QString &name,RDLogLine *ll,
|
||||
else {
|
||||
ret+=RDJsonNullField("startDateTime",4+padding);
|
||||
}
|
||||
ret+=RDJsonField("lineNumber",line,4+padding);
|
||||
ret+=RDJsonField("lineId",ll->id(),4+padding);
|
||||
ret+=RDJsonField("cartNumber",ll->cartNumber(),4+padding);
|
||||
ret+=RDJsonField("cartType",RDCart::typeText(ll->cartType()),4+padding);
|
||||
if(ll->cartType()==RDCart::Audio) {
|
||||
|
@ -190,7 +190,7 @@ class RDLogPlay : public QObject,public RDLogEvent
|
||||
bool ClearBlock(int start_line);
|
||||
void SendNowNext();
|
||||
QString GetPadJson(const QString &name,RDLogLine *ll,
|
||||
const QDateTime &start_datetime,int padding,
|
||||
const QDateTime &start_datetime,int line,int padding,
|
||||
bool final=false) const;
|
||||
void LogTraffic(RDLogLine *logline,RDLogLine::PlaySource src,
|
||||
RDAirPlayConf::TrafficAction action,bool onair_flag) const;
|
||||
|
@ -73,7 +73,7 @@ QString RDResolveNowNextEncode(const QString &str,int encoding)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void RDResolveNowNext(QString *str,RDLogLine **loglines,int encoding)
|
||||
void RDResolveNowNext(QString *str,RDLogLine **loglines,int line,int encoding)
|
||||
{
|
||||
//
|
||||
// NOW PLAYING Event
|
||||
@ -104,6 +104,7 @@ void RDResolveNowNext(QString *str,RDLogLine **loglines,int encoding)
|
||||
str->replace("%o",RDResolveNowNextEncode(loglines[0]->outcue(),encoding));
|
||||
str->replace("%i",RDResolveNowNextEncode(loglines[0]->description(),
|
||||
encoding));
|
||||
str->replace("%x",QString().sprintf("%d",loglines[0]->id()));
|
||||
RDResolveNowNextDateTime(str,"%d(",loglines[0]->startDatetime());
|
||||
}
|
||||
else { // No NOW PLAYING Event
|
||||
@ -125,6 +126,7 @@ void RDResolveNowNext(QString *str,RDLogLine **loglines,int encoding)
|
||||
str->replace("%u","");
|
||||
str->replace("%o","");
|
||||
str->replace("%i","");
|
||||
str->replace("%z","");
|
||||
RDResolveNowNextDateTime(str,"%d(",QDateTime());
|
||||
}
|
||||
|
||||
@ -156,6 +158,7 @@ void RDResolveNowNext(QString *str,RDLogLine **loglines,int encoding)
|
||||
str->replace("%O",RDResolveNowNextEncode(loglines[1]->outcue(),encoding));
|
||||
str->replace("%I",RDResolveNowNextEncode(loglines[1]->description(),
|
||||
encoding));
|
||||
str->replace("%X",QString().sprintf("%d",loglines[1]->id()));
|
||||
RDResolveNowNextDateTime(str,"%D(",loglines[1]->startDatetime());
|
||||
}
|
||||
else { // No NEXT Event
|
||||
@ -177,6 +180,7 @@ void RDResolveNowNext(QString *str,RDLogLine **loglines,int encoding)
|
||||
str->replace("%U","");
|
||||
str->replace("%O","");
|
||||
str->replace("%I","");
|
||||
str->replace("%X","");
|
||||
RDResolveNowNextDateTime(str,"%D(",QDateTime());
|
||||
}
|
||||
str->replace("%%","%");
|
||||
@ -185,7 +189,7 @@ void RDResolveNowNext(QString *str,RDLogLine **loglines,int encoding)
|
||||
}
|
||||
|
||||
|
||||
QString RDResolveNowNext(const QString &pattern,RDLogLine *ll)
|
||||
QString RDResolveNowNext(const QString &pattern,RDLogLine *ll,int line)
|
||||
{
|
||||
QString ret=pattern;
|
||||
|
||||
|
@ -24,8 +24,8 @@
|
||||
#include <rdlog_line.h>
|
||||
#include "../apis/rlm/rlm.h"
|
||||
|
||||
void RDResolveNowNext(QString *str,RDLogLine **loglines,int encoding);
|
||||
QString RDResolveNowNext(const QString &pattern,RDLogLine *ll);
|
||||
void RDResolveNowNext(QString *str,RDLogLine **loglines,int line,int encoding);
|
||||
QString RDResolveNowNext(const QString &pattern,RDLogLine *ll,int line);
|
||||
|
||||
|
||||
#endif // RDNOWNEXT_H
|
||||
|
@ -436,7 +436,7 @@ const char *RLMResolveNowNextEncoded(void *ptr,const struct rlm_pad *now,
|
||||
loglines[1]=new RDLogLine();
|
||||
RDRLMHost::saveMetadata(now,loglines[0]);
|
||||
RDRLMHost::saveMetadata(next,loglines[1]);
|
||||
RDResolveNowNext(&str,loglines,encoding);
|
||||
RDResolveNowNext(&str,loglines,0,encoding);
|
||||
strncpy(host->plugin_value_string,str,1024);
|
||||
delete loglines[1];
|
||||
delete loglines[0];
|
||||
|
@ -352,7 +352,7 @@ void RDSlotBox::setCart(RDLogLine *logline)
|
||||
(!line_logline->originDateTime().isValid())) {
|
||||
line_title_label->
|
||||
setText(RDResolveNowNext(line_airplay_conf->titleTemplate(),
|
||||
logline));
|
||||
logline,log_id+1));
|
||||
}
|
||||
else {
|
||||
line_title_label->setText(line_logline->title()+" -- "+
|
||||
@ -362,10 +362,10 @@ void RDSlotBox::setCart(RDLogLine *logline)
|
||||
}
|
||||
line_description_label->
|
||||
setText(RDResolveNowNext(line_airplay_conf->descriptionTemplate(),
|
||||
logline));
|
||||
logline,log_id+1));
|
||||
line_artist_label->
|
||||
setText(RDResolveNowNext(line_airplay_conf->artistTemplate(),
|
||||
logline));
|
||||
logline,log_id+1));
|
||||
line_up_label->
|
||||
setText(RDGetTimeLength(line_logline->playPosition(),true,true));
|
||||
line_down_label->
|
||||
@ -378,7 +378,7 @@ void RDSlotBox::setCart(RDLogLine *logline)
|
||||
setText(QString().sprintf("%03u",logline->cutNumber()));
|
||||
line_outcue_label->
|
||||
setText(RDResolveNowNext(line_airplay_conf->outcueTemplate(),
|
||||
logline));
|
||||
logline,log_id+1));
|
||||
line_position_bar->show();
|
||||
line_up_label->show();
|
||||
line_down_label->show();
|
||||
|
@ -526,7 +526,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type,
|
||||
line_logline->originUser().isEmpty()||
|
||||
(!line_logline->originDateTime().isValid())) {
|
||||
line_title_label->
|
||||
setText(RDResolveNowNext(line_title_template,line_logline));
|
||||
setText(RDResolveNowNext(line_title_template,line_logline,line));
|
||||
}
|
||||
else {
|
||||
line_title_label->setText(line_logline->title()+" -- "+
|
||||
@ -535,9 +535,10 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type,
|
||||
toString("M/d hh:mm"));
|
||||
}
|
||||
line_description_label->
|
||||
setText(RDResolveNowNext(line_description_template,line_logline));
|
||||
setText(RDResolveNowNext(line_description_template,line_logline,
|
||||
line));
|
||||
line_artist_label->
|
||||
setText(RDResolveNowNext(line_artist_template,line_logline));
|
||||
setText(RDResolveNowNext(line_artist_template,line_logline,line));
|
||||
line_up_label->
|
||||
setText(RDGetTimeLength(line_logline->playPosition(),true,true));
|
||||
line_down_label->
|
||||
@ -549,7 +550,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type,
|
||||
line_cut_label->
|
||||
setText(QString().sprintf("%03u",logline->cutNumber()));
|
||||
line_outcue_label->
|
||||
setText(RDResolveNowNext(line_outcue_template,line_logline));
|
||||
setText(RDResolveNowNext(line_outcue_template,line_logline,line));
|
||||
}
|
||||
else {
|
||||
setBackgroundColor(QColor(LOGLINEBOX_MISSING_COLOR));
|
||||
@ -664,13 +665,13 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type,
|
||||
false,false));
|
||||
|
||||
line_title_label->
|
||||
setText(RDResolveNowNext(line_title_template,line_logline));
|
||||
setText(RDResolveNowNext(line_title_template,line_logline,line));
|
||||
line_description_label->
|
||||
setText(RDResolveNowNext(line_description_template,line_logline));
|
||||
setText(RDResolveNowNext(line_description_template,line_logline,line));
|
||||
line_artist_label->
|
||||
setText(RDResolveNowNext(line_artist_template,line_logline));
|
||||
setText(RDResolveNowNext(line_artist_template,line_logline,line));
|
||||
line_outcue_label->
|
||||
setText(RDResolveNowNext(line_outcue_template,line_logline));
|
||||
setText(RDResolveNowNext(line_outcue_template,line_logline,line));
|
||||
delete cart;
|
||||
delete cut;
|
||||
setMode(line_mode);
|
||||
|
Loading…
x
Reference in New Issue
Block a user