NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 21 22 23 24 25 … 93 Next »
How to display custom plugin names and descriptions.

 
  • 0 Vote(s) - 0 Average
How to display custom plugin names and descriptions.
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#1
2009-11-20, 05:55 AM (This post was last modified: 2010-01-01, 07:54 AM by whurlston.)
When implementing BaseButtonListUiTask, you have two methods/functions (among others): GetName() and GetDescription(). This GetDescription() example uses GBPVRCommonUtilities (a third party library) while the GetName() example does not. You can choose which you want and use the same method for both. This example is in C#

Code:
// This example requires a reference to GBPVRCommonUtilities
        public override string getDescription()
        {
            System.Xml.XmlDocument s = new System.Xml.XmlDocument();
            try { s.Load("config.xml"); }
            catch
            {
               // Custom log method. Do whatever you like here in the event that config.xml could not be loaded.
               // CommonUtils.LogMessage(LogLevel.Error, "Could not load config.xml");
            }
            // This queries <PluginSettings> <NetflixPlugin> <WatchNowDesc>, if it is not found, it returns "Watch movies from netflix.com" by default.
            return ConfigFileUtilities.GetStringConfigSetting(s, "NetflixPlugin", "WatchNowDesc", "Watch movies from netflix.com", false);
        }

        // This example requires no additional references.
        public override string getName()
        {
            string DispName;
            System.Xml.XmlDocument s = new System.Xml.XmlDocument();
            try
            {
                s.Load("config.xml");
    
                // This queries <PluginSettings> <NetflixPlugin> <WatchNowName>.
                DispName = s.SelectSingleNode("/settings/PluginSettings/NetflixPlugin/WatchNowName").InnerText;
            }
            catch (Exception)
           {
              If the query fails, use this value by default.
              DispName = "Netflix Watch Now";
            }
            return DispName;
        }

So in my plugin setting section of config.xml, I can have the following to make them appear in the main menu of GBPVR:

Code:
<PluginSettings>
    <NetflixPlugin>
      <WatchNowName>Netflix</WatchNowName>
      <WatchNowDesc>My custom Netflix description</WatchNowDesc>
    </NetflixPlugin>
  </PluginSettings>

You can add a text field in your Config form if you like or just have people edit the config.xml manually if you only want power users to do it. Keep in mind that if you allow the change in your Config form, users must exit Config, then reopen it and enable the plugin under the new name. If they just change the description, restarting Config is not necessary.

Edit: I stink at instructions so feel free to ask questions on anything that's not clear.

Edit 2: Corrected the post. BaseButtonListUiTask should be implemented and not IMenuTask.
ACTCMS
Offline

Posting Freak

UK
Posts: 2,730
Threads: 101
Joined: Jun 2007
#2
2009-11-20, 03:05 PM
It might be worth pointing out that getName() is not just a cosmetic thing which only affects what is displayed in the menus - it also changes plugin related Notify events (like activated) to use the custom name. It could be a PITA for MLpanel which does different things depending on which music/radio plugin is active.

I don't suppose you've come across a way of finding out what the original name is?Smile
Fatman_do
Offline

Posting Freak

Posts: 3,482
Threads: 95
Joined: Nov 2005
#3
2009-11-20, 07:07 PM
Is it worth noting that GBPVRCommonUtilities is a 3rd party DLL and not part of GB-PVR?
Fatman_do
[SIZE="1"]
HTPC: AMD XP+2500, 512MB DDR (400) ~ Capture Device: Hauppage PVR-150
Storage: 30GB OS & Recording, 160GB Post Processing & Archive
Video Output: HD 32" TV via eVGA Geforce 6200le 256MB AGP DVI-HDMI cable out
Audio Output: Turtle Beach Riviera S/PDIF Optic Output (Digital pass thru only) to Home Theater Receiver[/SIZE]

[SIZE="2"]
Moderator | Tutorials | Community Skin | CommunitySkin-SVN[/SIZE]
McBainUK
Offline

Posting Freak

Posts: 4,711
Threads: 429
Joined: Sep 2005
#4
2009-11-20, 08:20 PM
I think it's fine as an example. Devs know other ways of getting config settings without using the GBPVRCommonUtilities library.
Wiki profile
My Projects
Programs Plugin [SIZE=2](retired)
| Volume OSD Plugin (retired) | Documentation Wiki (retired)
[/SIZE]
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,766
Threads: 954
Joined: May 2006
#5
2009-11-20, 08:34 PM
Fatman_do Wrote:Is it worth noting that GBPVRCommonUtilities is a 3rd party DLL and not part of GB-PVR?

Definitely. When I build Web Radio I thought it was sub's and it wasn't until did some clean machine install testing that I found out otherwise. There are some obsolete functions in it so I eventually want to remove it now.

Martin
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#6
2009-11-21, 03:37 AM
Fatman_do Wrote:Is it worth noting that GBPVRCommonUtilities is a 3rd party DLL and not part of GB-PVR?

That's why I showed an example using it and one not. I'll make a note of that in the original post though. There are several other ways that config.xml can be queried as well. Also, the values could actually be stored anywhere: registry, separate config file, etc.
scb147
Offline

Posting Freak

Posts: 806
Threads: 77
Joined: Nov 2006
#7
2009-12-01, 08:27 PM
Maybe it's just my plugin, but I implemented the getName() to use a custom name. The custom name appears in the plugin list, and in the menu. But the name of the plugin in the upper-left corner of the plugin screen shows the actual plugin name, not the custom. Is this normal, or just me?
McBainUK
Offline

Posting Freak

Posts: 4,711
Threads: 429
Joined: Sep 2005
#8
2009-12-01, 09:27 PM
Is the name hardcoded in the skin?
Wiki profile
My Projects
Programs Plugin [SIZE=2](retired)
| Volume OSD Plugin (retired) | Documentation Wiki (retired)
[/SIZE]
scb147
Offline

Posting Freak

Posts: 806
Threads: 77
Joined: Nov 2006
#9
2009-12-01, 09:34 PM
Nope, I think GBPVR puts this label there. But I wonder if it uses something other than the getName() method from the plugin to populate it.
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#10
2009-12-15, 06:43 AM
scb147 Wrote:Nope, I think GBPVR puts this label there. But I wonder if it uses something other than the getName() method from the plugin to populate it.
This usually happens when it doesn't read the config file properly and it drops back to the default setting.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (3): 1 2 3 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  Custom recording tomx 2 398 2025-02-07, 09:14 AM
Last Post: tomx
  PIP plugin for Kodi sgilani 2 2,716 2022-10-17, 12:44 AM
Last Post: sgilani
  New Systems Plugin kirschey 10 3,291 2020-11-14, 08:01 PM
Last Post: sub
  custom creation of a recurring error p37307 2 2,202 2017-12-19, 03:45 AM
Last Post: mvallevand
  VIdeo playback from plugin mvallevand 5 3,420 2015-08-06, 10:43 PM
Last Post: sub
  Custom recording rules mvallevand 58 21,587 2014-12-08, 03:28 AM
Last Post: mvallevand
  Attention Sub: Open TV / Custom Data Grabber plugin Benoire 2 2,856 2014-11-14, 02:05 AM
Last Post: Benoire
  API docs to help with plugin development? McBainUK 3 2,731 2013-06-08, 06:14 PM
Last Post: sub
  Refreshing TV Guide Data (after System plugin EPG update) imilne 13 6,027 2013-03-24, 08:03 PM
Last Post: imilne
  sabnzbd plugin to show processed files Wakalaka 1 1,930 2013-03-12, 06:48 AM
Last Post: psycik

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

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

Linear Mode
Threaded Mode