Exemple #1
0
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration<PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();

            kernel.MetadataProviderFactories.Add(new MetadataProviderFactory(typeof(DvrmsMetadataProvider)));

            Logger.ReportInfo(Name + " (version " + Version + ") Loaded.");
        }
Exemple #2
0
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration <PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();

            kernel.MetadataProviderFactories.Add(new MetadataProviderFactory(typeof(DvrmsMetadataProvider)));

            Logger.ReportInfo(Name + " (version " + Version + ") Loaded.");
        }
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration<PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();

            var trailers = kernel.ItemRepository.RetrieveItem(TrailersGuid) ?? new ITunesTrailerFolder();
            trailers.Path = "";
            trailers.Id = TrailersGuid;
            kernel.RootFolder.AddVirtualChild(trailers);
        }
Exemple #4
0
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration <PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();

            var trailers = kernel.ItemRepository.RetrieveItem(TrailersGuid) ?? new ITunesTrailerFolder();

            trailers.Path = "";
            trailers.Id   = TrailersGuid;
            kernel.RootFolder.AddVirtualChild(trailers);
        }
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration<PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();

            FilmTrailerFolder trailers = (FilmTrailerFolder)kernel.ItemRepository.RetrieveItem(TrailersGuid) ?? new FilmTrailerFolder();
            trailers.Path = "";
            trailers.Id = TrailersGuid;

            kernel.RootFolder.AddVirtualChild(trailers);
            Logger.ReportInfo("Film Trailer Plug-in (version " + Version + ") Loaded.  Using feed from " + Plugin.PluginOptions.Instance.TrailerSource + " (" + trailers.Feed + ")");
        }
Exemple #6
0
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration <PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();

            FilmTrailerFolder trailers = (FilmTrailerFolder)kernel.ItemRepository.RetrieveItem(TrailersGuid) ?? new FilmTrailerFolder();

            trailers.Path = "";
            trailers.Id   = TrailersGuid;

            kernel.RootFolder.AddVirtualChild(trailers);
            Logger.ReportInfo("Film Trailer Plug-in (version " + Version + ") Loaded.  Using feed from " + Plugin.PluginOptions.Instance.TrailerSource + " (" + trailers.Feed + ")");
        }
Exemple #7
0
        /// <summary>
        /// Initializes the plugin
        /// </summary>
        /// <param name="kernel"></param>
        public override void Init(Kernel kernel)
        {
            kernel.MetadataProviderFactories.Add(MetadataProviderFactory.Get <SubtitleProvider>());

            PluginOptions = new PluginConfiguration <PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();

            var isMc = AppDomain.CurrentDomain.FriendlyName.Contains("ehExtHost");

            if (isMc) //only do this inside of MediaCenter as menus can only be created inside MediaCenter
            {
                SubtitleMenuManager.CreateMenu(kernel);
            }
        }
Exemple #8
0
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration <PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();
            Logger.ReportInfo("MBWeb (version " + Version + ") Plug-in loaded.");

            server = new Server();
            server.Add(HttpServer.HttpListener.Create(IPAddress.Any, 9999));
            var module = new TinyWebModule();

            module.MapPath("/", "/index.html");
            server.Add(module);

            server.Start(5);
        }
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration<PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();
            if (PluginOptions.Instance.ClearBadFiles)
            {
                foreach (var badFile in PluginOptions.Instance.BadFiles)
                {
                    if (!PluginOptions.Instance.FormerBadFiles.Contains(badFile)) PluginOptions.Instance.FormerBadFiles.Add(badFile);
                }
                PluginOptions.Instance.BadFiles.Clear();
                PluginOptions.Instance.ClearBadFiles = false;
                PluginOptions.Save();
            }

            int.TryParse(PluginOptions.Instance.ServiceTimeout, out ServiceTimeout);
            kernel.MetadataProviderFactories.Add(MetadataProviderFactory.Get<MediaInfoProvider>());
        }
Exemple #10
0
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration <PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();

            EnsureMtnIsExtracted();

            kernel.MetadataProviderFactories.Add(new MetadataProviderFactory(typeof(FrameGrabProvider)));

            kernel.ImageResolvers.Add((path, canBeProcessed, item) =>
            {
                if (path.ToLower().StartsWith("mtn"))
                {
                    return(new GrabImage());
                }
                return(null);
            });
            Logger.ReportInfo(Name + " (version " + Version + ") Loaded.");
        }
Exemple #11
0
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration <PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();
            if (PluginOptions.Instance.ClearBadFiles)
            {
                foreach (var badFile in PluginOptions.Instance.BadFiles)
                {
                    if (!PluginOptions.Instance.FormerBadFiles.Contains(badFile))
                    {
                        PluginOptions.Instance.FormerBadFiles.Add(badFile);
                    }
                }
                PluginOptions.Instance.BadFiles.Clear();
                PluginOptions.Instance.ClearBadFiles = false;
                PluginOptions.Save();
            }

            int.TryParse(PluginOptions.Instance.ServiceTimeout, out ServiceTimeout);
            kernel.MetadataProviderFactories.Add(MetadataProviderFactory.Get <MediaInfoProvider>());
        }
Exemple #12
0
        public override void Initialize()
        {
            var config = PluginConfiguration.Load <SDWConfig>();

            Terraria.WorldGen.Hooks.OnWorldGenConfigProcess += (ref WorldGenConfiguration _) =>
            {
                TShock.Log.Info("Generating world with seed: {0}", Terraria.WorldGen.currentWorldSeed);
                TShock.Log.Info("Feature configuration: {0}", PluginConfiguration.Stringify(config));

                if (Main.maxTilesY > 1200 && config.DrunkTerrain && config.WorthyTerrain)
                {
                    TShock.Log.Warn("DrunkWorld and ForTheWorthy are very likely to crash worldgen when used together for medium or large maps");
                }

                WorldGen.drunkWorldGen |= config.DrunkTerrain;
                Main.drunkWorld        |= config.DrunkFlag;

                WorldGen.getGoodWorldGen |= config.WorthyTerrain;
                Main.getGoodWorld        |= config.WorthyFlag;

                WorldGen.notTheBees |= config.NotTheBees;
            };
        }
Exemple #13
0
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration<PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();

            EnsureMtnIsExtracted();

            kernel.MetadataProviderFactories.Add(new MetadataProviderFactory(typeof(FrameGrabProvider)));

            kernel.ImageResolvers.Add((path,canBeProcessed,item) =>
            {
                if (path.ToLower().StartsWith("mtn")) {
                    return new GrabImage();
                }
                return null;
            });
            Logger.ReportInfo(Name + " (version " + Version + ") Loaded.");
        }
Exemple #14
0
 public override void Init(Kernel kernel)
 {
     PluginOptions = new PluginConfiguration<PluginOptions>(kernel, this.GetType().Assembly);
     PluginOptions.Load();
 }
Exemple #15
0
        /// <summary>
        /// Initializes the plugin
        /// </summary>
        /// <param name="kernel"></param>
        public override void Init(Kernel kernel)
        {
            kernel.MetadataProviderFactories.Add(MetadataProviderFactory.Get<SubtitleProvider>());

            PluginOptions = new PluginConfiguration<PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();

            var isMc = AppDomain.CurrentDomain.FriendlyName.Contains("ehExtHost");
            if (isMc) //only do this inside of MediaCenter as menus can only be created inside MediaCenter
                SubtitleMenuManager.CreateMenu(kernel);
        }
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration<PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();
            Logger.ReportInfo("MBWeb (version "+Version+") Plug-in loaded.");

            server = new Server();
            server.Add(HttpServer.HttpListener.Create(IPAddress.Any, 9999));
            var module = new TinyWebModule();
            module.MapPath("/", "/index.html");
            server.Add(module);

            server.Start(5);
        }
Exemple #17
0
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration <PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();

            var trailers = (kernel.ItemRepository.RetrieveItem(TrailersGuid) as MBTrailerFolder) ?? new MBTrailerFolder();

            trailers.Path = "";
            trailers.Id   = TrailersGuid;
            //validate sort value and fill in
            //int sort = 0;
            //int.TryParse(PluginOptions.Instance.SortOrder, out sort);
            //if (sort > 0) trailers.SortName = sort.ToString("000");
            //Logger.ReportInfo("MBTrailers Sort is: " + trailers.SortName);

            kernel.RootFolder.AddVirtualChild(trailers);

            if (Kernel.LoadContext == MBLoadContext.Service || Kernel.LoadContext == MBLoadContext.Core)  //create proxy in core and service (will only listen in service)
            {
                string cachePath = PluginOptions.Instance.CacheDir;
                if (string.IsNullOrEmpty(cachePath) || !System.IO.Directory.Exists(cachePath))
                {
                    cachePath = System.IO.Path.Combine(ApplicationPaths.AppConfigPath, "TrailerCache");
                    if (!Directory.Exists(cachePath))
                    {
                        Directory.CreateDirectory(cachePath);
                    }
                }

                long maxBandwidth = 1000 * 1024;
                long.TryParse(PluginOptions.Instance.MaxBandWidth, out maxBandwidth);
                if (maxBandwidth < 0)
                {
                    maxBandwidth = 1000 * 1024;
                }
                else
                {
                    maxBandwidth = maxBandwidth * 1024L;
                }

                proxy = new HttpProxy(cachePath, ProxyPort);
                if (Kernel.LoadContext == MBLoadContext.Service)
                { //only actually start the proxy in the service
                    Logger.ReportInfo("MBTrailers starting proxy server on port: " + ProxyPort);
                    proxy.Start(PluginOptions.Instance.AutoDownload, maxBandwidth);
                    //and clean up the cache if requested
                    if (PluginOptions.Instance.AutoClearCache)
                    {
                        MediaBrowser.Library.Threading.Async.Queue("MBTrailers cache clear", () =>
                        {
                            while (true)
                            {
                                trailers.CleanCache();
                                System.Threading.Thread.Sleep(24 * 60 * 60000);  //once per day
                            }
                        });
                    }
                }
                else
                {
                    if (proxy.AlreadyRunning())
                    {
                        Logger.ReportInfo("MBTrailers not starting proxy.  Running in service.");
                    }
                    else
                    {
                        Logger.ReportInfo("MBTrailers - no proxy running.  Start Media Browser Service.");
                    }
                }
                //load mytrailers option if specified
                if (PluginOptions.Instance.ShowMyTrailers)
                {
                    localTrailers    = kernel.ItemRepository.RetrieveItem(MyTrailersGuid) as LocalTrailerFolder ?? new LocalTrailerFolder();
                    localTrailers.Id = MyTrailersGuid;
                    kernel.RootFolder.AddVirtualChild(localTrailers);
                    kernel.ItemRepository.SaveItem(localTrailers);

                    //make sure our image cache is there
                    if (!Directory.Exists(Util.ImageCache))
                    {
                        try
                        {
                            Directory.CreateDirectory(Util.ImageCache);
                        }
                        catch (Exception e)
                        {
                            Logger.ReportException("Error Creating MyTrailers Image Cache: " + Util.ImageCache, e);
                        }
                    }

                    //Tell the log we loaded.
                    Logger.ReportInfo("My Trailers Support Loaded.");
                }

                //refresh the paths of trailers, but wait a bit in case the service side isn't up yet (we load before the service)
                MediaBrowser.Library.Threading.Async.Queue("MB Trailers refresh", () => trailers.RefreshProxy(), 3000);

                //tell core our types are playable (for menus)
                kernel.AddExternalPlayableItem(typeof(ITunesTrailer));
                kernel.AddExternalPlayableFolder(typeof(MBTrailerFolder));
            }
            Logger.ReportInfo("MBTrailers (version " + Version + ") Plug-in loaded.");
        }
Exemple #18
0
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration<PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();

            var trailers = (kernel.ItemRepository.RetrieveItem(TrailersGuid) as MBTrailerFolder) ?? new MBTrailerFolder();
            trailers.Path = "";
            trailers.Id = TrailersGuid;
            //validate sort value and fill in
            //int sort = 0;
            //int.TryParse(PluginOptions.Instance.SortOrder, out sort);
            //if (sort > 0) trailers.SortName = sort.ToString("000");
            //Logger.ReportInfo("MBTrailers Sort is: " + trailers.SortName);

            kernel.RootFolder.AddVirtualChild(trailers);

            if (Kernel.LoadContext == MBLoadContext.Service || Kernel.LoadContext == MBLoadContext.Core)  //create proxy in core and service (will only listen in service)
            {
                string cachePath = PluginOptions.Instance.CacheDir;
                if (string.IsNullOrEmpty(cachePath) || !System.IO.Directory.Exists(cachePath))
                {
                    cachePath = System.IO.Path.Combine(ApplicationPaths.AppConfigPath, "TrailerCache");
                    if (!Directory.Exists(cachePath))
                    {
                        Directory.CreateDirectory(cachePath);
                    }
                }

                long maxBandwidth = 1000 * 1024;
                long.TryParse(PluginOptions.Instance.MaxBandWidth, out maxBandwidth);
                if (maxBandwidth < 0)
                    maxBandwidth = 1000 * 1024;
                else
                    maxBandwidth = maxBandwidth * 1024L;

                proxy = new HttpProxy(cachePath, ProxyPort);
                if (Kernel.LoadContext == MBLoadContext.Service)
                { //only actually start the proxy in the service
                    Logger.ReportInfo("MBTrailers starting proxy server on port: " + ProxyPort);
                    proxy.Start(PluginOptions.Instance.AutoDownload, maxBandwidth);
                    //and clean up the cache if requested
                    if (PluginOptions.Instance.AutoClearCache)
                    {
                        MediaBrowser.Library.Threading.Async.Queue("MBTrailers cache clear", () =>
                        {
                             while (true)
                             {
                                 trailers.CleanCache();
                                 System.Threading.Thread.Sleep(24 * 60 * 60000); //once per day
                             }

                        });
                    }
                }
                else
                {
                    if (proxy.AlreadyRunning())
                        Logger.ReportInfo("MBTrailers not starting proxy.  Running in service.");
                    else
                        Logger.ReportInfo("MBTrailers - no proxy running.  Start Media Browser Service.");
                }
                //load mytrailers option if specified
                if (PluginOptions.Instance.ShowMyTrailers)
                {
                    localTrailers = kernel.ItemRepository.RetrieveItem(MyTrailersGuid) as LocalTrailerFolder ?? new LocalTrailerFolder();
                    localTrailers.Id = MyTrailersGuid;
                    kernel.RootFolder.AddVirtualChild(localTrailers);
                    kernel.ItemRepository.SaveItem(localTrailers);

                    //make sure our image cache is there
                    if (!Directory.Exists(Util.ImageCache))
                        try
                        {
                            Directory.CreateDirectory(Util.ImageCache);
                        }
                        catch (Exception e)
                        {
                            Logger.ReportException("Error Creating MyTrailers Image Cache: " + Util.ImageCache, e);
                        }

                    //Tell the log we loaded.
                    Logger.ReportInfo("My Trailers Support Loaded.");
                }

                //refresh the paths of trailers, but wait a bit in case the service side isn't up yet (we load before the service)
                MediaBrowser.Library.Threading.Async.Queue("MB Trailers refresh",() => trailers.RefreshProxy(), 3000);

                //tell core our types are playable (for menus)
                kernel.AddExternalPlayableItem(typeof(ITunesTrailer));
                kernel.AddExternalPlayableFolder(typeof(MBTrailerFolder));
            }
            Logger.ReportInfo("MBTrailers (version "+Version+") Plug-in loaded.");
        }