Added Media Provider Interface and XBMC's implementation

This commit is contained in:
nothingmn 2010-10-07 21:19:05 -07:00
parent 95c368fd04
commit 92e0a8f1a4
3 changed files with 146 additions and 0 deletions

View File

@ -149,6 +149,8 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Providers\IMediaProvider.cs" />
<Compile Include="Providers\XBMCMediaProvider.cs" />
<Compile Include="SonicTrace.cs" />
<Compile Include="Providers\ConfigProvider.cs" />
<Compile Include="Providers\EpisodeProvider.cs" />

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Providers
{
interface IMediaProvider
{
void Play();
void Play(string Location);
void Play(string Location, bool AddToQueue);
void Pause();
void Stop();
void Next();
void Previous();
void Seek(string RawTime);
void Seek(int Hour, int Minute, int Second);
void Seek(System.TimeSpan SeekTime);
void Queue(string Location);
System.Uri Uri { get; }
string UniqueDeviceName { get; }
OpenSource.UPnP.UPnPDevice Device { get; }
OpenSource.UPnP.AV.CpAVTransport Transport { get; }
string FriendlyName { get; }
DateTime FirstSeen { get; }
DateTime LastSeen { get; }
bool IsActive { get; }
}
}

View File

@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Providers
{
public class XBMCMediaProvider : IMediaProvider
{
public OpenSource.XBMC.XBMCAVDevice XBMCDevice{ get; set; }
public XBMCMediaProvider(OpenSource.XBMC.XBMCAVDevice XBMCDevice)
{
this.XBMCDevice = XBMCDevice;
}
#region IAVDevice Members
public DateTime FirstSeen { get { return XBMCDevice.FirstSeen; } }
public DateTime LastSeen { get { return XBMCDevice.LastSeen; } }
public bool IsActive
{
get
{
return XBMCDevice.IsActive;
}
}
public void Play()
{
XBMCDevice.Play();
}
public void Play(string Location)
{
XBMCDevice.Play(Location);
}
public void Play(string Location, bool AddToQueue)
{
XBMCDevice.Play(Location, AddToQueue);
}
public void Stop()
{
XBMCDevice.Stop();
}
public void Next()
{
XBMCDevice.Next();
}
public void Previous()
{
XBMCDevice.Previous();
}
public void Seek(string RawTime)
{
XBMCDevice.Seek(RawTime);
}
public void Seek(int Hour, int Minute, int Second)
{
XBMCDevice.Seek(Hour, Minute, Second);
}
public void Seek(System.TimeSpan SeekTime)
{
XBMCDevice.Seek(SeekTime);
}
public void Queue(string Location)
{
XBMCDevice.Queue(Location);
}
public OpenSource.UPnP.UPnPDevice Device {
get { return XBMCDevice.Device; }
}
public void Pause()
{
XBMCDevice.Pause();
}
public System.Uri Uri
{
get { return XBMCDevice.Uri; }
}
public string UniqueDeviceName
{
get { return XBMCDevice.UniqueDeviceName; }
}
public OpenSource.UPnP.AV.CpAVTransport Transport
{
get
{
return XBMCDevice.Transport;
}
}
public string FriendlyName
{
get
{
return XBMCDevice.FriendlyName;
}
}
#endregion
}
}