|
|
@ -1,5 +1,8 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
using System.Net.Http;
|
|
|
|
using System.IO;
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
|
|
namespace QuickPlay
|
|
|
|
namespace QuickPlay
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -73,7 +76,7 @@ namespace QuickPlay
|
|
|
|
public PlayerConfiguration GetPlayerConfig()
|
|
|
|
public PlayerConfiguration GetPlayerConfig()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// TODO: decide sensibly
|
|
|
|
// TODO: decide sensibly
|
|
|
|
var cfgProvider = new CurlConfigurationProvider(playerConfigUrl);
|
|
|
|
var cfgProvider = new HttpConfigurationProvider(playerConfigUrl);
|
|
|
|
return cfgProvider.GetConfiguration();
|
|
|
|
return cfgProvider.GetConfiguration();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -97,9 +100,23 @@ namespace QuickPlay
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public class PlayerConfiguration
|
|
|
|
public class PlayerConfiguration
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
List<IPlayable> songs;
|
|
|
|
|
|
|
|
|
|
|
|
public static PlayerConfiguration FromFile(StreamReader reader)
|
|
|
|
public static PlayerConfiguration FromFile(StreamReader reader)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return null; // FIXME: Implement
|
|
|
|
var parser = new IniParser(reader);
|
|
|
|
|
|
|
|
var ini = parser.Parse();
|
|
|
|
|
|
|
|
foreach (string key in ini.Keys)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Two options: either general options, or song descriptions
|
|
|
|
|
|
|
|
if (key == "general")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Song
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public IPlayer GetPlayer()
|
|
|
|
public IPlayer GetPlayer()
|
|
|
@ -113,16 +130,19 @@ namespace QuickPlay
|
|
|
|
PlayerConfiguration GetConfiguration();
|
|
|
|
PlayerConfiguration GetConfiguration();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sealed class CurlConfigurationProvider : IPlayerConfigurationProvider
|
|
|
|
sealed class HttpConfigurationProvider : IPlayerConfigurationProvider
|
|
|
|
{
|
|
|
|
{
|
|
|
|
readonly string configUrl;
|
|
|
|
readonly string configUrl;
|
|
|
|
public CurlConfigurationProvider(string url)
|
|
|
|
public HttpConfigurationProvider(string url)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
configUrl = url;
|
|
|
|
configUrl = url;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public PlayerConfiguration GetConfiguration()
|
|
|
|
public async Task<PlayerConfiguration> GetConfiguration()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
var client = new HttpClient() ;
|
|
|
|
|
|
|
|
var resp = await client.GetStreamAsync(configUrl);
|
|
|
|
|
|
|
|
var sr = new StreamReader(resp);
|
|
|
|
|
|
|
|
return PlayerConfiguration.FromFile(sr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|