Skip to content

Commit c9f9325

Browse files
author
dsward2
committed
In WebServerConnection generateNowPlayingStatusString, the "tuner_gain" value is converted from NSNumber to NSString formatted for one digit of precision to the right of the decimal point. This avoids a lengthy floating-point approximation for some tuner gain values in the "Now Playing" web page.
1 parent 0bc5e26 commit c9f9325

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

LocalRadio/WebServerConnection.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,6 +1766,17 @@ - (NSString *)generateNowPlayingStatusString
17661766
[nowPlayingDictionary setObject:value forKey:newKey];
17671767
}
17681768
}
1769+
1770+
id tunerGainValue = [nowPlayingDictionary objectForKey:@"tuner_gain"];
1771+
if (tunerGainValue != NULL)
1772+
{
1773+
if ([tunerGainValue isKindOfClass:[NSNumber class]] == YES)
1774+
{
1775+
NSString * tunerGainString = [NSString stringWithFormat:@"%.1f", [tunerGainValue floatValue]];
1776+
1777+
[nowPlayingDictionary setObject:tunerGainString forKey:@"tuner_gain"];
1778+
}
1779+
}
17691780

17701781
NSError *error = nil;
17711782
NSData * nowPlayingData = [NSJSONSerialization

0 commit comments

Comments
 (0)