diff --git a/QuickPlay/Configuration.cs b/QuickPlay/Configuration.cs
index 64abf2d..4f06c9f 100644
--- a/QuickPlay/Configuration.cs
+++ b/QuickPlay/Configuration.cs
@@ -104,6 +104,11 @@ namespace QuickPlay
}
#pragma warning restore CS0659
+ public enum PlayerType
+ {
+ MPD,
+ }
+
///
/// Configuration of the player.
///
@@ -111,8 +116,10 @@ namespace QuickPlay
///
public class PlayerConfiguration
{
- Dictionary songs;
- string playerName;
+ public Dictionary songs;
+ public string playerName;
+ public PlayerType playerType;
+ public string playerConnectionDetails; // This is opaque to this class, the player will make sense of it.
public static PlayerConfiguration FromFile(StreamReader reader)
{
@@ -125,6 +132,8 @@ namespace QuickPlay
if (elem.Key == "general")
{
result.playerName = elem.Value["name"];
+ result.playerType = PlayerType.MPD; //FIXME: not always.
+ result.playerConnectionDetails = elem.Value["connection"];
} else
{
var song = new Song(elem.Key, elem.Value);
@@ -136,7 +145,16 @@ namespace QuickPlay
public IPlayer GetPlayer()
{
- throw new NotImplementedException();
+ IPlayer result;
+ switch (playerType)
+ {
+ case PlayerType.MPD:
+ result = new MpdPlayer(this);
+ break;
+ default:
+ throw new InvalidOperationException("Cannot happen: Player had no type.");
+ }
+ return result;
}
}
diff --git a/QuickPlay/MpdPlayer.cs b/QuickPlay/MpdPlayer.cs
new file mode 100644
index 0000000..6cba223
--- /dev/null
+++ b/QuickPlay/MpdPlayer.cs
@@ -0,0 +1,36 @@
+using Android.App;
+using Android.Content;
+using Android.OS;
+using Android.Runtime;
+using Android.Views;
+using Android.Widget;
+using System;
+using System.Collections.Generic;
+
+namespace QuickPlay
+{
+ class MpdPlayer: IPlayer
+ {
+ public Dictionary Songs { get; private set; }
+ public float CurrentProgress { get {
+ throw new NotImplementedException();
+ } }
+ public bool IsReady { get
+ {
+ throw new NotImplementedException();
+ } }
+ public void Play(string songId)
+ {
+ throw new NotImplementedException();
+ }
+ public void SetReasonableOptions()
+ {
+ throw new NotImplementedException();
+ }
+ public MpdPlayer(PlayerConfiguration cfg)
+ {
+ //TODO
+ Songs = cfg.songs;
+ }
+ }
+}
\ No newline at end of file
diff --git a/QuickPlay/QuickPlay.csproj b/QuickPlay/QuickPlay.csproj
index ff49baa..bfdf3c7 100644
--- a/QuickPlay/QuickPlay.csproj
+++ b/QuickPlay/QuickPlay.csproj
@@ -73,6 +73,7 @@
+
diff --git a/QuickPlay/SongRecycler.cs b/QuickPlay/SongRecycler.cs
index 48b3a87..e0a0927 100644
--- a/QuickPlay/SongRecycler.cs
+++ b/QuickPlay/SongRecycler.cs
@@ -22,7 +22,7 @@ namespace QuickPlay
{
get
{
- throw new NotImplementedException();
+ return player.Songs.Count;
}
}
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)