2012-07-24 14:54:34 +00:00
|
|
|
|
using System;
|
2012-07-26 02:33:11 +00:00
|
|
|
|
using System.ComponentModel.Composition;
|
2012-07-24 14:54:34 +00:00
|
|
|
|
using MediaBrowser.Common.Plugins;
|
2012-07-12 06:55:27 +00:00
|
|
|
|
using MediaBrowser.Controller;
|
2012-08-23 20:51:10 +00:00
|
|
|
|
using MediaBrowser.Controller.Library;
|
2012-07-24 14:54:34 +00:00
|
|
|
|
using MediaBrowser.Model.Plugins;
|
2012-07-12 06:55:27 +00:00
|
|
|
|
using MediaBrowser.TV.Entities;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.TV
|
|
|
|
|
{
|
2012-07-26 02:33:11 +00:00
|
|
|
|
[Export(typeof(BasePlugin))]
|
2012-07-24 14:54:34 +00:00
|
|
|
|
public class Plugin : BaseGenericPlugin<BasePluginConfiguration>
|
2012-07-12 06:55:27 +00:00
|
|
|
|
{
|
2012-07-24 14:54:34 +00:00
|
|
|
|
public override string Name
|
|
|
|
|
{
|
|
|
|
|
get { return "TV"; }
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-06 14:18:54 +00:00
|
|
|
|
protected override void InitializeOnServer()
|
2012-07-12 06:55:27 +00:00
|
|
|
|
{
|
|
|
|
|
Kernel.Instance.ItemController.PreBeginResolvePath += ItemController_PreBeginResolvePath;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-06 14:18:54 +00:00
|
|
|
|
protected override void DisposeOnServer()
|
2012-07-29 15:19:25 +00:00
|
|
|
|
{
|
|
|
|
|
Kernel.Instance.ItemController.PreBeginResolvePath -= ItemController_PreBeginResolvePath;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-12 06:55:27 +00:00
|
|
|
|
void ItemController_PreBeginResolvePath(object sender, PreBeginResolveEventArgs e)
|
|
|
|
|
{
|
2012-08-23 18:35:44 +00:00
|
|
|
|
// Don't try and resolve files with the metadata folder
|
2012-08-21 14:42:40 +00:00
|
|
|
|
if (System.IO.Path.GetFileName(e.Path).Equals("metadata", StringComparison.OrdinalIgnoreCase) && e.IsDirectory)
|
2012-07-12 06:55:27 +00:00
|
|
|
|
{
|
|
|
|
|
if (e.Parent is Season || e.Parent is Series)
|
|
|
|
|
{
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|