Skip to content

Commit 2334b81

Browse files
author
dsward2
committed
A new option checkbox labeled as "Log all stderr messages" was added to the user interface, and a new setting key "CaptureStderr" was added to the local_radio_config table. If enabled, this option will add a pipe from each NSTask's stderr back to the host app
1 parent b40b70d commit 2334b81

7 files changed

Lines changed: 91 additions & 56 deletions

File tree

LocalRadio/AppDelegate.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585

8686
@property (weak) IBOutlet NSButton * useWebViewAudioPlayerCheckbox;
8787
@property (weak) IBOutlet NSButton * useAutoPlayCheckbox;
88+
@property (weak) IBOutlet NSButton * logAllStderrMessagesCheckbox;
8889

8990

9091
@property (weak) IBOutlet NSTextField * editHttpServerPortTextField;
@@ -100,11 +101,11 @@
100101
@property (weak) IBOutlet NSTextField * editControlPortTextField;
101102
@property (weak) IBOutlet NSTextField * editAudioPortTextField;
102103

103-
@property (weak) IBOutlet NSButton * editMP3ConstantRadioButton;
104104
@property (weak) IBOutlet NSPopUpButton * editMP3ConstantPopUpButton;
105105
@property (weak) IBOutlet NSPopUpButton * editMP3EncodingQualityPopUpButton;
106106

107107
@property (weak) IBOutlet NSButton * editUseWebViewAudioPlayerCheckbox;
108+
@property (weak) IBOutlet NSButton * editLogAllStderrMessages;
108109

109110
@property (weak) IBOutlet NSButton * editSaveButton;
110111
@property (weak) IBOutlet NSButton * editCancelButton;
@@ -120,6 +121,7 @@
120121
@property (strong) NSString * mp3Settings;
121122
@property (assign) BOOL useWebViewAudioPlayer;
122123
@property (assign) BOOL useAutoPlay;
124+
@property (assign) BOOL logAllStderrMessages;
123125
@property (assign) NSUInteger icecastServerPort;
124126
@property (strong) NSString * statusFrequencyID;
125127
@property (strong) NSString * statusFrequency;

LocalRadio/AppDelegate.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
110110

111111
self.useWebViewAudioPlayerCheckbox.state = YES;
112112
self.listenMode = kListenModeIdle;
113-
113+
114+
NSNumber * logAllStderrMessagesNumber = [self.localRadioAppSettings integerForKey:@"CaptureStderr"];
115+
self.logAllStderrMessagesCheckbox.state = logAllStderrMessagesNumber.boolValue;
116+
114117
[self updateCopiedSettingsValues];
115118

116119
[NSThread detachNewThreadSelector:@selector(startServices) toTarget:self withObject:NULL];
@@ -181,6 +184,9 @@ - (void)updateCopiedSettingsValues
181184

182185
self.useWebViewAudioPlayer = self.useWebViewAudioPlayerCheckbox.state;
183186

187+
self.logAllStderrMessages = self.logAllStderrMessagesCheckbox.state;
188+
[self.localRadioAppSettings setInteger:self.logAllStderrMessages forKey:@"CaptureStderr"];
189+
184190
self.icecastServerPort = self.icecastServerPortTextField.integerValue;
185191
}
186192

@@ -985,6 +991,9 @@ - (void)updateConfiguration
985991
BOOL useWebViewAudioPlayer = self.editUseWebViewAudioPlayerCheckbox.state;
986992
self.useWebViewAudioPlayerCheckbox.state = useWebViewAudioPlayer;
987993

994+
BOOL logAllStderrMessages = self.editLogAllStderrMessages.state;
995+
self.logAllStderrMessagesCheckbox.state = logAllStderrMessages;
996+
988997
NSString * constantBitrateString = self.editMP3ConstantPopUpButton.titleOfSelectedItem;
989998
NSInteger constantBitrateInteger = constantBitrateString.integerValue / 1000;
990999
NSString * encodingQualityString = self.editMP3EncodingQualityPopUpButton.titleOfSelectedItem;

LocalRadio/Automator Scripts/LocalRadio Clean-Up.workflow/Contents/document.wflow

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<key>displayWarning</key>
6565
<false/>
6666
<key>explanationText</key>
67-
<string>If LocalRadio crashes and fail to terminate the subprocesses correctly, use this script to kill the following processes: sox, UDPSender, UDPListener, rtl_fm_localradio, icecast, ezstream, AudioMonitor, and stereodemux.</string>
67+
<string>If LocalRadio crashes and fail to terminate the subprocesses correctly, use this script to kill the following processes: sox, UDPSender, UDPListener, rtl_fm_localradio, icecast, ezstream, AudioMonitor, AudioMonitor2 and stereodemux.</string>
6868
<key>negativeTitle</key>
6969
<string>Cancel</string>
7070
<key>questionText</key>
@@ -173,7 +173,7 @@
173173
<key>isViewVisible</key>
174174
<true/>
175175
<key>location</key>
176-
<string>270.750000:199.000000</string>
176+
<string>357.500000:199.000000</string>
177177
<key>nibPath</key>
178178
<string>/System/Library/Automator/Ask for Confirmation.action/Contents/Resources/English.lproj/main.nib</string>
179179
</dict>
@@ -277,6 +277,12 @@ else
277277
pkill AudioMonitor
278278
fi
279279

280+
if pgrep -x "AudioMonitor2" &gt; /dev/null
281+
then
282+
echo "pkill AudioMonitor2"
283+
pkill AudioMonitor2
284+
fi
285+
280286
if pgrep -x "stereodemux" &gt; /dev/null
281287
then
282288
echo "pkill stereodemux"
@@ -396,7 +402,7 @@ fi
396402
<key>isViewVisible</key>
397403
<true/>
398404
<key>location</key>
399-
<string>270.750000:450.000000</string>
405+
<string>357.500000:382.000000</string>
400406
<key>nibPath</key>
401407
<string>/System/Library/Automator/Run Shell Script.action/Contents/Resources/English.lproj/main.nib</string>
402408
</dict>
@@ -528,12 +534,10 @@ fi
528534
<string>2</string>
529535
</dict>
530536
</dict>
531-
<key>conversionLabel</key>
532-
<integer>0</integer>
533537
<key>isViewVisible</key>
534538
<true/>
535539
<key>location</key>
536-
<string>270.750000:640.000000</string>
540+
<string>357.500000:572.000000</string>
537541
<key>nibPath</key>
538542
<string>/System/Library/Automator/Display Notification.action/Contents/Resources/Base.lproj/main.nib</string>
539543
</dict>
@@ -543,19 +547,19 @@ fi
543547
</array>
544548
<key>connectors</key>
545549
<dict>
546-
<key>0B9E33F7-F22B-4170-B489-6E77A335B564</key>
550+
<key>4361561E-A401-4361-93CD-145C9057762B</key>
547551
<dict>
548552
<key>from</key>
549-
<string>1F543706-C4DE-4D1F-8710-5966E55254C7 - 1F543706-C4DE-4D1F-8710-5966E55254C7</string>
553+
<string>F71504F6-88ED-4F28-9945-F7A987CB8965 - F71504F6-88ED-4F28-9945-F7A987CB8965</string>
550554
<key>to</key>
551-
<string>17810AEA-E10E-4539-A179-27F66A9F6362 - 17810AEA-E10E-4539-A179-27F66A9F6362</string>
555+
<string>1F543706-C4DE-4D1F-8710-5966E55254C7 - 1F543706-C4DE-4D1F-8710-5966E55254C7</string>
552556
</dict>
553-
<key>66917305-C763-4618-9E34-1B205CBA8E25</key>
557+
<key>7657EA24-5DB6-4FCB-8B52-A1C8BE6624C4</key>
554558
<dict>
555559
<key>from</key>
556-
<string>F71504F6-88ED-4F28-9945-F7A987CB8965 - F71504F6-88ED-4F28-9945-F7A987CB8965</string>
557-
<key>to</key>
558560
<string>1F543706-C4DE-4D1F-8710-5966E55254C7 - 1F543706-C4DE-4D1F-8710-5966E55254C7</string>
561+
<key>to</key>
562+
<string>17810AEA-E10E-4539-A179-27F66A9F6362 - 17810AEA-E10E-4539-A179-27F66A9F6362</string>
559563
</dict>
560564
</dict>
561565
<key>workflowMetaData</key>

LocalRadio/Base.lproj/MainMenu.xib

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<outlet property="editIcecastServerPortTextField" destination="J0M-ht-KQr" id="Jyc-79-p4f"/>
3232
<outlet property="editIcecastServerSourcePasswordTextField" destination="fuC-VO-4HF" id="Tak-k7-TMG"/>
3333
<outlet property="editIcecastServerWebURLTextField" destination="Yny-sG-TDf" id="5qV-rf-qex"/>
34+
<outlet property="editLogAllStderrMessages" destination="ILi-lj-8oz" id="twh-yH-Mel"/>
3435
<outlet property="editMP3ConstantPopUpButton" destination="9xJ-Ya-ucR" id="TfL-tB-lT9"/>
3536
<outlet property="editMP3EncodingQualityPopUpButton" destination="mzI-of-7vc" id="BNI-4g-ucX"/>
3637
<outlet property="editSaveButton" destination="zcQ-cW-z91" id="KCl-EY-Nj4"/>
@@ -48,6 +49,7 @@
4849
<outlet property="icecastServerSourcePasswordTextField" destination="uJW-ps-tz3" id="z7K-VN-9L1"/>
4950
<outlet property="icecastServerWebURLTextField" destination="EM9-rk-98W" id="bfL-qT-rDL"/>
5051
<outlet property="localRadioAppSettings" destination="e7V-Ua-sAt" id="eV1-zd-FDq"/>
52+
<outlet property="logAllStderrMessagesCheckbox" destination="CW5-5Q-W7U" id="929-HB-sdr"/>
5153
<outlet property="mp3SettingsDescriptionTextField" destination="WIb-31-0nH" id="XIM-xa-cD7"/>
5254
<outlet property="mp3SettingsTextField" destination="P1Z-tT-rgf" id="GhK-4s-6ux"/>
5355
<outlet property="openIcecastWebPageButton" destination="aJu-A8-6K2" id="EdH-e7-8yX"/>
@@ -874,22 +876,22 @@
874876
</view>
875877
</box>
876878
<box fixedFrame="YES" title="Audio Player" translatesAutoresizingMaskIntoConstraints="NO" id="Xha-az-kBL">
877-
<rect key="frame" x="210" y="227" width="211" height="110"/>
879+
<rect key="frame" x="210" y="258" width="211" height="79"/>
878880
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
879881
<view key="contentView" id="jqJ-NN-JvP">
880-
<rect key="frame" x="2" y="2" width="207" height="93"/>
882+
<rect key="frame" x="2" y="2" width="207" height="62"/>
881883
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
882884
<subviews>
883885
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="X0z-yz-DCl">
884-
<rect key="frame" x="12" y="64" width="183" height="18"/>
886+
<rect key="frame" x="12" y="33" width="183" height="18"/>
885887
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
886888
<buttonCell key="cell" type="check" title="Use WebView audio player" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="9nh-01-8Vy">
887889
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
888890
<font key="font" metaFont="system"/>
889891
</buttonCell>
890892
</button>
891893
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dfu-YO-d0f">
892-
<rect key="frame" x="12" y="38" width="175" height="18"/>
894+
<rect key="frame" x="12" y="7" width="175" height="18"/>
893895
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
894896
<buttonCell key="cell" type="check" title="Use Auto-Play in this app" bezelStyle="regularSquare" imagePosition="left" inset="2" id="HtL-er-1ZY">
895897
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
@@ -938,9 +940,17 @@ Gw
938940
<action selector="editSetDefaultsButtonAction:" target="Voe-Tx-rLC" id="Tsd-cI-9cF"/>
939941
</connections>
940942
</button>
943+
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ILi-lj-8oz">
944+
<rect key="frame" x="222" y="229" width="167" height="18"/>
945+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
946+
<buttonCell key="cell" type="check" title="Log all stderr messages" bezelStyle="regularSquare" imagePosition="left" inset="2" id="PQB-cj-X2q">
947+
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
948+
<font key="font" metaFont="system"/>
949+
</buttonCell>
950+
</button>
941951
</subviews>
942952
</view>
943-
<point key="canvasLocation" x="42" y="550.5"/>
953+
<point key="canvasLocation" x="49" y="604"/>
944954
</window>
945955
<window title="FCC Database Search" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="wir-9v-BJf" userLabel="FCC Search Window">
946956
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
@@ -993,7 +1003,7 @@ Gw
9931003
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
9941004
<clipView key="contentView" ambiguous="YES" id="pWY-8B-R8i">
9951005
<rect key="frame" x="1" y="0.0" width="673" height="315"/>
996-
<autoresizingMask key="autoresizingMask"/>
1006+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
9971007
<subviews>
9981008
<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">
9991009
<rect key="frame" x="0.0" y="0.0" width="673" height="292"/>
@@ -1374,12 +1384,12 @@ Gw
13741384
<font key="font" metaFont="system"/>
13751385
<tabViewItems>
13761386
<tabViewItem label="LocalRadio" identifier="" id="8Qy-d0-fpa">
1377-
<view key="view" ambiguous="YES" id="bIe-XZ-nnh">
1378-
<rect key="frame" x="10" y="33" width="197" height="0.0"/>
1387+
<view key="view" id="bIe-XZ-nnh">
1388+
<rect key="frame" x="10" y="33" width="450" height="548"/>
13791389
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
13801390
<subviews>
13811391
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uQZ-Iv-hbS" customClass="URLTextField">
1382-
<rect key="frame" x="15" y="-43" width="420" height="32"/>
1392+
<rect key="frame" x="15" y="505" width="420" height="32"/>
13831393
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
13841394
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="center" id="x1K-dl-dH5">
13851395
<font key="font" size="22" name="CourierNewPSMT"/>
@@ -1392,7 +1402,7 @@ Gw
13921402
</connections>
13931403
</textField>
13941404
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="T93-lK-wzp">
1395-
<rect key="frame" x="-3" y="-551" width="452" height="500"/>
1405+
<rect key="frame" x="-3" y="-3" width="452" height="500"/>
13961406
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
13971407
</customView>
13981408
</subviews>
@@ -1744,7 +1754,7 @@ Gw
17441754
</view>
17451755
</tabViewItem>
17461756
<tabViewItem label="Configuration" identifier="" id="Amd-pe-F7E">
1747-
<view key="view" id="QdK-3V-Sdm">
1757+
<view key="view" ambiguous="YES" id="QdK-3V-Sdm">
17481758
<rect key="frame" x="10" y="33" width="450" height="548"/>
17491759
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
17501760
<subviews>
@@ -2017,14 +2027,6 @@ Gw
20172027
</subviews>
20182028
</view>
20192029
</box>
2020-
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="X6N-TX-t5V">
2021-
<rect key="frame" x="143" y="74" width="183" height="18"/>
2022-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
2023-
<buttonCell key="cell" type="check" title="Use WebView audio player" bezelStyle="regularSquare" imagePosition="left" enabled="NO" state="on" inset="2" id="soh-fS-X96">
2024-
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
2025-
<font key="font" metaFont="system"/>
2026-
</buttonCell>
2027-
</button>
20282030
<box fixedFrame="YES" title="MP3 Settings" translatesAutoresizingMaskIntoConstraints="NO" id="3IH-Uj-chv">
20292031
<rect key="frame" x="14" y="103" width="417" height="67"/>
20302032
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
@@ -2053,6 +2055,22 @@ Gw
20532055
</subviews>
20542056
</view>
20552057
</box>
2058+
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="CW5-5Q-W7U">
2059+
<rect key="frame" x="255" y="74" width="167" height="18"/>
2060+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
2061+
<buttonCell key="cell" type="check" title="Log all stderr messages" bezelStyle="regularSquare" imagePosition="left" enabled="NO" inset="2" id="mBI-gR-0oK">
2062+
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
2063+
<font key="font" metaFont="system"/>
2064+
</buttonCell>
2065+
</button>
2066+
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="X6N-TX-t5V">
2067+
<rect key="frame" x="29" y="74" width="183" height="18"/>
2068+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
2069+
<buttonCell key="cell" type="check" title="Use WebView audio player" bezelStyle="regularSquare" imagePosition="left" enabled="NO" state="on" inset="2" id="soh-fS-X96">
2070+
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
2071+
<font key="font" metaFont="system"/>
2072+
</buttonCell>
2073+
</button>
20562074
</subviews>
20572075
</view>
20582076
</tabViewItem>

LocalRadio/LocalRadioAppSettings.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ - (void) registerDefaultSettings
2727

2828
[self setDefaultInteger:0 forKey:@"IcecastServerMode"];
2929

30+
[self setDefaultInteger:0 forKey:@"CaptureStderr"];
31+
3032
[self setDefaultValue:@"127.0.0.1" forKey:@"IcecastServerHost"];
3133
[self setDefaultValue:@"localradio" forKey:@"IcecastServerMountName"];
3234

0 commit comments

Comments
 (0)