mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-12-27 18:06:43 +00:00
Added new api handlers to get plugin information
This commit is contained in:
parent
6c7175e33d
commit
84af205572
|
@ -1,101 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using MediaBrowser.Common.Net.Handlers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Api.HttpHandlers
|
||||
{
|
||||
class MediaHandler : BaseHandler
|
||||
{
|
||||
private string _MediaPath = string.Empty;
|
||||
private string MediaPath
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_MediaPath))
|
||||
{
|
||||
_MediaPath = GetMediaPath();
|
||||
}
|
||||
|
||||
return _MediaPath;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetMediaPath()
|
||||
{
|
||||
string path = QueryString["path"] ?? string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
BaseItem item = ApiService.GetItemById(QueryString["id"]);
|
||||
|
||||
return item.Path;
|
||||
}
|
||||
|
||||
public override bool GzipResponse
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ContentType
|
||||
{
|
||||
get
|
||||
{
|
||||
// http://www.codingcereal.com/2011/10/an-array-of-45-video-mime-types/
|
||||
|
||||
string extension = Path.GetExtension(MediaPath);
|
||||
|
||||
if (extension.EndsWith("mkv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/x-matroska";
|
||||
}
|
||||
else if (extension.EndsWith("avi", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/avi";
|
||||
}
|
||||
else if (extension.EndsWith("wmv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/wmv";
|
||||
}
|
||||
else if (extension.EndsWith("m4v", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/m4v";
|
||||
}
|
||||
else if (extension.EndsWith("flv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/flv";
|
||||
}
|
||||
else if (extension.EndsWith("mov", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/quicktime";
|
||||
}
|
||||
else if (extension.EndsWith("mp4", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "video/mp4";
|
||||
}
|
||||
|
||||
return "video/x-matroska";
|
||||
}
|
||||
}
|
||||
|
||||
protected override void WriteResponseToOutputStream(Stream stream)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (Stream input = File.OpenRead(MediaPath))
|
||||
{
|
||||
input.CopyTo(stream);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
19
MediaBrowser.Api/HttpHandlers/PluginConfigurationHandler.cs
Normal file
19
MediaBrowser.Api/HttpHandlers/PluginConfigurationHandler.cs
Normal file
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Controller;
|
||||
|
||||
namespace MediaBrowser.Api.HttpHandlers
|
||||
{
|
||||
public class PluginConfigurationHandler : JsonHandler
|
||||
{
|
||||
protected override object ObjectToSerialize
|
||||
{
|
||||
get
|
||||
{
|
||||
string pluginName = QueryString["name"];
|
||||
|
||||
return Kernel.Instance.PluginController.Plugins.First(p => p.Name.Equals(pluginName, StringComparison.OrdinalIgnoreCase)).Configuration;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
MediaBrowser.Api/HttpHandlers/PluginsHandler.cs
Normal file
37
MediaBrowser.Api/HttpHandlers/PluginsHandler.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System.Linq;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Model.Plugins;
|
||||
|
||||
namespace MediaBrowser.Api.HttpHandlers
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides information about installed plugins
|
||||
/// </summary>
|
||||
public class PluginsHandler : JsonHandler
|
||||
{
|
||||
protected override object ObjectToSerialize
|
||||
{
|
||||
get
|
||||
{
|
||||
var plugins = Kernel.Instance.PluginController.Plugins.Select(p =>
|
||||
{
|
||||
return new PluginInfo()
|
||||
{
|
||||
Path = p.Path,
|
||||
Name = p.Name,
|
||||
Enabled = p.Enabled,
|
||||
DownloadToUI = p.DownloadToUI,
|
||||
Version = p.Version
|
||||
};
|
||||
});
|
||||
|
||||
if (QueryString["uionly"] == "1")
|
||||
{
|
||||
plugins = plugins.Where(p => p.DownloadToUI);
|
||||
}
|
||||
|
||||
return plugins;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -54,13 +54,14 @@
|
|||
<Compile Include="HttpHandlers\ItemListHandler.cs" />
|
||||
<Compile Include="HttpHandlers\JsonHandler.cs" />
|
||||
<Compile Include="HttpHandlers\PersonHandler.cs" />
|
||||
<Compile Include="HttpHandlers\PluginConfigurationHandler.cs" />
|
||||
<Compile Include="HttpHandlers\PluginsHandler.cs" />
|
||||
<Compile Include="HttpHandlers\RecentlyAddedItemsHandler.cs" />
|
||||
<Compile Include="HttpHandlers\StudioHandler.cs" />
|
||||
<Compile Include="HttpHandlers\StudiosHandler.cs" />
|
||||
<Compile Include="HttpHandlers\UserConfigurationHandler.cs" />
|
||||
<Compile Include="HttpHandlers\UsersHandler.cs" />
|
||||
<Compile Include="ImageProcessor.cs" />
|
||||
<Compile Include="HttpHandlers\MediaHandler.cs" />
|
||||
<Compile Include="Plugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -5,12 +5,18 @@ using MediaBrowser.Common.Net;
|
|||
using MediaBrowser.Common.Net.Handlers;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Model.Plugins;
|
||||
|
||||
namespace MediaBrowser.Api
|
||||
{
|
||||
public class Plugin : BasePlugin<BasePluginConfiguration>
|
||||
public class Plugin : BaseGenericPlugin<BasePluginConfiguration>
|
||||
{
|
||||
protected override void InitInternal()
|
||||
public override string Name
|
||||
{
|
||||
get { return "WebAPI"; }
|
||||
}
|
||||
|
||||
public override void InitInServer()
|
||||
{
|
||||
var httpServer = Kernel.Instance.HttpServer;
|
||||
|
||||
|
@ -43,10 +49,6 @@ namespace MediaBrowser.Api
|
|||
{
|
||||
handler = new UsersHandler();
|
||||
}
|
||||
else if (localPath.EndsWith("/api/media", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
handler = new MediaHandler();
|
||||
}
|
||||
else if (localPath.EndsWith("/api/genre", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
handler = new GenreHandler();
|
||||
|
@ -75,6 +77,14 @@ namespace MediaBrowser.Api
|
|||
{
|
||||
handler = new UserConfigurationHandler();
|
||||
}
|
||||
else if (localPath.EndsWith("/api/plugins", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
handler = new PluginsHandler();
|
||||
}
|
||||
else if (localPath.EndsWith("/api/pluginconfiguration", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
handler = new PluginConfigurationHandler();
|
||||
}
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// 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.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="Configuration\BaseConfiguration.cs" />
|
||||
<Compile Include="Configuration\ConfigurationController.cs" />
|
||||
<Compile Include="Configuration\UserConfiguration.cs" />
|
||||
<Compile Include="Events\GenericItemEventArgs.cs" />
|
||||
<Compile Include="Json\JsonSerializer.cs" />
|
||||
<Compile Include="Kernel\BaseKernel.cs" />
|
||||
|
@ -63,7 +62,6 @@
|
|||
<Compile Include="Net\Request.cs" />
|
||||
<Compile Include="Net\RequestContext.cs" />
|
||||
<Compile Include="Net\StreamExtensions.cs" />
|
||||
<Compile Include="Plugins\BasePluginConfiguration.cs" />
|
||||
<Compile Include="Logging\BaseLogger.cs" />
|
||||
<Compile Include="Logging\FileLogger.cs" />
|
||||
<Compile Include="Logging\Logger.cs" />
|
||||
|
|
|
@ -1,49 +1,97 @@
|
|||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
using MediaBrowser.Common.Json;
|
||||
using MediaBrowser.Model.Plugins;
|
||||
|
||||
namespace MediaBrowser.Common.Plugins
|
||||
{
|
||||
public abstract class BasePlugin<TConfigurationType> : IPlugin
|
||||
/// <summary>
|
||||
/// Provides a BasePlugin with generics, allowing for strongly typed configuration access.
|
||||
/// </summary>
|
||||
public abstract class BaseGenericPlugin<TConfigurationType> : BasePlugin
|
||||
where TConfigurationType : BasePluginConfiguration, new()
|
||||
{
|
||||
public string Path { get; set; }
|
||||
public TConfigurationType Configuration { get; private set; }
|
||||
public new TConfigurationType Configuration
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Configuration as TConfigurationType;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Configuration = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string ConfigurationPath
|
||||
public override void ReloadConfiguration()
|
||||
{
|
||||
if (!File.Exists(ConfigurationPath))
|
||||
{
|
||||
Configuration = new TConfigurationType();
|
||||
}
|
||||
else
|
||||
{
|
||||
Configuration = JsonSerializer.DeserializeFromFile<TConfigurationType>(ConfigurationPath);
|
||||
Configuration.DateLastModified = File.GetLastWriteTime(ConfigurationPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides a common base class for all plugins
|
||||
/// </summary>
|
||||
public abstract class BasePlugin
|
||||
{
|
||||
public abstract string Name { get; }
|
||||
public string Path { get; set; }
|
||||
public Version Version { get; set; }
|
||||
|
||||
public BasePluginConfiguration Configuration { get; protected set; }
|
||||
|
||||
protected string ConfigurationPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return System.IO.Path.Combine(Path, "config.js");
|
||||
}
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
Configuration = GetConfiguration();
|
||||
|
||||
if (Configuration.Enabled)
|
||||
public bool Enabled
|
||||
{
|
||||
get
|
||||
{
|
||||
InitInternal();
|
||||
return Configuration.Enabled;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void InitInternal();
|
||||
|
||||
private TConfigurationType GetConfiguration()
|
||||
public DateTime ConfigurationDateLastModified
|
||||
{
|
||||
if (!File.Exists(ConfigurationPath))
|
||||
get
|
||||
{
|
||||
return new TConfigurationType();
|
||||
return Configuration.DateLastModified;
|
||||
}
|
||||
|
||||
return JsonSerializer.DeserializeFromFile<TConfigurationType>(ConfigurationPath);
|
||||
}
|
||||
}
|
||||
|
||||
public interface IPlugin
|
||||
{
|
||||
string Path { get; set; }
|
||||
/// <summary>
|
||||
/// Returns true or false indicating if the plugin should be downloaded and run within the UI.
|
||||
/// </summary>
|
||||
public virtual bool DownloadToUI
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void ReloadConfiguration();
|
||||
|
||||
public virtual void InitInServer()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void InitInUI()
|
||||
{
|
||||
}
|
||||
|
||||
void Init();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
|
||||
namespace MediaBrowser.Common.Plugins
|
||||
{
|
||||
public class BasePluginConfiguration
|
||||
{
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
public BasePluginConfiguration()
|
||||
{
|
||||
Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ namespace MediaBrowser.Common.Plugins
|
|||
/// <summary>
|
||||
/// Gets the list of currently loaded plugins
|
||||
/// </summary>
|
||||
public IEnumerable<IPlugin> Plugins { get; private set; }
|
||||
public IEnumerable<BasePlugin> Plugins { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the controller
|
||||
|
@ -32,7 +32,21 @@ namespace MediaBrowser.Common.Plugins
|
|||
|
||||
Parallel.For(0, Plugins.Count(), i =>
|
||||
{
|
||||
Plugins.ElementAt(i).Init();
|
||||
var plugin = Plugins.ElementAt(i);
|
||||
|
||||
plugin.ReloadConfiguration();
|
||||
|
||||
if (plugin.Enabled)
|
||||
{
|
||||
if (context == KernelContext.Server)
|
||||
{
|
||||
plugin.InitInServer();
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.InitInUI();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -40,18 +54,18 @@ namespace MediaBrowser.Common.Plugins
|
|||
/// Gets all plugins within PluginsPath
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private IEnumerable<IPlugin> GetAllPlugins()
|
||||
private IEnumerable<BasePlugin> GetAllPlugins()
|
||||
{
|
||||
if (!Directory.Exists(PluginsPath))
|
||||
{
|
||||
Directory.CreateDirectory(PluginsPath);
|
||||
}
|
||||
|
||||
List<IPlugin> plugins = new List<IPlugin>();
|
||||
List<BasePlugin> plugins = new List<BasePlugin>();
|
||||
|
||||
foreach (string folder in Directory.GetDirectories(PluginsPath, "*", SearchOption.TopDirectoryOnly))
|
||||
{
|
||||
IPlugin plugin = GetPluginFromDirectory(folder);
|
||||
BasePlugin plugin = GetPluginFromDirectory(folder);
|
||||
|
||||
plugin.Path = folder;
|
||||
|
||||
|
@ -64,7 +78,7 @@ namespace MediaBrowser.Common.Plugins
|
|||
return plugins;
|
||||
}
|
||||
|
||||
private IPlugin GetPluginFromDirectory(string path)
|
||||
private BasePlugin GetPluginFromDirectory(string path)
|
||||
{
|
||||
string dll = Directory.GetFiles(path, "*.dll", SearchOption.TopDirectoryOnly).FirstOrDefault();
|
||||
|
||||
|
@ -76,18 +90,22 @@ namespace MediaBrowser.Common.Plugins
|
|||
return null;
|
||||
}
|
||||
|
||||
private IPlugin GetPluginFromDll(string path)
|
||||
private BasePlugin GetPluginFromDll(string path)
|
||||
{
|
||||
return GetPluginFromDll(Assembly.Load(File.ReadAllBytes(path)));
|
||||
}
|
||||
|
||||
private IPlugin GetPluginFromDll(Assembly assembly)
|
||||
private BasePlugin GetPluginFromDll(Assembly assembly)
|
||||
{
|
||||
var plugin = assembly.GetTypes().Where(type => typeof(IPlugin).IsAssignableFrom(type)).FirstOrDefault();
|
||||
var plugin = assembly.GetTypes().Where(type => typeof(BasePlugin).IsAssignableFrom(type)).FirstOrDefault();
|
||||
|
||||
if (plugin != null)
|
||||
{
|
||||
return plugin.GetConstructor(Type.EmptyTypes).Invoke(null) as IPlugin;
|
||||
BasePlugin instance = plugin.GetConstructor(Type.EmptyTypes).Invoke(null) as BasePlugin;
|
||||
|
||||
instance.Version = assembly.GetName().Version;
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -55,6 +55,10 @@
|
|||
<Project>{17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2}</Project>
|
||||
<Name>MediaBrowser.Controller</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
|
||||
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
|
||||
<Name>MediaBrowser.Model</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Model.Plugins;
|
||||
|
||||
namespace MediaBrowser.Configuration
|
||||
{
|
||||
public class Plugin : BasePlugin<BasePluginConfiguration>
|
||||
public class Plugin : BaseGenericPlugin<BasePluginConfiguration>
|
||||
{
|
||||
protected override void InitInternal()
|
||||
public override string Name
|
||||
{
|
||||
get { return "Web-based Configuration"; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// 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.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
|
||||
namespace MediaBrowser.Controller.Configuration
|
||||
{
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
|
||||
namespace MediaBrowser.Controller.Configuration
|
||||
{
|
||||
|
|
|
@ -5,13 +5,13 @@ using System.Linq;
|
|||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Events;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Users;
|
||||
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
using System;
|
||||
using System.Reactive.Linq;
|
||||
using MediaBrowser.Common.Net.Handlers;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.HtmlBrowser.Handlers;
|
||||
using MediaBrowser.Model.Plugins;
|
||||
|
||||
namespace MediaBrowser.HtmlBrowser
|
||||
{
|
||||
public class Plugin : BasePlugin<BasePluginConfiguration>
|
||||
public class Plugin : BaseGenericPlugin<BasePluginConfiguration>
|
||||
{
|
||||
protected override void InitInternal()
|
||||
public override string Name
|
||||
{
|
||||
get { return "Html Library Browser"; }
|
||||
}
|
||||
|
||||
public override void InitInServer()
|
||||
{
|
||||
var httpServer = Kernel.Instance.HttpServer;
|
||||
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// 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.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
|
@ -52,6 +52,10 @@
|
|||
<Project>{17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2}</Project>
|
||||
<Name>MediaBrowser.Controller</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
|
||||
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
|
||||
<Name>MediaBrowser.Model</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.Movies\MediaBrowser.Movies.csproj">
|
||||
<Project>{92b9f802-4415-438f-90e1-44602135ea41}</Project>
|
||||
<Name>MediaBrowser.Movies</Name>
|
||||
|
|
|
@ -2,9 +2,14 @@
|
|||
|
||||
namespace MediaBrowser.InternetProviders
|
||||
{
|
||||
public class Plugin : BasePlugin<PluginConfiguration>
|
||||
public class Plugin : BaseGenericPlugin<PluginConfiguration>
|
||||
{
|
||||
protected override void InitInternal()
|
||||
public override string Name
|
||||
{
|
||||
get { return "Internet Providers"; }
|
||||
}
|
||||
|
||||
public override void InitInServer()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Model.Plugins;
|
||||
|
||||
namespace MediaBrowser.InternetProviders
|
||||
{
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// 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.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.Configuration
|
||||
|
||||
namespace MediaBrowser.Model.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// This holds settings that can be personalized on a per-user, per-device basis.
|
|
@ -35,6 +35,7 @@
|
|||
<!-- A reference to the entire .NET Framework is automatically included -->
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Configuration\UserConfiguration.cs" />
|
||||
<Compile Include="Entities\ApiBaseItem.cs" />
|
||||
<Compile Include="Entities\Audio.cs" />
|
||||
<Compile Include="Entities\BaseItem.cs" />
|
||||
|
@ -45,6 +46,8 @@
|
|||
<Compile Include="Entities\Studio.cs" />
|
||||
<Compile Include="Entities\Video.cs" />
|
||||
<Compile Include="Entities\Year.cs" />
|
||||
<Compile Include="Plugins\BasePluginConfiguration.cs" />
|
||||
<Compile Include="Plugins\PluginInfo.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Users\User.cs" />
|
||||
<Compile Include="Users\UserItemData.cs" />
|
||||
|
|
18
MediaBrowser.Model/Plugins/BasePluginConfiguration.cs
Normal file
18
MediaBrowser.Model/Plugins/BasePluginConfiguration.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace MediaBrowser.Model.Plugins
|
||||
{
|
||||
public class BasePluginConfiguration
|
||||
{
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public DateTime DateLastModified { get; set; }
|
||||
|
||||
public BasePluginConfiguration()
|
||||
{
|
||||
Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
17
MediaBrowser.Model/Plugins/PluginInfo.cs
Normal file
17
MediaBrowser.Model/Plugins/PluginInfo.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.Plugins
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a serializable stub class that is used by the api to provide information about installed plugins.
|
||||
/// </summary>
|
||||
public class PluginInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Path { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public bool DownloadToUI { get; set; }
|
||||
public DateTime ConfigurationDateLastModified { get; set; }
|
||||
public Version Version { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,13 +1,19 @@
|
|||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Model.Plugins;
|
||||
using MediaBrowser.Movies.Entities;
|
||||
using MediaBrowser.Movies.Resolvers;
|
||||
|
||||
namespace MediaBrowser.Movies
|
||||
{
|
||||
public class Plugin : BasePlugin<BasePluginConfiguration>
|
||||
public class Plugin : BaseGenericPlugin<BasePluginConfiguration>
|
||||
{
|
||||
protected override void InitInternal()
|
||||
public override string Name
|
||||
{
|
||||
get { return "Movies"; }
|
||||
}
|
||||
|
||||
public override void InitInServer()
|
||||
{
|
||||
Kernel.Instance.AddBaseItemType<BoxSet, BoxSetResolver>();
|
||||
Kernel.Instance.AddBaseItemType<Movie, MovieResolver>();
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// 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.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
using MediaBrowser.Common.Plugins;
|
||||
using System;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Events;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Plugins;
|
||||
using MediaBrowser.TV.Entities;
|
||||
using MediaBrowser.TV.Resolvers;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.TV
|
||||
{
|
||||
public class Plugin : BasePlugin<BasePluginConfiguration>
|
||||
public class Plugin : BaseGenericPlugin<BasePluginConfiguration>
|
||||
{
|
||||
protected override void InitInternal()
|
||||
public override string Name
|
||||
{
|
||||
get { return "TV"; }
|
||||
}
|
||||
|
||||
public override void InitInServer()
|
||||
{
|
||||
Kernel.Instance.AddBaseItemType<Series, SeriesResolver>();
|
||||
Kernel.Instance.AddBaseItemType<Season, SeasonResolver>();
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// 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.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
Loading…
Reference in a new issue