Compare commits
9 Commits
c5e8534af7
...
v1.3.1
Author | SHA1 | Date | |
---|---|---|---|
67667c74da | |||
8033aebb23 | |||
0898d5cf11 | |||
cb741349fa | |||
cabfb165da | |||
b074a4e975 | |||
53d7668fd6 | |||
124b263499 | |||
3f74b1a4e7 |
22
CHANGELOG.md
22
CHANGELOG.md
@ -1,5 +1,27 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v1.3.1
|
||||||
|
|
||||||
|
*Released: 03/11/2022*
|
||||||
|
|
||||||
|
* Update .NET version from 5.0 to 6.0
|
||||||
|
* Fix: simple patch to avoid a crash concerning GetAlbumCover
|
||||||
|
* Fix: connection change now working
|
||||||
|
|
||||||
|
## v1.3
|
||||||
|
|
||||||
|
*Released: 18/04/2022*
|
||||||
|
|
||||||
|
* New feature: add support for readpicture, aka embedded cover art
|
||||||
|
* New feature: add support for MPD password
|
||||||
|
* Spanish translation
|
||||||
|
* Trim album release date
|
||||||
|
* Cover icon when a radio is playing
|
||||||
|
* Update MpcNET package from 1.3 to 1.4
|
||||||
|
* Fix: Snapcast not working with hostname
|
||||||
|
* Fix: some radios crash
|
||||||
|
* Fix: disable/enable radios and Snapcast with connection
|
||||||
|
|
||||||
## v1.2
|
## v1.2
|
||||||
|
|
||||||
*Released: 07/04/2022*
|
*Released: 07/04/2022*
|
||||||
|
@ -64,17 +64,19 @@ namespace unison
|
|||||||
private MpcConnection _connection;
|
private MpcConnection _connection;
|
||||||
private MpcConnection _commandConnection;
|
private MpcConnection _commandConnection;
|
||||||
private IPEndPoint _mpdEndpoint;
|
private IPEndPoint _mpdEndpoint;
|
||||||
private CancellationTokenSource _cancelToken;
|
|
||||||
|
private CancellationTokenSource _cancelCommand;
|
||||||
|
private CancellationTokenSource _cancelConnect;
|
||||||
|
|
||||||
public MPDHandler()
|
public MPDHandler()
|
||||||
{
|
{
|
||||||
Initialize(null, null);
|
Startup(null, null);
|
||||||
|
|
||||||
_stats = new Statistics();
|
_stats = new Statistics();
|
||||||
|
|
||||||
_retryTimer = new DispatcherTimer();
|
_retryTimer = new DispatcherTimer();
|
||||||
_retryTimer.Interval = TimeSpan.FromSeconds(5);
|
_retryTimer.Interval = TimeSpan.FromSeconds(5);
|
||||||
_retryTimer.Tick += Initialize;
|
_retryTimer.Tick += Startup;
|
||||||
|
|
||||||
_elapsedTimer = new System.Timers.Timer(500);
|
_elapsedTimer = new System.Timers.Timer(500);
|
||||||
_elapsedTimer.Elapsed += new System.Timers.ElapsedEventHandler(ElapsedTimer);
|
_elapsedTimer.Elapsed += new System.Timers.ElapsedEventHandler(ElapsedTimer);
|
||||||
@ -147,7 +149,7 @@ namespace unison
|
|||||||
|
|
||||||
public async Task<T> SafelySendCommandAsync<T>(IMpcCommand<T> command)
|
public async Task<T> SafelySendCommandAsync<T>(IMpcCommand<T> command)
|
||||||
{
|
{
|
||||||
if (_commandConnection == null)
|
if (_commandConnection == null || !IsConnected())
|
||||||
{
|
{
|
||||||
Trace.WriteLine("[SafelySendCommandAsync] no command connection");
|
Trace.WriteLine("[SafelySendCommandAsync] no command connection");
|
||||||
return default(T);
|
return default(T);
|
||||||
@ -175,21 +177,52 @@ namespace unison
|
|||||||
return default(T);
|
return default(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Initialize(object sender, EventArgs e)
|
public async void Startup(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!_connected)
|
await Initialize();
|
||||||
Connect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Connect()
|
public async Task Initialize()
|
||||||
{
|
{
|
||||||
_cancelToken = new CancellationTokenSource();
|
Trace.WriteLine("Initializing");
|
||||||
CancellationToken token = _cancelToken.Token;
|
|
||||||
|
Disconnected();
|
||||||
|
|
||||||
|
if (!_connected)
|
||||||
|
await Connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Disconnected()
|
||||||
|
{
|
||||||
|
_connected = false;
|
||||||
|
ConnectionChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
|
||||||
|
_commandConnection?.DisconnectAsync();
|
||||||
|
_connection?.DisconnectAsync();
|
||||||
|
|
||||||
|
_cancelConnect?.Cancel();
|
||||||
|
_cancelConnect = new CancellationTokenSource();
|
||||||
|
|
||||||
|
_cancelCommand?.Cancel();
|
||||||
|
_cancelCommand = new CancellationTokenSource();
|
||||||
|
|
||||||
|
_connection = null;
|
||||||
|
_commandConnection = null;
|
||||||
|
|
||||||
|
Trace.WriteLine("Disconnected");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Connect()
|
||||||
|
{
|
||||||
|
Trace.WriteLine("Connecting");
|
||||||
|
|
||||||
|
if (_cancelCommand.IsCancellationRequested || _cancelConnect.IsCancellationRequested)
|
||||||
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_connection = await ConnectInternal(token);
|
_connection = await ConnectInternal(_cancelConnect.Token);
|
||||||
_commandConnection = await ConnectInternal(token);
|
_commandConnection = await ConnectInternal(_cancelCommand.Token);
|
||||||
}
|
}
|
||||||
catch (MpcNET.Exceptions.MpcConnectException e)
|
catch (MpcNET.Exceptions.MpcConnectException e)
|
||||||
{
|
{
|
||||||
@ -217,11 +250,14 @@ namespace unison
|
|||||||
await UpdateStatusAsync();
|
await UpdateStatusAsync();
|
||||||
await UpdateSongAsync();
|
await UpdateSongAsync();
|
||||||
|
|
||||||
Loop(token);
|
Loop(_cancelCommand.Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<MpcConnection> ConnectInternal(CancellationToken token)
|
private async Task<MpcConnection> ConnectInternal(CancellationToken token)
|
||||||
{
|
{
|
||||||
|
if (token.IsCancellationRequested)
|
||||||
|
return null;
|
||||||
|
|
||||||
IPAddress.TryParse(Properties.Settings.Default.mpd_host, out _ipAddress);
|
IPAddress.TryParse(Properties.Settings.Default.mpd_host, out _ipAddress);
|
||||||
|
|
||||||
if (_ipAddress == null)
|
if (_ipAddress == null)
|
||||||
@ -261,18 +297,6 @@ namespace unison
|
|||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Disconnected()
|
|
||||||
{
|
|
||||||
_connected = false;
|
|
||||||
ConnectionChanged?.Invoke(this, EventArgs.Empty);
|
|
||||||
|
|
||||||
if (_connection != null)
|
|
||||||
_connection = null;
|
|
||||||
|
|
||||||
if (_commandConnection != null)
|
|
||||||
_commandConnection = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Loop(CancellationToken token)
|
private void Loop(CancellationToken token)
|
||||||
{
|
{
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
@ -281,8 +305,7 @@ namespace unison
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
token.ThrowIfCancellationRequested();
|
if (token.IsCancellationRequested || _connection == null || !IsConnected())
|
||||||
if (token.IsCancellationRequested || _connection == null)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
IMpdMessage<string> idleChanges = await _connection.SendAsync(new IdleCommand("stored_playlist playlist player mixer output options update"));
|
IMpdMessage<string> idleChanges = await _connection.SendAsync(new IdleCommand("stored_playlist playlist player mixer output options update"));
|
||||||
@ -291,14 +314,17 @@ namespace unison
|
|||||||
await HandleIdleResponseAsync(idleChanges.Response.Content);
|
await HandleIdleResponseAsync(idleChanges.Response.Content);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Trace.WriteLine($"Error in Idle connection thread: {idleChanges.Response?.Content}");
|
Trace.WriteLine($"Error in Idle connection thread (1): {idleChanges.Response?.Content}");
|
||||||
throw new Exception(idleChanges.Response?.Content);
|
throw new Exception(idleChanges.Response?.Content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Trace.WriteLine($"Error in Idle connection thread: {e.Message}");
|
if (token.IsCancellationRequested)
|
||||||
Disconnected();
|
Trace.WriteLine($"Idle connection cancelled.");
|
||||||
|
else
|
||||||
|
Trace.WriteLine($"Error in Idle connection thread: {e.Message}");
|
||||||
|
await Initialize();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,6 +347,7 @@ namespace unison
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Trace.WriteLine($"Error in Idle connection thread: {e.Message}");
|
Trace.WriteLine($"Error in Idle connection thread: {e.Message}");
|
||||||
|
await Initialize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,6 +372,7 @@ namespace unison
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Trace.WriteLine($"Error in Idle connection thread: {e.Message}");
|
Trace.WriteLine($"Error in Idle connection thread: {e.Message}");
|
||||||
|
await Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
_isUpdatingStatus = false;
|
_isUpdatingStatus = false;
|
||||||
@ -352,6 +380,8 @@ namespace unison
|
|||||||
|
|
||||||
private async Task UpdateSongAsync()
|
private async Task UpdateSongAsync()
|
||||||
{
|
{
|
||||||
|
Trace.WriteLine("Updating song");
|
||||||
|
|
||||||
if (_connection == null || _isUpdatingSong)
|
if (_connection == null || _isUpdatingSong)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -371,13 +401,17 @@ namespace unison
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Trace.WriteLine($"Error in Idle connection thread: {e.Message}");
|
Trace.WriteLine($"Error in Idle connection thread: {e.Message}");
|
||||||
|
await Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
_isUpdatingSong = false;
|
_isUpdatingSong = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void GetAlbumCover(string path, CancellationToken token = default)
|
private async void GetAlbumCover(string path, CancellationToken token)
|
||||||
{
|
{
|
||||||
|
if (token.IsCancellationRequested)
|
||||||
|
return;
|
||||||
|
|
||||||
List<byte> data = new List<byte>();
|
List<byte> data = new List<byte>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -390,7 +424,7 @@ namespace unison
|
|||||||
if (_connection == null)
|
if (_connection == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IMpdMessage<MpdBinaryData> albumReq = await _connection.SendAsync(new ReadPictureCommand(path, currentSize));
|
IMpdMessage<MpdBinaryData> albumReq = await _connection.SendAsync(new AlbumArtCommand(path, currentSize));
|
||||||
if (!albumReq.IsResponseValid)
|
if (!albumReq.IsResponseValid)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -412,7 +446,7 @@ namespace unison
|
|||||||
if (_connection == null)
|
if (_connection == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IMpdMessage<MpdBinaryData> albumReq = await _connection.SendAsync(new AlbumArtCommand(path, currentSize));
|
IMpdMessage<MpdBinaryData> albumReq = await _connection.SendAsync(new ReadPictureCommand(path, currentSize));
|
||||||
if (!albumReq.IsResponseValid)
|
if (!albumReq.IsResponseValid)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -428,6 +462,9 @@ namespace unison
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
if (token.IsCancellationRequested)
|
||||||
|
return;
|
||||||
|
|
||||||
Trace.WriteLine("Exception caught while getting albumart: " + e);
|
Trace.WriteLine("Exception caught while getting albumart: " + e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -441,7 +478,7 @@ namespace unison
|
|||||||
{
|
{
|
||||||
_cover = BitmapFrame.Create(stream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
|
_cover = BitmapFrame.Create(stream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
|
||||||
}
|
}
|
||||||
catch (System.NotSupportedException)
|
catch
|
||||||
{
|
{
|
||||||
_cover = null;
|
_cover = null;
|
||||||
}
|
}
|
||||||
@ -476,7 +513,7 @@ namespace unison
|
|||||||
SongChanged?.Invoke(this, EventArgs.Empty);
|
SongChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
|
||||||
string uri = Regex.Escape(_currentSong.Path);
|
string uri = Regex.Escape(_currentSong.Path);
|
||||||
GetAlbumCover(uri);
|
GetAlbumCover(uri, _cancelCommand.Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateCover()
|
public void UpdateCover()
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
BIN
Resources/nothing.png
Normal file
BIN
Resources/nothing.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 369 B |
BIN
Resources/radio.png
Normal file
BIN
Resources/radio.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
@ -104,7 +104,8 @@
|
|||||||
<VisualBrush Visual="{Binding ElementName=mask}"/>
|
<VisualBrush Visual="{Binding ElementName=mask}"/>
|
||||||
</StackPanel.OpacityMask>
|
</StackPanel.OpacityMask>
|
||||||
<Image x:Name="Cover" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Resources/nocover.png" Visibility="Collapsed" />
|
<Image x:Name="Cover" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Resources/nocover.png" Visibility="Collapsed" />
|
||||||
<Image x:Name="NoCover" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Resources/nocover.png" />
|
<Image x:Name="NoCover" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Resources/nocover.png" Visibility="Collapsed" />
|
||||||
|
<Image x:Name="RadioCover" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Resources/radio.png" Visibility="Collapsed" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
@ -46,9 +46,12 @@ namespace unison
|
|||||||
{
|
{
|
||||||
if (_mpd.IsConnected())
|
if (_mpd.IsConnected())
|
||||||
{
|
{
|
||||||
Snapcast.IsEnabled = true;
|
|
||||||
ConnectionOkIcon.Visibility = Visibility.Visible;
|
ConnectionOkIcon.Visibility = Visibility.Visible;
|
||||||
ConnectionFailIcon.Visibility = Visibility.Collapsed;
|
ConnectionFailIcon.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
|
Snapcast.IsEnabled = true;
|
||||||
|
if (_radiosWin.IsConnected())
|
||||||
|
Radio.IsEnabled = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -56,6 +59,9 @@ namespace unison
|
|||||||
DefaultState(true);
|
DefaultState(true);
|
||||||
ConnectionOkIcon.Visibility = Visibility.Collapsed;
|
ConnectionOkIcon.Visibility = Visibility.Collapsed;
|
||||||
ConnectionFailIcon.Visibility = Visibility.Visible;
|
ConnectionFailIcon.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
|
Snapcast.IsEnabled = false;
|
||||||
|
Radio.IsEnabled = false;
|
||||||
}
|
}
|
||||||
_settingsWin.UpdateConnectionStatus();
|
_settingsWin.UpdateConnectionStatus();
|
||||||
Connection.Text = $"{Properties.Settings.Default.mpd_host}:{Properties.Settings.Default.mpd_port}";
|
Connection.Text = $"{Properties.Settings.Default.mpd_host}:{Properties.Settings.Default.mpd_port}";
|
||||||
@ -153,8 +159,9 @@ namespace unison
|
|||||||
PlayPause.Text = (string)Application.Current.FindResource("pauseButton");
|
PlayPause.Text = (string)Application.Current.FindResource("pauseButton");
|
||||||
TimeSlider.Value = 50;
|
TimeSlider.Value = 50;
|
||||||
TimeSlider.IsEnabled = false;
|
TimeSlider.IsEnabled = false;
|
||||||
NoCover.Visibility = Visibility.Visible;
|
NoCover.Visibility = Visibility.Collapsed;
|
||||||
Cover.Visibility = Visibility.Collapsed;
|
Cover.Visibility = Visibility.Collapsed;
|
||||||
|
RadioCover.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
if (LostConnection)
|
if (LostConnection)
|
||||||
{
|
{
|
||||||
@ -166,16 +173,18 @@ namespace unison
|
|||||||
|
|
||||||
public void OnCoverChanged(object sender, EventArgs e)
|
public void OnCoverChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_mpd.GetCover() == null)
|
NoCover.Visibility = Visibility.Collapsed;
|
||||||
{
|
Cover.Visibility = Visibility.Collapsed;
|
||||||
|
RadioCover.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
|
if (_mpd.GetCurrentSong().Time == -1)
|
||||||
|
RadioCover.Visibility = Visibility.Visible;
|
||||||
|
else if (_mpd.GetCover() == null)
|
||||||
NoCover.Visibility = Visibility.Visible;
|
NoCover.Visibility = Visibility.Visible;
|
||||||
Cover.Visibility = Visibility.Collapsed;
|
|
||||||
}
|
|
||||||
else if (Cover.Source != _mpd.GetCover())
|
else if (Cover.Source != _mpd.GetCover())
|
||||||
{
|
{
|
||||||
Cover.Source = _mpd.GetCover();
|
Cover.Source = _mpd.GetCover();
|
||||||
Cover.Visibility = Visibility.Visible;
|
Cover.Visibility = Visibility.Visible;
|
||||||
NoCover.Visibility = Visibility.Collapsed;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,11 +197,6 @@ namespace unison
|
|||||||
SnapcastText.Text = unison.Resources.Resources.StartSnapcast;
|
SnapcastText.Text = unison.Resources.Resources.StartSnapcast;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnRadioBrowserConnected()
|
|
||||||
{
|
|
||||||
Radio.IsEnabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateButton(ref Border border, bool b)
|
public void UpdateButton(ref Border border, bool b)
|
||||||
{
|
{
|
||||||
border.Style = b ? (Style)Resources["SelectedButton"] : (Style)Resources["UnselectedButton"];
|
border.Style = b ? (Style)Resources["SelectedButton"] : (Style)Resources["UnselectedButton"];
|
||||||
|
@ -54,6 +54,9 @@ namespace unison
|
|||||||
{
|
{
|
||||||
private RadioBrowserClient _radioBrowser;
|
private RadioBrowserClient _radioBrowser;
|
||||||
private MPDHandler _mpd;
|
private MPDHandler _mpd;
|
||||||
|
private bool _connected = true;
|
||||||
|
|
||||||
|
public bool IsConnected() => _connected;
|
||||||
|
|
||||||
public Radios()
|
public Radios()
|
||||||
{
|
{
|
||||||
@ -69,11 +72,8 @@ namespace unison
|
|||||||
Debug.WriteLine("Exception while connecting to RadioBrowser: " + e.Message);
|
Debug.WriteLine("Exception while connecting to RadioBrowser: " + e.Message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
|
||||||
{
|
_connected = true;
|
||||||
MainWindow MainWin = (MainWindow)Application.Current.MainWindow;
|
|
||||||
MainWin.OnRadioBrowserConnected();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Initialize()
|
public async void Initialize()
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
<StackPanel Margin="0,5,0,0">
|
<StackPanel Margin="0,5,0,0">
|
||||||
<TextBlock Text="{x:Static properties:Resources.Settings_Password}" TextWrapping="Wrap" Margin="5,0,0,0"/>
|
<TextBlock Text="{x:Static properties:Resources.Settings_Password}" TextWrapping="Wrap" Margin="5,0,0,0"/>
|
||||||
<PasswordBox x:Name="MpdPassword" Width="250" Margin="10,2,0,0"/>
|
<PasswordBox x:Name="MpdPassword" KeyDown="ConnectHandler" Width="250" Margin="10,2,0,0"/>
|
||||||
<TextBlock Text="{x:Static properties:Resources.Settings_ConnectionPasswordInfo}" TextWrapping="Wrap" Margin="10,5,0,0" MaxWidth="250" HorizontalAlignment="Left"/>
|
<TextBlock Text="{x:Static properties:Resources.Settings_ConnectionPasswordInfo}" TextWrapping="Wrap" Margin="10,5,0,0" MaxWidth="250" HorizontalAlignment="Left"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
@ -52,7 +52,6 @@
|
|||||||
<Run x:Name="ConnectionStatus" Text="{x:Static properties:Resources.Settings_ConnectionStatusOffline}"/>
|
<Run x:Name="ConnectionStatus" Text="{x:Static properties:Resources.Settings_ConnectionStatusOffline}"/>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
<!--<TextBlock x:Name="ConnectionStatus" Text="{x:Static properties:Resources.Settings_ConnectionStatusOffline}" TextWrapping="Wrap" Margin="5,10,0,0"/>-->
|
|
||||||
<Button x:Name="ConnectButton" Content="{x:Static properties:Resources.Settings_ConnectButton}" Margin="0,10,0,0" Width="120" Click="MPDConnect_Clicked"/>
|
<Button x:Name="ConnectButton" Content="{x:Static properties:Resources.Settings_ConnectButton}" Margin="0,10,0,0" Width="120" Click="MPDConnect_Clicked"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
@ -60,30 +59,6 @@
|
|||||||
</DockPanel>
|
</DockPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<TabItem Header="{x:Static properties:Resources.Stats}">
|
|
||||||
<DockPanel Margin="8">
|
|
||||||
<GroupBox DockPanel.Dock="Top" Padding="0,4,0,0">
|
|
||||||
<GroupBox.Header>
|
|
||||||
<TextBlock>
|
|
||||||
<emoji:EmojiInline Text="📊"/>
|
|
||||||
<Run Text="{x:Static properties:Resources.Stats}"/>
|
|
||||||
</TextBlock>
|
|
||||||
</GroupBox.Header>
|
|
||||||
<Grid VerticalAlignment="Top">
|
|
||||||
<TextBlock>
|
|
||||||
<Run Text="{x:Static properties:Resources.Stats_Songs}"/><Run Text=" "/><Run x:Name="StatSong"/><LineBreak/>
|
|
||||||
<Run Text="{x:Static properties:Resources.Stats_Albums}"/><Run Text=" "/><Run x:Name="StatAlbum"/><LineBreak/>
|
|
||||||
<Run Text="{x:Static properties:Resources.Stats_Artists}"/><Run Text=" "/><Run x:Name="StatArtist"/><LineBreak/>
|
|
||||||
<Run Text="{x:Static properties:Resources.Stats_TotalPlaytime}"/><Run Text=" "/><Run x:Name="StatTotalPlaytime"/><LineBreak/><LineBreak/>
|
|
||||||
<Run Text="{x:Static properties:Resources.Stats_Uptime}"/><Run Text=" "/><Run x:Name="StatUptime"/><LineBreak/>
|
|
||||||
<Run Text="{x:Static properties:Resources.Stats_TotalTimePlayed}"/><Run Text=" "/><Run x:Name="StatTotalTimePlayed"/><LineBreak/>
|
|
||||||
<Run Text="{x:Static properties:Resources.Stats_LastDatabaseUpdate}"/><Run Text=" "/><Run x:Name="StatDatabaseUpdate"/>
|
|
||||||
</TextBlock>
|
|
||||||
</Grid>
|
|
||||||
</GroupBox>
|
|
||||||
</DockPanel>
|
|
||||||
</TabItem>
|
|
||||||
|
|
||||||
<TabItem Header="Snapcast">
|
<TabItem Header="Snapcast">
|
||||||
<DockPanel Margin="8">
|
<DockPanel Margin="8">
|
||||||
<GroupBox DockPanel.Dock="Top" Padding="0,4,0,0">
|
<GroupBox DockPanel.Dock="Top" Padding="0,4,0,0">
|
||||||
@ -222,6 +197,30 @@
|
|||||||
</DockPanel>
|
</DockPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
|
<TabItem Header="{x:Static properties:Resources.Stats}">
|
||||||
|
<DockPanel Margin="8">
|
||||||
|
<GroupBox DockPanel.Dock="Top" Padding="0,4,0,0">
|
||||||
|
<GroupBox.Header>
|
||||||
|
<TextBlock>
|
||||||
|
<emoji:EmojiInline Text="📊"/>
|
||||||
|
<Run Text="{x:Static properties:Resources.Stats}"/>
|
||||||
|
</TextBlock>
|
||||||
|
</GroupBox.Header>
|
||||||
|
<Grid VerticalAlignment="Top">
|
||||||
|
<TextBlock>
|
||||||
|
<Run Text="{x:Static properties:Resources.Stats_Songs}"/><Run Text=" "/><Run x:Name="StatSong"/><LineBreak/>
|
||||||
|
<Run Text="{x:Static properties:Resources.Stats_Albums}"/><Run Text=" "/><Run x:Name="StatAlbum"/><LineBreak/>
|
||||||
|
<Run Text="{x:Static properties:Resources.Stats_Artists}"/><Run Text=" "/><Run x:Name="StatArtist"/><LineBreak/>
|
||||||
|
<Run Text="{x:Static properties:Resources.Stats_TotalPlaytime}"/><Run Text=" "/><Run x:Name="StatTotalPlaytime"/><LineBreak/><LineBreak/>
|
||||||
|
<Run Text="{x:Static properties:Resources.Stats_Uptime}"/><Run Text=" "/><Run x:Name="StatUptime"/><LineBreak/>
|
||||||
|
<Run Text="{x:Static properties:Resources.Stats_TotalTimePlayed}"/><Run Text=" "/><Run x:Name="StatTotalTimePlayed"/><LineBreak/>
|
||||||
|
<Run Text="{x:Static properties:Resources.Stats_LastDatabaseUpdate}"/><Run Text=" "/><Run x:Name="StatDatabaseUpdate"/>
|
||||||
|
</TextBlock>
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
</DockPanel>
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
<TabItem Header="{x:Static properties:Resources.Settings_About}" Height="20" VerticalAlignment="Bottom">
|
<TabItem Header="{x:Static properties:Resources.Settings_About}" Height="20" VerticalAlignment="Bottom">
|
||||||
<DockPanel Margin="8">
|
<DockPanel Margin="8">
|
||||||
<GroupBox DockPanel.Dock="Top" Padding="0,4,0,0">
|
<GroupBox DockPanel.Dock="Top" Padding="0,4,0,0">
|
||||||
|
@ -111,14 +111,11 @@ namespace unison
|
|||||||
|
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
|
|
||||||
MPDHandler mpd = (MPDHandler)Application.Current.Properties["mpd"];
|
|
||||||
if (mpd.IsConnected())
|
|
||||||
mpd = new MPDHandler();
|
|
||||||
|
|
||||||
ConnectButton.IsEnabled = false;
|
ConnectButton.IsEnabled = false;
|
||||||
ConnectionStatus.Text = unison.Resources.Resources.Settings_ConnectionStatusConnecting;
|
ConnectionStatus.Text = unison.Resources.Resources.Settings_ConnectionStatusConnecting;
|
||||||
|
|
||||||
System.Threading.Tasks.Task.Run(() => { mpd.Connect(); });
|
MPDHandler mpd = (MPDHandler)Application.Current.Properties["mpd"];
|
||||||
|
System.Threading.Tasks.Task.Run(async () => { await mpd.Initialize(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SnapcastReset_Clicked(object sender, RoutedEventArgs e)
|
private void SnapcastReset_Clicked(object sender, RoutedEventArgs e)
|
||||||
|
@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net5.0-windows</TargetFramework>
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
<ApplicationIcon>Resources\icon-full.ico</ApplicationIcon>
|
<ApplicationIcon>Resources\icon-full.ico</ApplicationIcon>
|
||||||
<Win32Resource></Win32Resource>
|
<Win32Resource></Win32Resource>
|
||||||
<StartupObject>unison.App</StartupObject>
|
<StartupObject>unison.App</StartupObject>
|
||||||
<Version>1.2</Version>
|
<Version>1.3.1</Version>
|
||||||
<Company />
|
<Company />
|
||||||
<Authors>Théo Marchal</Authors>
|
<Authors>Théo Marchal</Authors>
|
||||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
<PackageProjectUrl>https://git.n700.ovh/keb/unison</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/ZetaKebab/unison</PackageProjectUrl>
|
||||||
<RepositoryUrl>https://git.n700.ovh/keb/unison</RepositoryUrl>
|
<RepositoryUrl>https://github.com/ZetaKebab/unison</RepositoryUrl>
|
||||||
<Copyright>Théo Marchal</Copyright>
|
<Copyright>Théo Marchal</Copyright>
|
||||||
<PackageIconUrl />
|
<PackageIconUrl />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -22,6 +22,8 @@
|
|||||||
<None Remove="Resources\icon-mini.ico" />
|
<None Remove="Resources\icon-mini.ico" />
|
||||||
<None Remove="Resources\nocover.png" />
|
<None Remove="Resources\nocover.png" />
|
||||||
<None Remove="LICENSE" />
|
<None Remove="LICENSE" />
|
||||||
|
<None Remove="Resources\nothing.png" />
|
||||||
|
<None Remove="Resources\radio.png" />
|
||||||
<None Include="LICENSE">
|
<None Include="LICENSE">
|
||||||
<Pack>True</Pack>
|
<Pack>True</Pack>
|
||||||
<PackagePath></PackagePath>
|
<PackagePath></PackagePath>
|
||||||
@ -38,6 +40,12 @@
|
|||||||
<Resource Include="Resources\nocover.png">
|
<Resource Include="Resources\nocover.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="Resources\nothing.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Resource>
|
||||||
|
<Resource Include="Resources\radio.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Resource>
|
||||||
<Content Include="LICENSE">
|
<Content Include="LICENSE">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
@ -47,7 +55,7 @@
|
|||||||
<PackageReference Include="Emoji.Wpf" Version="0.3.3" />
|
<PackageReference Include="Emoji.Wpf" Version="0.3.3" />
|
||||||
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" />
|
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" />
|
||||||
<PackageReference Include="RadioBrowser" Version="0.6.1" />
|
<PackageReference Include="RadioBrowser" Version="0.6.1" />
|
||||||
<PackageReference Include="MpcNET" Version="1.3.0" />
|
<PackageReference Include="MpcNET" Version="1.4.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Reference in New Issue
Block a user