Skip to content

Commit

Permalink
Merge pull request Materdaddy#6 from jasoveen/master
Browse files Browse the repository at this point in the history
Plugin fixes for FPP 1.8
  • Loading branch information
Materdaddy authored Oct 11, 2016
2 parents 9fdcb61 + 1c9093b commit fd01a57
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
22 changes: 17 additions & 5 deletions callbacks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ fi

transmit_setting=$(grep -i "^TurnOff\s*=.*" ${CFGDIR}/plugin.vastfmt | sed -e "s/.*=\s*//")
power=$(grep -i "^Power\s*=.*" ${CFGDIR}/plugin.vastfmt | sed -e "s/.*=\s*//")
rds_setting=$(grep -i "^RdsType\s*=.*" ${CFGDIR}/plugin.vastfmt | sed -e "s/.*=\s*//")
rds_setting=$(grep -i "^RdsType\s*=.*" ${CFGDIR}/plugin.vastfmt | sed -e "s/.*=\s*\"\(.*\)\"/\1/")
rds_static_text=$(grep -i "^RDSStaticText\s*=.*" ${CFGDIR}/plugin.vastfmt | sed -e "s/.*=\s*\"\(.*\)\"/\1/")
set_frequency=$(grep -i "^SetFreq\s*=.*" ${CFGDIR}/plugin.vastfmt | sed -e "s/.*=\s*//")
frequency=$(grep -i "^Frequency\s*=.*" ${CFGDIR}/plugin.vastfmt | sed -e "s/.*=\s*//")
station=$(grep -i "^Station\s*=.*" ${CFGDIR}/plugin.vastfmt | sed -e "s/.*=\s*//")
station=$(grep -i "^Station\s*=.*" ${CFGDIR}/plugin.vastfmt | sed -e "s/.*=\s*\"\(.*\)\"/\1/")

if [ -n "$DEBUG" ]; then

Expand All @@ -87,6 +88,7 @@ if [ -n "$DEBUG" ]; then
echo "set transmit: $transmit_setting" >&2
echo "power: $power" >&2
echo "rds type: $rds_setting" >&2
echo "rds static text: $rds_static_text" >&2
echo "set freq: $set_frequency" >&2
echo "frequency: $frequency" >&2
echo "station: $station" >&2
Expand All @@ -107,8 +109,8 @@ case $operation in
fi

# Use jq to parse our JSON data
artist=$(echo $DATA | ./jq/jq -r ".artist")
title=$(echo $DATA | ./jq/jq -r ".title")
artist=$(echo $DATA | $(dirname $0)/jq/jq -r ".artist")
title=$(echo $DATA | $(dirname $0)/jq/jq -r ".title")

# Try to grab artist if Media exists. This assumes the filename
# is "Artist - Title.extension"
Expand Down Expand Up @@ -192,13 +194,23 @@ case $operation in
vast_args="$vast_args -f $frequency"
fi
if [ "x$rds_setting" != "xdisabled" ]; then
vast_args="$vast_args --rds -s $station"
if [ ${#station} -gt 0 ]; then
vast_args="$vast_args --rds -s \"$station\""
else
vast_args="$vast_args --rds"
fi
fi
if [ ${#rds_static_text} -gt 0 ]; then
vast_args="$vast_args --rds-text \"$rds_static_text\""
fi
else
echo "turn things off..."
if [ "x$transmit_setting" == "x1" ]; then
vast_args="$vast_args -n"
fi
if [ ${#rds_static_text} -gt 0 ]; then
vast_args="$vast_args --rds-text \"$rds_static_text\""
fi
fi

if [ -n "$DEBUG" ]; then
Expand Down
7 changes: 5 additions & 2 deletions plugin_setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,26 @@ function toggleSettings()
{
$('#Frequency').prop("disabled", false);
$('#saveFrequency').prop("disabled", false);
$('#RdsType').prop("disabled", false);
}
else
{
$('#Frequency').prop("disabled", true);
$('#saveFrequency').prop("disabled", true);
$('#RdsType').prop("disabled", true);
}
}
function toggleStation()
{
if ($('#RdsType').val() == "disabled")
{
$('#RDSStaticText').prop("disabled", true);
$('#saveRDSStaticText').prop("disabled", true);
$('#Station').prop("disabled", true);
$('#saveStation').prop("disabled", true);
}
else
{
$('#RDSStaticText').prop("disabled", false);
$('#saveRDSStaticText').prop("disabled", false);
$('#Station').prop("disabled", false);
$('#saveStation').prop("disabled", false);
}
Expand All @@ -84,6 +86,7 @@ function toggleStation()
<p>Set frequency on playlist start/stop: <?php PrintSettingCheckbox("Set frequency", "SetFreq", 1, 0, "1", "0", "vastfmt", "toggleSettings"); ?></p>
<p>Frequency: <?php PrintSettingText("Frequency", 1, 0, 8, 8, "vastfmt"); ?>MHz <?php PrintSettingSave("Transmit Frequency", "Frequency", 1, 0, "vastfmt"); ?></p>
<p>RDS Type: <?php PrintSettingSelect("RDS Type", "RdsType", 1, 0, "RT+", Array("Disabled"=>"disabled", "RT+"=>"rtp", "RT"=>"rt", "PS"=>"ps"), "vastfmt", "toggleStation"); ?></p>
<p>RDS Static Text: <?php PrintSettingText("RDSStaticText", 1, 0, 50, 50, "vastfmt"); ?><?php PrintSettingSave("RDS Static Text", "RDSStaticText", 1, 0, "vastfmt"); ?></p>
<p>Station ID: <?php PrintSettingText("Station", 1, 0, 4, 4, "vastfmt"); ?><?php PrintSettingSave("Station ID", "Station", 1, 0, "vastfmt"); ?></p>

</fieldset>
Expand Down

0 comments on commit fd01a57

Please sign in to comment.