[banshee: 1/57] Added initial skeleton of uPnP Client addin
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee: 1/57] Added initial skeleton of uPnP Client addin
- Date: Mon, 13 Feb 2012 20:27:54 +0000 (UTC)
commit 7ecf1919888e466b5c4a427b8001d8be50051887
Author: Tobias Arrskog <tobias arrskog gmail com>
Date: Tue May 24 14:46:55 2011 +0200
Added initial skeleton of uPnP Client addin
Banshee.sln | 19 +++-
build/build.environment.mk | 1 +
configure.ac | 1 +
.../Banshee.UPnPClient.addin.xml | 24 +++++
.../Banshee.UPnPClient/Banshee.UPnPClient.csproj | 107 ++++++++++++++++++++
.../Banshee.UPnPClient/UPnPContainerSource.cs | 69 +++++++++++++
.../Banshee.UPnPClient/UPnPService.cs | 71 +++++++++++++
.../Banshee.UPnPClient/UPnPSource.cs | 102 +++++++++++++++++++
.../Banshee.UPnPClient/UPnPTrackInfo.cs | 53 ++++++++++
src/Extensions/Banshee.UPnPClient/Makefile.am | 15 +++
src/Extensions/Makefile.am | 1 +
11 files changed, 460 insertions(+), 3 deletions(-)
---
diff --git a/Banshee.sln b/Banshee.sln
index 45a8030..849bd23 100644
--- a/Banshee.sln
+++ b/Banshee.sln
@@ -144,6 +144,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.SoundMenu", "src\Ex
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.UbuntuOneMusicStore", "src\Extensions\Banshee.UbuntuOneMusicStore\Banshee.UbuntuOneMusicStore.csproj", "{3B855EBC-8E55-48DF-816B-B241BE45EBD8}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.UPnPClient", "src\Extensions\Banshee.UPnPClient\Banshee.UPnPClient.csproj", "{06E64490-7043-4D8B-B621-24205D2BE312}"
+EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{4F47D6F1-4047-4A89-AE85-3AE5EF9F2961}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
@@ -192,6 +194,16 @@ Global
{05148D80-6C5C-4BE5-9BD7-89613753D027}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05148D80-6C5C-4BE5-9BD7-89613753D027}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
{05148D80-6C5C-4BE5-9BD7-89613753D027}.Windows|Any CPU.Build.0 = Windows|Any CPU
+ {06E64490-7043-4D8B-B621-24205D2BE312}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {06E64490-7043-4D8B-B621-24205D2BE312}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {06E64490-7043-4D8B-B621-24205D2BE312}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {06E64490-7043-4D8B-B621-24205D2BE312}.Debug|x86.Build.0 = Debug|Any CPU
+ {06E64490-7043-4D8B-B621-24205D2BE312}.Release|Any CPU.ActiveCfg = Debug|Any CPU
+ {06E64490-7043-4D8B-B621-24205D2BE312}.Release|Any CPU.Build.0 = Debug|Any CPU
+ {06E64490-7043-4D8B-B621-24205D2BE312}.Release|x86.ActiveCfg = Debug|Any CPU
+ {06E64490-7043-4D8B-B621-24205D2BE312}.Release|x86.Build.0 = Debug|Any CPU
+ {06E64490-7043-4D8B-B621-24205D2BE312}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
+ {06E64490-7043-4D8B-B621-24205D2BE312}.Windows|Any CPU.Build.0 = Windows|Any CPU
{0AB92BF8-3A25-46AD-9748-1236471E9408}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0AB92BF8-3A25-46AD-9748-1236471E9408}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0AB92BF8-3A25-46AD-9748-1236471E9408}.Release|Any CPU.ActiveCfg = Debug|Any CPU
@@ -209,9 +221,6 @@ Global
{10A5B2EE-C9F0-4B7B-B79B-87B7DA9C1DC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{10A5B2EE-C9F0-4B7B-B79B-87B7DA9C1DC1}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
{10A5B2EE-C9F0-4B7B-B79B-87B7DA9C1DC1}.Windows|Any CPU.Build.0 = Windows|Any CPU
- {FDB90084-A1E6-4497-8047-52800A4AAB28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FDB90084-A1E6-4497-8047-52800A4AAB28}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FDB90084-A1E6-4497-8047-52800A4AAB28}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
{12984BDF-C565-4452-AD47-79BD3C440E28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12984BDF-C565-4452-AD47-79BD3C440E28}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12984BDF-C565-4452-AD47-79BD3C440E28}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
@@ -468,6 +477,9 @@ Global
{FCC1AE87-E10B-4B47-8ADE-D5F447E48518}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FCC1AE87-E10B-4B47-8ADE-D5F447E48518}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
{FCC1AE87-E10B-4B47-8ADE-D5F447E48518}.Windows|Any CPU.Build.0 = Windows|Any CPU
+ {FDB90084-A1E6-4497-8047-52800A4AAB28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FDB90084-A1E6-4497-8047-52800A4AAB28}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FDB90084-A1E6-4497-8047-52800A4AAB28}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{EB1FDF3F-048C-4010-80F5-D936A312580F} = {E6AD3714-5EA3-49D9-BA8D-12C69B2B8067}
@@ -533,6 +545,7 @@ Global
{AF8A9C6D-2188-413D-8EB8-C5E242BD68AC} = {4DD1DE63-F20B-4FC3-8FDA-F0BDF4183722}
{EE91126B-5500-4719-9FAA-36CBAC95DEE3} = {4DD1DE63-F20B-4FC3-8FDA-F0BDF4183722}
{3B855EBC-8E55-48DF-816B-B241BE45EBD8} = {4DD1DE63-F20B-4FC3-8FDA-F0BDF4183722}
+ {06E64490-7043-4D8B-B621-24205D2BE312} = {4DD1DE63-F20B-4FC3-8FDA-F0BDF4183722}
{95374549-9553-4C1E-9D89-667755F90E12} = {4F47D6F1-4047-4A89-AE85-3AE5EF9F2961}
{95374549-9553-4C1E-9D89-667755F90E13} = {4F47D6F1-4047-4A89-AE85-3AE5EF9F2961}
{C856EFD8-E812-4E61-8B76-E3583D94C233} = {4F47D6F1-4047-4A89-AE85-3AE5EF9F2961}
diff --git a/build/build.environment.mk b/build/build.environment.mk
index 0ba40dc..e8baa06 100644
--- a/build/build.environment.mk
+++ b/build/build.environment.mk
@@ -163,6 +163,7 @@ REF_EXTENSION_AUDIOBOOK = $(LINK_BANSHEE_THICKCLIENT_DEPS)
REF_EXTENSION_SAMPLE = $(LINK_BANSHEE_THICKCLIENT_DEPS)
REF_EXTENSION_REMOTE_AUDIO = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_MONO_ZEROCONF)
REF_EXTENSION_UBUNTUONEMUSICSTORE= $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_UBUNTUONESHARP)
+REF_EXTENSION_UPNP= $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_BANSHEE_SERVICES_DEPS)
REF_EXTENSION_WIKIPEDIA= $(LINK_BANSHEE_WEBBROWSER_DEPS)
# Backends
diff --git a/configure.ac b/configure.ac
index ebadc40..c1463ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -346,6 +346,7 @@ src/Extensions/Banshee.Sample/Makefile
src/Extensions/Banshee.Torrent/Makefile
src/Extensions/Banshee.RemoteAudio/Makefile
src/Extensions/Banshee.UbuntuOneMusicStore/Makefile
+src/Extensions/Banshee.UPnPClient/Makefile
src/Extensions/Banshee.Wikipedia/Makefile
src/Extensions/Banshee.YouTube/Makefile
diff --git a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient.addin.xml b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient.addin.xml
new file mode 100644
index 0000000..3b1ce70
--- /dev/null
+++ b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient.addin.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Addin
+ id="Banshee.UPnPClient"
+ version="1.0"
+ compatVersion="1.0"
+ copyright="Copyright  2011 Tobias 'topfs2' Arrskog. Licensed under the MIT X11 license."
+ name="uPnP Client"
+ category="Utilities"
+ description="Client extension for uPnP"
+ author="Tobias 'topfs2' Arrskog"
+ url="http://banshee-project.org/"
+ defaultEnabled="false">
+
+ <Localizer type="Gettext" catalog="banshee-community-extensions" location="../../../share/locale"/>
+
+ <Dependencies>
+ <Addin id="Banshee.Services" version="1.0"/>
+ <Addin id="Banshee.ThickClient" version="1.0"/>
+ </Dependencies>
+
+ <Extension path="/Banshee/ServiceManager/Service">
+ <Service class="Banshee.UPnPClient.UPnPService"/>
+ </Extension>
+</Addin>
diff --git a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient.csproj b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient.csproj
new file mode 100644
index 0000000..7b0d87a
--- /dev/null
+++ b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient.csproj
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <ProjectGuid>{06E64490-7043-4D8B-B621-24205D2BE312}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <UseParentDirectoryAsNamespace>true</UseParentDirectoryAsNamespace>
+ <AssemblyName>Banshee.UPnPClient</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <Optimize>true</Optimize>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
+ <RootNamespace>Banshee.UPnPClient</RootNamespace>
+ <AssemblyOriginatorKeyFile>.</AssemblyOriginatorKeyFile>
+ <ReleaseVersion>1.3</ReleaseVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <OutputPath>..\..\..\bin</OutputPath>
+ <CustomCommands>
+ <CustomCommands>
+ <Command type="Execute" command="make run" workingdir="${SolutionDir}" />
+ </CustomCommands>
+ </CustomCommands>
+ <WarningLevel>4</WarningLevel>
+ <Optimize>false</Optimize>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Windows|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <OutputPath>..\..\..\bin</OutputPath>
+ <PlatformTarget>x86</PlatformTarget>
+ <WarningLevel>4</WarningLevel>
+ <Optimize>false</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+ <Package>gtk-sharp-2.0</Package>
+ </Reference>
+ <Reference Include="Mono.Posix" />
+ <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+ <Package>gtk-sharp-2.0</Package>
+ </Reference>
+ <Reference Include="Mono.Cairo">
+ <SpecificVersion>False</SpecificVersion>
+ </Reference>
+ <Reference Include="Mono.Addins">
+ <SpecificVersion>False</SpecificVersion>
+ <Package>mono-addins</Package>
+ </Reference>
+ <Reference Include="Banshee.Core, Version=1.7.0.0, Culture=neutral">
+ <Package>banshee-core</Package>
+ </Reference>
+ <Reference Include="Banshee.Services, Version=1.7.0.0, Culture=neutral">
+ <Package>banshee-services</Package>
+ </Reference>
+ <Reference Include="Banshee.ThickClient, Version=1.7.0.0, Culture=neutral">
+ <Package>banshee-thickclient</Package>
+ </Reference>
+ <Reference Include="Banshee.Widgets, Version=1.7.0.0, Culture=neutral">
+ <Package>banshee-thickclient</Package>
+ </Reference>
+ <Reference Include="Hyena, Version=1.7.0.0, Culture=neutral">
+ <Package>banshee-hyena</Package>
+ </Reference>
+ <Reference Include="Hyena.Data.Sqlite, Version=1.7.0.0, Culture=neutral">
+ <Package>banshee-hyena-data-sqlite</Package>
+ </Reference>
+ <Reference Include="Hyena.Gui, Version=1.7.0.0, Culture=neutral">
+ <Package>banshee-hyena-gui</Package>
+ </Reference>
+ <Reference Include="System.Core" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Banshee.UPnPClient.addin.xml">
+ <LogicalName>Foo.Banshee.UPnPClient.addin.xml</LogicalName>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Banshee.UPnPClient\UPnPSource.cs" />
+ <Compile Include="Banshee.UPnPClient\UPnPService.cs" />
+ <Compile Include="Banshee.UPnPClient\UPnPContainerSource.cs" />
+ <Compile Include="Banshee.UPnPClient\UPnPTrackInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ProjectExtensions>
+ <MonoDevelop>
+ <Properties>
+ <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="Makefile.am">
+ <BuildFilesVar Sync="true" Name="SOURCES" />
+ <DeployFilesVar />
+ <ResourcesVar Sync="true" Name="RESOURCES" />
+ <OthersVar />
+ <GacRefVar />
+ <AsmRefVar />
+ <ProjectRefVar />
+ </MonoDevelop.Autotools.MakefileInfo>
+ </Properties>
+ </MonoDevelop>
+ </ProjectExtensions>
+</Project>
diff --git a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPContainerSource.cs b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPContainerSource.cs
new file mode 100644
index 0000000..a0dcf8c
--- /dev/null
+++ b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPContainerSource.cs
@@ -0,0 +1,69 @@
+//
+// UPnPContainerSource.cs
+//
+// Authors:
+// Tobias 'topfs2' Arrskog <tobias arrskog gmail com>
+//
+// Copyright (C) 2011 Tobias 'topfs2' Arrskog
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Mono.Unix;
+
+using Banshee.Base;
+using Banshee.Collection;
+using Banshee.Configuration;
+using Banshee.Sources;
+using Banshee.ServiceStack;
+
+namespace Banshee.UPnPClient
+{
+ public class UPnPContainerSource : Source
+ {
+ public UPnPContainerSource () : base (Catalog.GetString ("Shared Music"), Catalog.GetString ("Shared Music"), 300)
+ {
+ Properties.SetStringList ("Icon.Name", "applications-internet", "network-server");
+ TypeUniqueId = "upnp-container";
+ }
+
+ public override bool? AutoExpand {
+ get { return ExpandedSchema.Get (); }
+ }
+
+ public override bool Expanded {
+ get { return ExpandedSchema.Get (); }
+ set { ExpandedSchema.Set (value); }
+ }
+
+ public override bool CanActivate {
+ get { return false; }
+ }
+
+ public override bool CanRename {
+ get { return false; }
+ }
+
+ public static readonly SchemaEntry<bool> ExpandedSchema = new SchemaEntry<bool> (
+ "plugins.upnp", "expanded", true, "Shared Music expanded", "Shared Music expanded"
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPService.cs b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPService.cs
new file mode 100644
index 0000000..7cdcd31
--- /dev/null
+++ b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPService.cs
@@ -0,0 +1,71 @@
+//
+// UPnPClientSource.cs
+//
+// Authors:
+// Tobias 'topfs2' Arrskog <tobias arrskog gmail com>
+//
+// Copyright (C) 2011 Tobias 'topfs2' Arrskog
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+using Mono.Addins;
+
+using Banshee.Base;
+using Banshee.Sources.Gui;
+using Banshee.ServiceStack;
+using Banshee.Preferences;
+using Banshee.MediaEngine;
+using Banshee.PlaybackController;
+
+namespace Banshee.UPnPClient
+{
+ public class UPnPService : IExtensionService, IDisposable
+ {
+ private UPnPContainerSource container;
+
+ void IExtensionService.Initialize ()
+ {
+ container = new UPnPContainerSource();
+ container.AddChildSource (new UPnPSource("First test uPnP Client", "localhost-1"));
+ container.AddChildSource (new UPnPSource("Second test uPnP Client", "localhost-2"));
+
+ ServiceManager.SourceManager.AddSource(container);
+ }
+
+ public void Dispose ()
+ {
+ if (container != null)
+ {
+ foreach (UPnPSource source in container.Children)
+ source.Disconnect();
+
+ ServiceManager.SourceManager.RemoveSource(container);
+ container = null;
+ }
+ }
+
+ string IService.ServiceName {
+ get { return "uPnP Client service"; }
+ }
+ }
+}
diff --git a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPSource.cs b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPSource.cs
new file mode 100644
index 0000000..63f3e00
--- /dev/null
+++ b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPSource.cs
@@ -0,0 +1,102 @@
+//
+// UPnPClientSource.cs
+//
+// Authors:
+// Tobias 'topfs2' Arrskog <tobias arrskog gmail com>
+//
+// Copyright (C) 2011 Tobias 'topfs2' Arrskog
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+using Mono.Unix;
+using Mono.Addins;
+
+using Hyena.Collections;
+
+using Banshee.Base;
+using Banshee.Sources;
+using Banshee.Sources.Gui;
+using Banshee.Collection.Database;
+using Banshee.ServiceStack;
+using Banshee.Preferences;
+using Banshee.MediaEngine;
+using Banshee.PlaybackController;
+
+namespace Banshee.UPnPClient
+{
+ public class UPnPSource : PrimarySource
+ {
+ const int sort_order = 190;
+ private string uuid;
+
+ public UPnPSource (string name, string uuid) : base (Catalog.GetString ("Music Share"), name, uuid, sort_order)
+ {
+ Hyena.Log.Information ("UPnPSource.Added(\"" + this.Name + "\", \"" + uuid + "\")");
+
+ this.uuid = uuid;
+ Properties.SetStringList ("Icon.Name", "computer", "network-server");
+
+ // Remove tracks previously associated with this source, we do this to be sure they are non-existant before we refresh.
+ PurgeTracks();
+
+ AfterInitialized ();
+
+ UPnPTrackInfo track = new UPnPTrackInfo (this);
+ track.Save();
+ }
+
+ ~UPnPSource()
+ {
+ Dispose ();
+ }
+
+ public override void Dispose ()
+ {
+ Disconnect ();
+ base.Dispose ();
+ }
+
+ public void Disconnect()
+ {
+ Hyena.Log.Information ("UPnPSource.Disconnect(\"" + this.Name + "\", \"" + uuid + "\")");
+
+ // Stop currently playing track if its from us.
+ try {
+ if (ServiceManager.PlayerEngine.CurrentState == Banshee.MediaEngine.PlayerState.Playing) {
+ DatabaseTrackInfo track = ServiceManager.PlayerEngine.CurrentTrack as DatabaseTrackInfo;
+ if (track != null && track.PrimarySource == this) {
+ ServiceManager.PlayerEngine.Close ();
+ }
+ }
+ } catch {}
+
+ // Remove tracks associated with this source, we will refetch them on next connect
+ PurgeTracks();
+ }
+
+ public override bool CanDeleteTracks
+ {
+ get { return false; }
+ }
+ }
+}
diff --git a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPTrackInfo.cs b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPTrackInfo.cs
new file mode 100644
index 0000000..926d1ba
--- /dev/null
+++ b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPTrackInfo.cs
@@ -0,0 +1,53 @@
+//
+// UPnPTrackInfo.cs
+//
+// Authors:
+// Tobias 'topfs2' Arrskog <tobias arrskog gmail com>
+//
+// Copyright (C) 2011 Tobias 'topfs2' Arrskog
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Mono.Unix;
+using Hyena;
+
+using Banshee.Collection;
+using Banshee.Collection.Database;
+
+namespace Banshee.UPnPClient
+{
+ public class UPnPTrackInfo : DatabaseTrackInfo
+ {
+ public UPnPTrackInfo (UPnPSource source) : base()
+ {
+ ArtistName = "Artist";
+ AlbumTitle = "Album";
+ TrackTitle = "Song";
+
+ ExternalId = 1;
+
+ PrimarySource = source;
+
+ Uri = new SafeUri ("file://~/song.flac");
+ }
+ }
+}
diff --git a/src/Extensions/Banshee.UPnPClient/Makefile.am b/src/Extensions/Banshee.UPnPClient/Makefile.am
new file mode 100644
index 0000000..f031d75
--- /dev/null
+++ b/src/Extensions/Banshee.UPnPClient/Makefile.am
@@ -0,0 +1,15 @@
+ASSEMBLY = Banshee.UPnPClient
+TARGET = library
+LINK = $(REF_EXTENSION_UPNP)
+INSTALL_DIR = $(EXTENSIONS_INSTALL_DIR)
+
+SOURCES = \
+ Banshee.UPnPClient/UPnPContainerSource.cs \
+ Banshee.UPnPClient/UPnPService.cs \
+ Banshee.UPnPClient/UPnPSource.cs \
+ Banshee.UPnPClient/UPnPTrackInfo.cs
+
+RESOURCES = Banshee.UPnPClient.addin.xml
+
+include $(top_srcdir)/build/build.mk
+
diff --git a/src/Extensions/Makefile.am b/src/Extensions/Makefile.am
index b5621b1..d1fd9ad 100644
--- a/src/Extensions/Makefile.am
+++ b/src/Extensions/Makefile.am
@@ -32,6 +32,7 @@ SUBDIRS = \
Banshee.Torrent \
Banshee.RemoteAudio \
Banshee.UbuntuOneMusicStore \
+ Banshee.UPnPClient \
Banshee.Wikipedia \
Banshee.YouTube
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]