├── OpenSonos.LocalMusicServer.Test.Unit ├── packages.config ├── Browsing │ ├── SonosIdentifierTests.cs │ └── GuidProviderTests.cs ├── Bootstrapping │ └── ServerConfigurationTests.cs ├── MusicDatabase │ └── PhysicalResourceTests.cs ├── Properties │ └── AssemblyInfo.cs ├── OpenSonos.LocalMusicServer.Test.Unit.csproj └── Smapi │ └── ResponseFormattingExtensionsTests.cs ├── OpenSonos.LocalMusicServer ├── Browsing │ ├── IRepresentAResource.cs │ ├── IIdentityProvider.cs │ ├── MusicRepositories │ │ ├── ISearchProvider.cs │ │ ├── IMonitorTheFileSystemForChanges.cs │ │ ├── TopLevelDirectorySearchProvider.cs │ │ ├── ChangeMonitor.cs │ │ └── FlatFileMusicRepository.cs │ ├── Container.cs │ ├── MusicFile.cs │ ├── IMusicRepository.cs │ ├── ResourceCollection.cs │ ├── ConvertPathsToSha1.cs │ ├── SonosIdentifier.cs │ ├── PhysicalResource.cs │ └── IdentityProvider.cs ├── App.config ├── Bootstrapping │ ├── ServerConfiguration.cs │ ├── ServerConfigurationFactory.cs │ ├── SimpleServicesToNinject.cs │ └── Bindings.cs ├── packages.config ├── Smapi │ ├── SmapiSoapControllerDependencies.cs │ ├── ResponseFormattingExtensions.cs │ └── SmapiSoapController.cs ├── SmapiService.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── ServerRegistrationService.cs ├── DiscoveryAndRegistration │ └── PlayerWebInterface.cs └── OpenSonos.LocalMusicServer.csproj ├── OpenSonos ├── packages.config ├── SonosPlayer.cs ├── SonosServer │ ├── ISonosMetadataApi.cs │ ├── Metadata │ │ ├── Presentation.cs │ │ └── PresentationMap.cs │ ├── ServerBase.cs │ └── ISonosApi.cs ├── Properties │ └── AssemblyInfo.cs ├── LocalMusicServerFactory.cs ├── Players.cs └── OpenSonos.csproj ├── OpenSonos.Test.Unit ├── Properties │ └── AssemblyInfo.cs └── OpenSonos.Test.Unit.csproj ├── OpenSonos.sln ├── .gitignore ├── README.md ├── LICENSE └── Sonos.wsdl /OpenSonos.LocalMusicServer.Test.Unit/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Browsing/IRepresentAResource.cs: -------------------------------------------------------------------------------- 1 | namespace OpenSonos.LocalMusicServer.Browsing 2 | { 3 | public interface IRepresentAResource 4 | { 5 | SonosIdentifier Identifier { get; } 6 | string DisplayName { get; } 7 | } 8 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Browsing/IIdentityProvider.cs: -------------------------------------------------------------------------------- 1 | namespace OpenSonos.LocalMusicServer.Browsing 2 | { 3 | public interface IIdentityProvider 4 | { 5 | SonosIdentifier IdFor(string path); 6 | SonosIdentifier FromRequestId(string requestedId); 7 | } 8 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Browsing/MusicRepositories/ISearchProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace OpenSonos.LocalMusicServer.Browsing.MusicRepositories 4 | { 5 | public interface ISearchProvider 6 | { 7 | List Search(string query); 8 | } 9 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Browsing/MusicRepositories/IMonitorTheFileSystemForChanges.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OpenSonos.LocalMusicServer.Browsing.MusicRepositories 4 | { 5 | public interface IMonitorTheFileSystemForChanges 6 | { 7 | void StartMonitoring(string path, Action onChange); 8 | } 9 | } -------------------------------------------------------------------------------- /OpenSonos/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Browsing/Container.cs: -------------------------------------------------------------------------------- 1 | namespace OpenSonos.LocalMusicServer.Browsing 2 | { 3 | public class Container : PhysicalResource 4 | { 5 | public Container() 6 | { 7 | } 8 | 9 | public Container(SonosIdentifier path) : base(path) 10 | { 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Browsing/MusicFile.cs: -------------------------------------------------------------------------------- 1 | namespace OpenSonos.LocalMusicServer.Browsing 2 | { 3 | public class MusicFile : PhysicalResource 4 | { 5 | public MusicFile() 6 | { 7 | } 8 | 9 | public MusicFile(SonosIdentifier path) : base(path) 10 | { 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Browsing/IMusicRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OpenSonos.LocalMusicServer.Browsing 4 | { 5 | public interface IMusicRepository 6 | { 7 | DateTime LastUpdate { get; } 8 | 9 | ResourceCollection GetResources(string identifier); 10 | ResourceCollection Search(string query); 11 | } 12 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /OpenSonos/SonosPlayer.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace OpenSonos 4 | { 5 | public class SonosPlayer 6 | { 7 | public IPAddress Address { get; set; } 8 | 9 | public SonosPlayer(string address) 10 | { 11 | Address = IPAddress.Parse(address); 12 | } 13 | 14 | private static readonly SonosPlayer NoPlayer = new SonosPlayer("0.0.0.0"); 15 | public static SonosPlayer None { get { return NoPlayer; } } 16 | } 17 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Bootstrapping/ServerConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace OpenSonos.LocalMusicServer.Bootstrapping 4 | { 5 | public class ServerConfiguration 6 | { 7 | public string BaseUrl { get; set; } 8 | public string BasePort { get; set; } 9 | public string MusicShare { get; set; } 10 | public IPAddress ServerIp { get; set; } 11 | 12 | public string ServerRoot { get { return "http://" + ServerIp + ":" + BasePort; } } 13 | 14 | } 15 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OpenSonos/SonosServer/ISonosMetadataApi.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel; 2 | using System.ServiceModel.Web; 3 | using OpenSonos.SonosServer.Metadata; 4 | 5 | namespace OpenSonos.SonosServer 6 | { 7 | [ServiceContract] 8 | [XmlSerializerFormat] 9 | public interface ISonosMetadataApi 10 | { 11 | [OperationContract] 12 | [WebGet(UriTemplate = "presentation-maps", BodyStyle = WebMessageBodyStyle.Bare)] 13 | [ServiceKnownType(typeof(PresentationMap))] 14 | Presentation GetPresentationMaps(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Browsing/ResourceCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace OpenSonos.LocalMusicServer.Browsing 4 | { 5 | public class ResourceCollection : List 6 | { 7 | public SonosIdentifier Identifier { get; set; } 8 | 9 | public ResourceCollection(SonosIdentifier identifier, IEnumerable enumerable) 10 | : this(identifier) 11 | { 12 | AddRange(enumerable); 13 | } 14 | 15 | public ResourceCollection(SonosIdentifier identifier) 16 | { 17 | Identifier = identifier; 18 | } 19 | 20 | public ResourceCollection() 21 | { 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer.Test.Unit/Browsing/SonosIdentifierTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using OpenSonos.LocalMusicServer.Browsing; 3 | 4 | namespace OpenSonos.LocalMusicServer.Test.Unit.Browsing 5 | { 6 | [TestFixture] 7 | public class SonosIdentifierTests 8 | { 9 | [TestCase("\\\\some\\path", true)] 10 | [TestCase("\\\\some\\path\\file.mp3", false)] 11 | public void CreatedWithAPath_IsDirectoryIsAccurate(string path, bool isDirectory) 12 | { 13 | var si = new SonosIdentifier {Path = path}; 14 | 15 | Assert.That(si.IsDirectory, Is.EqualTo(isDirectory)); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Browsing/ConvertPathsToSha1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Security.Cryptography; 3 | using System.Text; 4 | 5 | namespace OpenSonos.LocalMusicServer.Browsing 6 | { 7 | public class ConvertPathsToSha1 8 | { 9 | private readonly SHA1CryptoServiceProvider _sha; 10 | 11 | public ConvertPathsToSha1() 12 | { 13 | _sha = new SHA1CryptoServiceProvider(); 14 | } 15 | 16 | public string IdentifierFor(string path) 17 | { 18 | var bytes = _sha.ComputeHash(Encoding.ASCII.GetBytes(path)); 19 | return BitConverter.ToString(bytes).Replace("-", "").ToLower(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Smapi/SmapiSoapControllerDependencies.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using OpenSonos.LocalMusicServer.Browsing; 3 | 4 | namespace OpenSonos.LocalMusicServer.Smapi 5 | { 6 | public class SmapiSoapControllerDependencies 7 | { 8 | public Guid Id { get; set; } 9 | public IMusicRepository MusicRepository { get; set; } 10 | public IIdentityProvider IdentityProvider { get; set; } 11 | 12 | public SmapiSoapControllerDependencies(IMusicRepository musicRepository, IIdentityProvider identityProvider) 13 | { 14 | Id = Guid.NewGuid(); 15 | MusicRepository = musicRepository; 16 | IdentityProvider = identityProvider; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /OpenSonos/SonosServer/Metadata/Presentation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Xml.Serialization; 4 | 5 | namespace OpenSonos.SonosServer.Metadata 6 | { 7 | [Serializable] 8 | [XmlRoot("Presentation")] 9 | public class Presentation 10 | { 11 | [XmlElement("PresentationMap")] 12 | public List PresentationMaps; 13 | 14 | public Presentation() 15 | { 16 | } 17 | 18 | public Presentation(PresentationMap singleMap) 19 | { 20 | PresentationMaps = new List 21 | { 22 | PresentationMap.DefaultSonosSearch() 23 | }; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer.Test.Unit/Bootstrapping/ServerConfigurationTests.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using NUnit.Framework; 3 | using OpenSonos.LocalMusicServer.Bootstrapping; 4 | 5 | namespace OpenSonos.LocalMusicServer.Test.Unit.Bootstrapping 6 | { 7 | [TestFixture] 8 | public class ServerConfigurationTests 9 | { 10 | [Test] 11 | public void ServerRoot_CalculatedBaseOnServerIpAndPort() 12 | { 13 | var sc = new ServerConfiguration 14 | { 15 | ServerIp = IPAddress.Parse("127.0.0.1"), 16 | BasePort = "80" 17 | }; 18 | 19 | Assert.That(sc.ServerRoot, Is.EqualTo("http://127.0.0.1:80")); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Bootstrapping/ServerConfigurationFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | 5 | namespace OpenSonos.LocalMusicServer.Bootstrapping 6 | { 7 | public static class ServerConfigurationFactory 8 | { 9 | public static ServerConfiguration LoadConfiguration() 10 | { 11 | var appSetting = new System.Configuration.Abstractions.ConfigurationManager(); 12 | var cfg = appSetting.AppSettings.Map(); 13 | cfg.ServerIp = GetIp(); 14 | return cfg; 15 | } 16 | 17 | private static IPAddress GetIp() 18 | { 19 | var host = Dns.GetHostEntry(Dns.GetHostName()); 20 | return host.AddressList.First(x => x.AddressFamily == AddressFamily.InterNetwork); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Browsing/SonosIdentifier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OpenSonos.LocalMusicServer.Browsing 4 | { 5 | public class SonosIdentifier 6 | { 7 | public string Id { get; set; } 8 | public string Path { get; set; } 9 | 10 | public bool IsDirectory 11 | { 12 | get { return Path == null || !Path.EndsWith(".mp3"); } 13 | } 14 | 15 | public string Uri 16 | { 17 | get { return "x-file-cifs:" + Path.Replace("\\", "/"); } 18 | } 19 | 20 | public SonosIdentifier() 21 | { 22 | Id = string.Empty; 23 | Path = string.Empty; 24 | } 25 | 26 | public static SonosIdentifier Default(string rootPath) 27 | { 28 | return new SonosIdentifier {Id = Guid.Empty.ToString(), Path = rootPath}; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Browsing/PhysicalResource.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace OpenSonos.LocalMusicServer.Browsing 4 | { 5 | public abstract class PhysicalResource : IRepresentAResource 6 | { 7 | public SonosIdentifier Identifier { get; set; } 8 | public string DisplayName { get { return Identifier.Path.Split('\\').Last(); } } 9 | 10 | public PhysicalResource() 11 | { 12 | } 13 | 14 | protected PhysicalResource(SonosIdentifier identifier) 15 | { 16 | Identifier = identifier; 17 | } 18 | 19 | public static PhysicalResource FromId(SonosIdentifier identifier) 20 | { 21 | return identifier.IsDirectory 22 | ? (PhysicalResource) new Container(identifier) 23 | : new MusicFile(identifier); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/SmapiService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ServiceModel; 3 | using OpenSonos.LocalMusicServer.Bootstrapping; 4 | using SimpleServices; 5 | 6 | namespace OpenSonos.LocalMusicServer 7 | { 8 | public class SmapiService : IWindowsService 9 | { 10 | public ApplicationContext AppContext { get; set; } 11 | 12 | private readonly ServiceHost _server; 13 | 14 | public SmapiService(LocalMusicServerFactory localMusicServerFactory, ServerConfiguration config) 15 | { 16 | _server = localMusicServerFactory.HostedAt(new Uri(config.BaseUrl + ":" + config.BasePort)); 17 | } 18 | 19 | public void Start(string[] args) 20 | { 21 | _server.Open(); 22 | } 23 | 24 | public void Stop() 25 | { 26 | _server.Close(new TimeSpan(0, 0, 0, 10)); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Bootstrapping/SimpleServicesToNinject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Ninject; 4 | using SimpleServices; 5 | 6 | namespace OpenSonos.LocalMusicServer.Bootstrapping 7 | { 8 | public class SimpleServicesToNinject : IIocContainer 9 | { 10 | private readonly IKernel _kernel; 11 | 12 | public SimpleServicesToNinject(IKernel kernel) 13 | { 14 | _kernel = kernel; 15 | } 16 | 17 | public T GetType() 18 | { 19 | return _kernel.Get(); 20 | } 21 | 22 | public IEnumerable GetAll() 23 | { 24 | return _kernel.GetAll(); 25 | } 26 | 27 | public object Get(Type t) 28 | { 29 | return _kernel.Get(t); 30 | } 31 | 32 | public IEnumerable GetAll(Type t) 33 | { 34 | return _kernel.GetAll(t); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Browsing/MusicRepositories/TopLevelDirectorySearchProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO.Abstractions; 3 | using System.Linq; 4 | using OpenSonos.LocalMusicServer.Bootstrapping; 5 | 6 | namespace OpenSonos.LocalMusicServer.Browsing.MusicRepositories 7 | { 8 | public class TopLevelDirectorySearchProvider : ISearchProvider 9 | { 10 | private readonly ServerConfiguration _config; 11 | private readonly IFileSystem _fs; 12 | 13 | public TopLevelDirectorySearchProvider(ServerConfiguration config, IFileSystem fs) 14 | { 15 | _config = config; 16 | _fs = fs; 17 | } 18 | 19 | public List Search(string query) 20 | { 21 | return string.IsNullOrWhiteSpace(query) 22 | ? new List() 23 | : _fs.Directory.GetDirectories(_config.MusicShare, query + "*").ToList(); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer.Test.Unit/MusicDatabase/PhysicalResourceTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using OpenSonos.LocalMusicServer.Browsing; 3 | 4 | namespace OpenSonos.LocalMusicServer.Test.Unit.MusicDatabase 5 | { 6 | [TestFixture] 7 | public class PhysicalResourceTests 8 | { 9 | [Test] 10 | public void FromId_IdIsForAPath_ReturnsAContainer() 11 | { 12 | var id = new SonosIdentifier {Path = "\\abc\\def"}; 13 | 14 | var resource = PhysicalResource.FromId(id); 15 | 16 | Assert.That(resource, Is.TypeOf()); 17 | Assert.That(resource.DisplayName, Is.EqualTo("def")); 18 | } 19 | 20 | [Test] 21 | public void FromId_IdIsForAFile_ReturnsAContainer() 22 | { 23 | var id = new SonosIdentifier {Path = "\\abc\\def.mp3"}; 24 | 25 | var resource = PhysicalResource.FromId(id); 26 | 27 | Assert.That(resource, Is.TypeOf()); 28 | Assert.That(resource.DisplayName, Is.EqualTo("def.mp3")); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Linq; 4 | using System.ServiceProcess; 5 | using Ninject; 6 | using OpenSonos.LocalMusicServer.Bootstrapping; 7 | using SimpleServices; 8 | 9 | namespace OpenSonos.LocalMusicServer 10 | { 11 | [RunInstaller(true)] 12 | public class Program : SimpleServiceApplication 13 | { 14 | public static void Main(string[] args) 15 | { 16 | var kernel = new StandardKernel(new Bindings()); 17 | 18 | new Service(args, 19 | ()=> kernel.GetAll().ToArray(), 20 | installationSettings: (serviceInstaller, serviceProcessInstaller) => 21 | { 22 | serviceInstaller.ServiceName = "OpenSonos.LocalMusicServer.Service"; 23 | serviceInstaller.StartType = ServiceStartMode.Automatic; 24 | serviceProcessInstaller.Account = ServiceAccount.NetworkService; 25 | }, 26 | configureContext: x => { x.Log = Console.WriteLine; }, 27 | registerContainer: () => new SimpleServicesToNinject(kernel)) 28 | .Host(); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Browsing/MusicRepositories/ChangeMonitor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace OpenSonos.LocalMusicServer.Browsing.MusicRepositories 5 | { 6 | public class ChangeMonitor : IMonitorTheFileSystemForChanges 7 | { 8 | private readonly FileSystemWatcher _changeMonitor; 9 | private Action _onChange; 10 | 11 | public ChangeMonitor() 12 | { 13 | _changeMonitor = new FileSystemWatcher 14 | { 15 | IncludeSubdirectories = true, 16 | InternalBufferSize = 65536, 17 | }; 18 | 19 | _changeMonitor.Changed += SourceModified; 20 | _changeMonitor.Created += SourceModified; 21 | _changeMonitor.Deleted += SourceModified; 22 | _changeMonitor.Renamed += SourceModified; 23 | } 24 | 25 | public void StartMonitoring(string path, Action onChange) 26 | { 27 | _onChange = onChange; 28 | _changeMonitor.Path = path; 29 | _changeMonitor.EnableRaisingEvents = true; 30 | } 31 | 32 | private void SourceModified(object sender, FileSystemEventArgs fileSystemEventArgs) 33 | { 34 | _onChange = _onChange ?? (() => { }); 35 | _onChange(); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /OpenSonos/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("OpenSonos")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenSonos")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("dd2d87c8-ea81-4199-8119-fcc3cee49596")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /OpenSonos.Test.Unit/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("OpenSonos.Test.Unit")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenSonos.Test.Unit")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e3ffb703-31c9-4a9e-b13c-a503135d2379")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("OpenSonos.LocalMusicServer")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenSonos.LocalMusicServer")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("ccedfaf6-1461-4ef0-91d1-0724a7e94569")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("0.0.0.1")] 36 | [assembly: AssemblyFileVersion("0.0.0.1")] 37 | -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/ServerRegistrationService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using OpenSonos.LocalMusicServer.Bootstrapping; 3 | using OpenSonos.LocalMusicServer.DiscoveryAndRegistration; 4 | using SimpleServices; 5 | 6 | namespace OpenSonos.LocalMusicServer 7 | { 8 | public class ServerRegistrationService : IWindowsService 9 | { 10 | public ApplicationContext AppContext { get; set; } 11 | private readonly PlayerWebInterface _webInterface; 12 | private readonly ServerConfiguration _config; 13 | 14 | public ServerRegistrationService(PlayerWebInterface webInterface, ServerConfiguration config) 15 | { 16 | _webInterface = webInterface; 17 | _config = config; 18 | } 19 | 20 | public void Start(string[] args) 21 | { 22 | var sync = new object(); 23 | var registeredYet = false; 24 | 25 | Players.Discover(_config.ServerIp, sonosPlayer => 26 | { 27 | lock (sync) 28 | { 29 | if (registeredYet) 30 | { 31 | return; 32 | } 33 | 34 | registeredYet = _webInterface.RegisterServer(sonosPlayer, _config.ServerIp).Result; 35 | 36 | if (registeredYet) 37 | { 38 | Console.WriteLine("Autoregistered server with player " + sonosPlayer.Address); 39 | } 40 | } 41 | }); 42 | } 43 | 44 | public void Stop() 45 | { 46 | } 47 | 48 | } 49 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer.Test.Unit/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("OpenSonos.LocalMusicServer.Test.Unit")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenSonos.LocalMusicServer.Test.Unit")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d28a8716-289c-42a8-9ba8-3fe50f17e379")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /OpenSonos/LocalMusicServerFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.ServiceModel; 4 | using System.ServiceModel.Description; 5 | using OpenSonos.SonosServer; 6 | 7 | namespace OpenSonos 8 | { 9 | public class LocalMusicServerFactory 10 | { 11 | private readonly Type _unconfiguredHostType; 12 | 13 | public LocalMusicServerFactory(Type unconfiguredHostType) 14 | { 15 | _unconfiguredHostType = unconfiguredHostType; 16 | } 17 | 18 | public ServiceHost HostedAt(Uri baseUri) 19 | { 20 | var host = new ServiceHost(_unconfiguredHostType, baseUri); 21 | host.Description.Behaviors.Add(new ServiceMetadataBehavior { MetadataExporter = { PolicyVersion = PolicyVersion.Policy15 } }); 22 | host.AddServiceEndpoint(typeof(ISonosApi), new BasicHttpBinding(), "sonos-api"); 23 | host.AddServiceEndpoint(typeof(ISonosApi), new WSHttpBinding(), ""); 24 | 25 | var endpoint = host.AddServiceEndpoint(typeof(ISonosMetadataApi), new BasicHttpBinding(), "metadata"); 26 | endpoint.Binding = new WebHttpBinding(); 27 | endpoint.Behaviors.Add(new WebHttpBehavior()); 28 | 29 | host.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexHttpBinding(), "mex"); 30 | 31 | Console.WriteLine("Hosting Sonos API endpoints:" + Environment.NewLine); 32 | foreach (var ep in host.Description.Endpoints.OrderBy(x=>x.Address.Uri.ToString().Length)) 33 | { 34 | Console.WriteLine("\t" + ep.Address); 35 | } 36 | 37 | return host; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Bootstrapping/Bindings.cs: -------------------------------------------------------------------------------- 1 | using System.IO.Abstractions; 2 | using Ninject; 3 | using Ninject.Extensions.Conventions; 4 | using Ninject.Modules; 5 | using OpenSonos.LocalMusicServer.Browsing; 6 | using OpenSonos.LocalMusicServer.Browsing.MusicRepositories; 7 | using OpenSonos.LocalMusicServer.Smapi; 8 | 9 | namespace OpenSonos.LocalMusicServer.Bootstrapping 10 | { 11 | public class Bindings : INinjectModule 12 | { 13 | public string Name { get { return "Default"; } } 14 | public IKernel Kernel { get; private set; } 15 | 16 | public void OnLoad(IKernel kernel) 17 | { 18 | kernel.Bind(x => x.FromThisAssembly().SelectAllClasses().BindAllInterfaces()); 19 | kernel.Bind(x => x.FromAssemblyContaining().SelectAllClasses().BindAllInterfaces()); 20 | kernel.Bind(x => x.FromAssemblyContaining().SelectAllClasses().BindAllInterfaces()); 21 | 22 | kernel.Rebind().ToMethod(x => ServerConfigurationFactory.LoadConfiguration()).InSingletonScope(); 23 | kernel.Rebind().To().InSingletonScope(); 24 | kernel.Rebind().To().InSingletonScope(); 25 | kernel.Rebind().To().InSingletonScope(); 26 | 27 | SmapiSoapController.Dependencies = () => kernel.Get(); 28 | 29 | kernel.Bind().ToMethod(context => new LocalMusicServerFactory(typeof(SmapiSoapController))); 30 | } 31 | 32 | public void OnUnload(IKernel kernel) 33 | { 34 | } 35 | 36 | public void OnVerifyRequiredModules() 37 | { 38 | } 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /OpenSonos/SonosServer/Metadata/PresentationMap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml.Serialization; 3 | 4 | namespace OpenSonos.SonosServer.Metadata 5 | { 6 | [Serializable] 7 | public class PresentationMap 8 | { 9 | [XmlAttribute("type")] 10 | public string type; 11 | 12 | [XmlElement("Match")] 13 | public MatchContainer Match; 14 | 15 | public static PresentationMap DefaultSonosSearch() 16 | { 17 | return new PresentationMap 18 | { 19 | type = "Search", 20 | Match = new MatchContainer 21 | { 22 | SearchCategories = new SearchCategories 23 | { 24 | Category = new[] 25 | { 26 | new Category {id = "artists", mappedId = "artists"}, 27 | new Category {id = "albums", mappedId = "albums"}, 28 | new Category {id = "tracks", mappedId = "tracks"}, 29 | new Category {id = "playlists", mappedId = "playlists"}, 30 | new Category {id = "people", mappedId = "people"}, 31 | } 32 | } 33 | } 34 | }; 35 | } 36 | 37 | [Serializable] 38 | public class MatchContainer 39 | { 40 | [XmlElement("SearchCategories")] public SearchCategories SearchCategories; 41 | } 42 | 43 | [Serializable] 44 | public class SearchCategories 45 | { 46 | [XmlElement("Category")] public Category[] Category; 47 | } 48 | 49 | [Serializable] 50 | public class Category 51 | { 52 | [XmlAttribute("mappedId")] public string mappedId; 53 | [XmlAttribute("id")] public string id; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Browsing/IdentityProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using OpenSonos.LocalMusicServer.Bootstrapping; 6 | 7 | namespace OpenSonos.LocalMusicServer.Browsing 8 | { 9 | public class IdentityProvider : IIdentityProvider 10 | { 11 | private readonly ConcurrentDictionary _hashCache; 12 | private readonly ConvertPathsToSha1 _idGen; 13 | 14 | public IdentityProvider(ServerConfiguration config) 15 | { 16 | _hashCache = new ConcurrentDictionary(); 17 | _idGen = new ConvertPathsToSha1(); 18 | 19 | _hashCache.TryAdd("root", new SonosIdentifier 20 | { 21 | Id = "root", 22 | Path = config.MusicShare 23 | }); 24 | } 25 | 26 | public IdentityProvider(ServerConfiguration config, IEnumerable> backingStore) 27 | : this(config) 28 | { 29 | if (backingStore == null) 30 | { 31 | return; 32 | } 33 | 34 | foreach (var item in backingStore) 35 | { 36 | _hashCache.TryAdd(item.Key, item.Value); 37 | } 38 | } 39 | 40 | public SonosIdentifier IdFor(string path) 41 | { 42 | if (_hashCache.ContainsKey(path)) 43 | { 44 | return _hashCache[path]; 45 | } 46 | 47 | var identifier = new SonosIdentifier 48 | { 49 | Id = _idGen.IdentifierFor(path), 50 | Path = path 51 | }; 52 | 53 | _hashCache.TryAdd(path, identifier); 54 | return identifier; 55 | } 56 | 57 | public SonosIdentifier FromRequestId(string requestedId) 58 | { 59 | return _hashCache.SingleOrDefault(x => x.Value.Id == requestedId).Value; 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /OpenSonos/Players.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Net; 4 | using System.Net.Http; 5 | using System.Threading.Tasks; 6 | 7 | namespace OpenSonos 8 | { 9 | public static class Players 10 | { 11 | public static async void Discover(IPAddress currentIp, Action andThen = null) 12 | { 13 | andThen = andThen ?? (p => { }); 14 | 15 | var subnet = string.Join(".", currentIp.ToString().Split('.').Take(3)); 16 | for (var ipPart = 1; ipPart < 256; ipPart++) 17 | { 18 | await SpawnAsyncTaskToScanForSonos(andThen, subnet + "." + ipPart); 19 | } 20 | } 21 | 22 | private static async Task SpawnAsyncTaskToScanForSonos(Action andThen, string ip) 23 | { 24 | await Task.Run(() => 25 | { 26 | ScanForSonos(ip).ContinueWith(t => 27 | { 28 | if (t.Result != SonosPlayer.None) 29 | { 30 | andThen(t.Result); 31 | } 32 | }, TaskContinuationOptions.ExecuteSynchronously); 33 | }); 34 | } 35 | 36 | private static async Task ScanForSonos(string ip) 37 | { 38 | var request = new HttpRequestMessage(HttpMethod.Head, string.Format("http://{0}:1400/xml/device_description.xml", ip)); 39 | var response = await TrySend(request); 40 | return response != null && response.StatusCode == HttpStatusCode.OK 41 | ? new SonosPlayer(ip) 42 | : SonosPlayer.None; 43 | } 44 | 45 | public static async Task TrySend(HttpRequestMessage request) 46 | { 47 | var http = new HttpClient { Timeout = new TimeSpan(0, 0, 0, 0, 150) }; 48 | 49 | try 50 | { 51 | return await http.SendAsync(request); 52 | } 53 | catch (Exception) 54 | { 55 | return null; 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Smapi/ResponseFormattingExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using OpenSonos.LocalMusicServer.Browsing; 4 | using OpenSonos.SonosServer; 5 | 6 | namespace OpenSonos.LocalMusicServer.Smapi 7 | { 8 | public static class ResponseFormattingExtensions 9 | { 10 | public static mediaMetadata ToMediaMetadata(this IRepresentAResource entry) 11 | { 12 | return new mediaMetadata 13 | { 14 | itemType = itemType.track, 15 | id = entry.Identifier.Id, 16 | title = entry.DisplayName, 17 | mimeType = "audio/mpeg3", 18 | Item = new trackMetadata 19 | { 20 | canSkip = true, 21 | canAddToFavorites = true, 22 | canSkipSpecified = true, 23 | canPlay = true, 24 | canPlaySpecified = true, 25 | } 26 | }; 27 | } 28 | 29 | public static mediaList ToMediaList(this ResourceCollection directoryEntries, int index, int count) 30 | { 31 | var requestedPage = directoryEntries.Skip(index).Take(count).ToList(); 32 | 33 | var collections = new List(); 34 | foreach (var subdirectory in requestedPage.Where(x => x is Container)) 35 | { 36 | collections.Add(new mediaCollection 37 | { 38 | id = subdirectory.Identifier.Id, 39 | title = subdirectory.DisplayName, 40 | itemType = itemType.collection, 41 | canEnumerate = true, 42 | canPlay = true 43 | }); 44 | } 45 | 46 | foreach (var entry in requestedPage.Where(x => x is MusicFile)) 47 | { 48 | var meta = entry.ToMediaMetadata(); 49 | 50 | ((trackMetadata) meta.Item).albumId = null != directoryEntries.Identifier 51 | ? directoryEntries.Identifier.Id 52 | : null; 53 | 54 | collections.Add(meta); 55 | } 56 | 57 | return new mediaList 58 | { 59 | count = count, 60 | index = index, 61 | Items = collections.ToArray(), 62 | total = directoryEntries.Count 63 | }; 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /OpenSonos.Test.Unit/OpenSonos.Test.Unit.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {A6E5A238-6FF8-4F71-996E-17F4374C1334} 8 | Library 9 | Properties 10 | OpenSonos.Test.Unit 11 | OpenSonos.Test.Unit 12 | v4.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 52 | -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Browsing/MusicRepositories/FlatFileMusicRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.IO.Abstractions; 4 | using System.Linq; 5 | using OpenSonos.LocalMusicServer.Bootstrapping; 6 | 7 | namespace OpenSonos.LocalMusicServer.Browsing.MusicRepositories 8 | { 9 | public class FlatFileMusicRepository : IMusicRepository 10 | { 11 | private readonly IIdentityProvider _identityStore; 12 | private readonly ISearchProvider _searchProvider; 13 | private readonly IFileSystem _fs; 14 | 15 | public DateTime LastUpdate { get; set; } 16 | 17 | public FlatFileMusicRepository(ServerConfiguration config, IIdentityProvider identityStore, ISearchProvider searchProvider, IFileSystem fs, IMonitorTheFileSystemForChanges changeMonitor) 18 | { 19 | _identityStore = identityStore; 20 | _searchProvider = searchProvider; 21 | _fs = fs; 22 | 23 | LastUpdate = DateTime.UtcNow; 24 | changeMonitor.StartMonitoring(config.MusicShare, () => 25 | { 26 | LastUpdate = DateTime.UtcNow; 27 | }); 28 | } 29 | 30 | public ResourceCollection GetResources(string identifier) 31 | { 32 | var id = _identityStore.FromRequestId(identifier); 33 | 34 | if (id == null) 35 | { 36 | throw new ArgumentException("Unrecognised identifier '{0}' requested. Sonos player has cached an expired key."); 37 | } 38 | 39 | return GetResources(id); 40 | } 41 | 42 | private ResourceCollection GetResources(SonosIdentifier identifier) 43 | { 44 | if (!identifier.IsDirectory) 45 | { 46 | return new ResourceCollection(identifier); 47 | } 48 | 49 | var directoryEntries = new ResourceCollection(identifier); 50 | directoryEntries.AddRange(_fs.Directory.GetDirectories(identifier.Path).Select(ToPhysicalResource)); 51 | directoryEntries.AddRange(_fs.Directory.GetFiles(identifier.Path, "*.mp3", SearchOption.TopDirectoryOnly).Select(ToPhysicalResource)); 52 | return directoryEntries; 53 | } 54 | 55 | public ResourceCollection Search(string query) 56 | { 57 | var pathsFound = _searchProvider.Search(query); 58 | return new ResourceCollection(null, pathsFound.Select(ToPhysicalResource)); 59 | } 60 | 61 | private TResourceType ToPhysicalResource(string subdir) where TResourceType: PhysicalResource, new() 62 | { 63 | return new TResourceType { Identifier = _identityStore.IdFor(subdir) }; 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /OpenSonos.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30723.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSonos", "OpenSonos\OpenSonos.csproj", "{4B7A83FB-1A9E-4C19-B1AD-CE8097A3AAC7}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSonos.LocalMusicServer", "OpenSonos.LocalMusicServer\OpenSonos.LocalMusicServer.csproj", "{A67F0125-7297-457B-AD0A-AC050A2D793D}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSonos.Test.Unit", "OpenSonos.Test.Unit\OpenSonos.Test.Unit.csproj", "{A6E5A238-6FF8-4F71-996E-17F4374C1334}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSonos.LocalMusicServer.Test.Unit", "OpenSonos.LocalMusicServer.Test.Unit\OpenSonos.LocalMusicServer.Test.Unit.csproj", "{B3FD6BCE-00B4-4D23-95C9-E4308F8FA544}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {4B7A83FB-1A9E-4C19-B1AD-CE8097A3AAC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {4B7A83FB-1A9E-4C19-B1AD-CE8097A3AAC7}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {4B7A83FB-1A9E-4C19-B1AD-CE8097A3AAC7}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {4B7A83FB-1A9E-4C19-B1AD-CE8097A3AAC7}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {A67F0125-7297-457B-AD0A-AC050A2D793D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {A67F0125-7297-457B-AD0A-AC050A2D793D}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {A67F0125-7297-457B-AD0A-AC050A2D793D}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {A67F0125-7297-457B-AD0A-AC050A2D793D}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {A6E5A238-6FF8-4F71-996E-17F4374C1334}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {A6E5A238-6FF8-4F71-996E-17F4374C1334}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {A6E5A238-6FF8-4F71-996E-17F4374C1334}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {A6E5A238-6FF8-4F71-996E-17F4374C1334}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {B3FD6BCE-00B4-4D23-95C9-E4308F8FA544}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {B3FD6BCE-00B4-4D23-95C9-E4308F8FA544}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {B3FD6BCE-00B4-4D23-95C9-E4308F8FA544}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {B3FD6BCE-00B4-4D23-95C9-E4308F8FA544}.Release|Any CPU.Build.0 = Release|Any CPU 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | EndGlobal 41 | -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/Smapi/SmapiSoapController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using OpenSonos.LocalMusicServer.Browsing; 4 | using OpenSonos.SonosServer; 5 | using OpenSonos.SonosServer.Metadata; 6 | 7 | namespace OpenSonos.LocalMusicServer.Smapi 8 | { 9 | public class SmapiSoapController : ServerBase 10 | { 11 | public static Func Dependencies { get; set; } 12 | private static SmapiSoapControllerDependencies _ { get { return Dependencies(); } } 13 | 14 | public override Presentation GetPresentationMaps() 15 | { 16 | return new Presentation(PresentationMap.DefaultSonosSearch()); 17 | } 18 | 19 | public override getSessionIdResponse GetSessionId(getSessionIdRequest request) 20 | { 21 | return new getSessionIdResponse("1"); 22 | } 23 | 24 | public override getMetadataResponse GetMetadata(getMetadataRequest request) 25 | { 26 | var timer = Stopwatch.StartNew(); 27 | 28 | var results = _.MusicRepository 29 | .GetResources(request.id) 30 | .ToMediaList(request.index, request.count); 31 | 32 | var dto = new getMetadataResponse(results); 33 | 34 | timer.Stop(); 35 | Console.WriteLine(timer.Elapsed.TotalMilliseconds + "ms"); 36 | return dto; 37 | } 38 | 39 | public override getExtendedMetadataResponse GetExtendedMetadata(getExtendedMetadataRequest request) 40 | { 41 | var id = _.IdentityProvider.FromRequestId(request.id); 42 | return new getExtendedMetadataResponse(PhysicalResource.FromId(id).ToMediaMetadata()); 43 | } 44 | 45 | public override getMediaMetadataResponse GetMediaMetadata(getMediaMetadataRequest request) 46 | { 47 | var id = _.IdentityProvider.FromRequestId(request.id); 48 | return new getMediaMetadataResponse(PhysicalResource.FromId(id).ToMediaMetadata()); 49 | } 50 | 51 | public override getMediaURIResponse GetMediaUri(getMediaURIRequest request) 52 | { 53 | var id = _.IdentityProvider.FromRequestId(request.id); 54 | return new getMediaURIResponse(id.Uri); 55 | } 56 | 57 | public override getLastUpdateResponse GetLastUpdate(getLastUpdateRequest request) 58 | { 59 | return getLastUpdateResponse.ChangedAt(_.MusicRepository.LastUpdate); 60 | } 61 | 62 | public override searchResponse Search(searchRequest request) 63 | { 64 | var results = _.MusicRepository.Search(request.term); 65 | return new searchResponse(results.ToMediaList(request.index, request.count)); 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/DiscoveryAndRegistration/PlayerWebInterface.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Net; 3 | using System.Net.Http; 4 | using System.Net.Http.Headers; 5 | using System.Threading.Tasks; 6 | using OpenSonos.LocalMusicServer.Bootstrapping; 7 | 8 | namespace OpenSonos.LocalMusicServer.DiscoveryAndRegistration 9 | { 10 | public class PlayerWebInterface 11 | { 12 | private readonly ServerConfiguration _config; 13 | 14 | #if DEBUG 15 | private const string ServerName = "LANServer_Dev_vNext"; 16 | private const string Sid = "244"; 17 | #else 18 | private const string ServerName = "LANServer_vNext"; 19 | private const string Sid = "245"; 20 | #endif 21 | 22 | public PlayerWebInterface(ServerConfiguration config) 23 | { 24 | _config = config; 25 | } 26 | 27 | public async Task RegisterServer(SonosPlayer player, IPAddress serverIp) 28 | { 29 | var request = new HttpRequestMessage(HttpMethod.Post, string.Format("http://{0}:1400/customsd", player.Address)) 30 | { 31 | Content = new FormUrlEncodedContent(new List> 32 | { 33 | new KeyValuePair("sid", Sid), 34 | new KeyValuePair("name", ServerName), 35 | new KeyValuePair("uri", _config.ServerRoot + "/sonos-api"), 36 | new KeyValuePair("secureUri", _config.ServerRoot + "/sonos-api"), 37 | new KeyValuePair("pollInterval", "900"), 38 | new KeyValuePair("authType", "UserId"), 39 | new KeyValuePair("stringsVersion", "0"), 40 | new KeyValuePair("stringsUri", ""), 41 | new KeyValuePair("presentationMapVersion", "10"), 42 | new KeyValuePair("presentationMapUri", _config.ServerRoot + "/metadata/presentation-maps"), 43 | new KeyValuePair("containerType", "SoundLab"), 44 | new KeyValuePair("caps", "search"), 45 | new KeyValuePair("caps", "extendedMD"), 46 | new KeyValuePair("caps", "mediaUriActions"), 47 | }) 48 | }; 49 | 50 | var response = await Process(request); 51 | return response.StatusCode == HttpStatusCode.OK; 52 | } 53 | 54 | public async Task Process(HttpRequestMessage request) 55 | { 56 | request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("text/html")); 57 | request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xhtml+xml")); 58 | request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml", 0.9)); 59 | request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("image/webp")); 60 | request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("*/*", 0.8)); 61 | 62 | var channel = new HttpClient(); 63 | return await channel.SendAsync(request); 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | [Dd]ebug/ 11 | [Dd]ebugPublic/ 12 | [Rr]elease/ 13 | x64/ 14 | build/ 15 | bld/ 16 | [Bb]in/ 17 | [Oo]bj/ 18 | 19 | # MSTest test Results 20 | [Tt]est[Rr]esult*/ 21 | [Bb]uild[Ll]og.* 22 | 23 | #NUNIT 24 | *.VisualState.xml 25 | TestResult.xml 26 | 27 | # Build Results of an ATL Project 28 | [Dd]ebugPS/ 29 | [Rr]eleasePS/ 30 | dlldata.c 31 | 32 | *_i.c 33 | *_p.c 34 | *_i.h 35 | *.ilk 36 | *.meta 37 | *.obj 38 | *.pch 39 | *.pdb 40 | *.pgc 41 | *.pgd 42 | *.rsp 43 | *.sbr 44 | *.tlb 45 | *.tli 46 | *.tlh 47 | *.tmp 48 | *.tmp_proj 49 | *.log 50 | *.vspscc 51 | *.vssscc 52 | .builds 53 | *.pidb 54 | *.svclog 55 | *.scc 56 | 57 | # Chutzpah Test files 58 | _Chutzpah* 59 | 60 | # Visual C++ cache files 61 | ipch/ 62 | *.aps 63 | *.ncb 64 | *.opensdf 65 | *.sdf 66 | *.cachefile 67 | 68 | # Visual Studio profiler 69 | *.psess 70 | *.vsp 71 | *.vspx 72 | 73 | # TFS 2012 Local Workspace 74 | $tf/ 75 | 76 | # Guidance Automation Toolkit 77 | *.gpState 78 | 79 | # ReSharper is a .NET coding add-in 80 | _ReSharper*/ 81 | *.[Rr]e[Ss]harper 82 | *.DotSettings.user 83 | 84 | # JustCode is a .NET coding addin-in 85 | .JustCode 86 | 87 | # TeamCity is a build add-in 88 | _TeamCity* 89 | 90 | # DotCover is a Code Coverage Tool 91 | *.dotCover 92 | 93 | # NCrunch 94 | *.ncrunch* 95 | _NCrunch_* 96 | .*crunch*.local.xml 97 | 98 | # MightyMoose 99 | *.mm.* 100 | AutoTest.Net/ 101 | 102 | # Web workbench (sass) 103 | .sass-cache/ 104 | 105 | # Installshield output folder 106 | [Ee]xpress/ 107 | 108 | # DocProject is a documentation generator add-in 109 | DocProject/buildhelp/ 110 | DocProject/Help/*.HxT 111 | DocProject/Help/*.HxC 112 | DocProject/Help/*.hhc 113 | DocProject/Help/*.hhk 114 | DocProject/Help/*.hhp 115 | DocProject/Help/Html2 116 | DocProject/Help/html 117 | 118 | # Click-Once directory 119 | publish/ 120 | 121 | # Publish Web Output 122 | *.[Pp]ublish.xml 123 | *.azurePubxml 124 | 125 | # NuGet Packages Directory 126 | packages/ 127 | ## TODO: If the tool you use requires repositories.config uncomment the next line 128 | #!packages/repositories.config 129 | 130 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 131 | # This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented) 132 | !packages/build/ 133 | 134 | # Windows Azure Build Output 135 | csx/ 136 | *.build.csdef 137 | 138 | # Windows Store app package directory 139 | AppPackages/ 140 | 141 | # Others 142 | sql/ 143 | *.Cache 144 | ClientBin/ 145 | [Ss]tyle[Cc]op.* 146 | ~$* 147 | *~ 148 | *.dbmdl 149 | *.dbproj.schemaview 150 | *.pfx 151 | *.publishsettings 152 | node_modules/ 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | *.mdf 166 | *.ldf 167 | 168 | # Business Intelligence projects 169 | *.rdl.data 170 | *.bim.layout 171 | *.bim_*.settings 172 | 173 | # Microsoft Fakes 174 | FakesAssemblies/ 175 | -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer.Test.Unit/OpenSonos.LocalMusicServer.Test.Unit.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B3FD6BCE-00B4-4D23-95C9-E4308F8FA544} 8 | Library 9 | Properties 10 | OpenSonos.LocalMusicServer.Test.Unit 11 | OpenSonos.LocalMusicServer.Test.Unit 12 | v4.5.1 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | ..\packages\NUnit.2.6.3\lib\nunit.framework.dll 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | {A67F0125-7297-457B-AD0A-AC050A2D793D} 59 | OpenSonos.LocalMusicServer 60 | 61 | 62 | {4B7A83FB-1A9E-4C19-B1AD-CE8097A3AAC7} 63 | OpenSonos 64 | 65 | 66 | 67 | 68 | 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | OpenSonos 2 | ========= 3 | 4 | An implementation of Sonos "SMAPI" (Sonos Music API) documented here: http://musicpartners.sonos.com/?q=docs 5 | 6 | # What does this do? 7 | 8 | This proof of concept implementation allows you to run a sonos music server on your home network, sharing any SMB file share in it's entirety. 9 | It's un-indexed, and not subject to the 65k track limits of the sonos media library. 10 | 11 | Provided is an API implementation, and a simplistic search implementation. 12 | 13 | # What doesn't work? 14 | 15 | * Anything that isn't an MP3 right now won't display or play. 16 | * Metadata and artwork - this is all bare bones 17 | * Search only searches top-level directory names for the time 18 | 19 | Those features can all be supported off this codebase. They're just currently not implemented. 20 | 21 | # Pre-Requirements 22 | 23 | .NET 4.5.1 24 | 25 | # How do I use it? 26 | 27 | * Git pull 28 | * Compile 29 | * Open app.config and edit the baseUrl, basePort and musicShare settings as you wish 30 | * Run OpenSonos.LocalMusicServer.exe 31 | 32 | The service will then auto-register itself after scanning your network. 33 | Make sure your firewall allows traffic on your configured port (by default, 8080). 34 | 35 | * Then open your sonos controller, and "login" by going to your "Service Settings", click "Sonos Labs" and add "LANServer". 36 | * Just put anything in the username and password boxes 37 | 38 | The app must be run with local admin credentials, and the music share must be an authentication-less SMB share that's compatible with cifs (Windows shares with guest access are fine). 39 | 40 | # Manual Registration with your Sonos devices 41 | 42 | The server attempts to scan your local network for Sonos players (given an IPv4 network). If it can't find them, you'll need to register the server by hand. 43 | 44 | You'll need the IP address of a player on hand. You can grab one from the Sonos desktop app. 45 | 46 | * Wait until it detects the Sonos players on your network 47 | * Open a browser and visit: http://[player-ip-address]:1400/customsd.htm 48 | * Fill in the following settings: 49 | 50 | * SID: 255 51 | * Service name: LANServer 52 | * Endpoint URL: http://[base-Url-from-config]/sonos-api 53 | * Secure Endpoint URL: http://[base-Url-from-config]/sonos-api 54 | * Polling interval: 15 55 | * Authentication: Session ID 56 | * Presentation map: Version 4, Uri: http://[base-Url-from-config]/metadata/presentation-maps 57 | * Select Sonos Sound Lab 58 | * Capabilities: Search, Extended Metadata, Support the ability to received actions... 59 | 60 | * Submit the form, this has registered the sonos server 61 | 62 | # Running as a service 63 | 64 | Open a command prompt and type 65 | 66 | OpenSonos.LocalMusicServer.exe /i 67 | 68 | This will request elevated access and install the app as a Windows service. 69 | 70 | You'll then need to ensure the service is running as a user with administrative privileges. 71 | Alternatively you can use urlacl to grant the service access to host at the URL you've specified in the configuration. Up to you. 72 | 73 | It's simpler to go to services.msc and give the service a user account with appropriate privileges though. 74 | That's it, it'll be running all the time. 75 | 76 | # Known Isssues 77 | 78 | For some reason (currently unknown, the network traffic looks correct) sometimes you'll have to enter a folder, return back out, and enter it again before MP3s show up. I have a suspicion this is some kind of client side caching, but I'll dig further into it - the network responses are identical. 79 | 80 | # That's all rough and ready, can you make it easier? 81 | 82 | Yes, in time. Installers, binaries etc, etc. But if you want it now, you're going to have to do it by hand! 83 | 84 | # Can I help? 85 | 86 | Sure! Get in touch 87 | 88 | - D -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer.Test.Unit/Browsing/GuidProviderTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using NUnit.Framework; 4 | using OpenSonos.LocalMusicServer.Bootstrapping; 5 | using OpenSonos.LocalMusicServer.Browsing; 6 | 7 | namespace OpenSonos.LocalMusicServer.Test.Unit.Browsing 8 | { 9 | [TestFixture] 10 | public class IdentityProviderTests 11 | { 12 | private string _uncompressedId; 13 | private IIdentityProvider _provider; 14 | private ServerConfiguration _config; 15 | private string _compressedId; 16 | 17 | [SetUp] 18 | public void SetUp() 19 | { 20 | _uncompressedId = "\\\\some\\smb\\path"; 21 | _compressedId = new ConvertPathsToSha1().IdentifierFor(_uncompressedId); 22 | 23 | var backing = new Dictionary 24 | { 25 | {_uncompressedId, new SonosIdentifier {Id = _compressedId, Path = "\\\\some\\smb\\path"}} 26 | }; 27 | 28 | _config = new ServerConfiguration {MusicShare = "\\\\a\\\\b"}; 29 | _provider = new IdentityProvider(_config, backing); 30 | } 31 | 32 | [Test] 33 | public void FromPath_WithPath_IdAndPathSetCorrectly() 34 | { 35 | var identifier = _provider.IdFor(_uncompressedId); 36 | 37 | Assert.That(identifier.Id, Is.EqualTo(_compressedId)); 38 | } 39 | 40 | [Test] 41 | public void FromPath_WithMaxWindowsPathLength_CanCreateCompressedId() 42 | { 43 | var identifier = _provider.IdFor("\\abcdefghjklmnopqrstuvwxyz\\ABCDEFGHIJKLMNOPQRSTUVWXYZ\\AbCdEfGhIjLlMnoPqRsTuVwZyZ\\the quick brown fox jumped ov\\er the lazy dog and this i\\s strin a long string th\\at should be very hard toc\\ompress reliably for gzip \\compression to handle well and q"); 44 | 45 | Assert.That(identifier.Id, Is.Not.Null); 46 | } 47 | 48 | [Test] 49 | public void FromPath_WhenPathHasLotsOfEntropy_CanCreateCompressedId() 50 | { 51 | var identifier = _provider.IdFor("Justin Timberlake - The 20-20 Experience (Deluxe Edition) 2013 Pop 320kbps CBR MP3 [VX]"); 52 | 53 | Assert.That(identifier.Id, Is.Not.Null); 54 | } 55 | 56 | [Test] 57 | public void FromPath_WhenPathIsProvidedTwice_SameIdReturned() 58 | { 59 | var identifier1 = _provider.IdFor("\\something\\here"); 60 | var identifier2 = _provider.IdFor("\\something\\here"); 61 | 62 | Assert.That(identifier1.Id, Is.EqualTo(identifier2.Id)); 63 | Assert.That(identifier1.Path, Is.EqualTo(identifier2.Path)); 64 | } 65 | 66 | [Test] 67 | public void FromRequestId_WithValidCompressedId_PathIsCorrect() 68 | { 69 | var identifier = _provider.FromRequestId(_compressedId); 70 | 71 | Assert.That(identifier.Path, Is.EqualTo(_uncompressedId)); 72 | } 73 | 74 | [Test] 75 | public void FromRequestId_WithNullEmptyId_ReturnsNull() 76 | { 77 | var identifier = _provider.FromRequestId(""); 78 | 79 | Assert.That(identifier, Is.Null); 80 | } 81 | 82 | [Test] 83 | public void FromRequestId_WithUnrecognisedPath_ReturnsNull() 84 | { 85 | var identifier = _provider.FromRequestId("random-thing-here"); 86 | 87 | Assert.That(identifier, Is.Null); 88 | } 89 | 90 | [Test] 91 | public void FromRequestId_WithRootPath_ReturnsRootId() 92 | { 93 | var identifier = _provider.FromRequestId("root"); 94 | 95 | Assert.That(identifier.Id, Is.Not.Null); 96 | Assert.That(identifier.Path, Is.EqualTo(_config.MusicShare)); 97 | Assert.That(identifier.IsDirectory, Is.True); 98 | } 99 | 100 | [Test] 101 | public void FromRequestId_WithDirectoryPath_IsDirectoryIsTrue() 102 | { 103 | var identifier = _provider.FromRequestId(_compressedId); 104 | 105 | Assert.That(identifier.IsDirectory, Is.EqualTo(true)); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer.Test.Unit/Smapi/ResponseFormattingExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using OpenSonos.LocalMusicServer.Browsing; 3 | using OpenSonos.LocalMusicServer.Smapi; 4 | using OpenSonos.SonosServer; 5 | using Container = OpenSonos.LocalMusicServer.Browsing.Container; 6 | 7 | namespace OpenSonos.LocalMusicServer.Test.Unit.Smapi 8 | { 9 | [TestFixture] 10 | public class ResponseFormattingExtensionsTests 11 | { 12 | private ResourceCollection _fileEntries; 13 | private ResourceCollection _directoryEntries; 14 | 15 | [SetUp] 16 | public void SetUp() 17 | { 18 | _fileEntries = new ResourceCollection { new MusicFile(new SonosIdentifier {Id = "1", Path = "\\\\some\\file.mp3"}) }; 19 | _directoryEntries = new ResourceCollection { new Container(new SonosIdentifier { Id = "1", Path = "\\\\some\\path" }) }; 20 | } 21 | 22 | [Test] 23 | public void DirectoryToSonosResponse_SingleResourceForAFile_SingleEntryReturnedWithCorrectMetadata() 24 | { 25 | var result = _fileEntries.ToMediaList(0, 1); 26 | 27 | Assert.That(result.Items.Length, Is.EqualTo(1)); 28 | Assert.That(result.count, Is.EqualTo(1)); 29 | Assert.That(result.index, Is.EqualTo(0)); 30 | Assert.That(result.total, Is.EqualTo(1)); 31 | } 32 | 33 | [Test] 34 | public void DirectoryToSonosResponse_SingleResourceForAFile_PropertiesMappedCorrectly() 35 | { 36 | var result = _fileEntries.ToMediaList(0, 1); 37 | 38 | Assert.That(result.Items[0].id, Is.EqualTo("1")); 39 | Assert.That(result.Items[0].title, Is.EqualTo("file.mp3")); 40 | } 41 | 42 | [Test] 43 | public void DirectoryToSonosResponse_SingleResourceForAFile_ItemReturnedIsMediaMetadata() 44 | { 45 | var result = _fileEntries.ToMediaList(0, 1); 46 | 47 | Assert.That(result.Items[0], Is.TypeOf()); 48 | } 49 | 50 | [Test] 51 | public void DirectoryToSonosResponse_SingleResourceForAFile_MediaMetadataIsCorrect() 52 | { 53 | var result = _fileEntries.ToMediaList(0, 1); 54 | 55 | var mmd = (mediaMetadata) result.Items[0]; 56 | var meta = (trackMetadata) mmd.Item; 57 | Assert.That(mmd.mimeType, Is.EqualTo("audio/mpeg3")); 58 | Assert.That(mmd.itemType, Is.EqualTo(itemType.track)); 59 | Assert.That(meta.canPlay, Is.True); 60 | Assert.That(meta.canSkip, Is.True); 61 | Assert.That(meta.canPlay, Is.True); 62 | Assert.That(meta.canPlaySpecified, Is.True); 63 | Assert.That(meta.canSkipSpecified, Is.True); 64 | } 65 | 66 | [Test] 67 | public void DirectoryToSonosResponse_SingleResourceForADirectory_SingleEntryReturnedWithCorrectMetadata() 68 | { 69 | var result = _directoryEntries.ToMediaList(0, 1); 70 | 71 | Assert.That(result.Items.Length, Is.EqualTo(1)); 72 | Assert.That(result.count, Is.EqualTo(1)); 73 | Assert.That(result.index, Is.EqualTo(0)); 74 | Assert.That(result.total, Is.EqualTo(1)); 75 | } 76 | 77 | [Test] 78 | public void DirectoryToSonosResponse_SingleResourceForADirectory_PropertiesMappedCorrectly() 79 | { 80 | var result = _directoryEntries.ToMediaList(0, 1); 81 | 82 | Assert.That(result.Items[0].id, Is.EqualTo("1")); 83 | Assert.That(result.Items[0].title, Is.EqualTo("path")); 84 | } 85 | 86 | [Test] 87 | public void DirectoryToSonosResponse_SingleResourceForADirectory_ItemReturnedIsAMediaCollection() 88 | { 89 | var result = _directoryEntries.ToMediaList(0, 1); 90 | 91 | Assert.That(result.Items[0], Is.TypeOf()); 92 | } 93 | 94 | [Test] 95 | public void DirectoryToSonosResponse_SingleResourceForADirectory_MediaCollectionIsCorrect() 96 | { 97 | var result = _directoryEntries.ToMediaList(0, 1); 98 | 99 | var mmd = (mediaCollection)result.Items[0]; 100 | Assert.That(mmd.canPlay, Is.True); 101 | Assert.That(mmd.canEnumerate, Is.True); 102 | Assert.That(mmd.itemType, Is.EqualTo(itemType.collection)); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /OpenSonos/OpenSonos.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {4B7A83FB-1A9E-4C19-B1AD-CE8097A3AAC7} 8 | Library 9 | Properties 10 | OpenSonos 11 | OpenSonos 12 | v4.5.1 13 | 512 14 | 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | false 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | ..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Extensions.dll 46 | 47 | 48 | ..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 89 | -------------------------------------------------------------------------------- /OpenSonos/SonosServer/ServerBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ServiceModel; 3 | using OpenSonos.SonosServer.Metadata; 4 | 5 | namespace OpenSonos.SonosServer 6 | { 7 | [ServiceBehavior(IncludeExceptionDetailInFaults = true)] 8 | public abstract class ServerBase : ISonosApi, ISonosMetadataApi 9 | { 10 | public virtual Presentation GetPresentationMaps() 11 | { 12 | throw new NotImplementedException(); 13 | } 14 | 15 | // Bare minimum implementation 16 | public abstract getSessionIdResponse GetSessionId(getSessionIdRequest request); 17 | public abstract getMetadataResponse GetMetadata(getMetadataRequest request); 18 | public abstract getExtendedMetadataResponse GetExtendedMetadata(getExtendedMetadataRequest request); 19 | public abstract getMediaMetadataResponse GetMediaMetadata(getMediaMetadataRequest request); 20 | public abstract getMediaURIResponse GetMediaUri(getMediaURIRequest request); 21 | public abstract getLastUpdateResponse GetLastUpdate(getLastUpdateRequest request); 22 | 23 | public virtual getExtendedMetadataTextResponse GetExtendedMetadataText(getExtendedMetadataTextRequest request) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | 28 | public virtual rateItemResponse RateItem(rateItemRequest request) 29 | { 30 | throw new NotImplementedException(); 31 | } 32 | 33 | public virtual searchResponse Search(searchRequest request) 34 | { 35 | throw new NotImplementedException(); 36 | } 37 | 38 | public virtual createItemResponse CreateItem(createItemRequest request) 39 | { 40 | throw new NotImplementedException(); 41 | } 42 | 43 | public virtual deleteItemResponse DeleteItem(deleteItemRequest request) 44 | { 45 | throw new NotImplementedException(); 46 | } 47 | 48 | public virtual getScrollIndicesResponse GetScrollIndices(getScrollIndicesRequest request) 49 | { 50 | throw new NotImplementedException(); 51 | } 52 | 53 | public virtual reportStatusResponse ReportStatus(reportStatusRequest request) 54 | { 55 | throw new NotImplementedException(); 56 | } 57 | 58 | public virtual setPlayedSecondsResponse SetPlayedSeconds(setPlayedSecondsRequest request) 59 | { 60 | throw new NotImplementedException(); 61 | } 62 | 63 | public virtual reportPlaySecondsResponse ReportPlaySeconds(reportPlaySecondsRequest request) 64 | { 65 | throw new NotImplementedException(); 66 | } 67 | 68 | public virtual reportPlayStatusResponse ReportPlayStatus(reportPlayStatusRequest request) 69 | { 70 | throw new NotImplementedException(); 71 | } 72 | 73 | public virtual reportAccountActionResponse ReportAccountAction(reportAccountActionRequest request) 74 | { 75 | throw new NotImplementedException(); 76 | } 77 | 78 | public virtual getDeviceLinkCodeResponse GetDeviceLinkCode(getDeviceLinkCodeRequest request) 79 | { 80 | throw new NotImplementedException(); 81 | } 82 | 83 | public virtual getDeviceAuthTokenResponse GetDeviceAuthToken(getDeviceAuthTokenRequest request) 84 | { 85 | throw new NotImplementedException(); 86 | } 87 | 88 | public virtual getStreamingMetadataResponse GetStreamingMetadata(getStreamingMetadataRequest request) 89 | { 90 | throw new NotImplementedException(); 91 | } 92 | 93 | public virtual getContentKeyResponse GetContentKey(getContentKeyRequest request) 94 | { 95 | throw new NotImplementedException(); 96 | } 97 | 98 | public virtual createContainerResponse CreateContainer(createContainerRequest request) 99 | { 100 | throw new NotImplementedException(); 101 | } 102 | 103 | public virtual addToContainerResponse AddToContainer(addToContainerRequest request) 104 | { 105 | throw new NotImplementedException(); 106 | } 107 | 108 | public virtual renameContainerResponse RenameContainer(renameContainerRequest request) 109 | { 110 | throw new NotImplementedException(); 111 | } 112 | 113 | public virtual deleteContainerResponse DeleteContainer(deleteContainerRequest request) 114 | { 115 | throw new NotImplementedException(); 116 | } 117 | 118 | public virtual removeFromContainerResponse RemoveFromContainer(removeFromContainerRequest request) 119 | { 120 | throw new NotImplementedException(); 121 | } 122 | 123 | public virtual reorderContainerResponse ReorderContainer(reorderContainerRequest request) 124 | { 125 | throw new NotImplementedException(); 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /OpenSonos.LocalMusicServer/OpenSonos.LocalMusicServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {A67F0125-7297-457B-AD0A-AC050A2D793D} 8 | Exe 9 | Properties 10 | OpenSonos.LocalMusicServer 11 | OpenSonos.LocalMusicServer 12 | v4.5.1 13 | 512 14 | 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | ..\packages\Ninject.3.2.2.0\lib\net45-full\Ninject.dll 38 | 39 | 40 | ..\packages\Ninject.Extensions.Conventions.3.2.0.0\lib\net45-full\Ninject.Extensions.Conventions.dll 41 | 42 | 43 | ..\packages\simpleservices.2.0.0\lib\Net45\SimpleServices.dll 44 | 45 | 46 | 47 | 48 | ..\packages\System.Configuration.Abstractions.2.0.2.15\lib\net45\System.Configuration.Abstractions.dll 49 | 50 | 51 | 52 | 53 | ..\packages\System.IO.Abstractions.1.4.0.92\lib\net35\System.IO.Abstractions.dll 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | Component 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | {4b7a83fb-1a9e-4c19-b1ad-ce8097a3aac7} 102 | OpenSonos 103 | 104 | 105 | 106 | 113 | -------------------------------------------------------------------------------- /OpenSonos/SonosServer/ISonosApi.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel; 2 | 3 | namespace OpenSonos.SonosServer 4 | { 5 | [ServiceContract(Namespace = "http://www.sonos.com/Services/1.1", ConfigurationName = "SonosContract.ISonosApi")] 6 | public interface ISonosApi 7 | { 8 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#getSessionId", ReplyAction = "*")] 9 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#getSessionId", Name = "SonosError")] 10 | [XmlSerializerFormat(SupportFaults = true)] 11 | [ServiceKnownType(typeof (AbstractMedia))] 12 | getSessionIdResponse GetSessionId(getSessionIdRequest request); 13 | 14 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#getMetadata", ReplyAction = "*")] 15 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#getMetadata", Name = "SonosError")] 16 | [XmlSerializerFormat(SupportFaults = true)] 17 | [ServiceKnownType(typeof (AbstractMedia))] 18 | getMetadataResponse GetMetadata(getMetadataRequest request); 19 | 20 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#getExtendedMetadata", ReplyAction = "*")] 21 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#getExtendedMetadata", Name = "SonosError")] 22 | [XmlSerializerFormat(SupportFaults = true)] 23 | [ServiceKnownType(typeof (AbstractMedia))] 24 | getExtendedMetadataResponse GetExtendedMetadata(getExtendedMetadataRequest request); 25 | 26 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#getExtendedMetadataText", ReplyAction = "*")] 27 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#getExtendedMetadataText", Name = "SonosError")] 28 | [XmlSerializerFormat(SupportFaults = true)] 29 | [ServiceKnownType(typeof (AbstractMedia))] 30 | getExtendedMetadataTextResponse GetExtendedMetadataText(getExtendedMetadataTextRequest request); 31 | 32 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#rateItem", ReplyAction = "*")] 33 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#rateItem", Name = "SonosError")] 34 | [XmlSerializerFormat(SupportFaults = true)] 35 | [ServiceKnownType(typeof (AbstractMedia))] 36 | rateItemResponse RateItem(rateItemRequest request); 37 | 38 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#search", ReplyAction = "*")] 39 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#search", Name = "SonosError")] 40 | [XmlSerializerFormat(SupportFaults = true)] 41 | [ServiceKnownType(typeof (AbstractMedia))] 42 | searchResponse Search(searchRequest request); 43 | 44 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#getMediaMetadata", ReplyAction = "*")] 45 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#getMediaMetadata", Name = "SonosError")] 46 | [XmlSerializerFormat(SupportFaults = true)] 47 | [ServiceKnownType(typeof (AbstractMedia))] 48 | getMediaMetadataResponse GetMediaMetadata(getMediaMetadataRequest request); 49 | 50 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#getMediaURI", ReplyAction = "*")] 51 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#getMediaURI", Name = "SonosError")] 52 | [XmlSerializerFormat(SupportFaults = true)] 53 | [ServiceKnownType(typeof (AbstractMedia))] 54 | getMediaURIResponse GetMediaUri(getMediaURIRequest request); 55 | 56 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#createItem", ReplyAction = "*")] 57 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#createItem", Name = "SonosError")] 58 | [XmlSerializerFormat(SupportFaults = true)] 59 | [ServiceKnownType(typeof (AbstractMedia))] 60 | createItemResponse CreateItem(createItemRequest request); 61 | 62 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#deleteItem", ReplyAction = "*")] 63 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#deleteItem", Name = "SonosError")] 64 | [XmlSerializerFormat(SupportFaults = true)] 65 | [ServiceKnownType(typeof (AbstractMedia))] 66 | deleteItemResponse DeleteItem(deleteItemRequest request); 67 | 68 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#getScrollIndices", ReplyAction = "*")] 69 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#getScrollIndices", Name = "SonosError")] 70 | [XmlSerializerFormat(SupportFaults = true)] 71 | [ServiceKnownType(typeof (AbstractMedia))] 72 | getScrollIndicesResponse GetScrollIndices(getScrollIndicesRequest request); 73 | 74 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#getLastUpdate", ReplyAction = "*")] 75 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#getLastUpdate", Name = "SonosError")] 76 | [XmlSerializerFormat(SupportFaults = true)] 77 | [ServiceKnownType(typeof (AbstractMedia))] 78 | getLastUpdateResponse GetLastUpdate(getLastUpdateRequest request); 79 | 80 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#reportStatus", ReplyAction = "*")] 81 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#reportStatus", Name = "SonosError")] 82 | [XmlSerializerFormat(SupportFaults = true)] 83 | [ServiceKnownType(typeof (AbstractMedia))] 84 | reportStatusResponse ReportStatus(reportStatusRequest request); 85 | 86 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#setPlayedSeconds", ReplyAction = "*")] 87 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#setPlayedSeconds", Name = "SonosError")] 88 | [XmlSerializerFormat(SupportFaults = true)] 89 | [ServiceKnownType(typeof (AbstractMedia))] 90 | setPlayedSecondsResponse SetPlayedSeconds(setPlayedSecondsRequest request); 91 | 92 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#reportPlaySeconds", ReplyAction = "*")] 93 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#reportPlaySeconds", Name = "SonosError")] 94 | [XmlSerializerFormat(SupportFaults = true)] 95 | [ServiceKnownType(typeof (AbstractMedia))] 96 | reportPlaySecondsResponse ReportPlaySeconds(reportPlaySecondsRequest request); 97 | 98 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#reportPlayStatus", ReplyAction = "*")] 99 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#reportPlayStatus", Name = "SonosError")] 100 | [XmlSerializerFormat(SupportFaults = true)] 101 | [ServiceKnownType(typeof (AbstractMedia))] 102 | reportPlayStatusResponse ReportPlayStatus(reportPlayStatusRequest request); 103 | 104 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#reportAccountAction", ReplyAction = "*")] 105 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#reportAccountAction", Name = "SonosError")] 106 | [XmlSerializerFormat(SupportFaults = true)] 107 | [ServiceKnownType(typeof (AbstractMedia))] 108 | reportAccountActionResponse ReportAccountAction(reportAccountActionRequest request); 109 | 110 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#getDeviceLinkCode", ReplyAction = "*")] 111 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#getDeviceLinkCode", Name = "SonosError")] 112 | [XmlSerializerFormat(SupportFaults = true)] 113 | [ServiceKnownType(typeof (AbstractMedia))] 114 | getDeviceLinkCodeResponse GetDeviceLinkCode(getDeviceLinkCodeRequest request); 115 | 116 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#getDeviceAuthToken", ReplyAction = "*")] 117 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#getDeviceAuthToken", Name = "SonosError")] 118 | [XmlSerializerFormat(SupportFaults = true)] 119 | [ServiceKnownType(typeof (AbstractMedia))] 120 | getDeviceAuthTokenResponse GetDeviceAuthToken(getDeviceAuthTokenRequest request); 121 | 122 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#getStreamingMetadata", ReplyAction = "*")] 123 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#getStreamingMetadata", Name = "SonosError")] 124 | [XmlSerializerFormat(SupportFaults = true)] 125 | [ServiceKnownType(typeof (AbstractMedia))] 126 | getStreamingMetadataResponse GetStreamingMetadata(getStreamingMetadataRequest request); 127 | 128 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#getContentKey", ReplyAction = "*")] 129 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#getContentKey", Name = "SonosError")] 130 | [XmlSerializerFormat(SupportFaults = true)] 131 | [ServiceKnownType(typeof (AbstractMedia))] 132 | getContentKeyResponse GetContentKey(getContentKeyRequest request); 133 | 134 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#createContainer", ReplyAction = "*")] 135 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#createContainer", Name = "SonosError")] 136 | [XmlSerializerFormat(SupportFaults = true)] 137 | [ServiceKnownType(typeof (AbstractMedia))] 138 | createContainerResponse CreateContainer(createContainerRequest request); 139 | 140 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#addToContainer", ReplyAction = "*")] 141 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#addToContainer", Name = "SonosError")] 142 | [XmlSerializerFormat(SupportFaults = true)] 143 | [ServiceKnownType(typeof (AbstractMedia))] 144 | addToContainerResponse AddToContainer(addToContainerRequest request); 145 | 146 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#renameContainer", ReplyAction = "*")] 147 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#renameContainer", Name = "SonosError")] 148 | [XmlSerializerFormat(SupportFaults = true)] 149 | [ServiceKnownType(typeof (AbstractMedia))] 150 | renameContainerResponse RenameContainer(renameContainerRequest request); 151 | 152 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#deleteContainer", ReplyAction = "*")] 153 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#deleteContainer", Name = "SonosError")] 154 | [XmlSerializerFormat(SupportFaults = true)] 155 | [ServiceKnownType(typeof (AbstractMedia))] 156 | deleteContainerResponse DeleteContainer(deleteContainerRequest request); 157 | 158 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#removeFromContainer", ReplyAction = "*")] 159 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#removeFromContainer", Name = "SonosError")] 160 | [XmlSerializerFormat(SupportFaults = true)] 161 | [ServiceKnownType(typeof (AbstractMedia))] 162 | removeFromContainerResponse RemoveFromContainer(removeFromContainerRequest request); 163 | 164 | [OperationContract(Action = "http://www.sonos.com/Services/1.1#reorderContainer", ReplyAction = "*")] 165 | [FaultContract(typeof (int), Action = "http://www.sonos.com/Services/1.1#reorderContainer", Name = "SonosError")] 166 | [XmlSerializerFormat(SupportFaults = true)] 167 | [ServiceKnownType(typeof (AbstractMedia))] 168 | reorderContainerResponse ReorderContainer(reorderContainerRequest request); 169 | } 170 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Sonos.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 17 | 23 | 24 | 25 | 26 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 191 | 192 | 193 | 194 | 197 | 198 | 199 | 204 | 205 | 206 | 210 | 211 | 212 | 215 | 216 | 217 | 220 | 221 | 222 | 225 | 226 | 227 | 228 | 229 | 230 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 264 | 265 | 266 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | segmentMetadata is metadata that applies to a specified time range. 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | Specifies the inclusive start time of the period to which this metadata 360 | applies. 361 | 362 | 363 | 364 | 365 | 366 | Specifies the length of the period in milliseconds. 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | Specifies the inclusive start time of the period for this list. If 388 | omitted, defaults the startTime of the first temporalMediaMetadata element. 389 | 390 | 391 | 392 | 393 | 394 | Specifies the length of the period of this list in milliseconds. If 395 | omitted, defaults the duration between startTime and the last elment's end time. 396 | 397 | 398 | 399 | 400 | 401 | A chronologically ordered list of segmentMetadata elements 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 596 | 597 | 598 | 599 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1187 | 1188 | 1189 | 1190 | 1191 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1201 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | 1223 | 1224 | 1225 | 1226 | 1227 | 1228 | 1229 | 1230 | 1231 | 1232 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 1239 | 1240 | 1241 | 1242 | 1243 | 1244 | 1245 | 1246 | 1247 | 1248 | 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | 1258 | 1259 | 1260 | 1261 | 1262 | 1263 | 1264 | 1265 | 1266 | 1267 | 1268 | 1269 | 1270 | 1271 | 1272 | 1273 | 1274 | 1275 | 1276 | 1277 | 1278 | 1279 | 1280 | 1281 | 1282 | 1283 | 1284 | 1285 | 1286 | 1287 | 1288 | 1289 | 1290 | 1291 | 1292 | 1293 | 1294 | 1295 | 1296 | 1297 | 1298 | 1299 | 1300 | 1301 | 1302 | 1303 | 1304 | 1305 | 1306 | 1307 | 1308 | 1309 | 1310 | 1311 | 1312 | 1313 | 1314 | 1315 | 1316 | 1317 | 1318 | 1319 | 1320 | 1321 | 1322 | 1323 | 1324 | 1325 | 1326 | 1327 | 1328 | 1329 | 1330 | 1331 | 1332 | 1333 | 1334 | 1335 | 1336 | 1337 | 1338 | 1339 | 1340 | 1341 | 1342 | 1343 | 1344 | 1345 | 1346 | 1347 | 1348 | 1349 | 1350 | 1351 | 1352 | 1353 | 1354 | 1355 | 1356 | 1357 | 1358 | 1359 | 1360 | 1361 | 1362 | 1363 | 1364 | 1365 | 1366 | 1367 | 1368 | 1369 | 1370 | 1371 | 1372 | 1373 | 1374 | 1375 | 1376 | 1377 | 1378 | 1379 | 1380 | 1381 | 1382 | 1383 | 1384 | 1385 | 1386 | 1387 | 1388 | 1389 | 1390 | 1391 | 1392 | 1393 | 1394 | 1395 | 1396 | 1397 | 1398 | 1399 | 1400 | 1401 | 1402 | 1403 | 1404 | 1405 | 1406 | 1407 | 1408 | 1409 | 1410 | 1411 | 1412 | 1413 | 1414 | 1415 | 1416 | 1417 | 1418 | 1419 | 1420 | 1421 | 1422 | 1423 | 1424 | 1425 | 1426 | 1427 | 1428 | 1429 | 1430 | 1431 | 1432 | 1433 | 1434 | 1435 | 1436 | 1437 | 1438 | 1439 | 1440 | 1441 | 1442 | 1443 | 1444 | 1445 | 1446 | 1447 | 1448 | 1449 | 1450 | 1451 | 1452 | 1453 | 1454 | 1455 | 1456 | 1457 | 1458 | 1459 | 1460 | 1461 | 1462 | 1463 | 1464 | 1465 | 1466 | 1467 | 1468 | 1469 | 1470 | 1471 | 1472 | 1473 | 1474 | 1475 | 1476 | 1477 | 1478 | 1479 | 1480 | 1481 | 1482 | 1483 | 1484 | 1485 | 1486 | 1487 | 1488 | 1489 | 1490 | 1491 | 1492 | 1493 | 1494 | 1495 | 1496 | 1497 | 1498 | 1499 | 1500 | 1501 | 1502 | 1503 | 1504 | 1505 | 1506 | 1507 | 1508 | 1509 | 1510 | 1511 | 1512 | 1513 | 1514 | 1515 | 1516 | 1517 | 1518 | 1519 | 1520 | 1521 | 1522 | 1523 | 1524 | 1525 | 1526 | 1527 | 1528 | 1529 | 1530 | 1531 | 1532 | 1533 | 1534 | 1535 | 1536 | 1537 | 1538 | 1539 | 1540 | 1541 | 1542 | 1543 | 1544 | 1545 | 1546 | 1547 | 1548 | 1549 | 1550 | 1551 | 1552 | 1553 | 1554 | 1555 | 1556 | 1557 | 1558 | 1559 | 1560 | 1561 | 1562 | 1563 | 1564 | 1565 | 1566 | 1567 | 1568 | 1569 | 1570 | 1571 | 1572 | 1573 | 1574 | 1575 | 1576 | 1577 | 1578 | 1579 | 1580 | 1581 | 1582 | 1583 | 1584 | 1585 | 1586 | 1587 | 1588 | 1589 | 1590 | 1591 | 1592 | 1593 | 1594 | 1595 | 1596 | 1597 | 1598 | 1599 | 1600 | 1601 | 1602 | 1603 | 1604 | 1605 | 1606 | 1607 | 1608 | 1609 | 1610 | 1611 | 1612 | 1613 | 1614 | 1615 | 1616 | 1617 | 1618 | 1619 | 1620 | 1621 | 1622 | 1623 | 1624 | 1625 | 1626 | 1627 | 1628 | 1629 | 1630 | 1631 | 1632 | 1633 | 1634 | 1635 | 1636 | 1637 | 1638 | 1639 | 1640 | 1641 | 1642 | 1643 | 1644 | 1645 | 1646 | 1647 | 1648 | 1649 | 1650 | 1651 | 1652 | 1653 | 1654 | 1655 | 1656 | 1657 | 1658 | 1659 | 1660 | 1661 | 1662 | 1663 | 1664 | 1665 | 1666 | 1667 | 1668 | 1669 | 1670 | 1671 | 1672 | 1673 | 1674 | 1675 | 1676 | 1677 | 1678 | 1679 | 1680 | 1681 | 1682 | 1683 | 1684 | 1685 | 1686 | 1687 | 1688 | 1689 | 1690 | --------------------------------------------------------------------------------