Skip to content

Commit 0aca333

Browse files
committed
Added folder settings for recordings
1 parent f41db36 commit 0aca333

File tree

8 files changed

+69
-10
lines changed

8 files changed

+69
-10
lines changed

FiloStreamer/App.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
<setting name="settingsAdvanced" serializeAs="String">
6565
<value>False</value>
6666
</setting>
67+
<setting name="settingsRecordingFolder" serializeAs="String">
68+
<value />
69+
</setting>
6770
</FiloStreamer.Properties.Settings>
6871
</userSettings>
6972
</configuration>

FiloStreamer/FiloStreamer.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
<Resource Include="Resources\Music-Library-icon.png" />
159159
<Resource Include="Resources\movie-icon.png" />
160160
<Resource Include="Resources\web-icon.png" />
161+
<Resource Include="Resources\Folder-Movies-icon.png" />
161162
<Content Include="vlclib\libvlc.dll">
162163
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
163164
</Content>

FiloStreamer/MainWindow.xaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@
9898
</GroupBox>
9999
<GroupBox x:Name="groupBoxRecord" Grid.Column="2" Margin="4" Style="{DynamicResource GroupBoxSlick}">
100100
<GroupBox.Header>
101-
<TextBlock Text="Record" Foreground="#777777" />
101+
<StackPanel Orientation="Horizontal">
102+
<TextBlock Text="Record " Foreground="#777777" />
103+
<TextBlock Text="{Binding Path=File}" Foreground="#777777" />
104+
</StackPanel>
102105
</GroupBox.Header>
103106
<Grid>
104107
<Grid.RowDefinitions>
@@ -125,14 +128,11 @@
125128
</GroupBox>
126129
</Grid>
127130
<Grid>
128-
<GroupBox Margin="4,12,4,0" FocusManager.IsFocusScope="True" Style="{DynamicResource GroupBoxSlick}" Visibility="{Binding Path=IsLive, Converter={StaticResource BoolInvertedToVisibility}}">
131+
<GroupBox Margin="4,12,4,0" VerticalAlignment="Top" MaxWidth="715" Height="350" Style="{DynamicResource GroupBoxSlick}" Visibility="{Binding Path=IsLive, Converter={StaticResource BoolInvertedToVisibility}}">
129132
<GroupBox.Header>
130-
<StackPanel Orientation="Horizontal">
131-
<Image Margin="0 1 4 0" Source="Resources/cog-icon.png" Stretch="Fill" Width="16" Height="16" />
132-
<TextBlock><Run Text="Settings"/></TextBlock>
133-
</StackPanel>
133+
<TextBlock Foreground="#777777" Text="Settings" />
134134
</GroupBox.Header>
135-
<controls:SettingsPanel Margin="0,0.56" d:LayoutOverrides="Height"/>
135+
<controls:SettingsPanel Margin="8" d:LayoutOverrides="Height"/>
136136
</GroupBox>
137137
<vlc:VlcPlayer x:Name="vlcPlayer" Margin="4"
138138
Visibility="{Binding Path=IsLive, Converter={StaticResource BoolToVisibililty}}" VideoSourceChanged="vlcPlayer_VideoSourceChanged" />

FiloStreamer/Properties/Settings.Designer.cs

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FiloStreamer/Properties/Settings.settings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,8 @@
5656
<Setting Name="settingsAdvanced" Type="System.Boolean" Scope="User">
5757
<Value Profile="(Default)">False</Value>
5858
</Setting>
59+
<Setting Name="settingsRecordingFolder" Type="System.String" Scope="User">
60+
<Value Profile="(Default)" />
61+
</Setting>
5962
</Settings>
6063
</SettingsFile>

FiloStreamer/Recorder/LocalRecorder.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Linq;
55
using System.Text;
66
using System.Threading.Tasks;
7+
using System.IO;
78
using FiloStreamer.Properties;
89
using FiloStreamer.Encoder;
910
using System.Windows.Threading;
@@ -13,6 +14,7 @@ namespace FiloStreamer.Recorder
1314
class LocalRecorder : BasicEncoder
1415
{
1516
private bool _isRecording;
17+
private string _file;
1618

1719
public LocalRecorder(Dispatcher dispatcher)
1820
: base(dispatcher, "Rec")
@@ -25,14 +27,24 @@ public void Run()
2527
string video = string.Format("-vcodec copy");
2628
string audio = string.Format("-acodec copy");
2729
string network = string.Format("-i udp://{0}", Settings.Default.networkLocal);
28-
string arguments = string.Format("-y -threads 4 {0} -map 0 {1} {2} \"test.mp4\"", network, video, audio);
30+
var time = DateTime.Now;
31+
File = Path.Combine(Properties.Settings.Default.settingsRecordingFolder,
32+
string.Format("{0}-{1:00}-{2:00}_{3:00}-{4:00}-{5:00}.mp4",
33+
time.Year,
34+
time.Month,
35+
time.Day,
36+
time.Hour,
37+
time.Minute,
38+
time.Second));
39+
string arguments = string.Format("-y -threads 4 {0} -map 0 {1} {2} \"{3}\"", network, video, audio, File);
2940
this.IsRecording = true;
3041
base.Run(arguments);
3142
}
3243

3344
public void Stop()
3445
{
3546
_process.Stop();
47+
File = "";
3648
}
3749

3850
protected override void _process_ProcessExited(object sender, EventArgs e)
@@ -41,6 +53,16 @@ protected override void _process_ProcessExited(object sender, EventArgs e)
4153
this.IsRecording = false;
4254
}
4355

56+
public string File
57+
{
58+
get { return _file; }
59+
set
60+
{
61+
_file = value;
62+
RunPropertyChanged("File");
63+
}
64+
}
65+
4466
public bool IsRecording
4567
{
4668
get { return _isRecording; }
4.74 KB
Loading

FiloStreamer/XamlControls/SettingsPanel.xaml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:local="clr-namespace:FiloStreamer"
77
xmlns:Properties="clr-namespace:FiloStreamer.Properties"
88
mc:Ignorable="d"
9-
d:DesignHeight="250" d:DesignWidth="497">
9+
d:DesignHeight="300" d:DesignWidth="497">
1010
<Grid>
1111
<Grid.RowDefinitions>
1212
<RowDefinition Height="32" />
@@ -15,6 +15,8 @@
1515
<RowDefinition Height="32" />
1616
<RowDefinition Height="32" />
1717
<RowDefinition Height="32" />
18+
<RowDefinition Height="32" />
19+
<RowDefinition Height="32" />
1820
<RowDefinition Height="*" />
1921
</Grid.RowDefinitions>
2022
<Grid.ColumnDefinitions>
@@ -130,6 +132,22 @@
130132
Style="{StaticResource FlatTextbox}"
131133
Text="{Binding networkLocal, Mode=TwoWay, Source={x:Static Properties:Settings.Default}}"
132134
Visibility="{Binding Path=IsChecked, ElementName=checkboxAdvanced, Converter={StaticResource BoolInvertedToVisibility}}" />
133-
<CheckBox x:Name="checkboxAdvanced" Style="{StaticResource FlatCheckBox}" Grid.Row="6" Grid.ColumnSpan="2" Margin="6" Height="16" HorizontalAlignment="Left" VerticalAlignment="Bottom" IsChecked="{Binding settingsAdvanced, Mode=TwoWay, Source={x:Static Properties:Settings.Default}}">Advanced Settings</CheckBox>
135+
136+
<!-- Folder -->
137+
<Image Grid.Row="6" Grid.RowSpan="2" Margin="0 4 0 0" HorizontalAlignment="Left" Source="../Resources/Folder-Movies-icon.png" Stretch="Fill" VerticalAlignment="Top" Width="64" Height="64"/>
138+
<TextBlock Grid.Row="6" Grid.RowSpan="2" Grid.Column="1" Margin="6 2 10 2" VerticalAlignment="Center" Text="Folder:"
139+
Visibility="{Binding Path=IsChecked, ElementName=checkboxAdvanced, Converter={StaticResource BoolInvertedToVisibility}}" />
140+
<TextBox Grid.Row="6" Grid.RowSpan="2" Grid.Column="2" Grid.ColumnSpan="3" VerticalAlignment="Center" Margin="1 0 6 0"
141+
Style="{StaticResource FlatTextbox}"
142+
Text="{Binding settingsRecordingFolder, Mode=TwoWay, Source={x:Static Properties:Settings.Default}}"
143+
Visibility="{Binding Path=IsChecked, ElementName=checkboxAdvanced, Converter={StaticResource BoolInvertedToVisibility}}" />
144+
<TextBlock Grid.Row="6" Grid.Column="1" Margin="6 2" VerticalAlignment="Bottom" Text="Folder:"
145+
Visibility="{Binding Path=IsChecked, ElementName=checkboxAdvanced, Converter={StaticResource BoolToVisibililty}}" />
146+
<TextBox Grid.Row="6" Grid.Column="2" Grid.ColumnSpan="3" VerticalAlignment="Bottom" Margin="0 0 6 0"
147+
Text="{Binding settingsRecordingFolder, Mode=TwoWay, Source={x:Static Properties:Settings.Default}}"
148+
Visibility="{Binding Path=IsChecked, ElementName=checkboxAdvanced, Converter={StaticResource BoolToVisibililty}}" />
149+
<TextBlock Grid.Row="7" Grid.Column="2" Grid.ColumnSpan="3" Margin="2 4" VerticalAlignment="Top" Text="Location to store the recordings into"
150+
Visibility="{Binding Path=IsChecked, ElementName=checkboxAdvanced, Converter={StaticResource BoolToVisibililty}}" />
151+
<CheckBox x:Name="checkboxAdvanced" Style="{StaticResource FlatCheckBox}" Grid.Row="8" Grid.ColumnSpan="2" Margin="6" Height="16" HorizontalAlignment="Left" VerticalAlignment="Bottom" IsChecked="{Binding settingsAdvanced, Mode=TwoWay, Source={x:Static Properties:Settings.Default}}">Advanced Settings</CheckBox>
134152
</Grid>
135153
</UserControl>

0 commit comments

Comments
 (0)