|
|
|
@ -77,7 +77,7 @@ namespace QuickPlay
|
|
|
|
|
{
|
|
|
|
|
// TODO: decide sensibly
|
|
|
|
|
var cfgProvider = new HttpConfigurationProvider(playerConfigUrl);
|
|
|
|
|
return cfgProvider.GetConfiguration();
|
|
|
|
|
return cfgProvider.GetConfigurationAsync().Result; // Bad code, but hopefully we dont hang.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// We want to compare by values.
|
|
|
|
@ -131,7 +131,7 @@ namespace QuickPlay
|
|
|
|
|
|
|
|
|
|
interface IPlayerConfigurationProvider
|
|
|
|
|
{
|
|
|
|
|
PlayerConfiguration GetConfiguration();
|
|
|
|
|
Task<PlayerConfiguration> GetConfigurationAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sealed class HttpConfigurationProvider : IPlayerConfigurationProvider
|
|
|
|
@ -141,7 +141,7 @@ namespace QuickPlay
|
|
|
|
|
{
|
|
|
|
|
configUrl = url;
|
|
|
|
|
}
|
|
|
|
|
public async Task<PlayerConfiguration> GetConfiguration()
|
|
|
|
|
public async Task<PlayerConfiguration> GetConfigurationAsync()
|
|
|
|
|
{
|
|
|
|
|
var client = new HttpClient() ;
|
|
|
|
|
var resp = await client.GetStreamAsync(configUrl);
|
|
|
|
@ -162,15 +162,15 @@ namespace QuickPlay
|
|
|
|
|
{
|
|
|
|
|
this.reader = new StreamReader(filename);
|
|
|
|
|
}
|
|
|
|
|
public PlayerConfiguration GetConfiguration()
|
|
|
|
|
public Task<PlayerConfiguration> GetConfigurationAsync()
|
|
|
|
|
{
|
|
|
|
|
return PlayerConfiguration.FromFile(reader);
|
|
|
|
|
return Task.FromResult(PlayerConfiguration.FromFile(reader));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sealed class DummyConfigurationProvider : IPlayerConfigurationProvider
|
|
|
|
|
{
|
|
|
|
|
public PlayerConfiguration GetConfiguration() => null;
|
|
|
|
|
public Task<PlayerConfiguration> GetConfigurationAsync() => null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Song: IPlayable
|
|
|
|
|