NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 12 13 14 15 16 … 93 Next »
Resolving required plugin assemblies problem

 
  • 0 Vote(s) - 0 Average
Resolving required plugin assemblies problem
bgowland
Offline

Posting Freak

West Yorkshire, UK
Posts: 4,595
Threads: 387
Joined: Dec 2004
#11
2011-03-29, 08:21 PM
imilne Wrote:Ok, thanks. I'll get the google pigeons on the case and see what they can find.
You could try hacking the MediaInfoDLL.cs class to use DLLImport with an explicit path which relates to the location of your plugin.

Never tried it but I could walk you through it with some example code that I'd try if I wanted to do something similar.
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#12
2011-03-30, 07:18 AM
bgowland Wrote:You could try hacking the MediaInfoDLL.cs class to use DLLImport with an explicit path which relates to the location of your plugin.

Never tried it but I could walk you through it with some example code that I'd try if I wanted to do something similar.

That would be great if you don't mind. I did try messing around with it quickly but the compiler decided it hated me so I gave up for the night.

Iain
McBainUK
Offline

Posting Freak

Posts: 4,711
Threads: 429
Joined: Sep 2005
#13
2011-03-30, 07:54 AM
sub Wrote:If you rename the Spotify directory to 'MusicSpot' does it help?
No. Same result.
Wiki profile
My Projects
Programs Plugin [SIZE=2](retired)
| Volume OSD Plugin (retired) | Documentation Wiki (retired)
[/SIZE]
bgowland
Offline

Posting Freak

West Yorkshire, UK
Posts: 4,595
Threads: 387
Joined: Dec 2004
#14
2011-03-30, 02:48 PM (This post was last modified: 2011-03-30, 03:36 PM by bgowland.)
imilne Wrote:That would be great if you don't mind. I did try messing around with it quickly but the compiler decided it hated me so I gave up for the night.
OK, try this...

EDIT to use npvr native call to get data directory (thanks InVermont)

In the plugin class itself add the following (example)...

Code:
public class MyPlugin : SimpleButtonListPlugin
{
    private static string npvrPluginsFolder = "";

    ...

    public override void Activate()
    {
        getNpvrPluginsFolder();
        ...
        base.Activate();
    }

    ...

    private void getNpvrPluginsFolder()
    {
        string npvrDataDirectory = NUtility.SettingsHelper.GetInstance().GetDataDirectory();
        if (!npvrDataDirectory.EndsWith(@"\"))
            npvrDataDirectory += @"\";
        npvrPluginsFolder = npvrDataDirectory + @"Plugins\";
    }

Next, in the MediaInfoDLL.cs class file, add a string for the path to the plugins folder and a new constructor to accept/set the path string (example)...

Code:
public class MediaInfo
{
    private static mediaInfoDLLPath = "";

    // DLLImport stuff here

    public MediaInfo(string dllPath)
    {
            // Add the following line, the rest is the same as the default ctor
            mediaInfoDLLPath = dllPath;

            Handle = MediaInfo_New();
            if (Environment.OSVersion.ToString().IndexOf("Windows")==-1)
                MustUseAnsi=true;
            else
                MustUseAnsi=false;
    }

Finally do a Find/Replace on the MediaInfoDLL.cs file...

Find this...

Code:
[DllImport("MediaInfo.dll")]

Replace with this...

Code:
[DllImport(mediaInfoDLLPath + "MediaInfo.dll")]

If you call the default MediaInfoDLL constructor, then the mediaInfoDLLPath string will be "" so behaviour will be as before but hopefully using the new constructor will allow you to place the MediaInfo.dll in the plugins folder.

No idea if it will work, usual disclaimers, etc, etc. Big Grin

Cheers,
Brian
InVermont
Offline

Member

Posts: 157
Threads: 10
Joined: Mar 2007
#15
2011-03-30, 03:13 PM
bgowland Wrote:// I couldn't find a method native to N-PVR to get the data folder but
// if there is one, use that.
Brian

NUtility.SettingsHelper.GetInstance().GetDataDirectory()

I think that should do it.
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#16
2011-03-30, 03:25 PM
Cheers guys, I'll give it a try tonight if I get the chance...

Iain
bgowland
Offline

Posting Freak

West Yorkshire, UK
Posts: 4,595
Threads: 387
Joined: Dec 2004
#17
2011-03-30, 03:31 PM
InVermont Wrote:NUtility.SettingsHelper.GetInstance().GetDataDirectory()

I think that should do it.
Indeed it does. I had a feeling there would be a way but didn't spend too much time looking. I'll edit my example to make it a bit more light-weight. Smile

Thanks.
bgowland
Offline

Posting Freak

West Yorkshire, UK
Posts: 4,595
Threads: 387
Joined: Dec 2004
#18
2011-03-30, 03:39 PM
imilne Wrote:Cheers guys, I'll give it a try tonight if I get the chance...
Looking slightly cleaner with the NUtility call in there instead of the Reg stuff. Hope it works.

Cheers,
Brian
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#19
2011-03-30, 05:39 PM
Stalled at the first attempt unfortunately, with just trying to replace the "MediaInfo.dll" string with the mediaInfoDLLPath variable:

Code:
An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type

If it needs to be a constant, then I don't see how you can give it something that's got to be dynamic at runtime. Hmm... must be possible somehow.

Iain
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,807
Threads: 769
Joined: Nov 2003
#20
2011-03-30, 06:07 PM
Did you try LoadLibrary before calling any methods that depend ond the DLL?
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (4): « Previous 1 2 3 4 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  PIP plugin for Kodi sgilani 2 3,081 2022-10-17, 12:44 AM
Last Post: sgilani
  New Systems Plugin kirschey 10 3,556 2020-11-14, 08:01 PM
Last Post: sub
  NextPVR 5: When is PIN Required for API Access? pkscout 3 2,835 2020-05-26, 04:45 AM
Last Post: sub
  VIdeo playback from plugin mvallevand 5 3,639 2015-08-06, 10:43 PM
Last Post: sub
  Attention Sub: Open TV / Custom Data Grabber plugin Benoire 2 3,001 2014-11-14, 02:05 AM
Last Post: Benoire
  Trouble loading .NET System assemblies bgowland 3 2,474 2013-10-31, 02:37 AM
Last Post: bgowland
  API docs to help with plugin development? McBainUK 3 2,870 2013-06-08, 06:14 PM
Last Post: sub
  Refreshing TV Guide Data (after System plugin EPG update) imilne 13 6,321 2013-03-24, 08:03 PM
Last Post: imilne
  sabnzbd plugin to show processed files Wakalaka 1 2,026 2013-03-12, 06:48 AM
Last Post: psycik
  Problem with preview image for Pending Recordings Northpole 2 2,069 2012-08-14, 02:56 AM
Last Post: Northpole

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode