NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
1 2 3 4 5 … 93 Next »
Plugins and NPVR. Where do we start?

 
  • 0 Vote(s) - 0 Average
Plugins and NPVR. Where do we start?
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#31
2010-07-15, 01:17 AM
Here's an example of my own Save() function that does that:

Code:
public void Save()
        {
            XmlNode node;

            #region Plugin Global Settings
            if ((node = _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt")) == null)
            {
                _sh.GetSettingsNode("/Settings/PluginSettings").AppendChild(_sh.GetBackingDocument().CreateNode("element", "StreamIt", ""));
            }
            if ((node = _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix")) == null)
            {
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt").AppendChild(_sh.GetBackingDocument().CreateNode("element", "Netflix", ""));
            }
            #endregion

            #region Last Selected Genre
            if ((node = _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/LastGenre")) == null)
            {
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix").AppendChild(_sh.GetBackingDocument().CreateNode("element", "LastGenre", ""));
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/LastGenre").InnerText = _LastGenre;
            }
            else _sh.SetSetting("/Settings/PluginSettings/StreamIt/Netflix/LastGenre", _LastGenre);
            #endregion

            #region Player Kiosk Mode
            if ((node = _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/PlayerKioskMode")) == null)
            {
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix").AppendChild(_sh.GetBackingDocument().CreateNode("element", "PlayerKioskMode", ""));
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/PlayerKioskMode").InnerText = _playerKioskMode.ToString().ToLowerInvariant();
            }
            else _sh.SetSetting("/Settings/PluginSettings/StreamIt/Netflix/PlayerKioskMode", _playerKioskMode);
            #endregion

            #region Last View Mode
            if ((node = _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/LastViewMode")) == null)
            {
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix").AppendChild(_sh.GetBackingDocument().CreateNode("element", "LastViewMode", ""));
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/LastViewMode").InnerText = _viewMode;
            }
            else _sh.SetSetting("/Settings/PluginSettings/StreamIt/Netflix/LastViewMode", _viewMode);
            #endregion

            #region Use BoxArt Reflections
            if ((node = _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/BoxArtReflections")) == null)
            {
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix").AppendChild(_sh.GetBackingDocument().CreateNode("element", "BoxArtReflections", ""));
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/BoxArtReflections").InnerText = _useReflections.ToString().ToLowerInvariant();
            }
            else _sh.SetSetting("/Settings/PluginSettings/StreamIt/Netflix/BoxArtReflections", _useReflections);
            #endregion

            #region BoxArt Reflection Starting Alpha
            if ((node = _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/ReflectionAlpha")) == null)
            {
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix").AppendChild(_sh.GetBackingDocument().CreateNode("element", "ReflectionAlpha", ""));
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/ReflectionAlpha").InnerText = _reflectionStartingAlpha.ToString();
            }
            else _sh.SetSetting("/Settings/PluginSettings/StreamIt/Netflix/ReflectionAlpha", _reflectionStartingAlpha);
            #endregion

            #region BoxArt Reflection Percentage
            if ((node = _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/ReflectionHeight")) == null)
            {
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix").AppendChild(_sh.GetBackingDocument().CreateNode("element", "ReflectionHeight", ""));
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/ReflectionHeight").InnerText = _reflectionPercent.ToString().ToLowerInvariant();
            }
            else _sh.SetSetting("/Settings/PluginSettings/StreamIt/Netflix/ReflectionHeight", _reflectionPercent);
            #endregion

            #region Ending Soon Days
            if ((node = _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/EndingSoonDays")) == null)
            {
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix").AppendChild(_sh.GetBackingDocument().CreateNode("element", "EndingSoonDays", ""));
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/EndingSoonDays").InnerText = _endingSoonDays.ToString();
            }
            else _sh.SetSetting("/Settings/PluginSettings/StreamIt/Netflix/EndingSoonDays", _endingSoonDays);
            #endregion

            #region Ending Soon Days
            if ((node = _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/ShowOnlyAvailable")) == null)
            {
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix").AppendChild(_sh.GetBackingDocument().CreateNode("element", "ShowOnlyAvailable", ""));
                _sh.GetSettingsNode("/Settings/PluginSettings/StreamIt/Netflix/ShowOnlyAvailable").InnerText = _showOnlyAvailable.ToString().ToLowerInvariant();
            }
            else _sh.SetSetting("/Settings/PluginSettings/StreamIt/Netflix/ShowOnlyAvailable", _showOnlyAvailable);
            #endregion
            _sh.Save();
        }


"_sh" being NUtility.SettingsHelper.GetInstance()

The end result in config.xml is:

Code:
<PluginSettings>
    <StreamIt>
      <Netflix>
        <LastGenre>All Movies</LastGenre>
        <PlayerKioskMode>false</PlayerKioskMode>
        <LastViewMode>LIST</LastViewMode>
        <BoxArtReflections>true</BoxArtReflections>
        <ReflectionAlpha>150</ReflectionAlpha>
        <ReflectionHeight>45</ReflectionHeight>
        <EndingSoonDays>30</EndingSoonDays>
        <ShowOnlyAvailable>true</ShowOnlyAvailable>
      </Netflix>
    </StreamIt>
  </PluginSettings>
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#32
2010-07-15, 03:38 PM
Thanks guys.

Iain
cncb
Offline

Senior Member

Posts: 729
Threads: 112
Joined: Aug 2011
#33
2011-08-02, 03:19 AM
I can't seem to locate the "skin.xml" file for the Test3 sample in either the zip file or the data directory from the installation?
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,774
Threads: 769
Joined: Nov 2003
#34
2011-08-02, 03:29 AM
cncb Wrote:I can't seem to locate the "skin.xml" file for the Test3 sample in either the zip file or the data directory from the installation?
Try this one.

The archive would be extracted into C:\Users\Public\NPVR\Skin\Default.
cncb
Offline

Senior Member

Posts: 729
Threads: 112
Joined: Aug 2011
#35
2011-08-02, 03:23 PM
sub Wrote:Try this one.

Thanks. Could you explain how popup.xml is used and associated with the plugin (I can't see it referenced in the code anywhere)?
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,774
Threads: 769
Joined: Nov 2003
#36
2011-08-02, 04:27 PM
cncb Wrote:Thanks. Could you explain how popup.xml is used and associated with the plugin (I can't see it referenced in the code anywhere)?
I just checked to remind myself and found I had a slightly later version than I posted at the beginning of this thread. I'd probably posted this version somewhere in this thread, but here it is again.
cncb
Offline

Senior Member

Posts: 729
Threads: 112
Joined: Aug 2011
#37
2011-08-03, 09:27 PM
Sorry for the basic question, but I don't understand how the UI elements created in code are "hooked up" to the skin elements. For example, "popup.xml" defines the "PopupButtons" element which the UiButtonList in the code seems to be added to but I don't see "PopupButtons" anywhere in the code to make the connection?
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 53,080
Threads: 957
Joined: May 2006
#38
2011-08-03, 10:20 PM
This confused me too. NextPVR loads some elements from global.xml if they are not in the current skin.

Martin
cncb
Offline

Senior Member

Posts: 729
Threads: 112
Joined: Aug 2011
#39
2011-08-03, 11:47 PM
mvallevand Wrote:This confused me too. NextPVR loads some elements from global.xml if they are not in the current skin.

Thanks, but I'm still a little confused. I now see the "PopupLeftButtonNormal" element defined in global.xml which seems to define the buttons but where is the "container" of the buttons specified (location and overall size of the button list)?
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,774
Threads: 769
Joined: Nov 2003
#40
2011-08-04, 01:50 AM
Its been about a year since I loaded up this plugin. I'll take a look to remind myself.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (9): « Previous 1 2 3 4 5 6 … 9 Next »
Jump to page 


Possibly Related Threads…
Thread Author Replies Views Last Post
  API channel.stream.start mvallevand 2 1,430 2023-05-07, 09:40 PM
Last Post: mvallevand
  Way to tell programmatically if channel load in from NPVR has finished... gdogg371 3 2,430 2021-03-11, 03:59 PM
Last Post: mvallevand
  Test/Development environment for npvr.db3 scJohn 10 4,487 2020-09-04, 09:14 PM
Last Post: scJohn
  How to extract M3U8 and get matching XMLTV guide data from NPVR almightyj 0 3,520 2018-10-23, 07:24 AM
Last Post: almightyj
  ios app to control npvr ui idea jnbooker15 4 3,676 2015-09-21, 10:19 PM
Last Post: sub
  ios app to control npvr ui idea jnbooker15 0 2,516 2015-09-21, 06:39 PM
Last Post: jnbooker15
  I want to start developing plugins...but how? OrenShapir 6 4,139 2014-11-18, 10:38 PM
Last Post: mvallevand
  Couple of questions about hacking npvr.db3 drmargarit 6 4,322 2014-09-08, 02:22 AM
Last Post: sub
  Absolute newbie trying to realize an idea - where to start? Oopsjoppe 13 5,742 2013-11-11, 05:33 PM
Last Post: Oopsjoppe
  high res (256x256+) npvr icon? reven 15 5,969 2013-09-01, 05:13 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