Skip to content

Commit 4431926

Browse files
author
dsward2
committed
In AppDelegate, the updateCurrentTasksText method will include the icecastStatusDictionary obtained from the Icecast server at /admin/stats .
In EZStreamController and IcecastController, the server config files for Icecast and EZStream are changed to use the Icecast password generated by the app. In IcecastController, the icecastStatusDictionary method sets a flag when an update query is in progress. If an update is in progress when icecastStatusDictionary is called, a copy of the most recent dictionary is returned. In WebServerConnection, some instrumentation was added to log requests and file responses.
1 parent a278914 commit 4431926

9 files changed

Lines changed: 193 additions & 72 deletions

File tree

LocalRadio/AppDelegate.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,21 @@ - (void)updateCurrentTasksText
248248

249249
[tasksString appendFormat:@"%@ %@\n\n",
250250
self.icecastController.quotedIcecastPath, self.icecastController.icecastTaskArgsString];
251+
252+
AppDelegate * appDelegate = (AppDelegate *)[NSApp delegate];
253+
IcecastController * icecastController = appDelegate.icecastController;
254+
NSDictionary * icecastStatusDictionary = [icecastController icecastStatusDictionary];
255+
256+
NSString * icecastStatusString = [icecastStatusDictionary description];
257+
[tasksString appendString:icecastStatusString];
258+
259+
[tasksString appendString:@"\n\n"];
251260
}
252261
else
253262
{
254263
[tasksString appendString:@"No tasks currently running\n\n"];
255264
}
256-
265+
257266
[tasksString appendString:@"--- EZStream tasks ---"];
258267

259268
NSString * ezStreamTasksString = self.ezStreamController.ezStreamTaskPipelineManager.tasksInfoString;

LocalRadio/Base.lproj/MainMenu.xib

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ Gw
972972
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
973973
<clipView key="contentView" ambiguous="YES" id="pWY-8B-R8i">
974974
<rect key="frame" x="1" y="0.0" width="673" height="315"/>
975-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
975+
<autoresizingMask key="autoresizingMask"/>
976976
<subviews>
977977
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="20" rowSizeStyle="automatic" headerView="xpx-kQ-Qcl" viewBased="YES" floatsGroupRows="NO" id="3dz-1S-5uR">
978978
<rect key="frame" x="0.0" y="0.0" width="673" height="292"/>
@@ -1354,11 +1354,11 @@ Gw
13541354
<tabViewItems>
13551355
<tabViewItem label="LocalRadio" identifier="" id="8Qy-d0-fpa">
13561356
<view key="view" id="bIe-XZ-nnh">
1357-
<rect key="frame" x="10" y="33" width="450" height="548"/>
1357+
<rect key="frame" x="10" y="33" width="197" height="0.0"/>
13581358
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
13591359
<subviews>
13601360
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uQZ-Iv-hbS" customClass="URLTextField">
1361-
<rect key="frame" x="15" y="505" width="420" height="32"/>
1361+
<rect key="frame" x="15" y="-43" width="420" height="32"/>
13621362
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
13631363
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="center" id="x1K-dl-dH5">
13641364
<font key="font" size="22" name="CourierNewPSMT"/>
@@ -1371,14 +1371,14 @@ Gw
13711371
</connections>
13721372
</textField>
13731373
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="T93-lK-wzp">
1374-
<rect key="frame" x="-3" y="-3" width="452" height="500"/>
1374+
<rect key="frame" x="-3" y="-551" width="452" height="500"/>
13751375
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
13761376
</customView>
13771377
</subviews>
13781378
</view>
13791379
</tabViewItem>
13801380
<tabViewItem label="Status" identifier="" id="GvX-g5-9UV">
1381-
<view key="view" ambiguous="YES" id="qnk-kF-EPU">
1381+
<view key="view" id="qnk-kF-EPU">
13821382
<rect key="frame" x="10" y="33" width="450" height="548"/>
13831383
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
13841384
<subviews>
@@ -1394,7 +1394,7 @@ Gw
13941394
<autoresizingMask key="autoresizingMask"/>
13951395
<clipView key="contentView" ambiguous="YES" id="XFC-hX-hWd">
13961396
<rect key="frame" x="1" y="1" width="432" height="184"/>
1397-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1397+
<autoresizingMask key="autoresizingMask"/>
13981398
<subviews>
13991399
<textView ambiguous="YES" editable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" findStyle="panel" allowsNonContiguousLayout="YES" id="ydX-HH-DPt">
14001400
<rect key="frame" x="0.0" y="0.0" width="432" height="184"/>
@@ -1412,7 +1412,7 @@ Gw
14121412
<autoresizingMask key="autoresizingMask"/>
14131413
</scroller>
14141414
<scroller key="verticalScroller" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="St6-kL-Qjl">
1415-
<rect key="frame" x="417" y="1" width="16" height="184"/>
1415+
<rect key="frame" x="-15" y="1" width="16" height="0.0"/>
14161416
<autoresizingMask key="autoresizingMask"/>
14171417
</scroller>
14181418
</scrollView>
@@ -1748,7 +1748,7 @@ Gw
17481748
</view>
17491749
</tabViewItem>
17501750
<tabViewItem label="Configuration" identifier="" id="Amd-pe-F7E">
1751-
<view key="view" id="QdK-3V-Sdm">
1751+
<view key="view" ambiguous="YES" id="QdK-3V-Sdm">
17521752
<rect key="frame" x="10" y="33" width="450" height="548"/>
17531753
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
17541754
<subviews>
@@ -1897,7 +1897,7 @@ Gw
18971897
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uJW-ps-tz3">
18981898
<rect key="frame" x="182" y="33" width="215" height="17"/>
18991899
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
1900-
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="myPassword123" id="90O-nw-YGp">
1900+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" sendsActionOnEndEditing="YES" title="myPassword123" id="90O-nw-YGp">
19011901
<font key="font" metaFont="system"/>
19021902
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
19031903
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@@ -2067,7 +2067,7 @@ Gw
20672067
</tabView>
20682068
</subviews>
20692069
</view>
2070-
<point key="canvasLocation" x="-270" y="208"/>
2070+
<point key="canvasLocation" x="-474" y="224"/>
20712071
</window>
20722072
</objects>
20732073
</document>

LocalRadio/EZStreamController.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,10 @@ - (NSString *)writeEZStreamConfig
182182
{
183183
// write a fresh copy of ezstream_mp3.xml to the (sandboxed) Application Support directory for this app, and return the path
184184

185+
NSNumber * httpServerPortNumber = [self.appDelegate.localRadioAppSettings integerForKey:@"HTTPServerPort"];
185186
NSNumber * icecastServerModeNumber = [self.appDelegate.localRadioAppSettings integerForKey:@"IcecastServerMode"];
186187
NSString * icecastServerHost = [self.appDelegate.localRadioAppSettings valueForKey:@"IcecastServerHost"];
188+
NSString * icecastServerSourcePassword = [self.appDelegate.localRadioAppSettings valueForKey:@"IcecastServerSourcePassword"];
187189
NSString * icecastServerMountName = [self.appDelegate.localRadioAppSettings valueForKey:@"IcecastServerMountName"];
188190
NSNumber * icecastServerPortNumber = [self.appDelegate.localRadioAppSettings integerForKey:@"IcecastServerPort"];
189191

@@ -293,7 +295,16 @@ - (NSString *)writeEZStreamConfig
293295
NSXMLElement * svrinfopublicElement = svrinfopublicResultArray.firstObject;
294296
[svrinfopublicElement setStringValue:@"0"];
295297
}
296-
298+
299+
// <sourcepassword>sourcepassword</sourcepassword>
300+
NSString * sourcePasswordQuery = @"sourcepassword";
301+
NSArray * sourcePasswordResultArray = [rootElement nodesForXPath:sourcePasswordQuery error:&error];
302+
if (sourcePasswordResultArray.count > 0)
303+
{
304+
NSXMLElement * sourcePasswordElement = sourcePasswordResultArray.firstObject;
305+
[sourcePasswordElement setStringValue:icecastServerSourcePassword];
306+
}
307+
297308
NSString * xmlString = [xmlDocument XMLString];
298309
NSString * newEZStreamConfigPath = [applicationSupportDirectoryPath stringByAppendingPathComponent:@"ezstream_mp3.xml"];
299310
NSError * writeError = NULL;

LocalRadio/IcecastController.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
@property (strong) NSString * icecastTaskArgsString;
2929
@property (strong) NSString * quotedIcecastPath;
3030

31+
@property (strong) NSDictionary * lastIcecastStatusDictionary;
32+
@property (assign) BOOL icecastStatusBusy;
33+
3134
@property (assign) int icecastTaskProcessID;
3235

3336
- (void)terminateTasks;

0 commit comments

Comments
 (0)