Add skeleton for a MPD-backed IPlayer

develop
LEdoian 3 years ago
parent f7dea469f8
commit 85066e197c

@ -104,6 +104,11 @@ namespace QuickPlay
} }
#pragma warning restore CS0659 #pragma warning restore CS0659
public enum PlayerType
{
MPD,
}
/// <summary> /// <summary>
/// Configuration of the player. /// Configuration of the player.
/// ///
@ -111,8 +116,10 @@ namespace QuickPlay
/// </summary> /// </summary>
public class PlayerConfiguration public class PlayerConfiguration
{ {
Dictionary<string, IPlayable> songs; public Dictionary<string, IPlayable> songs;
string playerName; 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) public static PlayerConfiguration FromFile(StreamReader reader)
{ {
@ -125,6 +132,8 @@ namespace QuickPlay
if (elem.Key == "general") if (elem.Key == "general")
{ {
result.playerName = elem.Value["name"]; result.playerName = elem.Value["name"];
result.playerType = PlayerType.MPD; //FIXME: not always.
result.playerConnectionDetails = elem.Value["connection"];
} else } else
{ {
var song = new Song(elem.Key, elem.Value); var song = new Song(elem.Key, elem.Value);
@ -136,7 +145,16 @@ namespace QuickPlay
public IPlayer GetPlayer() 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;
} }
} }

@ -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<string, IPlayable> 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;
}
}
}

@ -73,6 +73,7 @@
<Compile Include="Interfaces.cs" /> <Compile Include="Interfaces.cs" />
<Compile Include="MpdMonitorService.cs" /> <Compile Include="MpdMonitorService.cs" />
<Compile Include="MainActivity.cs" /> <Compile Include="MainActivity.cs" />
<Compile Include="MpdPlayer.cs" />
<Compile Include="Resources\Resource.designer.cs" /> <Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SongRecycler.cs" /> <Compile Include="SongRecycler.cs" />

@ -22,7 +22,7 @@ namespace QuickPlay
{ {
get get
{ {
throw new NotImplementedException(); return player.Songs.Count;
} }
} }
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)

Loading…
Cancel
Save