From 746c5d2fa7cd14f648c72a87ce52e5096c1f03f1 Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Fri, 22 Feb 2013 01:28:57 -0500 Subject: [PATCH] moved Plugins to separate repo --- MediaBrowser.Api/PluginService.cs | 10 +- .../ApiClient.js | 30 +- MediaBrowser.ApiInteraction/ApiClient.cs | 2 +- MediaBrowser.Common/Plugins/BasePlugin.cs | 4 +- MediaBrowser.Common/Plugins/IPlugin.cs | 2 +- MediaBrowser.Controller/Kernel.cs | 4 +- .../MediaBrowser.Controller.csproj | 2 +- .../Plugins/BaseConfigurationPage.cs | 81 -- .../Plugins/IPluginConfigurationPage.cs | 61 + MediaBrowser.Model/Plugins/PluginInfo.cs | 2 +- .../Configuration/DlnaConfigurationPage.cs | 50 - .../Configuration/PluginConfiguration.cs | 39 - .../Configuration/configPage.html | 92 -- .../MediaBrowser.Plugins.Dlna.csproj | 91 -- MediaBrowser.Plugins.Dlna/Plugin.cs | 1027 ----------------- .../Properties/AssemblyInfo.cs | 35 - .../MediaBrowser.Plugins.MpcHc.csproj | 109 -- .../MpcHcMediaPlayer.cs | 580 ---------- MediaBrowser.Plugins.MpcHc/Plugin.cs | 32 - .../Properties/AssemblyInfo.cs | 53 - .../Properties/Resources.Designer.cs | 62 - .../Properties/Resources.resx | 117 -- .../Properties/Settings.Designer.cs | 30 - .../Properties/Settings.settings | 7 - MediaBrowser.Plugins.MpcHc/app.config | 11 - .../MediaBrowser.Plugins.Tmt5.csproj | 108 -- MediaBrowser.Plugins.Tmt5/Plugin.cs | 32 - .../Properties/AssemblyInfo.cs | 53 - .../Properties/Resources.Designer.cs | 62 - .../Properties/Resources.resx | 117 -- .../Properties/Settings.Designer.cs | 30 - .../Properties/Settings.settings | 7 - MediaBrowser.Plugins.Tmt5/Tmt5MediaPlayer.cs | 405 ------- MediaBrowser.Plugins.Tmt5/app.config | 11 - .../AppleTrailerListingDownloader.cs | 314 ----- .../Configuration/PluginConfiguration.cs | 46 - .../Configuration/TrailerConfigurationPage.cs | 50 - .../Configuration/configPage.html | 119 -- .../Entities/TrailerCollectionFolder.cs | 33 - .../MediaBrowser.Plugins.Trailers.csproj | 88 -- MediaBrowser.Plugins.Trailers/Plugin.cs | 119 -- .../Properties/AssemblyInfo.cs | 34 - .../Providers/TrailerFromJsonProvider.cs | 143 --- .../Resolvers/TrailerResolver.cs | 51 - .../CurrentTrailerDownloadTask.cs | 311 ----- MediaBrowser.Plugins.Trailers/TrailerInfo.cs | 45 - MediaBrowser.UI.sln | 24 - MediaBrowser.UI/Controller/PluginUpdater.cs | 2 +- MediaBrowser.UI/MediaBrowser.UI.csproj | 5 +- .../Api/DashboardService.cs | 7 +- .../Html/scripts/PluginUpdatesPage.js | 8 +- .../Html/scripts/PluginsPage.js | 6 +- MediaBrowser.sln | 33 - ...iaBrowser.Server.Core.nupkg.REMOVED.git-id | 1 + 54 files changed, 104 insertions(+), 4693 deletions(-) delete mode 100644 MediaBrowser.Controller/Plugins/BaseConfigurationPage.cs create mode 100644 MediaBrowser.Controller/Plugins/IPluginConfigurationPage.cs delete mode 100644 MediaBrowser.Plugins.Dlna/Configuration/DlnaConfigurationPage.cs delete mode 100644 MediaBrowser.Plugins.Dlna/Configuration/PluginConfiguration.cs delete mode 100644 MediaBrowser.Plugins.Dlna/Configuration/configPage.html delete mode 100644 MediaBrowser.Plugins.Dlna/MediaBrowser.Plugins.Dlna.csproj delete mode 100644 MediaBrowser.Plugins.Dlna/Plugin.cs delete mode 100644 MediaBrowser.Plugins.Dlna/Properties/AssemblyInfo.cs delete mode 100644 MediaBrowser.Plugins.MpcHc/MediaBrowser.Plugins.MpcHc.csproj delete mode 100644 MediaBrowser.Plugins.MpcHc/MpcHcMediaPlayer.cs delete mode 100644 MediaBrowser.Plugins.MpcHc/Plugin.cs delete mode 100644 MediaBrowser.Plugins.MpcHc/Properties/AssemblyInfo.cs delete mode 100644 MediaBrowser.Plugins.MpcHc/Properties/Resources.Designer.cs delete mode 100644 MediaBrowser.Plugins.MpcHc/Properties/Resources.resx delete mode 100644 MediaBrowser.Plugins.MpcHc/Properties/Settings.Designer.cs delete mode 100644 MediaBrowser.Plugins.MpcHc/Properties/Settings.settings delete mode 100644 MediaBrowser.Plugins.MpcHc/app.config delete mode 100644 MediaBrowser.Plugins.Tmt5/MediaBrowser.Plugins.Tmt5.csproj delete mode 100644 MediaBrowser.Plugins.Tmt5/Plugin.cs delete mode 100644 MediaBrowser.Plugins.Tmt5/Properties/AssemblyInfo.cs delete mode 100644 MediaBrowser.Plugins.Tmt5/Properties/Resources.Designer.cs delete mode 100644 MediaBrowser.Plugins.Tmt5/Properties/Resources.resx delete mode 100644 MediaBrowser.Plugins.Tmt5/Properties/Settings.Designer.cs delete mode 100644 MediaBrowser.Plugins.Tmt5/Properties/Settings.settings delete mode 100644 MediaBrowser.Plugins.Tmt5/Tmt5MediaPlayer.cs delete mode 100644 MediaBrowser.Plugins.Tmt5/app.config delete mode 100644 MediaBrowser.Plugins.Trailers/AppleTrailerListingDownloader.cs delete mode 100644 MediaBrowser.Plugins.Trailers/Configuration/PluginConfiguration.cs delete mode 100644 MediaBrowser.Plugins.Trailers/Configuration/TrailerConfigurationPage.cs delete mode 100644 MediaBrowser.Plugins.Trailers/Configuration/configPage.html delete mode 100644 MediaBrowser.Plugins.Trailers/Entities/TrailerCollectionFolder.cs delete mode 100644 MediaBrowser.Plugins.Trailers/MediaBrowser.Plugins.Trailers.csproj delete mode 100644 MediaBrowser.Plugins.Trailers/Plugin.cs delete mode 100644 MediaBrowser.Plugins.Trailers/Properties/AssemblyInfo.cs delete mode 100644 MediaBrowser.Plugins.Trailers/Providers/TrailerFromJsonProvider.cs delete mode 100644 MediaBrowser.Plugins.Trailers/Resolvers/TrailerResolver.cs delete mode 100644 MediaBrowser.Plugins.Trailers/ScheduledTasks/CurrentTrailerDownloadTask.cs delete mode 100644 MediaBrowser.Plugins.Trailers/TrailerInfo.cs create mode 100644 Nuget/MediaBrowser.Server.Core.nupkg.REMOVED.git-id diff --git a/MediaBrowser.Api/PluginService.cs b/MediaBrowser.Api/PluginService.cs index ad7e37adc2..73bafd9fda 100644 --- a/MediaBrowser.Api/PluginService.cs +++ b/MediaBrowser.Api/PluginService.cs @@ -141,7 +141,7 @@ namespace MediaBrowser.Api /// System.Object. public object Get(GetPluginAssembly request) { - var plugin = Kernel.Plugins.First(p => p.UniqueId == request.Id); + var plugin = Kernel.Plugins.First(p => p.Id == request.Id); return ToStaticFileResult(plugin.AssemblyFilePath); } @@ -153,7 +153,7 @@ namespace MediaBrowser.Api /// System.Object. public object Get(GetPluginConfiguration request) { - var plugin = Kernel.Plugins.First(p => p.UniqueId == request.Id); + var plugin = Kernel.Plugins.First(p => p.Id == request.Id); var dateModified = plugin.ConfigurationDateLastModified; @@ -169,7 +169,7 @@ namespace MediaBrowser.Api /// System.Object. public object Get(GetPluginConfigurationFile request) { - var plugin = Kernel.Plugins.First(p => p.UniqueId == request.Id); + var plugin = Kernel.Plugins.First(p => p.Id == request.Id); return ToStaticFileResult(plugin.ConfigurationFilePath); } @@ -218,7 +218,7 @@ namespace MediaBrowser.Api var pathInfo = PathInfo.Parse(Request.PathInfo); var id = new Guid(pathInfo.GetArgumentValue(1)); - var plugin = Kernel.Plugins.First(p => p.UniqueId == id); + var plugin = Kernel.Plugins.First(p => p.Id == id); var configuration = JsonSerializer.DeserializeFromStream(request.RequestStream, plugin.ConfigurationType) as BasePluginConfiguration; @@ -233,7 +233,7 @@ namespace MediaBrowser.Api { var kernel = (Kernel)Kernel; - var plugin = kernel.Plugins.First(p => p.UniqueId == request.Id); + var plugin = kernel.Plugins.First(p => p.Id == request.Id); kernel.InstallationManager.UninstallPlugin(plugin); } diff --git a/MediaBrowser.ApiInteraction.Javascript/ApiClient.js b/MediaBrowser.ApiInteraction.Javascript/ApiClient.js index 0b185a55e9..df1c8f2c01 100644 --- a/MediaBrowser.ApiInteraction.Javascript/ApiClient.js +++ b/MediaBrowser.ApiInteraction.Javascript/ApiClient.js @@ -382,15 +382,15 @@ var ApiClient = { /** * Gets the configuration of a plugin - * @param {String} uniqueId + * @param {String} Id */ - getPluginConfiguration: function (uniqueId) { + getPluginConfiguration: function (id) { - if (!uniqueId) { - throw new Error("null uniqueId"); + if (!id) { + throw new Error("null Id"); } - var url = ApiClient.getUrl("Plugins/" + uniqueId + "/Configuration"); + var url = ApiClient.getUrl("Plugins/" + id + "/Configuration"); return $.getJSON(url); }, @@ -407,15 +407,15 @@ var ApiClient = { /** * Uninstalls a plugin - * @param {String} uniqueId + * @param {String} Id */ - uninstallPlugin: function (uniqueId) { + uninstallPlugin: function (id) { - if (!uniqueId) { - throw new Error("null uniqueId"); + if (!id) { + throw new Error("null Id"); } - var url = ApiClient.getUrl("Plugins/" + uniqueId); + var url = ApiClient.getUrl("Plugins/" + id); return $.ajax({ type: "DELETE", @@ -1207,20 +1207,20 @@ var ApiClient = { /** * Updates a plugin's configuration - * @param {String} uniqueId + * @param {String} Id * @param {Object} configuration */ - updatePluginConfiguration: function (uniqueId, configuration) { + updatePluginConfiguration: function (id, configuration) { - if (!uniqueId) { - throw new Error("null uniqueId"); + if (!id) { + throw new Error("null Id"); } if (!configuration) { throw new Error("null configuration"); } - var url = ApiClient.getUrl("Plugins/" + uniqueId + "/Configuration"); + var url = ApiClient.getUrl("Plugins/" + id + "/Configuration"); return $.post(url, JSON.stringify(configuration)); }, diff --git a/MediaBrowser.ApiInteraction/ApiClient.cs b/MediaBrowser.ApiInteraction/ApiClient.cs index cecb6a30bb..ef8197e168 100644 --- a/MediaBrowser.ApiInteraction/ApiClient.cs +++ b/MediaBrowser.ApiInteraction/ApiClient.cs @@ -362,7 +362,7 @@ namespace MediaBrowser.ApiInteraction throw new ArgumentNullException("plugin"); } - var url = GetApiUrl("Plugins/" + plugin.UniqueId + "/Assembly"); + var url = GetApiUrl("Plugins/" + plugin.Id + "/Assembly"); return HttpClient.GetStreamAsync(url, Logger, CancellationToken.None); } diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs index 98b2f8161f..d089aa1b38 100644 --- a/MediaBrowser.Common/Plugins/BasePlugin.cs +++ b/MediaBrowser.Common/Plugins/BasePlugin.cs @@ -90,7 +90,7 @@ namespace MediaBrowser.Common.Plugins /// Gets the unique id. /// /// The unique id. - public Guid UniqueId + public Guid Id { get { @@ -419,7 +419,7 @@ namespace MediaBrowser.Common.Plugins ConfigurationDateLastModified = ConfigurationDateLastModified, Description = Description, IsCorePlugin = IsCorePlugin, - UniqueId = UniqueId, + Id = Id, EnableAutoUpdate = Configuration.EnableAutoUpdate, UpdateClass = Configuration.UpdateClass, ConfigurationFileName = ConfigurationFileName diff --git a/MediaBrowser.Common/Plugins/IPlugin.cs b/MediaBrowser.Common/Plugins/IPlugin.cs index fdd99868ab..198678491b 100644 --- a/MediaBrowser.Common/Plugins/IPlugin.cs +++ b/MediaBrowser.Common/Plugins/IPlugin.cs @@ -35,7 +35,7 @@ namespace MediaBrowser.Common.Plugins /// Gets the unique id. /// /// The unique id. - Guid UniqueId { get; } + Guid Id { get; } /// /// Gets the plugin version diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs index a8cfb8dd76..952160b2b7 100644 --- a/MediaBrowser.Controller/Kernel.cs +++ b/MediaBrowser.Controller/Kernel.cs @@ -182,8 +182,8 @@ namespace MediaBrowser.Controller /// Gets the list of plugin configuration pages /// /// The configuration pages. - [ImportMany(typeof(BaseConfigurationPage))] - public IEnumerable PluginConfigurationPages { get; private set; } + [ImportMany(typeof(IPluginConfigurationPage))] + public IEnumerable PluginConfigurationPages { get; private set; } /// /// Gets the intro providers. diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 0bf3e6c1f5..27d67fd17e 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -128,7 +128,7 @@ - + diff --git a/MediaBrowser.Controller/Plugins/BaseConfigurationPage.cs b/MediaBrowser.Controller/Plugins/BaseConfigurationPage.cs deleted file mode 100644 index dc9405840a..0000000000 --- a/MediaBrowser.Controller/Plugins/BaseConfigurationPage.cs +++ /dev/null @@ -1,81 +0,0 @@ -using MediaBrowser.Common.Plugins; -using System.IO; - -namespace MediaBrowser.Controller.Plugins -{ - /// - /// Class BaseConfigurationPage - /// - public abstract class BaseConfigurationPage - { - /// - /// Gets the name. - /// - /// The name. - public abstract string Name { get; } - - /// - /// Gets the description. - /// - /// The description. - public virtual string Description - { - get { return string.Empty; } - } - - /// - /// Gets the type of the configuration page. - /// - /// The type of the configuration page. - public virtual ConfigurationPageType ConfigurationPageType - { - get { return ConfigurationPageType.PluginConfiguration; } - } - - /// - /// Gets the HTML stream from manifest resource. - /// - /// The resource. - /// Stream. - protected Stream GetHtmlStreamFromManifestResource(string resource) - { - return GetType().Assembly.GetManifestResourceStream(resource); - } - - /// - /// Gets the HTML stream. - /// - /// Stream. - public abstract Stream GetHtmlStream(); - - /// - /// Gets the name of the plugin. - /// - /// The name of the plugin. - public virtual string OwnerPluginName - { - get { return GetOwnerPlugin().Name; } - } - - /// - /// Gets the owner plugin. - /// - /// BasePlugin. - public abstract IPlugin GetOwnerPlugin(); - } - - /// - /// Enum ConfigurationPageType - /// - public enum ConfigurationPageType - { - /// - /// The plugin configuration - /// - PluginConfiguration, - /// - /// The none - /// - None - } -} diff --git a/MediaBrowser.Controller/Plugins/IPluginConfigurationPage.cs b/MediaBrowser.Controller/Plugins/IPluginConfigurationPage.cs new file mode 100644 index 0000000000..38fe368578 --- /dev/null +++ b/MediaBrowser.Controller/Plugins/IPluginConfigurationPage.cs @@ -0,0 +1,61 @@ +using System; +using System.IO; + +namespace MediaBrowser.Controller.Plugins +{ + /// + /// Interface IConfigurationPage + /// + public interface IPluginConfigurationPage + { + /// + /// Gets the name. + /// + /// The name. + string Name { get; } + + /// + /// Gets the type of the configuration page. + /// + /// The type of the configuration page. + ConfigurationPageType ConfigurationPageType { get; } + + /// + /// Gets the plugin id. + /// + /// The plugin id. + Guid? PluginId { get; } + + /// + /// Gets the HTML stream. + /// + /// Stream. + Stream GetHtmlStream(); + + /// + /// Gets the version. Typically taken from Plugin.Version + /// + /// The version. + string Version { get; } + + /// + /// For http caching purposes. Typically taken from Plugin.AssemblyDateLastModified + /// + DateTime DateLastModified { get; } + } + + /// + /// Enum ConfigurationPageType + /// + public enum ConfigurationPageType + { + /// + /// The plugin configuration + /// + PluginConfiguration, + /// + /// The none + /// + None + } +} diff --git a/MediaBrowser.Model/Plugins/PluginInfo.cs b/MediaBrowser.Model/Plugins/PluginInfo.cs index b518342800..0fe6fb6dba 100644 --- a/MediaBrowser.Model/Plugins/PluginInfo.cs +++ b/MediaBrowser.Model/Plugins/PluginInfo.cs @@ -71,7 +71,7 @@ namespace MediaBrowser.Model.Plugins /// /// The unique id. [ProtoMember(9)] - public Guid UniqueId { get; set; } + public Guid Id { get; set; } /// /// Whether or not this plug-in should be automatically updated when a diff --git a/MediaBrowser.Plugins.Dlna/Configuration/DlnaConfigurationPage.cs b/MediaBrowser.Plugins.Dlna/Configuration/DlnaConfigurationPage.cs deleted file mode 100644 index 44b6004af7..0000000000 --- a/MediaBrowser.Plugins.Dlna/Configuration/DlnaConfigurationPage.cs +++ /dev/null @@ -1,50 +0,0 @@ -using MediaBrowser.Common.Plugins; -using MediaBrowser.Controller.Plugins; -using System.ComponentModel.Composition; -using System.IO; - -namespace MediaBrowser.Plugins.Dlna.Configuration -{ - /// - /// Class DlnaConfigurationPage - /// - [Export(typeof(BaseConfigurationPage))] - class DlnaConfigurationPage : BaseConfigurationPage - { - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get { return "Dlna"; } - } - - /// - /// Gets the HTML stream. - /// - /// Stream. - public override Stream GetHtmlStream() - { - return GetHtmlStreamFromManifestResource("MediaBrowser.Plugins.Dlna.Configuration.configPage.html"); - } - - /// - /// Gets the owner plugin. - /// - /// BasePlugin. - public override IPlugin GetOwnerPlugin() - { - return Plugin.Instance; - } - - /// - /// Gets the type of the configuration page. - /// - /// The type of the configuration page. - public override ConfigurationPageType ConfigurationPageType - { - get { return ConfigurationPageType.PluginConfiguration; } - } - } -} diff --git a/MediaBrowser.Plugins.Dlna/Configuration/PluginConfiguration.cs b/MediaBrowser.Plugins.Dlna/Configuration/PluginConfiguration.cs deleted file mode 100644 index 47a56c9cf5..0000000000 --- a/MediaBrowser.Plugins.Dlna/Configuration/PluginConfiguration.cs +++ /dev/null @@ -1,39 +0,0 @@ -using MediaBrowser.Model.Plugins; - -namespace MediaBrowser.Plugins.Dlna.Configuration -{ - /// - /// Class PluginConfiguration - /// - public class PluginConfiguration : BasePluginConfiguration - { - /// - /// Gets or sets the friendly name of the DLNA Server. - /// - /// The friendly name of the DLNA Server. - public string FriendlyDlnaName { get; set; } - - /// - /// Gets or sets the Port Number for the DLNA Server. - /// - /// The Port Number of the DLNA Server. - public short? DlnaPortNumber { get; set; } - - /// - /// Gets or sets the name of the user to impersonate. - /// - /// The name of the User. - public string UserName { get; set; } - - /// - /// Initializes a new instance of the class. - /// - public PluginConfiguration() - : base() - { - //this.DlnaPortNumber = 1845; - this.FriendlyDlnaName = "MB3 UPnP"; - this.UserName = string.Empty; - } - } -} diff --git a/MediaBrowser.Plugins.Dlna/Configuration/configPage.html b/MediaBrowser.Plugins.Dlna/Configuration/configPage.html deleted file mode 100644 index 7a147f7c16..0000000000 --- a/MediaBrowser.Plugins.Dlna/Configuration/configPage.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - dlna - - -
- -
-
-
- -
    -
  • - - -
  • -
  • - - -
  • -
  • - - -
    - If specified, the Dlna server will use this port -
    -
  • -
  • - -
    - Saving will restart the dlna server. -
    - -
  • -
- -
-
-
- - -
- - diff --git a/MediaBrowser.Plugins.Dlna/MediaBrowser.Plugins.Dlna.csproj b/MediaBrowser.Plugins.Dlna/MediaBrowser.Plugins.Dlna.csproj deleted file mode 100644 index e5f3e7e18d..0000000000 --- a/MediaBrowser.Plugins.Dlna/MediaBrowser.Plugins.Dlna.csproj +++ /dev/null @@ -1,91 +0,0 @@ - - - - - Debug - AnyCPU - {A2CF4266-2110-419E-8620-E2FEEFCA0F48} - Library - Properties - MediaBrowser.Plugins.Dlna - MediaBrowser.Plugins.Dlna - v4.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - Always - - - - ..\ThirdParty\UPnP\Libs\Platinum.Managed.dll - - - - - - - - - - - - - - - - - - - {9142eefa-7570-41e1-bfcc-468bb571af2f} - MediaBrowser.Common - - - {17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2} - MediaBrowser.Controller - - - {7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b} - MediaBrowser.Model - - - - - Assemblies\Platinum.Managed.dll - - - - - Assemblies\log4net.dll - - - - - - xcopy "$(TargetPath)" "$(SolutionDir)\ProgramData-Server\Plugins\" /y - - - \ No newline at end of file diff --git a/MediaBrowser.Plugins.Dlna/Plugin.cs b/MediaBrowser.Plugins.Dlna/Plugin.cs deleted file mode 100644 index 9cca31d34e..0000000000 --- a/MediaBrowser.Plugins.Dlna/Plugin.cs +++ /dev/null @@ -1,1027 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.IO; -using System.Linq; -using System.Reflection; -using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.Net; -using MediaBrowser.Common.Plugins; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.Entities.TV; -using MediaBrowser.Model.Entities; -using MediaBrowser.Plugins.Dlna.Configuration; - -namespace MediaBrowser.Plugins.Dlna -{ - /// - /// Class Plugin - /// - [Export(typeof(IPlugin))] - public class Plugin : BasePlugin - { - //these are Neptune values, they probably belong in the managed wrapper somewhere, but they aren't - //techincally theres 50 to 100 of these values, but these 3 seem to be the most useful - private const int NEP_Failure = -1; - private const int NEP_NotImplemented = -2012; - private const int NEP_Success = 0; - - private Platinum.UPnP _Upnp; - private Platinum.MediaConnect _PlatinumServer; - private User _CurrentUser; - - - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get { return "DLNA Server"; } - } - - /// - /// Gets the description. - /// - /// The description. - public override string Description - { - get { return "DLNA Server"; } - } - - /// - /// Gets the instance. - /// - /// The instance. - public static Plugin Instance { get; private set; } - - /// - /// Initializes a new instance of the class. - /// - public Plugin() - : base() - { - Instance = this; - } - - /// - /// Initializes the on server. - /// - /// if set to true [is first run]. - protected override void InitializeOnServer(bool isFirstRun) - { - base.InitializeOnServer(isFirstRun); - - Kernel.ReloadCompleted += Kernel_ReloadCompleted; - AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; - - } - - /// - /// Handles the AssemblyResolve event of the CurrentDomain control. - /// - /// The source of the event. - /// The instance containing the event data. - /// Assembly. - Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) - { - var askedAssembly = new AssemblyName(args.Name); - - var resourcePath = "MediaBrowser.Plugins.Dlna.Assemblies." + askedAssembly.Name + ".dll"; - - using (var stream = GetType().Assembly.GetManifestResourceStream(resourcePath)) - { - if (stream != null) - { - Logger.Info("Loading assembly from resource {0}", resourcePath); - - using (var memoryStream = new MemoryStream()) - { - stream.CopyTo(memoryStream); - - memoryStream.Position = 0; - - return Assembly.Load(memoryStream.ToArray()); - } - } - } - - return null; - } - - /// - /// Disposes the on server. - /// - /// if set to true [dispose]. - protected override void DisposeOnServer(bool dispose) - { - if (dispose) - { - Kernel.ReloadCompleted -= Kernel_ReloadCompleted; - AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve; - DisposeDlnaServer(); - } - - base.DisposeOnServer(dispose); - } - - /// - /// Handles the ReloadCompleted event of the Kernel control. - /// - /// The source of the event. - /// The instance containing the event data. - void Kernel_ReloadCompleted(object sender, EventArgs e) - { - InitializeDlnaServer(); - } - - /// - /// Initializes the dlna server. - /// - private void InitializeDlnaServer() - { - this.SetupUPnPServer(); - } - - /// - /// Disposes the dlna server. - /// - private void DisposeDlnaServer() - { - this.CleanupUPnPServer(); - } - - private void SetupUPnPServer() - { - - this._Upnp = new Platinum.UPnP(); - // Will need a config setting to set the friendly name of the upnp server - //this._PlatinumServer = new Platinum.MediaConnect("MB3 UPnP", "MB3UPnP", 1901); - if (this.Configuration.DlnaPortNumber.HasValue) - this._PlatinumServer = new Platinum.MediaConnect(this.Configuration.FriendlyDlnaName, "MB3UPnP", this.Configuration.DlnaPortNumber.Value); - else - this._PlatinumServer = new Platinum.MediaConnect(this.Configuration.FriendlyDlnaName); - - this._PlatinumServer.BrowseMetadata += new Platinum.MediaConnect.BrowseMetadataDelegate(server_BrowseMetadata); - this._PlatinumServer.BrowseDirectChildren += new Platinum.MediaConnect.BrowseDirectChildrenDelegate(server_BrowseDirectChildren); - this._PlatinumServer.ProcessFileRequest += new Platinum.MediaConnect.ProcessFileRequestDelegate(server_ProcessFileRequest); - this._PlatinumServer.SearchContainer += new Platinum.MediaConnect.SearchContainerDelegate(server_SearchContainer); - - this._Upnp.AddDeviceHost(this._PlatinumServer); - this._Upnp.Start(); - } - - private void CleanupUPnPServer() - { - if (this._Upnp != null && this._Upnp.Running) - this._Upnp.Stop(); - - if (this._PlatinumServer != null) - { - this._PlatinumServer.BrowseMetadata -= new Platinum.MediaConnect.BrowseMetadataDelegate(server_BrowseMetadata); - this._PlatinumServer.BrowseDirectChildren -= new Platinum.MediaConnect.BrowseDirectChildrenDelegate(server_BrowseDirectChildren); - this._PlatinumServer.ProcessFileRequest -= new Platinum.MediaConnect.ProcessFileRequestDelegate(server_ProcessFileRequest); - this._PlatinumServer.SearchContainer -= new Platinum.MediaConnect.SearchContainerDelegate(server_SearchContainer); - - this._PlatinumServer.Dispose(); - this._PlatinumServer = null; - } - - if (this._Upnp != null) - { - this._Upnp.Dispose(); - this._Upnp = null; - } - } - - private int server_BrowseMetadata(Platinum.Action action, string object_id, string filter, int starting_index, int requested_count, string sort_criteria, Platinum.HttpRequestContext context) - { - Logger.Info("BrowseMetadata Entered - Parameters: action:{0} object_id:{1} filter:{2} starting_index:{3} requested_count:{4} sort_criteria:{5} context:{6}", - action.ToLogString(), object_id, filter, starting_index, requested_count, sort_criteria, context.ToLogString()); - - //nothing much seems to call BrowseMetadata so far - //but perhaps that is because we aren't handing out the correct info for the client to call this... I don't know - - //PS3 calls it - //Parameters: action:Action Name:Browse Description:Platinum.ActionDescription Arguments: object_id:0 - //filter:@id,upnp:class,res,res@protocolInfo,res@av:authenticationUri,res@size,dc:title,upnp:albumArtURI,res@dlna:ifoFileURI,res@protection,res@bitrate,res@duration,res@sampleFrequency,res@bitsPerSample,res@nrAudioChannels,res@resolution,res@colorDepth,dc:date,av:dateTime,upnp:artist,upnp:album,upnp:genre,dc:contributer,upnp:storageFree,upnp:storageUsed,upnp:originalTrackNumber,dc:publisher,dc:language,dc:region,dc:description,upnp:toc,@childCount,upnp:albumArtURI@dlna:profileID,res@dlna:cleartextSize - //starting_index:0 requested_count:1 sort_criteria: context:HttpRequestContext LocalAddress:HttpRequestContext.SocketAddress IP:192.168.1.56 Port:1845 RemoteAddress:HttpRequestContext.SocketAddress IP:192.168.1.40 Port:49277 Request:http://192.168.1.56:1845/ContentDirectory/7c6b1b90-872b-2cda-3c5c-21a0e430ce5e/control.xml Signature:PS3 - - - - if (object_id == "0") - { - var root = new Platinum.MediaContainer(); - root.Title = "Root"; - root.ObjectID = "0"; - root.ParentID = "-1"; - root.Class = new Platinum.ObjectClass("object.container.storageFolder", ""); - - var didl = Platinum.Didl.header + root.ToDidl(filter) + Platinum.Didl.footer; - action.SetArgumentValue("Result", didl); - action.SetArgumentValue("NumberReturned", "1"); - action.SetArgumentValue("TotalMatches", "1"); - - // update ID may be wrong here, it should be the one of the container? - action.SetArgumentValue("UpdateId", "1"); - - return NEP_Success; - } - else - { - return NEP_Failure; - } - } - private int server_BrowseDirectChildren(Platinum.Action action, String object_id, String filter, Int32 starting_index, Int32 requested_count, String sort_criteria, Platinum.HttpRequestContext context) - { - Logger.Info("BrowseDirectChildren Entered - Parameters: action:{0} object_id:{1} filter:{2} starting_index:{3} requested_count:{4} sort_criteria:{5} context:{6}", - action.ToLogString(), object_id, filter, starting_index, requested_count, sort_criteria, context.ToLogString()); - - //WMP doesn't care how many results we return and what type they are - //Xbox360 Music App is unknown, it calls SearchContainer and stops, not sure what will happen once we return it results - //XBox360 Video App has fairly specific filter string and it need it - if you serve it music (mp3), it'll put music in the video list, so we have to do our own filtering - - //XBox360 Video App - // action: "Browse" - // object_id: "15" - // filter: "dc:title,res,res@protection,res@duration,res@bitrate,upnp:genre,upnp:actor,res@microsoft:codec" - // starting_index: 0 - // requested_count: 100 - // sort_criteria: "+upnp:class,+dc:title" - // - //the wierd thing about the filter is that there isn't much in it that says "only give me video"... except... - //if we look at the doc available here: http://msdn.microsoft.com/en-us/library/windows/hardware/gg487545.aspx which describes the way WMP does its DLNA serving (not clienting) - //doc is also a search cached google docs here: https://docs.google.com/viewer?a=v&q=cache:tnrdpTFCc84J:download.microsoft.com/download/0/0/b/00bba048-35e6-4e5b-a3dc-36da83cbb0d1/NetCompat_WMP11.docx+&hl=en&gl=au&pid=bl&srcid=ADGEESiBSKE1ZJeWmgYVOkKmRJuYaSL3_50KL1o6Ugp28JL1Ytq-2QbEeu6xFD8rbWcX35ZG4d7qPQnzqURGR5vig79S2Arj5umQNPnLeJo1k5_iWYbqPejeMHwwAv0ATmq2ynoZCBNL&sig=AHIEtbQ2qZJ8xMXLZYBWHHerezzXShKoVg - //it describes object 15 as beeing Root/Video/Folders which can contain object.storageFolder - //so perhaps thats what is saying 'only give me video' - //I'm just not sure if those folders listed with object IDs are all well known across clients or if these ones are WMP specific - //if they are device specific but also significant, then that might explain why Plex goes to the trouble of having configurable client device profiles for its DLNA server - - var didl = Platinum.Didl.header; - - IEnumerable children = null; - - // I need to ask someone on the MB team if there's a better way to do this, it seems like it - //could get pretty expensive to get ALL children all the time - //if it's our only option perhaps we should cache results locally or something similar - children = this.CurrentUser.RootFolder.GetRecursiveChildren(this.CurrentUser); - //children = children.Filter(Extensions.FilterType.Music | Extensions.FilterType.Video).Page(starting_index, requested_count); - - int itemCount = 0; - - if (children != null) - { - foreach (var child in children) - { - - using (var item = BaseItemToMediaItem(child, context)) - { - if (item != null) - { - string test; - test = item.ToDidl(filter); - didl += item.ToDidl(filter); - itemCount++; - } - } - } - - didl += Platinum.Didl.footer; - - action.SetArgumentValue("Result", didl); - action.SetArgumentValue("NumberReturned", itemCount.ToString()); - action.SetArgumentValue("TotalMatches", itemCount.ToString()); - - // update ID may be wrong here, it should be the one of the container? - action.SetArgumentValue("UpdateId", "1"); - - return NEP_Success; - } - return NEP_Failure; - } - private int server_ProcessFileRequest(Platinum.HttpRequestContext context, Platinum.HttpResponse response) - { - Logger.Info("ProcessFileRequest Entered - Parameters: context:{0} response:{1}", - context.ToLogString(), response); - - Uri uri = context.Request.URI; - var id = uri.AbsolutePath.TrimStart('/'); - Guid itemID; - if (Guid.TryParseExact(id, "D", out itemID)) - { - var item = this.CurrentUser.RootFolder.FindItemById(itemID, this.CurrentUser); - - if (item != null) - { - //this is how the Xbox 360 Video app asks for artwork, it tacks this query string onto its request - //?albumArt=true - if (uri.Query == "?albumArt=true") - { - if (!string.IsNullOrWhiteSpace(item.PrimaryImagePath)) - //let see if we can serve artwork like this to the Xbox 360 Video App - Platinum.MediaServer.SetResponseFilePath(context, response, Kernel.HttpServerUrlPrefix.Replace("+", context.LocalAddress.ip) + "/api/image?id=" + item.Id.ToString() + "&type=primary"); - //Platinum.MediaServer.SetResponseFilePath(context, response, item.PrimaryImagePath); - } - else - Platinum.MediaServer.SetResponseFilePath(context, response, item.Path); - //this does not work for WMP - //Platinum.MediaServer.SetResponseFilePath(context, response, Kernel.HttpServerUrlPrefix.Replace("+", context.LocalAddress.ip) + "/api/video.ts?id=" + item.Id.ToString()); - - return NEP_Success; - } - } - return NEP_Failure; - } - private int server_SearchContainer(Platinum.Action action, string object_id, string searchCriteria, string filter, int starting_index, int requested_count, string sort_criteria, Platinum.HttpRequestContext context) - { - Logger.Info("SearchContainer Entered - Parameters: action:{0} object_id:{1} searchCriteria:{7} filter:{2} starting_index:{3} requested_count:{4} sort_criteria:{5} context:{6}", - action.ToLogString(), object_id, filter, starting_index, requested_count, sort_criteria, context.ToLogString(), searchCriteria); - - //Doesn't call search at all: - // XBox360 Video App - - //Calls search but does not require it to be implemented: - // WMP, probably uses it just for its "images" section - - //Calls search Seems to require it: - // XBox360 Music App - - //WMP - // action: "Search" - // object_id: "0" - // searchCriteria: "upnp:class derivedfrom \"object.item.imageItem\" and @refID exists false" - // filter: "*" - // starting_index: 0 - // requested_count: 200 - // sort_criteria: "-dc:date" - - //XBox360 Music App - // action: "Search" - // object_id: "7" - // searchCriteria: "(upnp:class = \"object.container.album.musicAlbum\")" - // filter: "dc:title,upnp:artist" - // starting_index: 0 - // requested_count: 1000 - // sort_criteria: "+dc:title" - // - //XBox360 Music App seems to work souly using SearchContainer and ProcessFileRequest - //I think the current resource Uri's aren't going to work because it seems to require an extension like .mp3 to work, but this requires further testing - //When hitting the Album tab of the app it's searching criteria is object.container.album.musicAlbum - //this means it wants albums put into containers, I thought Platinum might do this for us, but it doesn't - - - var didl = Platinum.Didl.header; - - IEnumerable children = null; - - // I need to ask someone on the MB team if there's a better way to do this, it seems like it - //could get pretty expensive to get ALL children all the time - //if it's our only option perhaps we should cache results locally or something similar - children = this.CurrentUser.RootFolder.GetRecursiveChildren(this.CurrentUser); - //children = children.Filter(Extensions.FilterType.Music | Extensions.FilterType.Video).Page(starting_index, requested_count); - - //var test = GetFilterFromCriteria(searchCriteria); - children = children.Where(GetBaseItemMatchFromCriteria(searchCriteria)); - - - int itemCount = 0; - - if (children != null) - { - Platinum.MediaItem item = null; - foreach (var child in children) - { - item = BaseItemToMediaItem(child, context); - - if (item != null) - { - item.ParentID = string.Empty; - - didl += item.ToDidl(filter); - itemCount++; - } - } - - didl += Platinum.Didl.footer; - - action.SetArgumentValue("Result", didl); - action.SetArgumentValue("NumberReturned", itemCount.ToString()); - action.SetArgumentValue("TotalMatches", itemCount.ToString()); - - // update ID may be wrong here, it should be the one of the container? - action.SetArgumentValue("UpdateId", "1"); - - return NEP_Success; - } - return NEP_Failure; - } - - private Platinum.MediaItem BaseItemToMediaItem(BaseItem child, Platinum.HttpRequestContext context) - { - Platinum.MediaItem result = null; - Platinum.MediaResource resource = null; - - if (child.IsFolder) - { - //DLNA is a fairly flat system, there doesn't appear to be much room in the system for folders so far - //I haven't tested too many DLNA clients yet tho - result = null; - //item = new Platinum.MediaItem(); - //item.Class = new Platinum.ObjectClass("object.container.storageFolder", ""); - } - else if (child is Episode) - { - result = MediaItemHelper.GetMediaItem((Episode)child); - resource = MediaItemHelper.GetMediaResource((Episode)child); - } - else if (child is Video) - { - result = MediaItemHelper.GetMediaItem((Video)child); - resource = MediaItemHelper.GetMediaResource((Video)child); - } - else if (child is Audio) - { - result = MediaItemHelper.GetMediaItem((Audio)child); - resource = MediaItemHelper.GetMediaResource((Audio)child); - } - - if (result != null) - { - //have a go at finding the mime type - var mimeType = string.Empty; - if (child.Path != null && Path.HasExtension(child.Path)) - mimeType = MimeTypes.GetMimeType(child.Path); - - resource.ProtoInfo = Platinum.ProtocolInfo.GetProtocolInfoFromMimeType(mimeType, true, context); - - // get list of ips and make sure the ip the request came from is used for the first resource returned - // this ensures that clients which look only at the first resource will be able to reach the item - IEnumerable ips = GetUPnPIPAddresses(context); //.Distinct(); - - // iterate through all ips and create a resource for each - // I think we need extensions (".mp3" type extensions) on these for Xbox360 Video and Music apps to work - - - //resource.URI = new Uri(Kernel.HttpServerUrlPrefix + "/api/video.ts?id=" + child.Id.ToString("D")).ToString(); - //result.AddResource(resource); - - foreach (String ip in ips) - { - //doesn't work for WMP - //resource.URI = new Uri(Kernel.HttpServerUrlPrefix.Replace("+", ip) + "/api/video.ts?id=" + child.Id.ToString()).ToString(); - resource.URI = new Uri("http://" + ip + ":" + context.LocalAddress.port + "/" + child.Id.ToString("D")).ToString(); - - result.AddResource(resource); - } - MediaItemHelper.AddAlbumArtInfoToMediaItem(result, child, Kernel.HttpServerUrlPrefix, ips); - } - - return result; - } - - private void AddResourcesToMediaItem(Platinum.MediaItem item, BaseItem child, Platinum.HttpRequestContext context) - { - Platinum.MediaResource resource = null; - - if (child is Video) - { - var videoChild = (Video)child; - resource = new Platinum.MediaResource(); - - if (videoChild.DefaultVideoStream != null) - { - //Bitrate is Bytes per second - if (videoChild.DefaultVideoStream.BitRate.HasValue) - resource.Bitrate = (uint)videoChild.DefaultVideoStream.BitRate; - - //not sure if we know Colour Depth - //resource.ColorDepth - if (videoChild.DefaultVideoStream.Channels.HasValue) - resource.NbAudioChannels = (uint)videoChild.DefaultVideoStream.Channels.Value; - - //resource.Protection - //resource.ProtoInfo - - //we must know resolution, I'm just not sure how to get it - //resource.Resolution - - //I'm not sure what this actually means, is it Sample Rate - if (videoChild.DefaultVideoStream.SampleRate.HasValue) - resource.SampleFrequency = (uint)videoChild.DefaultVideoStream.SampleRate.Value; - //file size? - //resource.Size - - } - } - else if (child is Audio) - { - - } - - // get list of ips and make sure the ip the request came from is used for the first resource returned - // this ensures that clients which look only at the first resource will be able to reach the item - List ips = GetUPnPIPAddresses(context); - - // iterate through all ips and create a resource for each - // I think we need extensions (".mp3" type extensions) on these for Xbox360 Video and Music apps to work - - foreach (String ip in ips) - { - resource.URI = new Uri("http://" + ip + ":" + context.LocalAddress.port + "/" + child.Id.ToString("D")).ToString(); - item.AddResource(resource); - } - } - - /// - /// Gets a list of valid IP Addresses that the UPnP server is using - /// - /// - /// - private List GetUPnPIPAddresses(Platinum.HttpRequestContext context) - { - // get list of ips and make sure the ip the request came from is used for the first resource returned - // this ensures that clients which look only at the first resource will be able to reach the item - List result = Platinum.UPnP.GetIpAddresses(true); //if this call is expensive we could cache the results - String localIP = context.LocalAddress.ip; - if (localIP != "0.0.0.0") - { - result.Remove(localIP); - result.Insert(0, localIP); - } - return result; - } - - /// - /// Gets the MB User with a user name that matches the user name configured in the plugin config - /// - /// MediaBrowser.Controller.Entities.User - private User CurrentUser - { - get - { - if (this._CurrentUser == null) - { - //this looks like a lot of processing but it really isn't - //its mostly gaurding against no users or no matching user existing - var serverKernel = Controller.Kernel.Instance; - if (serverKernel.Users.Any()) - { - if (string.IsNullOrWhiteSpace(this.Configuration.UserName)) - this._CurrentUser = serverKernel.Users.First(); - else - { - this._CurrentUser = serverKernel.Users.FirstOrDefault(i => string.Equals(i.Name, this.Configuration.UserName, StringComparison.OrdinalIgnoreCase)); - if (this._CurrentUser == null) - { - //log and return first user - this._CurrentUser = serverKernel.Users.First(); - Logger.Error("Configured user: \"{0}\" not found. Using first user found: \"{1}\" instead", this.Configuration.UserName, this._CurrentUser.Name); - } - } - } - else - { - Logger.Fatal("No users in the system"); - this._CurrentUser = null; - } - } - return this._CurrentUser; - } - } - - #region "A Search Idea" - //this is just an idea of how we might do some search - //it's a bit lackluster in places and might be overkill in others - //all in all it might not be a good idea, but I thought I'd see how it felt - - private Func GetBaseItemMatchFromCriteria(string searchCriteria) - { - //WMP Search when clicking Music: - //"upnp:class derivedfrom \"object.item.audioItem\" and @refID exists false" - //WMP Search when clicking Videos: - //"upnp:class derivedfrom \"object.item.videoItem\" and @refID exists false" - //WMP Search when clicking Pictures: - //"upnp:class derivedfrom \"object.item.imageItem\" and @refID exists false" - //WMP Search when clicking Recorded TV: - //"upnp:class derivedfrom \"object.item.videoItem\" and @refID exists false" - - //we really need a syntax tree parser here - //but the requests never seem to get more complex than "'Condition One' And 'Condition Two'" - //something like Rosylin would be fun but it'd be serious overkill - //the syntax seems to be very clear and there are only a handful of valid constructs - //so this very basic parsing will provide some support for now - - Queue criteriaQueue = new Queue(searchCriteria.Split(' ')); - - Func result = null; - var currentMainOperatorIsAnd = false; - - //loop through in order and process - do not parallelise, order is important - while (criteriaQueue.Any()) - { - Func currentFilter = null; - - var metadataElement = criteriaQueue.Dequeue(); - var criteriaOperator = criteriaQueue.Dequeue(); - var value = criteriaQueue.Dequeue(); - if (value.StartsWith("\"") || value.StartsWith("\\\"")) - while (!value.EndsWith("\"")) - { - value += criteriaQueue.Dequeue(); - } - value = value.Trim(); - - - if (string.Equals(metadataElement, "upnp:class", StringComparison.OrdinalIgnoreCase)) - currentFilter = GetUpnpClassFilter(criteriaOperator, value); - else if (string.Equals(metadataElement, "@refID", StringComparison.OrdinalIgnoreCase)) - { - //not entirely sure what refID is for - //Platinum has ReferenceID which I assume is the same thing, but we're not using it yet - - } - else - { - //fail?? - } - - - if (currentFilter != null) - { - if (result == null) - result = currentFilter; - else - if (currentMainOperatorIsAnd) - result = (i) => result(i) && currentFilter(i); - else - result = (i) => result(i) || currentFilter(i); - } - if (criteriaQueue.Any()) - { - var op = criteriaQueue.Dequeue(); - if (string.Equals(op, "and", StringComparison.OrdinalIgnoreCase)) - currentMainOperatorIsAnd = true; - else - currentMainOperatorIsAnd = false; - } - } - return result; - } - - private Func GetUpnpClassFilter(string criteriaOperator, string value) - { - //"upnp:class derivedfrom \"object.item.videoItem\" " - //"(upnp:class = \"object.container.album.musicAlbum\")" - - //only two options are valid for criteria - // =, derivedfrom - - //there are only a few values we care about - //object.item.videoItem - //object.item.audioItem - //object.container.storageFolder - - if (string.Equals(criteriaOperator, "=", StringComparison.OrdinalIgnoreCase)) - { - if (value.Contains("object.item.videoItem")) - return (i) => (i is Video); - else if (value.Contains("object.item.audioItem")) - return (i) => (i is Audio); - else if (value.Contains("object.container.storageFolder")) - return (i) => (i is Folder); - else - //something has gone wrong, don't filter anything - return (i) => true; - } - else if (string.Equals(criteriaOperator, "derivedfrom", StringComparison.OrdinalIgnoreCase)) - { - if (value.Contains("object.item.videoItem")) - return (i) => (i is Video); - else if (value.Contains("object.item.audioItem")) - return (i) => (i is Audio); - else if (value.Contains("object.container.storageFolder")) - return (i) => (i is Folder); - else - //something has gone wrong, don't filter anything - return (i) => true; - } - else - { - //something has gone wrong, don't filter anything - return (i) => true; - } - } - #endregion - - public override void UpdateConfiguration(Model.Plugins.BasePluginConfiguration configuration) - { - base.UpdateConfiguration(configuration); - var config = (PluginConfiguration)configuration; - - this.CleanupUPnPServer(); - this._CurrentUser = null; - this.SetupUPnPServer(); - } - } - - internal static class MediaItemHelper - { - internal static Platinum.MediaResource GetMediaResource(Video item) - { - var result = GetMediaResource((BaseItem)item); - - if (item.DefaultVideoStream != null) - { - //Bitrate is Bytes per second - if (item.DefaultVideoStream.BitRate.HasValue) - result.Bitrate = (uint)item.DefaultVideoStream.BitRate; - - //not sure if we know Colour Depth - //resource.ColorDepth - if (item.DefaultVideoStream.Channels.HasValue) - result.NbAudioChannels = (uint)item.DefaultVideoStream.Channels.Value; - - //resource.Protection - //resource.ProtoInfo - - //we must know resolution, I'm just not sure how to get it - //resource.Resolution - - //I'm not sure what this actually means, is it Sample Rate - if (item.DefaultVideoStream.SampleRate.HasValue) - result.SampleFrequency = (uint)item.DefaultVideoStream.SampleRate.Value; - //file size? - //resource.Size - - ////to do subtitles for clients that can deal with external subtitles (like srt) - ////we will have to do something like this - //IEnumerable ips = GetUPnPIPAddresses(context); - //foreach (var st in videoChild.MediaStreams) - //{ - // if (st.Type == MediaStreamType.Subtitle) - // { - // Platinum.MediaResource subtitleResource = new Platinum.MediaResource(); - // subtitleResource.ProtoInfo = Platinum.ProtocolInfo.GetProtocolInfo(st.Path, with_dlna_extension: false); - // foreach (String ip in ips) - // { - // //we'll need to figure out which of these options works for whick players - // //either serve them ourselves - // resource.URI = new Uri("http://" + ip + ":" + context.LocalAddress.port + "/" + child.Id.ToString("D")).ToString(); - // //or get the web api to serve them directly - // resource.URI = new Uri(Kernel.HttpServerUrlPrefix.Replace("+", ip) + "/api/video?id=" + child.Id.ToString() + "&type=Subtitle").ToString(); - // result.AddResource(resource); - // } - // } - //} - } - return result; - } - internal static Platinum.MediaItem GetMediaItem(Video item) - { - var result = GetMediaItem((BaseItem)item); - result.Title = GetTitle(item); - return result; - } - - internal static Platinum.MediaResource GetMediaResource(Episode item) - { - //there's nothing specific about an episode that requires extra Resources - return GetMediaResource((Video)item); - } - internal static Platinum.MediaItem GetMediaItem(Episode item) - { - var result = GetMediaItem((Video)item); - - if (item.IndexNumber.HasValue) - result.Recorded.EpisodeNumber = (uint)item.IndexNumber.Value; - if (item.Series != null && item.Series.Name != null) - result.Recorded.SeriesTitle = item.Series.Name; - result.Recorded.ProgramTitle = item.Name == null ? string.Empty : item.Name; - - return result; - } - - internal static Platinum.MediaResource GetMediaResource(Audio item) - { - //there's nothing specific about an audio item that requires extra Resources - return GetMediaResource((BaseItem)item); - } - internal static Platinum.MediaItem GetMediaItem(Audio item) - { - var result = GetMediaItem((BaseItem)item); - result.Title = GetTitle(item); - result.People.AddArtist(new Platinum.PersonRole(item.Artist)); - result.People.Contributor = item.AlbumArtist; - result.Affiliation.Album = item.Album; - return result; - } - - internal static Platinum.MediaResource GetMediaResource(BaseItem item) - { - var result = new Platinum.MediaResource(); - //duration is in seconds - if (item.RunTimeTicks.HasValue) - result.Duration = (uint)TimeSpan.FromTicks(item.RunTimeTicks.Value).TotalSeconds; - - return result; - } - internal static Platinum.MediaItem GetMediaItem(BaseItem item) - { - var result = new Platinum.MediaItem(); - - result.ObjectID = item.Id.ToString(); - - //if (child.Parent != null) - // result.ParentID = child.Parent.Id.ToString(); - result.Class = item.GetPlatinumClassObject(); - - result.Description.Date = item.PremiereDate.HasValue ? item.PremiereDate.Value.ToString() : string.Empty; - result.Description.Language = item.Language == null ? string.Empty : item.Language; - result.Description.DescriptionText = "this is DescriptionText"; - result.Description.LongDescriptionText = item.Overview == null ? string.Empty : item.Overview; - result.Description.Rating = item.CommunityRating.ToString(); - - if (item.Genres != null) - { - foreach (var genre in item.Genres) - { - result.Affiliation.AddGenre(genre); - } - } - if (item.People != null) - { - foreach (var person in item.People) - { - if (string.Equals(person.Type, PersonType.Actor, StringComparison.OrdinalIgnoreCase)) - result.People.AddActor(new Platinum.PersonRole(person.Name, person.Role == null ? string.Empty : person.Role)); - else if (string.Equals(person.Type, PersonType.MusicArtist, StringComparison.OrdinalIgnoreCase)) - { - result.People.AddArtist(new Platinum.PersonRole(person.Name, "MusicArtist")); - result.People.AddArtist(new Platinum.PersonRole(person.Name, "Performer")); - } - else if (string.Equals(person.Type, PersonType.Composer, StringComparison.OrdinalIgnoreCase)) - result.People.AddAuthors(new Platinum.PersonRole(person.Name, "Composer")); - else if (string.Equals(person.Type, PersonType.Writer, StringComparison.OrdinalIgnoreCase)) - result.People.AddAuthors(new Platinum.PersonRole(person.Name, "Writer")); - else if (string.Equals(person.Type, PersonType.Director, StringComparison.OrdinalIgnoreCase)) - { - result.People.AddAuthors(new Platinum.PersonRole(person.Name, "Director")); - result.People.Director = result.People.Director + " " + person.Name; - } - else - result.People.AddArtist(new Platinum.PersonRole(person.Name, person.Type == null ? string.Empty : person.Type)); - } - } - return result; - } - - internal static void AddAlbumArtInfoToMediaItem(Platinum.MediaItem item, BaseItem child, string httpServerUrlPrefix, IEnumerable ips) - { - foreach (var ip in ips) - { - AddAlbumArtInfoToMediaItem(item, child, httpServerUrlPrefix, ip); - } - } - private static void AddAlbumArtInfoToMediaItem(Platinum.MediaItem item, BaseItem child, string httpServerUrlPrefix, string ip) - { - //making the artwork a direct hit to the MediaBrowser server instead of via the DLNA plugin works for WMP - item.Extra.AddAlbumArtInfo(new Platinum.AlbumArtInfo(httpServerUrlPrefix.Replace("+", ip) + "/api/image?id=" + child.Id.ToString() + "&type=primary")); - } - - - /// - /// Gets the title. - /// - /// The video. - /// System.String. - private static string GetTitle(Video video) - { - //we have to be extremely careful with all string handling - //if we set a null reference to a Platinum string it will not marshall to native correctly and things got very bad very quickly - var title = video.Name == null ? string.Empty : video.Name; - - var episode = video as Episode; - - if (episode != null) - { - if (episode.Season != null) - { - title = string.Format("{0}-{1}", episode.Season.Name, title); - } - if (episode.Series != null) - { - title = string.Format("{0}-{1}", episode.Series.Name, title); - } - } - - return title; - } - - /// - /// Gets the title. - /// - /// The audio. - /// System.String. - private static string GetTitle(Audio audio) - { - return audio.Name == null ? string.Empty : audio.Name; - } - - } - - internal static class Extensions - { - [Flags()] - internal enum FilterType - { - Folder = 1, - Music = 2, - Video = 4 - } - internal static IEnumerable Filter(this IEnumerable en, FilterType filter) - { - return en.Where(i => ( - (((filter & FilterType.Folder) == FilterType.Folder) && (i is Folder)) || - (((filter & FilterType.Music) == FilterType.Music) && (i is Audio)) || - (((filter & FilterType.Video) == FilterType.Video) && (i is Video))) - ); - } - - internal static IEnumerable Page(this IEnumerable en, int starting_index, int requested_count) - { - return en.Skip(starting_index).Take(requested_count); - } - - - internal static Platinum.ObjectClass GetPlatinumClassObject(this BaseItem item) - { - if (item is Video) - return new Platinum.ObjectClass("object.item.videoItem", ""); - else if (item is Audio) - return new Platinum.ObjectClass("object.item.audioItem.musicTrack", ""); - else if (item is Folder) - return new Platinum.ObjectClass("object.container.storageFolder", ""); - else - return null; - } - internal static Platinum.ObjectClass GetPlatinumClassObject(this Folder item) - { - return new Platinum.ObjectClass("object.container.storageFolder", ""); - } - internal static Platinum.ObjectClass GetPlatinumClassObject(this Audio item) - { - return new Platinum.ObjectClass("object.item.audioItem.musicTrack", ""); - } - internal static Platinum.ObjectClass GetPlatinumClassObject(this Video item) - { - return new Platinum.ObjectClass("object.item.videoItem", ""); - } - } - internal static class LoggingExtensions - { - //provide some json-esque string that can be used for Verbose logging purposed - internal static string ToLogString(this Platinum.Action item) - { - return string.Format(" {{ Name:\"{0}\", Description:\"{1}\", Arguments:{2} }} ", - item.Name, item.Description.ToLogString(), item.Arguments.ToLogString()); - - } - internal static string ToLogString(this IEnumerable items) - { - var result = "["; - foreach (var arg in items) - { - result += (" " + arg.ToLogString()); - } - result += " ]"; - return result; - } - internal static string ToLogString(this Platinum.ActionArgumentDescription item) - { - return string.Format(" {{ Name:\"{0}\", Direction:{1}, HasReturnValue:{2}, RelatedStateVariable:{3} }} ", - item.Name, item.Direction, item.HasReturnValue, item.RelatedStateVariable.ToLogString()); - - } - internal static string ToLogString(this Platinum.StateVariable item) - { - return string.Format(" {{ Name:\"{0}\", DataType:{1}, DataTypeString:\"{2}\", Value:{3}, ValueString:\"{4}\" }} ", - item.Name, item.DataType, item.DataTypeString, item.Value, item.ValueString); - } - internal static string ToLogString(this Platinum.ActionDescription item) - { - return string.Format(" {{ Name:\"{0}\", Arguments:{1} }} ", - item.Name, item.Arguments.ToLogString()); - } - internal static string ToLogString(this Platinum.HttpRequestContext item) - { - return string.Format(" {{ LocalAddress:{0}, RemoteAddress:{1}, Request:\"{2}\", Signature:{3} }}", - item.LocalAddress.ToLogString(), item.RemoteAddress.ToLogString(), item.Request.URI.ToString(), item.Signature); - } - internal static string ToLogString(this Platinum.HttpRequestContext.SocketAddress item) - { - return string.Format("{{ IP:{0}, Port:{1} }}", - item.ip, item.port); - } - } -} diff --git a/MediaBrowser.Plugins.Dlna/Properties/AssemblyInfo.cs b/MediaBrowser.Plugins.Dlna/Properties/AssemblyInfo.cs deleted file mode 100644 index eab7fd5f1f..0000000000 --- a/MediaBrowser.Plugins.Dlna/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("MediaBrowser.Plugins.Dlna")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("MediaBrowser.Plugins.Dlna")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("f1855371-7cf5-40d2-bcd8-b780d7f006af")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.*")] diff --git a/MediaBrowser.Plugins.MpcHc/MediaBrowser.Plugins.MpcHc.csproj b/MediaBrowser.Plugins.MpcHc/MediaBrowser.Plugins.MpcHc.csproj deleted file mode 100644 index f95b73b656..0000000000 --- a/MediaBrowser.Plugins.MpcHc/MediaBrowser.Plugins.MpcHc.csproj +++ /dev/null @@ -1,109 +0,0 @@ - - - - - Debug - AnyCPU - {2E94BC08-A7A2-42DD-9893-EAA3DACD1CF9} - library - Properties - MediaBrowser.Plugins.MpcHc - MediaBrowser.Plugins.MpcHc - v4.5 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - ..\ - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - Always - - - - - - - - - - - - - 4.0 - - - - - - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - {9142eefa-7570-41e1-bfcc-468bb571af2f} - MediaBrowser.Common - - - {7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b} - MediaBrowser.Model - - - {b5ece1fb-618e-420b-9a99-8e972d76920a} - MediaBrowser.UI - - - - - xcopy "$(TargetPath)" "$(SolutionDir)\ProgramData-Server\Plugins\" /y - - - - \ No newline at end of file diff --git a/MediaBrowser.Plugins.MpcHc/MpcHcMediaPlayer.cs b/MediaBrowser.Plugins.MpcHc/MpcHcMediaPlayer.cs deleted file mode 100644 index e2d5398e4c..0000000000 --- a/MediaBrowser.Plugins.MpcHc/MpcHcMediaPlayer.cs +++ /dev/null @@ -1,580 +0,0 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Logging; -using MediaBrowser.UI.Configuration; -using MediaBrowser.UI.Controller; -using MediaBrowser.UI.Playback; -using MediaBrowser.UI.Playback.ExternalPlayer; -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.IO; -using System.Linq; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Plugins.MpcHc -{ - /// - /// Class GenericExternalPlayer - /// - [Export(typeof(BaseMediaPlayer))] - public class MpcHcMediaPlayer : BaseExternalPlayer - { - /// - /// The state sync lock - /// - private object stateSyncLock = new object(); - - /// - /// The MPC HTTP interface resource pool - /// - private SemaphoreSlim MpcHttpInterfaceResourcePool = new SemaphoreSlim(1, 1); - - [ImportingConstructor] - public MpcHcMediaPlayer([Import("logger")] ILogger logger) - : base(logger) - { - } - - /// - /// Gets or sets the HTTP interface cancellation token. - /// - /// The HTTP interface cancellation token. - private CancellationTokenSource HttpInterfaceCancellationTokenSource { get; set; } - - /// - /// Gets or sets a value indicating whether this instance has started playing. - /// - /// true if this instance has started playing; otherwise, false. - private bool HasStartedPlaying { get; set; } - - /// - /// Gets or sets the status update timer. - /// - /// The status update timer. - private Timer StatusUpdateTimer { get; set; } - - /// - /// Gets a value indicating whether this instance can monitor progress. - /// - /// true if this instance can monitor progress; otherwise, false. - protected override bool CanMonitorProgress - { - get - { - return true; - } - } - - /// - /// The _current position ticks - /// - private long? _currentPositionTicks; - - /// - /// Gets the current position ticks. - /// - /// The current position ticks. - public override long? CurrentPositionTicks - { - get - { - return _currentPositionTicks; - } - } - - /// - /// The _current playlist index - /// - private int _currentPlaylistIndex; - - /// - /// Gets the index of the current playlist. - /// - /// The index of the current playlist. - public override int CurrentPlaylistIndex - { - get - { - return _currentPlaylistIndex; - } - } - - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get { return "MpcHc"; } - } - - /// - /// Gets a value indicating whether this instance can close automatically. - /// - /// true if this instance can close automatically; otherwise, false. - protected override bool CanCloseAutomatically - { - get - { - return true; - } - } - - /// - /// Determines whether this instance can play the specified item. - /// - /// The item. - /// true if this instance can play the specified item; otherwise, false. - public override bool CanPlay(BaseItemDto item) - { - return item.IsVideo || item.IsAudio; - } - - /// - /// Gets the command arguments. - /// - /// The items. - /// The options. - /// The player configuration. - /// System.String. - protected override string GetCommandArguments(List items, PlayOptions options, PlayerConfiguration playerConfiguration) - { - var formatString = "{0} /play /fullscreen /close"; - - var firstItem = items[0]; - - var startTicks = Math.Max(options.StartPositionTicks, 0); - - if (startTicks > 0 && firstItem.IsVideo && firstItem.VideoType.HasValue && firstItem.VideoType.Value == VideoType.Dvd) - { - formatString += " /dvdpos 1#" + TimeSpan.FromTicks(startTicks).ToString("hh\\:mm\\:ss"); - } - else - { - formatString += " /start " + TimeSpan.FromTicks(startTicks).TotalMilliseconds; - } - - - return GetCommandArguments(items, formatString); - } - - /// - /// Gets the path for command line. - /// - /// The item. - /// System.String. - protected override string GetPathForCommandLine(BaseItemDto item) - { - var path = base.GetPathForCommandLine(item); - - if (item.IsVideo && item.VideoType.HasValue) - { - if (item.VideoType.Value == VideoType.Dvd) - { - // Point directly to the video_ts path - // Otherwise mpc will play any other media files that might exist in the dvd top folder (e.g. video backdrops). - var videoTsPath = Path.Combine(path, "video_ts"); - - if (Directory.Exists(videoTsPath)) - { - path = videoTsPath; - } - } - if (item.VideoType.Value == VideoType.BluRay) - { - // Point directly to the bdmv path - var bdmvPath = Path.Combine(path, "bdmv"); - - if (Directory.Exists(bdmvPath)) - { - path = bdmvPath; - } - } - } - - return FormatPath(path); - } - - /// - /// Formats the path. - /// - /// The path. - /// System.String. - private string FormatPath(string path) - { - if (path.EndsWith(":\\", StringComparison.OrdinalIgnoreCase)) - { - path = path.TrimEnd('\\'); - } - - return path; - } - - /// - /// Called when [external player launched]. - /// - protected override void OnExternalPlayerLaunched() - { - base.OnExternalPlayerLaunched(); - - ReloadStatusUpdateTimer(); - } - - /// - /// Reloads the status update timer. - /// - private void ReloadStatusUpdateTimer() - { - DisposeStatusTimer(); - - HttpInterfaceCancellationTokenSource = new CancellationTokenSource(); - - StatusUpdateTimer = new Timer(OnStatusUpdateTimerStopped, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1)); - } - - /// - /// Called when [status update timer stopped]. - /// - /// The state. - private async void OnStatusUpdateTimerStopped(object state) - { - try - { - var token = HttpInterfaceCancellationTokenSource.Token; - - using (var stream = await UIKernel.Instance.HttpManager.Get(StatusUrl, MpcHttpInterfaceResourcePool, token).ConfigureAwait(false)) - { - token.ThrowIfCancellationRequested(); - - using (var reader = new StreamReader(stream)) - { - token.ThrowIfCancellationRequested(); - - var result = await reader.ReadToEndAsync().ConfigureAwait(false); - - token.ThrowIfCancellationRequested(); - - ProcessStatusResult(result); - } - } - } - catch (HttpRequestException ex) - { - Logger.ErrorException("Error connecting to MpcHc status interface", ex); - } - catch (OperationCanceledException) - { - // Manually cancelled by us - Logger.Info("Status request cancelled"); - } - } - - /// - /// Processes the status result. - /// - /// The result. - private async void ProcessStatusResult(string result) - { - // Sample result - // OnStatus('test.avi', 'Playing', 5292, '00:00:05', 1203090, '00:20:03', 0, 100, 'C:\test.avi') - // 5292 = position in ms - // 00:00:05 = position - // 1203090 = duration in ms - // 00:20:03 = duration - - var quoteChar = result.IndexOf(", \"", StringComparison.OrdinalIgnoreCase) == -1 ? '\'' : '\"'; - - // Strip off the leading "OnStatus(" and the trailing ")" - result = result.Substring(result.IndexOf(quoteChar)); - result = result.Substring(0, result.LastIndexOf(quoteChar)); - - // Strip off the filename at the beginning - result = result.Substring(result.IndexOf(string.Format("{0}, {0}", quoteChar), StringComparison.OrdinalIgnoreCase) + 3); - - // Find the last index of ", '" so that we can extract and then strip off the file path at the end. - var lastIndexOfSeparator = result.LastIndexOf(", " + quoteChar, StringComparison.OrdinalIgnoreCase); - - // Get the current playing file path - var currentPlayingFile = result.Substring(lastIndexOfSeparator + 2).Trim(quoteChar); - - // Strip off the current playing file path - result = result.Substring(0, lastIndexOfSeparator); - - var values = result.Split(',').Select(v => v.Trim().Trim(quoteChar)).ToList(); - - var currentPositionTicks = TimeSpan.FromMilliseconds(double.Parse(values[1])).Ticks; - //var currentDurationTicks = TimeSpan.FromMilliseconds(double.Parse(values[3])).Ticks; - - var playstate = values[0]; - - var playlistIndex = GetPlaylistIndex(currentPlayingFile); - - if (playstate.Equals("stopped", StringComparison.OrdinalIgnoreCase)) - { - if (HasStartedPlaying) - { - await ClosePlayer().ConfigureAwait(false); - } - } - else - { - lock (stateSyncLock) - { - if (_currentPlaylistIndex != playlistIndex) - { - OnMediaChanged(_currentPlaylistIndex, _currentPositionTicks, playlistIndex); - } - - _currentPositionTicks = currentPositionTicks; - _currentPlaylistIndex = playlistIndex; - } - - if (playstate.Equals("playing", StringComparison.OrdinalIgnoreCase)) - { - HasStartedPlaying = true; - PlayState = PlayState.Playing; - } - else if (playstate.Equals("paused", StringComparison.OrdinalIgnoreCase)) - { - HasStartedPlaying = true; - PlayState = PlayState.Paused; - } - } - } - - /// - /// Gets the index of the playlist. - /// - /// The now playing path. - /// System.Int32. - private int GetPlaylistIndex(string nowPlayingPath) - { - for (var i = 0; i < Playlist.Count; i++) - { - var item = Playlist[i]; - - var pathArg = GetPathForCommandLine(item); - - if (pathArg.Equals(nowPlayingPath, StringComparison.OrdinalIgnoreCase)) - { - return i; - } - - if (item.VideoType.HasValue) - { - if (item.VideoType.Value == VideoType.BluRay || item.VideoType.Value == VideoType.Dvd || item.VideoType.Value == VideoType.HdDvd) - { - if (nowPlayingPath.StartsWith(pathArg, StringComparison.OrdinalIgnoreCase)) - { - return i; - } - } - } - } - return -1; - } - - /// - /// Called when [player stopped internal]. - /// - protected override void OnPlayerStoppedInternal() - { - HttpInterfaceCancellationTokenSource.Cancel(); - - DisposeStatusTimer(); - _currentPositionTicks = null; - _currentPlaylistIndex = 0; - HasStartedPlaying = false; - HttpInterfaceCancellationTokenSource = null; - - base.OnPlayerStoppedInternal(); - } - - /// - /// Disposes the status timer. - /// - private void DisposeStatusTimer() - { - if (StatusUpdateTimer != null) - { - StatusUpdateTimer.Dispose(); - } - } - - /// - /// Releases unmanaged and - optionally - managed resources. - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected override void Dispose(bool dispose) - { - if (dispose) - { - DisposeStatusTimer(); - - MpcHttpInterfaceResourcePool.Dispose(); - } - - base.Dispose(dispose); - } - - /// - /// Seeks the internal. - /// - /// The position ticks. - /// Task. - protected override Task SeekInternal(long positionTicks) - { - var additionalParams = new Dictionary(); - - var time = TimeSpan.FromTicks(positionTicks); - - var timeString = time.Hours + ":" + time.Minutes + ":" + time.Seconds; - - additionalParams.Add("position", timeString); - - return SendCommandToPlayer("-1", additionalParams); - } - - /// - /// Pauses the internal. - /// - /// Task. - protected override Task PauseInternal() - { - return SendCommandToPlayer("888", new Dictionary()); - } - - /// - /// Uns the pause internal. - /// - /// Task. - protected override Task UnPauseInternal() - { - return SendCommandToPlayer("887", new Dictionary()); - } - - /// - /// Stops the internal. - /// - /// Task. - protected override Task StopInternal() - { - return SendCommandToPlayer("890", new Dictionary()); - } - - /// - /// Closes the player. - /// - /// Task. - protected Task ClosePlayer() - { - return SendCommandToPlayer("816", new Dictionary()); - } - - /// - /// Sends a command to MPC using the HTTP interface - /// http://www.autohotkey.net/~specter333/MPC/HTTP%20Commands.txt - /// - /// The command number. - /// The additional params. - /// Task. - /// commandNumber - private async Task SendCommandToPlayer(string commandNumber, Dictionary additionalParams) - { - if (string.IsNullOrEmpty(commandNumber)) - { - throw new ArgumentNullException("commandNumber"); - } - - if (additionalParams == null) - { - throw new ArgumentNullException("additionalParams"); - } - - var url = CommandUrl + "?wm_command=" + commandNumber; - - url = additionalParams.Keys.Aggregate(url, (current, name) => current + ("&" + name + "=" + additionalParams[name])); - - Logger.Info("Sending command to MPC: " + url); - - try - { - using (var stream = await UIKernel.Instance.HttpManager.Get(url, MpcHttpInterfaceResourcePool, HttpInterfaceCancellationTokenSource.Token).ConfigureAwait(false)) - { - } - } - catch (HttpRequestException ex) - { - Logger.ErrorException("Error connecting to MpcHc command interface", ex); - } - catch (OperationCanceledException) - { - // Manually cancelled by us - Logger.Info("Command request cancelled"); - } - } - - /// - /// Gets a value indicating whether this instance can pause. - /// - /// true if this instance can pause; otherwise, false. - public override bool CanPause - { - get - { - return true; - } - } - - /// - /// Gets the server name that the http interface will be running on - /// - /// The HTTP server. - private string HttpServer - { - get - { - return "localhost"; - } - } - - /// - /// Gets the port that the web interface will be running on - /// - /// The HTTP port. - private string HttpPort - { - get - { - return "13579"; - } - } - - /// - /// Gets the url of that will be called to for status - /// - /// The status URL. - private string StatusUrl - { - get - { - return "http://" + HttpServer + ":" + HttpPort + "/status.html"; - } - } - - /// - /// Gets the url of that will be called to send commands - /// - /// The command URL. - private string CommandUrl - { - get - { - return "http://" + HttpServer + ":" + HttpPort + "/command.html"; - } - } - } -} diff --git a/MediaBrowser.Plugins.MpcHc/Plugin.cs b/MediaBrowser.Plugins.MpcHc/Plugin.cs deleted file mode 100644 index ca8acc94e9..0000000000 --- a/MediaBrowser.Plugins.MpcHc/Plugin.cs +++ /dev/null @@ -1,32 +0,0 @@ -using MediaBrowser.Common.Plugins; -using MediaBrowser.Model.Plugins; -using System; -using System.ComponentModel.Composition; - -namespace MediaBrowser.Plugins.MpcHc -{ - /// - /// Class Plugin - /// - [Export(typeof(IPlugin))] - public class Plugin : BaseUiPlugin - { - /// - /// Gets the name of the plugin - /// - /// The name. - public override string Name - { - get { return "MPC-HC Integration"; } - } - - /// - /// Gets the minimum required UI version. - /// - /// The minimum required UI version. - public override Version MinimumRequiredUIVersion - { - get { return new Version("2.9.4782.23738"); } - } - } -} diff --git a/MediaBrowser.Plugins.MpcHc/Properties/AssemblyInfo.cs b/MediaBrowser.Plugins.MpcHc/Properties/AssemblyInfo.cs deleted file mode 100644 index 10442b1363..0000000000 --- a/MediaBrowser.Plugins.MpcHc/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("MediaBrowser.Plugins.MpcHc")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("MediaBrowser.Plugins.MpcHc")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly:ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - -[assembly: Guid("F6D17656-25FE-4564-9246-B4584F797348")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.*")] diff --git a/MediaBrowser.Plugins.MpcHc/Properties/Resources.Designer.cs b/MediaBrowser.Plugins.MpcHc/Properties/Resources.Designer.cs deleted file mode 100644 index 14f2a3ba27..0000000000 --- a/MediaBrowser.Plugins.MpcHc/Properties/Resources.Designer.cs +++ /dev/null @@ -1,62 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18010 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace MediaBrowser.Plugins.MpcHc.Properties { - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if ((resourceMan == null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediaBrowser.Plugins.MpcHc.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/MediaBrowser.Plugins.MpcHc/Properties/Resources.resx b/MediaBrowser.Plugins.MpcHc/Properties/Resources.resx deleted file mode 100644 index af7dbebbac..0000000000 --- a/MediaBrowser.Plugins.MpcHc/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/MediaBrowser.Plugins.MpcHc/Properties/Settings.Designer.cs b/MediaBrowser.Plugins.MpcHc/Properties/Settings.Designer.cs deleted file mode 100644 index f64175f33a..0000000000 --- a/MediaBrowser.Plugins.MpcHc/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18010 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace MediaBrowser.Plugins.MpcHc.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/MediaBrowser.Plugins.MpcHc/Properties/Settings.settings b/MediaBrowser.Plugins.MpcHc/Properties/Settings.settings deleted file mode 100644 index 033d7a5e9e..0000000000 --- a/MediaBrowser.Plugins.MpcHc/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.Plugins.MpcHc/app.config b/MediaBrowser.Plugins.MpcHc/app.config deleted file mode 100644 index 29abde1f69..0000000000 --- a/MediaBrowser.Plugins.MpcHc/app.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.Plugins.Tmt5/MediaBrowser.Plugins.Tmt5.csproj b/MediaBrowser.Plugins.Tmt5/MediaBrowser.Plugins.Tmt5.csproj deleted file mode 100644 index 113c63f0f2..0000000000 --- a/MediaBrowser.Plugins.Tmt5/MediaBrowser.Plugins.Tmt5.csproj +++ /dev/null @@ -1,108 +0,0 @@ - - - - - Debug - AnyCPU - {BE9BAA85-9EF2-4308-92E4-0D2B6E33C487} - library - Properties - MediaBrowser.Plugins.Tmt5 - MediaBrowser.Plugins.Tmt5 - v4.5 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - ..\ - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - Always - - - - - - - - - - - - 4.0 - - - - - - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - {9142eefa-7570-41e1-bfcc-468bb571af2f} - MediaBrowser.Common - - - {7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b} - MediaBrowser.Model - - - {b5ece1fb-618e-420b-9a99-8e972d76920a} - MediaBrowser.UI - - - - - xcopy "$(TargetPath)" "$(SolutionDir)\ProgramData-Server\Plugins\" /y - - - - \ No newline at end of file diff --git a/MediaBrowser.Plugins.Tmt5/Plugin.cs b/MediaBrowser.Plugins.Tmt5/Plugin.cs deleted file mode 100644 index 7b5fb9267e..0000000000 --- a/MediaBrowser.Plugins.Tmt5/Plugin.cs +++ /dev/null @@ -1,32 +0,0 @@ -using MediaBrowser.Common.Plugins; -using MediaBrowser.Model.Plugins; -using System; -using System.ComponentModel.Composition; - -namespace MediaBrowser.Plugins.Tmt5 -{ - /// - /// Class Plugin - /// - [Export(typeof(IPlugin))] - public class Plugin : BaseUiPlugin - { - /// - /// Gets the name of the plugin - /// - /// The name. - public override string Name - { - get { return "TMT5 Integration"; } - } - - /// - /// Gets the minimum required UI version. - /// - /// The minimum required UI version. - public override Version MinimumRequiredUIVersion - { - get { return new Version("2.9.4782.23738"); } - } - } -} diff --git a/MediaBrowser.Plugins.Tmt5/Properties/AssemblyInfo.cs b/MediaBrowser.Plugins.Tmt5/Properties/AssemblyInfo.cs deleted file mode 100644 index eadd74785c..0000000000 --- a/MediaBrowser.Plugins.Tmt5/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("MediaBrowser.Plugins.Tmt5")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("MediaBrowser.Plugins.Tmt5")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly:ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - -[assembly: Guid("3921C21B-B8C0-46C2-92DE-CC0E1FE0C434")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.*")] diff --git a/MediaBrowser.Plugins.Tmt5/Properties/Resources.Designer.cs b/MediaBrowser.Plugins.Tmt5/Properties/Resources.Designer.cs deleted file mode 100644 index 3656ce547b..0000000000 --- a/MediaBrowser.Plugins.Tmt5/Properties/Resources.Designer.cs +++ /dev/null @@ -1,62 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18010 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace MediaBrowser.Plugins.Tmt5.Properties { - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if ((resourceMan == null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediaBrowser.Plugins.Tmt5.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/MediaBrowser.Plugins.Tmt5/Properties/Resources.resx b/MediaBrowser.Plugins.Tmt5/Properties/Resources.resx deleted file mode 100644 index af7dbebbac..0000000000 --- a/MediaBrowser.Plugins.Tmt5/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/MediaBrowser.Plugins.Tmt5/Properties/Settings.Designer.cs b/MediaBrowser.Plugins.Tmt5/Properties/Settings.Designer.cs deleted file mode 100644 index ac7a3dcab5..0000000000 --- a/MediaBrowser.Plugins.Tmt5/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18010 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace MediaBrowser.Plugins.Tmt5.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/MediaBrowser.Plugins.Tmt5/Properties/Settings.settings b/MediaBrowser.Plugins.Tmt5/Properties/Settings.settings deleted file mode 100644 index 033d7a5e9e..0000000000 --- a/MediaBrowser.Plugins.Tmt5/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.Plugins.Tmt5/Tmt5MediaPlayer.cs b/MediaBrowser.Plugins.Tmt5/Tmt5MediaPlayer.cs deleted file mode 100644 index 2643eaa445..0000000000 --- a/MediaBrowser.Plugins.Tmt5/Tmt5MediaPlayer.cs +++ /dev/null @@ -1,405 +0,0 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Logging; -using MediaBrowser.UI.Configuration; -using MediaBrowser.UI.Playback; -using MediaBrowser.UI.Playback.ExternalPlayer; -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.ComponentModel.Composition; -using System.Diagnostics; -using System.Globalization; -using System.IO; -using System.Threading.Tasks; - -namespace MediaBrowser.Plugins.Tmt5 -{ - /// - /// Class GenericExternalPlayer - /// - [Export(typeof(BaseMediaPlayer))] - public class Tmt5MediaPlayer : BaseExternalPlayer - { - [ImportingConstructor] - public Tmt5MediaPlayer([Import("logger")] ILogger logger) - : base(logger) - { - } - - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get { return "TMT5"; } - } - - /// - /// Gets a value indicating whether this instance can pause. - /// - /// true if this instance can pause; otherwise, false. - public override bool CanPause - { - get - { - return true; - } - } - - /// - /// Gets a value indicating whether this instance can close automatically. - /// - /// true if this instance can close automatically; otherwise, false. - protected override bool CanCloseAutomatically - { - get - { - return true; - } - } - - /// - /// Gets the play state directory. - /// - /// The play state directory. - private string PlayStateDirectory - { - get - { - return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ArcSoft"); - } - } - - - /// - /// The _current position ticks - /// - private long? _currentPositionTicks; - - /// - /// Gets the current position ticks. - /// - /// The current position ticks. - public override long? CurrentPositionTicks - { - get - { - return _currentPositionTicks; - } - } - - /// - /// The _current playlist index - /// - private int _currentPlaylistIndex; - - /// - /// Gets the index of the current playlist. - /// - /// The index of the current playlist. - public override int CurrentPlaylistIndex - { - get - { - return _currentPlaylistIndex; - } - } - - /// - /// Gets or sets the status file watcher. - /// - /// The status file watcher. - private FileSystemWatcher StatusFileWatcher { get; set; } - - /// - /// Gets or sets a value indicating whether this instance has started playing. - /// - /// true if this instance has started playing; otherwise, false. - private bool HasStartedPlaying { get; set; } - - /// - /// Gets or sets a value indicating whether this instance has stopped playing. - /// - /// true if this instance has stopped playing; otherwise, false. - private bool HasStoppedPlaying { get; set; } - - /// - /// Determines whether this instance can play the specified item. - /// - /// The item. - /// true if this instance can play the specified item; otherwise, false. - public override bool CanPlay(BaseItemDto item) - { - return item.IsVideo || item.IsAudio; - } - - /// - /// Called when [player stopped internal]. - /// - protected override void OnPlayerStoppedInternal() - { - DisposeFileSystemWatcher(); - HasStartedPlaying = false; - HasStoppedPlaying = false; - _currentPlaylistIndex = 0; - _currentPositionTicks = 0; - - base.OnPlayerStoppedInternal(); - } - - /// - /// Gets the command arguments. - /// - /// The items. - /// The options. - /// The player configuration. - /// System.String. - protected override string GetCommandArguments(List items, PlayOptions options, PlayerConfiguration playerConfiguration) - { - return "\"" + items[0].Path + "\""; - } - - /// - /// Called when [external player launched]. - /// - protected override void OnExternalPlayerLaunched() - { - base.OnExternalPlayerLaunched(); - - // If the playstate directory exists, start watching it - if (Directory.Exists(PlayStateDirectory)) - { - ReloadFileSystemWatcher(); - } - } - - /// - /// Pauses the internal. - /// - /// Task. - protected override Task PauseInternal() - { - return SendCommandToMMC("-pause"); - } - - /// - /// Uns the pause internal. - /// - /// Task. - protected override Task UnPauseInternal() - { - return SendCommandToMMC("-play"); - } - - /// - /// Stops the internal. - /// - /// Task. - protected override Task StopInternal() - { - return SendCommandToMMC("-stop"); - } - - /// - /// Closes the player. - /// - /// Task. - protected Task ClosePlayer() - { - return SendCommandToMMC("-close"); - } - - /// - /// Seeks the internal. - /// - /// The position ticks. - /// Task. - /// No media to seek to - protected override Task SeekInternal(long positionTicks) - { - if (CurrentMedia == null) - { - throw new InvalidOperationException("No media to seek to"); - } - - if (CurrentMedia.Chapters == null) - { - throw new InvalidOperationException("TMT5 cannot seek without chapter information"); - } - - var chapterIndex = 0; - - for (var i = 0; i < CurrentMedia.Chapters.Count; i++) - { - if (CurrentMedia.Chapters[i].StartPositionTicks < positionTicks) - { - chapterIndex = i; - } - } - - return JumpToChapter(chapterIndex); - } - - /// - /// Jumps to chapter. - /// - /// The chapter. - /// Task. - protected Task JumpToChapter(int chapter) - { - return SendCommandToMMC(" -chapter " + chapter); - } - - /// - /// Sends an arbitrary command to the TMT MMC console - /// - /// The command. - /// Task. - protected Task SendCommandToMMC(string command) - { - return Task.Run(() => - { - var directory = Path.GetDirectoryName(CurrentPlayerConfiguration.Command); - - var processInfo = new ProcessStartInfo - { - FileName = Path.Combine(directory, "MMCEDT5.exe"), - Arguments = command, - CreateNoWindow = true - }; - - Logger.Debug("{0} {1}", processInfo.FileName, processInfo.Arguments); - - using (var process = Process.Start(processInfo)) - { - process.WaitForExit(2000); - } - }); - } - - /// - /// Reloads the file system watcher. - /// - private void ReloadFileSystemWatcher() - { - DisposeFileSystemWatcher(); - - Logger.Info("Watching TMT folder: " + PlayStateDirectory); - - StatusFileWatcher = new FileSystemWatcher(PlayStateDirectory, "*.set") - { - IncludeSubdirectories = true - }; - - // Need to include subdirectories since there are subfolders undearneath this with the TMT version #. - StatusFileWatcher.Changed += StatusFileWatcher_Changed; - StatusFileWatcher.EnableRaisingEvents = true; - } - - private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); - - /// - /// Handles the Changed event of the StatusFileWatcher control. - /// - /// The source of the event. - /// The instance containing the event data. - async void StatusFileWatcher_Changed(object sender, FileSystemEventArgs e) - { - Logger.Debug("TMT File Watcher reports change type {1} at {0}", e.FullPath, e.ChangeType); - - NameValueCollection values; - - try - { - values = FileSystem.ParseIniFile(e.FullPath); - } - catch (IOException) - { - // This can happen if the file is being written to at the exact moment we're trying to access it - // Unfortunately we kind of have to just eat it - return; - } - - var tmtPlayState = values["State"]; - - if (tmtPlayState.Equals("play", StringComparison.OrdinalIgnoreCase)) - { - PlayState = PlayState.Playing; - - // Playback just started - HasStartedPlaying = true; - - if (CurrentPlayOptions.StartPositionTicks > 0) - { - SeekInternal(CurrentPlayOptions.StartPositionTicks); - } - } - else if (tmtPlayState.Equals("pause", StringComparison.OrdinalIgnoreCase)) - { - PlayState = PlayState.Paused; - } - - // If playback has previously started... - // First notify the Progress event handler - // Then check if playback has stopped - if (HasStartedPlaying) - { - TimeSpan currentPosition; - - //TimeSpan.TryParse(values["TotalTime"], out currentDuration); - - if (TimeSpan.TryParse(values["CurTime"], UsCulture, out currentPosition)) - { - _currentPositionTicks = currentPosition.Ticks; - } - - _currentPlaylistIndex = 0; - - // Playback has stopped - if (tmtPlayState.Equals("stop", StringComparison.OrdinalIgnoreCase)) - { - Logger.Info("Playstate changed to stopped"); - - if (!HasStoppedPlaying) - { - HasStoppedPlaying = true; - - DisposeFileSystemWatcher(); - - await ClosePlayer().ConfigureAwait(false); - } - } - } - } - - /// - /// Disposes the file system watcher. - /// - private void DisposeFileSystemWatcher() - { - if (StatusFileWatcher != null) - { - StatusFileWatcher.EnableRaisingEvents = false; - StatusFileWatcher.Changed -= StatusFileWatcher_Changed; - StatusFileWatcher.Dispose(); - StatusFileWatcher = null; - } - } - - /// - /// Releases unmanaged and - optionally - managed resources. - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected override void Dispose(bool dispose) - { - if (dispose) - { - DisposeFileSystemWatcher(); - } - - base.Dispose(dispose); - } - } -} diff --git a/MediaBrowser.Plugins.Tmt5/app.config b/MediaBrowser.Plugins.Tmt5/app.config deleted file mode 100644 index 29abde1f69..0000000000 --- a/MediaBrowser.Plugins.Tmt5/app.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/MediaBrowser.Plugins.Trailers/AppleTrailerListingDownloader.cs b/MediaBrowser.Plugins.Trailers/AppleTrailerListingDownloader.cs deleted file mode 100644 index 76d7569b9f..0000000000 --- a/MediaBrowser.Plugins.Trailers/AppleTrailerListingDownloader.cs +++ /dev/null @@ -1,314 +0,0 @@ -using MediaBrowser.Common.Extensions; -using MediaBrowser.Controller; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Extensions; -using MediaBrowser.Model.Entities; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using System.Xml; - -namespace MediaBrowser.Plugins.Trailers -{ - /// - /// Fetches Apple's list of current movie trailers - /// - public static class AppleTrailerListingDownloader - { - /// - /// The trailer feed URL - /// - private const string TrailerFeedUrl = "http://trailers.apple.com/trailers/home/xml/current_720p.xml"; - - /// - /// Downloads a list of trailer info's from the apple url - /// - /// Task{List{TrailerInfo}}. - public static async Task> GetTrailerList(CancellationToken cancellationToken) - { - var stream = await Kernel.Instance.HttpManager.Get(TrailerFeedUrl, Kernel.Instance.ResourcePools.AppleTrailerVideos, cancellationToken).ConfigureAwait(false); - - var list = new List(); - - using (var reader = XmlReader.Create(stream, new XmlReaderSettings { Async = true })) - { - await reader.MoveToContentAsync().ConfigureAwait(false); - - while (await reader.ReadAsync().ConfigureAwait(false)) - { - cancellationToken.ThrowIfCancellationRequested(); - - if (reader.NodeType == XmlNodeType.Element) - { - switch (reader.Name) - { - case "movieinfo": - var trailer = FetchTrailerInfo(reader.ReadSubtree()); - list.Add(trailer); - break; - } - } - } - } - - return list; - } - - /// - /// Fetches trailer info from an xml node - /// - /// The reader. - /// TrailerInfo. - private static TrailerInfo FetchTrailerInfo(XmlReader reader) - { - var trailerInfo = new TrailerInfo { }; - - reader.MoveToContent(); - - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element) - { - switch (reader.Name) - { - case "info": - FetchInfo(reader.ReadSubtree(), trailerInfo); - break; - case "cast": - FetchCast(reader.ReadSubtree(), trailerInfo); - break; - case "genre": - FetchGenres(reader.ReadSubtree(), trailerInfo); - break; - case "poster": - FetchPosterUrl(reader.ReadSubtree(), trailerInfo); - break; - case "preview": - FetchTrailerUrl(reader.ReadSubtree(), trailerInfo); - break; - default: - reader.Skip(); - break; - } - } - } - - return trailerInfo; - } - - private static readonly CultureInfo USCulture = new CultureInfo("en-US"); - - /// - /// Fetches from the info node - /// - /// The reader. - /// The info. - private static void FetchInfo(XmlReader reader, TrailerInfo info) - { - reader.MoveToContent(); - reader.Read(); - - while (reader.NodeType == XmlNodeType.Element) - { - switch (reader.Name) - { - case "title": - info.Video.Name = reader.ReadStringSafe(); - break; - case "runtime": - { - var runtime = reader.ReadStringSafe(); - - if (!string.IsNullOrWhiteSpace(runtime)) - { - if (runtime.StartsWith(":", StringComparison.OrdinalIgnoreCase)) - { - runtime = "0" + runtime; - } - - TimeSpan runtimeTimeSpan; - - if (TimeSpan.TryParse(runtime, USCulture, out runtimeTimeSpan)) - { - info.Video.RunTimeTicks = runtimeTimeSpan.Ticks; - } - } - break; - } - case "rating": - info.Video.OfficialRating = reader.ReadStringSafe(); - break; - case "studio": - { - var studio = reader.ReadStringSafe(); - if (!string.IsNullOrWhiteSpace(studio)) - { - info.Video.AddStudio(studio); - } - break; - } - case "postdate": - { - DateTime date; - - if (DateTime.TryParse(reader.ReadStringSafe(), USCulture, DateTimeStyles.None, out date)) - { - info.PostDate = date; - } - break; - } - case "releasedate": - { - var val = reader.ReadStringSafe(); - - if (!string.IsNullOrWhiteSpace(val)) - { - DateTime date; - - if (DateTime.TryParse(val, USCulture, DateTimeStyles.None, out date)) - { - info.Video.PremiereDate = date; - info.Video.ProductionYear = date.Year; - } - } - - break; - } - case "director": - { - var directors = reader.ReadStringSafe() ?? string.Empty; - - foreach (var director in directors.Split(',', StringSplitOptions.RemoveEmptyEntries)) - { - var name = director.Trim(); - - if (!string.IsNullOrWhiteSpace(name)) - { - info.Video.AddPerson(new PersonInfo { Name = name, Type = PersonType.Director }); - } - } - break; - } - case "description": - info.Video.Overview = reader.ReadStringSafe(); - break; - default: - reader.Skip(); - break; - } - } - } - - /// - /// Fetches from the genre node - /// - /// The reader. - /// The info. - private static void FetchGenres(XmlReader reader, TrailerInfo info) - { - reader.MoveToContent(); - reader.Read(); - - while (reader.IsStartElement()) - { - if (reader.NodeType == XmlNodeType.Element) - { - switch (reader.Name) - { - case "name": - info.Video.AddGenre(reader.ReadStringSafe()); - break; - default: - reader.Skip(); - break; - } - } - } - - } - - /// - /// Fetches from the cast node - /// - /// The reader. - /// The info. - private static void FetchCast(XmlReader reader, TrailerInfo info) - { - reader.MoveToContent(); - reader.Read(); - - while (reader.IsStartElement()) - { - if (reader.NodeType == XmlNodeType.Element) - { - switch (reader.Name) - { - case "name": - info.Video.AddPerson(new PersonInfo { Name = reader.ReadStringSafe(), Type = PersonType.Actor }); - break; - default: - reader.Skip(); - break; - } - } - } - - } - - /// - /// Fetches from the preview node - /// - /// The reader. - /// The info. - private static void FetchTrailerUrl(XmlReader reader, TrailerInfo info) - { - reader.MoveToContent(); - reader.Read(); - - while (reader.NodeType == XmlNodeType.Element) - { - switch (reader.Name) - { - case "large": - info.TrailerUrl = reader.ReadStringSafe(); - break; - default: - reader.Skip(); - break; - } - } - - } - - /// - /// Fetches from the poster node - /// - /// The reader. - /// The info. - private static void FetchPosterUrl(XmlReader reader, TrailerInfo info) - { - reader.MoveToContent(); - reader.Read(); - - while (reader.NodeType == XmlNodeType.Element) - { - switch (reader.Name) - { - case "location": - info.ImageUrl = reader.ReadStringSafe(); - break; - case "xlarge": - info.HdImageUrl = reader.ReadStringSafe(); - break; - default: - reader.Skip(); - break; - } - } - - } - - } -} diff --git a/MediaBrowser.Plugins.Trailers/Configuration/PluginConfiguration.cs b/MediaBrowser.Plugins.Trailers/Configuration/PluginConfiguration.cs deleted file mode 100644 index d54f017971..0000000000 --- a/MediaBrowser.Plugins.Trailers/Configuration/PluginConfiguration.cs +++ /dev/null @@ -1,46 +0,0 @@ -using MediaBrowser.Model.Plugins; - -namespace MediaBrowser.Plugins.Trailers.Configuration -{ - /// - /// Class PluginConfiguration - /// - public class PluginConfiguration : BasePluginConfiguration - { - /// - /// Gets or sets the name of the folder. - /// - /// The name of the folder. - public string FolderName { get; set; } - - /// - /// Trailers older than this will not be downloaded and deleted if already downloaded. - /// - /// The max trailer age. - public int? MaxTrailerAge { get; set; } - - /// - /// Gets the path to where trailers should be downloaded. - /// If not supplied then programdata/cache/trailers will be used. - /// - /// The download path. - public string DownloadPath { get; set; } - - /// - /// Gets or sets a value indicating whether [delete old trailers]. - /// - /// true if [delete old trailers]; otherwise, false. - public bool DeleteOldTrailers { get; set; } - - /// - /// Initializes a new instance of the class. - /// - public PluginConfiguration() - : base() - { - FolderName = "Trailers"; - - MaxTrailerAge = 60; - } - } -} diff --git a/MediaBrowser.Plugins.Trailers/Configuration/TrailerConfigurationPage.cs b/MediaBrowser.Plugins.Trailers/Configuration/TrailerConfigurationPage.cs deleted file mode 100644 index 93ce49dc26..0000000000 --- a/MediaBrowser.Plugins.Trailers/Configuration/TrailerConfigurationPage.cs +++ /dev/null @@ -1,50 +0,0 @@ -using MediaBrowser.Common.Plugins; -using MediaBrowser.Controller.Plugins; -using System.ComponentModel.Composition; -using System.IO; - -namespace MediaBrowser.Plugins.Trailers.Configuration -{ - /// - /// Class TrailerConfigurationPage - /// - [Export(typeof(BaseConfigurationPage))] - class TrailerConfigurationPage : BaseConfigurationPage - { - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get { return "Trailers"; } - } - - /// - /// Gets the HTML stream. - /// - /// Stream. - public override Stream GetHtmlStream() - { - return GetHtmlStreamFromManifestResource("MediaBrowser.Plugins.Trailers.Configuration.configPage.html"); - } - - /// - /// Gets the owner plugin. - /// - /// BasePlugin. - public override IPlugin GetOwnerPlugin() - { - return Plugin.Instance; - } - - /// - /// Gets the type of the configuration page. - /// - /// The type of the configuration page. - public override ConfigurationPageType ConfigurationPageType - { - get { return ConfigurationPageType.PluginConfiguration; } - } - } -} diff --git a/MediaBrowser.Plugins.Trailers/Configuration/configPage.html b/MediaBrowser.Plugins.Trailers/Configuration/configPage.html deleted file mode 100644 index 9467f3f98e..0000000000 --- a/MediaBrowser.Plugins.Trailers/Configuration/configPage.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - Trailers - - -
- -
-
-
- -
    -
  • - - -
  • -
  • - - -
    - If specified, trailers older than this will not be downloaded -
    -
  • -
  • - - -
  • -
  • - -
    - -
    - -
    - By default, trailers are downloaded to an internal data directory. Using a different location may make it easier to share over your network. -
    -
  • -
  • - - -
  • -
- -
-
-
- - -
- - diff --git a/MediaBrowser.Plugins.Trailers/Entities/TrailerCollectionFolder.cs b/MediaBrowser.Plugins.Trailers/Entities/TrailerCollectionFolder.cs deleted file mode 100644 index 95ba07967f..0000000000 --- a/MediaBrowser.Plugins.Trailers/Entities/TrailerCollectionFolder.cs +++ /dev/null @@ -1,33 +0,0 @@ -using MediaBrowser.Controller.Entities; -using System.ComponentModel.Composition; - -namespace MediaBrowser.Plugins.Trailers.Entities -{ - /// - /// Class TrailerCollectionFolder - /// - [Export(typeof(BasePluginFolder))] - class TrailerCollectionFolder : BasePluginFolder - { - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return Plugin.Instance.Configuration.FolderName; - } - } - - /// - /// Gets the path. - /// - /// The path. - public override string Path - { - get { return Plugin.Instance.DownloadPath; } - } - } -} diff --git a/MediaBrowser.Plugins.Trailers/MediaBrowser.Plugins.Trailers.csproj b/MediaBrowser.Plugins.Trailers/MediaBrowser.Plugins.Trailers.csproj deleted file mode 100644 index 6cf2aef78f..0000000000 --- a/MediaBrowser.Plugins.Trailers/MediaBrowser.Plugins.Trailers.csproj +++ /dev/null @@ -1,88 +0,0 @@ - - - - - Debug - AnyCPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF} - Library - Properties - MediaBrowser.Plugins.Trailers - MediaBrowser.Plugins.Trailers - v4.5 - 512 - ..\ - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - Always - - - - - - - - - - - - - - - - - - - - - - - - - - {9142eefa-7570-41e1-bfcc-468bb571af2f} - MediaBrowser.Common - - - {17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2} - MediaBrowser.Controller - - - {7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b} - MediaBrowser.Model - - - - - - - - xcopy "$(TargetPath)" "$(SolutionDir)\ProgramData-Server\Plugins\" /y - - - - \ No newline at end of file diff --git a/MediaBrowser.Plugins.Trailers/Plugin.cs b/MediaBrowser.Plugins.Trailers/Plugin.cs deleted file mode 100644 index 2fc2773d38..0000000000 --- a/MediaBrowser.Plugins.Trailers/Plugin.cs +++ /dev/null @@ -1,119 +0,0 @@ -using MediaBrowser.Common.Plugins; -using MediaBrowser.Controller.ScheduledTasks; -using MediaBrowser.Model.Plugins; -using MediaBrowser.Plugins.Trailers.Configuration; -using MediaBrowser.Plugins.Trailers.ScheduledTasks; -using System; -using System.ComponentModel.Composition; -using System.IO; - -namespace MediaBrowser.Plugins.Trailers -{ - /// - /// Class Plugin - /// - [Export(typeof(IPlugin))] - public class Plugin : BasePlugin - { - /// - /// Gets the name of the plugin - /// - /// The name. - public override string Name - { - get { return "Trailers"; } - } - - /// - /// Gets the description. - /// - /// The description. - public override string Description - { - get - { - return "Movie trailers for your collection."; - } - } - - /// - /// Gets the instance. - /// - /// The instance. - public static Plugin Instance { get; private set; } - - /// - /// Initializes a new instance of the class. - /// - public Plugin() - : base() - { - Instance = this; - } - - /// - /// The _download path - /// - private string _downloadPath; - /// - /// Gets the path to the trailer download directory - /// - /// The download path. - public string DownloadPath - { - get - { - if (_downloadPath == null) - { - // Use - _downloadPath = Configuration.DownloadPath; - - if (string.IsNullOrWhiteSpace(_downloadPath)) - { - _downloadPath = Path.Combine(Controller.Kernel.Instance.ApplicationPaths.DataPath, Name); - } - - if (!Directory.Exists(_downloadPath)) - { - Directory.CreateDirectory(_downloadPath); - } - } - return _downloadPath; - } - } - - /// - /// Starts the plugin on the server - /// - /// if set to true [is first run]. - protected override void InitializeOnServer(bool isFirstRun) - { - base.InitializeOnServer(isFirstRun); - - if (isFirstRun) - { - Kernel.TaskManager.QueueScheduledTask(); - } - } - - /// - /// Completely overwrites the current configuration with a new copy - /// Returns true or false indicating success or failure - /// - /// The configuration. - public override void UpdateConfiguration(BasePluginConfiguration configuration) - { - var config = (PluginConfiguration) configuration; - - var pathChanged = !string.Equals(Configuration.DownloadPath, config.DownloadPath, StringComparison.OrdinalIgnoreCase); - - base.UpdateConfiguration(configuration); - - if (pathChanged) - { - _downloadPath = null; - Kernel.TaskManager.QueueScheduledTask(); - } - } - } -} diff --git a/MediaBrowser.Plugins.Trailers/Properties/AssemblyInfo.cs b/MediaBrowser.Plugins.Trailers/Properties/AssemblyInfo.cs deleted file mode 100644 index 32dd174d5f..0000000000 --- a/MediaBrowser.Plugins.Trailers/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("MediaBrowser.Plugins.Trailers")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("MediaBrowser.Plugins.Trailers")] -[assembly: AssemblyCopyright("Copyright © 2012")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("986a7283-205a-4436-862d-23135c067f8a")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.*")] diff --git a/MediaBrowser.Plugins.Trailers/Providers/TrailerFromJsonProvider.cs b/MediaBrowser.Plugins.Trailers/Providers/TrailerFromJsonProvider.cs deleted file mode 100644 index 3f126dcdd4..0000000000 --- a/MediaBrowser.Plugins.Trailers/Providers/TrailerFromJsonProvider.cs +++ /dev/null @@ -1,143 +0,0 @@ -using MediaBrowser.Common.Serialization; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Plugins.Trailers.Entities; -using System; -using System.ComponentModel.Composition; -using System.IO; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Plugins.Trailers.Providers -{ - /// - /// Class TrailerFromJsonProvider - /// - [Export(typeof(BaseMetadataProvider))] - class TrailerFromJsonProvider : BaseMetadataProvider - { - /// - /// Supportses the specified item. - /// - /// The item. - /// true if XXXX, false otherwise - public override bool Supports(BaseItem item) - { - var trailer = item as Trailer; - - return trailer != null && trailer.Parent is TrailerCollectionFolder; - } - - /// - /// Override this to return the date that should be compared to the last refresh date - /// to determine if this provider should be re-fetched. - /// - /// The item. - /// DateTime. - protected override DateTime CompareDate(BaseItem item) - { - var entry = item.ResolveArgs.GetMetaFileByPath(Path.Combine(item.MetaLocation, "trailer.json")); - return entry != null ? entry.Value.LastWriteTimeUtc : DateTime.MinValue; - } - - /// - /// Fetches metadata and returns true or false indicating if any work that requires persistence was done - /// - /// The item. - /// if set to true [force]. - /// Task{System.Boolean}. - protected override Task FetchAsyncInternal(BaseItem item, bool force, CancellationToken cancellationToken) - { - return Task.Run(() => Fetch((Trailer)item)); - } - - /// - /// Fetches the specified item. - /// - /// The item. - /// true if XXXX, false otherwise - private bool Fetch(Trailer item) - { - var metadataFile = item.ResolveArgs.GetMetaFileByPath(Path.Combine(item.MetaLocation, "trailer.json")); - - if (metadataFile.HasValue) - { - var tempTrailer = JsonSerializer.DeserializeFromFile(metadataFile.Value.Path); - - ImportMetdata(tempTrailer, item); - - SetLastRefreshed(item, DateTime.UtcNow); - return true; - } - return false; - } - - /// - /// Gets the priority. - /// - /// The priority. - public override MetadataProviderPriority Priority - { - get { return MetadataProviderPriority.First; } - } - - /// - /// Imports the metdata. - /// - /// The source. - /// The target. - private void ImportMetdata(Trailer source, Trailer target) - { - if (!string.IsNullOrWhiteSpace(source.Name)) - { - target.Name = source.Name; - } - - if (source.RunTimeTicks.HasValue) - { - target.RunTimeTicks = source.RunTimeTicks; - } - - if (source.Genres != null) - { - foreach (var entry in source.Genres) - { - target.AddGenre(entry); - } - } - - if (!string.IsNullOrWhiteSpace(source.OfficialRating)) - { - target.OfficialRating = source.OfficialRating; - } - - if (!string.IsNullOrWhiteSpace(source.Overview)) - { - target.Overview = source.Overview; - } - - if (source.People != null) - { - target.AddPeople(source.People); - } - - if (source.PremiereDate.HasValue) - { - target.PremiereDate = source.PremiereDate; - } - - if (source.ProductionYear.HasValue) - { - target.ProductionYear = source.ProductionYear; - } - - if (source.Studios != null) - { - foreach (var entry in source.Studios) - { - target.AddStudio(entry); - } - } - } - } -} diff --git a/MediaBrowser.Plugins.Trailers/Resolvers/TrailerResolver.cs b/MediaBrowser.Plugins.Trailers/Resolvers/TrailerResolver.cs deleted file mode 100644 index b1e4968df3..0000000000 --- a/MediaBrowser.Plugins.Trailers/Resolvers/TrailerResolver.cs +++ /dev/null @@ -1,51 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Resolvers; -using System; -using System.ComponentModel.Composition; -using System.Linq; - -namespace MediaBrowser.Plugins.Trailers.Resolvers -{ - /// - /// Class TrailerResolver - /// - [Export(typeof(IBaseItemResolver))] - public class TrailerResolver : BaseVideoResolver - { - /// - /// Resolves the specified args. - /// - /// The args. - /// Trailer. - protected override Trailer Resolve(ItemResolveArgs args) - { - // Must be a directory and under the trailer download folder - if (args.IsDirectory && args.Path.StartsWith(Plugin.Instance.DownloadPath, StringComparison.OrdinalIgnoreCase)) - { - // The trailer must be a video file - return FindTrailer(args); - } - - return null; - } - - /// - /// Finds a movie based on a child file system entries - /// - /// The args. - /// Trailer. - private Trailer FindTrailer(ItemResolveArgs args) - { - // Loop through each child file/folder and see if we find a video - return args.FileSystemChildren - .Where(c => !c.IsDirectory) - .Select(child => base.Resolve(new ItemResolveArgs - { - FileInfo = child, - Path = child.Path - })) - .FirstOrDefault(i => i != null); - } - } -} diff --git a/MediaBrowser.Plugins.Trailers/ScheduledTasks/CurrentTrailerDownloadTask.cs b/MediaBrowser.Plugins.Trailers/ScheduledTasks/CurrentTrailerDownloadTask.cs deleted file mode 100644 index 47206fca03..0000000000 --- a/MediaBrowser.Plugins.Trailers/ScheduledTasks/CurrentTrailerDownloadTask.cs +++ /dev/null @@ -1,311 +0,0 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.ScheduledTasks; -using MediaBrowser.Common.Serialization; -using MediaBrowser.Controller; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Net; -using MediaBrowser.Model.Tasks; -using MediaBrowser.Plugins.Trailers.Entities; -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Plugins.Trailers.ScheduledTasks -{ - /// - /// Downloads trailers from the web at scheduled times - /// - [Export(typeof(IScheduledTask))] - public class CurrentTrailerDownloadTask : BaseScheduledTask - { - /// - /// Creates the triggers that define when the task will run - /// - /// IEnumerable{BaseTaskTrigger}. - protected override IEnumerable GetDefaultTriggers() - { - var trigger = new DailyTrigger { TimeOfDay = TimeSpan.FromHours(2) }; //2am - - return new[] { trigger }; - } - - /// - /// Returns the task to be executed - /// - /// The cancellation token. - /// The progress. - /// Task. - protected override async Task ExecuteInternal(CancellationToken cancellationToken, IProgress progress) - { - // Get the list of trailers - var trailers = await AppleTrailerListingDownloader.GetTrailerList(cancellationToken).ConfigureAwait(false); - - progress.Report(1); - - var trailersToDownload = trailers.Where(t => !IsOldTrailer(t.Video)).ToList(); - - cancellationToken.ThrowIfCancellationRequested(); - - var numComplete = 0; - - // Fetch them all in parallel - var tasks = trailersToDownload.Select(t => Task.Run(async () => - { - cancellationToken.ThrowIfCancellationRequested(); - - try - { - await DownloadTrailer(t, cancellationToken).ConfigureAwait(false); - } - catch (Exception ex) - { - Logger.ErrorException("Error downloading {0}", ex, t.TrailerUrl); - } - - // Update progress - lock (progress) - { - numComplete++; - double percent = numComplete; - percent /= trailersToDownload.Count; - - // Leave 1% for DeleteOldTrailers - progress.Report((99 * percent) + 1); - } - })); - - cancellationToken.ThrowIfCancellationRequested(); - - await Task.WhenAll(tasks).ConfigureAwait(false); - - cancellationToken.ThrowIfCancellationRequested(); - - if (Plugin.Instance.Configuration.DeleteOldTrailers) - { - // Enforce MaxTrailerAge - DeleteOldTrailers(); - } - - progress.Report(100); - } - - /// - /// Downloads a single trailer into the trailers directory - /// - /// The trailer. - /// The cancellation token. - /// Task. - private async Task DownloadTrailer(TrailerInfo trailer, CancellationToken cancellationToken) - { - // Construct the trailer foldername - var folderName = FileSystem.GetValidFilename(trailer.Video.Name); - - if (trailer.Video.ProductionYear.HasValue) - { - folderName += string.Format(" ({0})", trailer.Video.ProductionYear); - } - - var folderPath = Path.Combine(Plugin.Instance.DownloadPath, folderName); - - // Figure out which image we're going to download - var imageUrl = trailer.HdImageUrl ?? trailer.ImageUrl; - - // Construct the video filename (to match the folder name) - var videoFileName = Path.ChangeExtension(folderName, Path.GetExtension(trailer.TrailerUrl)); - - // Construct the image filename (folder + original extension) - var imageFileName = Path.ChangeExtension("folder", Path.GetExtension(imageUrl)); - - // Construct full paths - var videoFilePath = Path.Combine(folderPath, videoFileName); - var imageFilePath = Path.Combine(folderPath, imageFileName); - - // Create tasks to download each of them, if we don't already have them - Task videoTask = null; - Task imageTask = null; - - var tasks = new List(); - - if (!File.Exists(videoFilePath)) - { - Logger.Info("Downloading trailer: " + trailer.TrailerUrl); - - // Fetch the video to a temp file because it's too big to put into a MemoryStream - videoTask = Kernel.HttpManager.FetchToTempFile(trailer.TrailerUrl, Kernel.ResourcePools.AppleTrailerVideos, cancellationToken, new Progress { }, "QuickTime/7.6.2"); - tasks.Add(videoTask); - } - - if (!string.IsNullOrWhiteSpace(imageUrl) && !File.Exists(imageFilePath)) - { - // Fetch the image to a memory stream - Logger.Info("Downloading trailer image: " + imageUrl); - imageTask = Kernel.HttpManager.FetchToMemoryStream(imageUrl, Kernel.ResourcePools.AppleTrailerImages, cancellationToken); - tasks.Add(imageTask); - } - - try - { - // Wait for both downloads to finish - await Task.WhenAll(tasks).ConfigureAwait(false); - } - catch (HttpException ex) - { - Logger.ErrorException("Error downloading trailer file or image", ex); - } - - var videoFailed = false; - var directoryEnsured = false; - - // Proces the video file task result - if (videoTask != null) - { - if (videoTask.Status == TaskStatus.RanToCompletion) - { - EnsureDirectory(folderPath); - - directoryEnsured = true; - - // Move the temp file to the final destination - try - { - File.Move(videoTask.Result, videoFilePath); - } - catch (IOException ex) - { - Logger.ErrorException("Error moving temp file", ex); - File.Delete(videoTask.Result); - videoFailed = true; - } - } - else - { - Logger.Info("Trailer download failed: " + trailer.TrailerUrl); - - // Don't bother with the image if the video download failed - videoFailed = true; - } - } - - // Process the image file task result - if (imageTask != null && !videoFailed && imageTask.Status == TaskStatus.RanToCompletion) - { - if (!directoryEnsured) - { - EnsureDirectory(folderPath); - } - - try - { - // Save the image to the file system - using (var fs = new FileStream(imageFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, StreamDefaults.DefaultFileStreamBufferSize, FileOptions.Asynchronous)) - { - using (var sourceStream = imageTask.Result) - { - await sourceStream.CopyToAsync(fs).ConfigureAwait(false); - } - } - } - catch (IOException ex) - { - Logger.ErrorException("Error saving image to file system", ex); - } - } - - // Save metadata only if the video was downloaded - if (!videoFailed && videoTask != null) - { - JsonSerializer.SerializeToFile(trailer.Video, Path.Combine(folderPath, "trailer.json")); - } - } - - /// - /// Determines whether [is old trailer] [the specified trailer]. - /// - /// The trailer. - /// true if [is old trailer] [the specified trailer]; otherwise, false. - private bool IsOldTrailer(Trailer trailer) - { - if (!Plugin.Instance.Configuration.MaxTrailerAge.HasValue) - { - return false; - } - - if (!trailer.PremiereDate.HasValue) - { - return false; - } - - var now = DateTime.UtcNow; - - // Not old if it still hasn't premiered. - if (now < trailer.PremiereDate.Value) - { - return false; - } - - return (DateTime.UtcNow - trailer.PremiereDate.Value).TotalDays > - Plugin.Instance.Configuration.MaxTrailerAge.Value; - } - - /// - /// Deletes trailers that are older than the supplied date - /// - private void DeleteOldTrailers() - { - var collectionFolder = (Folder)Kernel.RootFolder.Children.First(c => c.GetType().Name.Equals(typeof(TrailerCollectionFolder).Name)); - - foreach (var trailer in collectionFolder.RecursiveChildren.OfType().Where(IsOldTrailer)) - { - Logger.Info("Deleting old trailer: " + trailer.Name); - - Directory.Delete(Path.GetDirectoryName(trailer.Path), true); - } - } - - /// - /// Ensures the directory. - /// - /// The path. - private void EnsureDirectory(string path) - { - if (!Directory.Exists(path)) - { - Directory.CreateDirectory(path); - } - } - - /// - /// Gets the name of the task - /// - /// The name. - public override string Name - { - get { return "Find current trailers"; } - } - - /// - /// Gets the category. - /// - /// The category. - public override string Category - { - get - { - return "Trailers"; - } - } - - /// - /// Gets the description. - /// - /// The description. - public override string Description - { - get { return "Searches the web for upcoming movie trailers, and downloads them based on your Trailer plugin settings."; } - } - } -} diff --git a/MediaBrowser.Plugins.Trailers/TrailerInfo.cs b/MediaBrowser.Plugins.Trailers/TrailerInfo.cs deleted file mode 100644 index e3c661b67f..0000000000 --- a/MediaBrowser.Plugins.Trailers/TrailerInfo.cs +++ /dev/null @@ -1,45 +0,0 @@ -using MediaBrowser.Controller.Entities; -using System; - -namespace MediaBrowser.Plugins.Trailers -{ - /// - /// This is a stub class used to hold information about a trailer - /// - public class TrailerInfo - { - /// - /// Gets or sets the video. - /// - /// The video. - public Trailer Video { get; set; } - /// - /// Gets or sets the image URL. - /// - /// The image URL. - public string ImageUrl { get; set; } - /// - /// Gets or sets the hd image URL. - /// - /// The hd image URL. - public string HdImageUrl { get; set; } - /// - /// Gets or sets the trailer URL. - /// - /// The trailer URL. - public string TrailerUrl { get; set; } - /// - /// Gets or sets the post date. - /// - /// The post date. - public DateTime PostDate { get; set; } - - /// - /// Initializes a new instance of the class. - /// - public TrailerInfo() - { - Video = new Trailer(); - } - } -} diff --git a/MediaBrowser.UI.sln b/MediaBrowser.UI.sln index dc58dc0893..8b79d2c6bc 100644 --- a/MediaBrowser.UI.sln +++ b/MediaBrowser.UI.sln @@ -11,10 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.ApiInteraction EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Plugins.DefaultTheme", "MediaBrowser.Plugins.DefaultTheme\MediaBrowser.Plugins.DefaultTheme.csproj", "{6E892999-711D-4E24-8BAC-DACF5BFA783A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Plugins.MpcHc", "MediaBrowser.Plugins.MpcHc\MediaBrowser.Plugins.MpcHc.csproj", "{2E94BC08-A7A2-42DD-9893-EAA3DACD1CF9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Plugins.Tmt5", "MediaBrowser.Plugins.Tmt5\MediaBrowser.Plugins.Tmt5.csproj", "{BE9BAA85-9EF2-4308-92E4-0D2B6E33C487}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.UI.Uninstall", "MediaBrowser.UI.Uninstall\MediaBrowser.UI.Uninstall.csproj", "{E4BE0659-4084-407B-B8A8-67802331CC9E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.IsoMounter", "MediaBrowser.IsoMounter\MediaBrowser.IsoMounter.csproj", "{5356AE30-6A6E-4A64-81E3-F76C50595E64}" @@ -95,26 +91,6 @@ Global {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Release|Mixed Platforms.Build.0 = Release|Any CPU {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Release|x86.ActiveCfg = Release|Any CPU {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Release|x86.Build.0 = Release|Any CPU - {2E94BC08-A7A2-42DD-9893-EAA3DACD1CF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2E94BC08-A7A2-42DD-9893-EAA3DACD1CF9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2E94BC08-A7A2-42DD-9893-EAA3DACD1CF9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {2E94BC08-A7A2-42DD-9893-EAA3DACD1CF9}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {2E94BC08-A7A2-42DD-9893-EAA3DACD1CF9}.Debug|x86.ActiveCfg = Debug|Any CPU - {2E94BC08-A7A2-42DD-9893-EAA3DACD1CF9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2E94BC08-A7A2-42DD-9893-EAA3DACD1CF9}.Release|Any CPU.Build.0 = Release|Any CPU - {2E94BC08-A7A2-42DD-9893-EAA3DACD1CF9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {2E94BC08-A7A2-42DD-9893-EAA3DACD1CF9}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {2E94BC08-A7A2-42DD-9893-EAA3DACD1CF9}.Release|x86.ActiveCfg = Release|Any CPU - {BE9BAA85-9EF2-4308-92E4-0D2B6E33C487}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BE9BAA85-9EF2-4308-92E4-0D2B6E33C487}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BE9BAA85-9EF2-4308-92E4-0D2B6E33C487}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {BE9BAA85-9EF2-4308-92E4-0D2B6E33C487}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {BE9BAA85-9EF2-4308-92E4-0D2B6E33C487}.Debug|x86.ActiveCfg = Debug|Any CPU - {BE9BAA85-9EF2-4308-92E4-0D2B6E33C487}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BE9BAA85-9EF2-4308-92E4-0D2B6E33C487}.Release|Any CPU.Build.0 = Release|Any CPU - {BE9BAA85-9EF2-4308-92E4-0D2B6E33C487}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {BE9BAA85-9EF2-4308-92E4-0D2B6E33C487}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {BE9BAA85-9EF2-4308-92E4-0D2B6E33C487}.Release|x86.ActiveCfg = Release|Any CPU {E4BE0659-4084-407B-B8A8-67802331CC9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E4BE0659-4084-407B-B8A8-67802331CC9E}.Debug|Any CPU.Build.0 = Debug|Any CPU {E4BE0659-4084-407B-B8A8-67802331CC9E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU diff --git a/MediaBrowser.UI/Controller/PluginUpdater.cs b/MediaBrowser.UI/Controller/PluginUpdater.cs index c5673f2d49..e56b6f54f2 100644 --- a/MediaBrowser.UI/Controller/PluginUpdater.cs +++ b/MediaBrowser.UI/Controller/PluginUpdater.cs @@ -217,7 +217,7 @@ namespace MediaBrowser.UI.Controller _logger.Info("Downloading {0} Configuration", pluginInfo.Name); // First download to a MemoryStream. This way if the download is cut off, we won't be left with a partial file - using (var stream = await UIKernel.Instance.ApiClient.GetPluginConfigurationFileAsync(pluginInfo.UniqueId).ConfigureAwait(false)) + using (var stream = await UIKernel.Instance.ApiClient.GetPluginConfigurationFileAsync(pluginInfo.Id).ConfigureAwait(false)) { using (var memoryStream = new MemoryStream()) { diff --git a/MediaBrowser.UI/MediaBrowser.UI.csproj b/MediaBrowser.UI/MediaBrowser.UI.csproj index f25707afa5..798bf461ad 100644 --- a/MediaBrowser.UI/MediaBrowser.UI.csproj +++ b/MediaBrowser.UI/MediaBrowser.UI.csproj @@ -5,7 +5,7 @@ Debug AnyCPU {B5ECE1FB-618E-420B-9A99-8E972D76920A} - WinExe + Library Properties MediaBrowser.UI MediaBrowser.UI @@ -57,7 +57,8 @@ 4
- MediaBrowser.UI.App + + Resources\Images\Icon.ico diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index 41bde3c7f9..7bf5bbab7f 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -25,7 +25,7 @@ namespace MediaBrowser.WebDashboard.Api /// Class GetDashboardConfigurationPages ///
[Route("/dashboard/ConfigurationPages", "GET")] - public class GetDashboardConfigurationPages : IReturn> + public class GetDashboardConfigurationPages : IReturn> { /// /// Gets or sets the type of the page. @@ -38,7 +38,7 @@ namespace MediaBrowser.WebDashboard.Api /// Class GetDashboardConfigurationPage /// [Route("/dashboard/ConfigurationPage", "GET")] - public class GetDashboardConfigurationPage : IReturn + public class GetDashboardConfigurationPage : IReturn { /// /// Gets or sets the name. @@ -139,9 +139,8 @@ namespace MediaBrowser.WebDashboard.Api var kernel = (Kernel)Kernel; var page = kernel.PluginConfigurationPages.First(p => p.Name.Equals(request.Name, StringComparison.OrdinalIgnoreCase)); - var plugin = page.GetOwnerPlugin(); - return ToStaticResult(plugin.Version.ToString().GetMD5(), plugin.AssemblyDateLastModified, null, MimeTypes.GetMimeType("page.html"), () => ModifyHtml(page.GetHtmlStream())); + return ToStaticResult(page.Version.GetMD5(), page.DateLastModified, null, MimeTypes.GetMimeType("page.html"), () => ModifyHtml(page.GetHtmlStream())); } /// diff --git a/MediaBrowser.WebDashboard/Html/scripts/PluginUpdatesPage.js b/MediaBrowser.WebDashboard/Html/scripts/PluginUpdatesPage.js index 4edb08602b..a89169c53b 100644 --- a/MediaBrowser.WebDashboard/Html/scripts/PluginUpdatesPage.js +++ b/MediaBrowser.WebDashboard/Html/scripts/PluginUpdatesPage.js @@ -41,7 +41,7 @@ var options = PluginUpdatesPage.getHtmlOptions(["Off", "On"], (plugin.EnableAutoUpdate ? "On" : "Off")); html += ""; - html += ""; + html += ""; html += ""; fieldId = "liPluginUpdateFieldb" + fieldIndex; @@ -49,7 +49,7 @@ options = PluginUpdatesPage.getHtmlOptions(["Release", "Beta", "Dev"], plugin.UpdateClass); html += ""; - html += ""; + html += ""; html += ""; html += ""; @@ -79,7 +79,7 @@ setAutoUpdate: function (select) { - var id = $(select).attr('data-uniqueid'); + var id = $(select).attr('data-id'); Dashboard.showLoadingMsg(); @@ -93,7 +93,7 @@ setUpdateClass: function (select) { - var id = $(select).attr('data-uniqueid'); + var id = $(select).attr('data-id'); Dashboard.showLoadingMsg(); diff --git a/MediaBrowser.WebDashboard/Html/scripts/PluginsPage.js b/MediaBrowser.WebDashboard/Html/scripts/PluginsPage.js index f7e05e4bac..e9098427dd 100644 --- a/MediaBrowser.WebDashboard/Html/scripts/PluginsPage.js +++ b/MediaBrowser.WebDashboard/Html/scripts/PluginsPage.js @@ -40,7 +40,7 @@ } var configPage = $.grep(pluginConfigurationPages, function (pluginConfigurationPage) { - return pluginConfigurationPage.OwnerPluginName == plugin.Name; + return pluginConfigurationPage.PluginId == plugin.Id; })[0]; html += "
  • "; @@ -56,7 +56,7 @@ html += ""; if (!plugin.IsCorePlugin) { - html += "Delete"; + html += "Delete"; } html += "
  • "; @@ -70,7 +70,7 @@ deletePlugin: function (link) { var name = link.getAttribute('data-pluginname'); - var uniqueid = link.getAttribute('data-uniqueid'); + var uniqueid = link.getAttribute('data-id'); var msg = "Are you sure you wish to uninstall " + name + "?"; diff --git a/MediaBrowser.sln b/MediaBrowser.sln index 27b0f81b50..902792c2e9 100644 --- a/MediaBrowser.sln +++ b/MediaBrowser.sln @@ -20,8 +20,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Performance19.psess = Performance19.psess EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Plugins.Trailers", "MediaBrowser.Plugins.Trailers\MediaBrowser.Plugins.Trailers.csproj", "{2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.ApiInteraction.Javascript", "MediaBrowser.ApiInteraction.Javascript\MediaBrowser.ApiInteraction.Javascript.csproj", "{767B536E-D90C-4D74-A14B-8564B16F3499}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.ApiInteraction", "MediaBrowser.ApiInteraction\MediaBrowser.ApiInteraction.csproj", "{921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}" @@ -41,8 +39,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BDInfo", "BDInfo\BDInfo.csp EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.IsoMounter", "MediaBrowser.IsoMounter\MediaBrowser.IsoMounter.csproj", "{5356AE30-6A6E-4A64-81E3-F76C50595E64}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Plugins.Dlna", "MediaBrowser.Plugins.Dlna\MediaBrowser.Plugins.Dlna.csproj", "{A2CF4266-2110-419E-8620-E2FEEFCA0F48}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Installer", "MediaBrowser.Installer\MediaBrowser.Installer.csproj", "{3879F78A-D6F6-45E5-B2A8-D8DCF2DABB74}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Server.Sqlite", "MediaBrowser.Server.Sqlite\MediaBrowser.Server.Sqlite.csproj", "{8649ED6B-8504-4D00-BFA5-B8C73CC744DB}" @@ -163,21 +159,6 @@ Global {5624B7B5-B5A7-41D8-9F10-CC5611109619}.Release|x64.ActiveCfg = Release|Any CPU {5624B7B5-B5A7-41D8-9F10-CC5611109619}.Release|x86.ActiveCfg = Release|Any CPU {5624B7B5-B5A7-41D8-9F10-CC5611109619}.Release|x86.Build.0 = Release|Any CPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}.Debug|Win32.ActiveCfg = Debug|Any CPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}.Debug|x64.ActiveCfg = Debug|Any CPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}.Debug|x86.ActiveCfg = Debug|Any CPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}.Debug|x86.Build.0 = Debug|Any CPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}.Release|Any CPU.Build.0 = Release|Any CPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}.Release|Win32.ActiveCfg = Release|Any CPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}.Release|x64.ActiveCfg = Release|Any CPU - {2F4C01E2-7C9F-4F08-922E-27AC4A1D53FF}.Release|x86.ActiveCfg = Release|Any CPU {767B536E-D90C-4D74-A14B-8564B16F3499}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {767B536E-D90C-4D74-A14B-8564B16F3499}.Debug|Any CPU.Build.0 = Debug|Any CPU {767B536E-D90C-4D74-A14B-8564B16F3499}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -267,20 +248,6 @@ Global {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|Win32.ActiveCfg = Release|Any CPU {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|x64.ActiveCfg = Release|Any CPU {5356AE30-6A6E-4A64-81E3-F76C50595E64}.Release|x86.ActiveCfg = Release|Any CPU - {A2CF4266-2110-419E-8620-E2FEEFCA0F48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A2CF4266-2110-419E-8620-E2FEEFCA0F48}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A2CF4266-2110-419E-8620-E2FEEFCA0F48}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {A2CF4266-2110-419E-8620-E2FEEFCA0F48}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {A2CF4266-2110-419E-8620-E2FEEFCA0F48}.Debug|Win32.ActiveCfg = Debug|Any CPU - {A2CF4266-2110-419E-8620-E2FEEFCA0F48}.Debug|x64.ActiveCfg = Debug|Any CPU - {A2CF4266-2110-419E-8620-E2FEEFCA0F48}.Debug|x86.ActiveCfg = Debug|Any CPU - {A2CF4266-2110-419E-8620-E2FEEFCA0F48}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A2CF4266-2110-419E-8620-E2FEEFCA0F48}.Release|Any CPU.Build.0 = Release|Any CPU - {A2CF4266-2110-419E-8620-E2FEEFCA0F48}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {A2CF4266-2110-419E-8620-E2FEEFCA0F48}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {A2CF4266-2110-419E-8620-E2FEEFCA0F48}.Release|Win32.ActiveCfg = Release|Any CPU - {A2CF4266-2110-419E-8620-E2FEEFCA0F48}.Release|x64.ActiveCfg = Release|Any CPU - {A2CF4266-2110-419E-8620-E2FEEFCA0F48}.Release|x86.ActiveCfg = Release|Any CPU {3879F78A-D6F6-45E5-B2A8-D8DCF2DABB74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3879F78A-D6F6-45E5-B2A8-D8DCF2DABB74}.Debug|Any CPU.Build.0 = Debug|Any CPU {3879F78A-D6F6-45E5-B2A8-D8DCF2DABB74}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU diff --git a/Nuget/MediaBrowser.Server.Core.nupkg.REMOVED.git-id b/Nuget/MediaBrowser.Server.Core.nupkg.REMOVED.git-id new file mode 100644 index 0000000000..a2490601ef --- /dev/null +++ b/Nuget/MediaBrowser.Server.Core.nupkg.REMOVED.git-id @@ -0,0 +1 @@ +da3d30d634468465d8995ba6cb1c0872959b3e9c \ No newline at end of file