2012-07-24 16:54:34 +02:00
|
|
|
|
using System;
|
|
|
|
|
using MediaBrowser.Common.Plugins;
|
2012-07-12 08:55:27 +02:00
|
|
|
|
using MediaBrowser.Controller;
|
|
|
|
|
using MediaBrowser.Controller.Events;
|
2012-07-24 16:54:34 +02:00
|
|
|
|
using MediaBrowser.Model.Plugins;
|
2012-07-12 08:55:27 +02:00
|
|
|
|
using MediaBrowser.TV.Entities;
|
|
|
|
|
using MediaBrowser.TV.Resolvers;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.TV
|
|
|
|
|
{
|
2012-07-24 16:54:34 +02:00
|
|
|
|
public class Plugin : BaseGenericPlugin<BasePluginConfiguration>
|
2012-07-12 08:55:27 +02:00
|
|
|
|
{
|
2012-07-24 16:54:34 +02:00
|
|
|
|
public override string Name
|
|
|
|
|
{
|
|
|
|
|
get { return "TV"; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void InitInServer()
|
2012-07-12 08:55:27 +02:00
|
|
|
|
{
|
|
|
|
|
Kernel.Instance.AddBaseItemType<Series, SeriesResolver>();
|
|
|
|
|
Kernel.Instance.AddBaseItemType<Season, SeasonResolver>();
|
|
|
|
|
Kernel.Instance.AddBaseItemType<Episode, EpisodeResolver>();
|
|
|
|
|
|
|
|
|
|
Kernel.Instance.ItemController.PreBeginResolvePath += ItemController_PreBeginResolvePath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ItemController_PreBeginResolvePath(object sender, PreBeginResolveEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (e.IsFolder && System.IO.Path.GetFileName(e.Path).Equals("metadata", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
if (e.Parent is Season || e.Parent is Series)
|
|
|
|
|
{
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|