Process plugins (1 Viewer)

dipunm

Portal Pro
August 6, 2006
68
1
37
I tried to start a process plugin, ive got the first version of the code ready to test but even though ive implemented isetupform, (and iplugin) it doesnt appear in mediaportal setup screen.

am using vc#express
referenced:

core
system
system.data
system.windows.forms
system.xml

files

BgHack.cs

contents of BgHack:



Code:
#region Copyright (C) 2006 Team MediaPortal

/* 
 *	Copyright (C) 2005-2006 Team MediaPortal
 *	[url]https://www.team-mediaportal.com[/url]
 *
 *  This Program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *   
 *  This Program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *   
 *  You should have received a copy of the GNU General Public License
 *  along with GNU Make; see the file COPYING.  If not, write to
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
 *  [url]http://www.gnu.org/copyleft/gpl.html[/url]
 *
 */

#endregion

using System;
using System.Windows.Forms;

using MediaPortal.GUI.Library;

namespace ProcessPlugins.BgHackPlugin
{
  class BgHack : ISetupForm, IPlugin
  {
    public BgHack()
    {

    }

    #region ISetupForm Members

    public bool CanEnable()
    {
      return true;
    }

    public string Description()
    {

      return "Defaults the video to play behind menu where possible";
    }

    public bool DefaultEnabled()
    {
      return true;
    }

    public int GetWindowId()
    {
      return -1;
    }

    public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
    {
      strButtonText = null;
      strButtonImage = null;
      strButtonImageFocus = null;
      strPictureImage = null;
      return false;
    }

    public string Author()
    {
      return "dipunm";
    }

    public string PluginName()
    {
      return "BgHack";
    }

    public bool HasSetup()
    {
      return false;
    }

    public void ShowPlugin()
    {

    }

    #endregion

    #region My Code
    void onMyAction(Action action)
    {
      if (!(GUIWindowManager.ActiveWindow == (int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO || GUIWindowManager.ActiveWindow == (int)GUIWindow.Window.WINDOW_FULLSCREEN_TELETEXT))
      {
        //check n doodledoo
        if (GUIGraphicsContext.ShowBackground)
        {
          if (GUIGraphicsContext.Vmr9Active)
          {
            GUIGraphicsContext.ShowBackground = false;
            GUIGraphicsContext.ARType = Geometry.Type.Stretch;
          }
          else
          {
           // return;
          }
        }
      }
    }


    #endregion

    #region IPlugin Members
    public void Start()
    {
      GUIWindowManager.OnNewAction += new OnActionHandler(OnMyAction);
    }

    public void Stop()
    {

    }
    #endregion

  }
}
 

dipunm

Portal Pro
August 6, 2006
68
1
37
thnx 4 the reply, appreciated... unfortuately tried, n failed ... i set it to 20 and tried it agen, not appearing any other suggestions?
 

mPod

Portal Pro
January 26, 2005
2,084
3
Berlin
Home Country
Germany Germany
Where do you place your compiled DLL? The source looks ok.

Also have a look to the log, if something informative comes up in it.
 

Glith

Portal Pro
April 19, 2006
265
28
Home Country
Sweden Sweden
Copyright and GPL???

Hi.
A small note. Why do you have a "Copyright (C) 2005-2006 Team MediaPortal" If it is published under GNU General Public License? Those two dont mix...

See also this page: http://www.gnu.org/copyleft/
 

dipunm

Portal Pro
August 6, 2006
68
1
37
Hi.
A small note. Why do you have a "Copyright (C) 2005-2006 Team MediaPortal" If it is published under GNU General Public License? Those two dont mix...

See also this page: http://www.gnu.org/copyleft/

lol copied it from some other plugin (zap2it or sumthing) i figured that was the actual comment that i was supposed to use (couldnt be bothered to find the page in the wiki which shows the real text) will change

thanks for the heads up ;)

Hi.
Where do you place your compiled DLL? The source looks ok.

Also have a look to the log, if something informative comes up in it.

i placed the plugin (dll file and (just in case) pdb file) into the plugins/process directory

about the logs, i dont see any info about the loading unloading of plugins at all, is there a specific place to look? i knoticed running setup copies mp's logs to baks and vice versa so i checked both (after running both) starting up mp, it documents the loading of my plugin but nothing else... will try to put in some log code in to see how far the plugin gets ;)
 

mPod

Portal Pro
January 26, 2005
2,084
3
Berlin
Home Country
Germany Germany
http://wiki.team-mediaportal.com/MediaPortalDevelopment/CodingStandards

How you did it, was correct. Below is a copy from http://www.gnu.org/copyleft/gpl.html. (The site Glith linked to)

one line to give the program's name and an idea of what it does.
Copyright (C) yyyy name of author

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Back to topic: Problem solved?
 

Glith

Portal Pro
April 19, 2006
265
28
Home Country
Sweden Sweden
I stand corrected. Sorry for the confusion.
I just thought it looked a little strange.

Please continue with your good work. =)
 

dipunm

Portal Pro
August 6, 2006
68
1
37
unfortunately, (unless im doing something wrong) it seems that nothing within the dll runs (not even the constructor)

are these changes the changes i should make to write to the log?
Code:
skip beginning....

using MediaPortal.Utils.Services;

...skip a bit.....

    ILog _log;
    public BgHack()
    {
      ServiceProvider services = GlobalServiceProvider.Instance;
      _log = services.Get<ILog>();
      _log.Info("bgHack constructed");
    };

etc.....

*edit*

quick question, is there a specific place i should place the project before referencing etc. (somewhere relative to core.dll mayb?)
 

samuel337

Portal Pro
August 25, 2004
772
0
Melbourne, Australia
So nothing in the Start method is being executed?

You should see something like this in mediaportal.log:
20/08/2006 2:39:08 AM 709 [Info.] PlugInManager.Load()
20/08/2006 2:39:08 AM 719 [Info.] Load plugins from :C:\Program Files\Team MediaPortal\MediaPortal\plugins\process\ECP2Plugin.dll
20/08/2006 2:39:08 AM 759 [Info.] Load plugins from :C:\Program Files\Team MediaPortal\MediaPortal\plugins\process\log4net.dll
20/08/2006 2:39:08 AM 799 [Info.] Load plugins from :C:\Program Files\Team MediaPortal\MediaPortal\plugins\process\ProcessPlugins.dll
20/08/2006 2:39:08 AM 839 [Info.] PlugInManager.Start()

Your plugin should appear there if it implements the IPlugin interface and is in the plugins/process folder.

BTW, devs - the new logging mechanism doesn't seem to know to append to logs once they reach a certain size - my current log is 6.88MB, and that's after nearly a week.

Sam
 

Users who are viewing this thread

Top Bottom