Plugin config order and language file strings within the plugin (2 Viewers)

Lightning303

MP Donator
  • Premium Supporter
  • September 12, 2009
    798
    577
    Germany Germany
    Country flag
    Hey,
    i have 2 small questions.

    Question 1:
    I added AtmoLight to the config/settings menu in MP2 a while ago, but what always bugged me was that the menu items are sorted alphabetically. The entries themselfs are sorted in the way i added them into the plugin.xml but not the menu items. And it makes it way harder to navigate in my opinion.
    A screenshot of how it looks like:

    config order.png


    However i would like it to be sorted like this:
    General Settings
    AtmoWin
    Hyperion
    Content Effects
    Remote Buttons
    Advanced Settings.

    plugin.xml section: https://github.com/ambilight-4-medi...ore/AtmoLight.MediaPortal2/plugin.xml#L38-L79

    Is it possible to change the order? If so how? If not, any plans to add the possiblity (pretty please)?


    Question 2:
    Is it possible to get the strings from the language files within the plugin, so i can work with them?

    I have this string in the file:
    Code:
    <string name="AtmoLight.AtmoWinConnectionLost">Connection to [Target] lost!</string>
    And i want to notify the user. However i would like to replace [Target] with something else within the plugin.
    Atm im doing this:

    Code:
          ServiceRegistration.Get<INotificationService>().EnqueueNotification(NotificationType.Error, "[AtmoLight.Name]", "[AtmoLight.AtmoWinConnectionLost]", true);
    Which of course tells me that connection to "[Target]" got lost and not to e.g. AtmoWin.
    Any method around that returns the string?
    E.g.
    GetStringFromLanguage("[AtmoLight.AtmoWinConnectionLost]") returns "Connection to [Target] lost!"

    Edit: As soon as i posted this and went to the kitchen to make something to eat i of course knew how i get the answer to question 2 myself... :p

    For everbody else curious:
    Code:
    MediaPortal.Common.Localization.LocalizationHelper.Translate("[AtmoLight.AtmoWinConnectionLost]")
    Thanks!
     
    Last edited:

    kilik360

    MP Donator
  • Premium Supporter
  • September 3, 2010
    574
    232
    Canada Canada
    Country flag
    Do I really see Hyperion ? That is promising ! What can you achieve from mediaportal ?
     

    Lightning303

    MP Donator
  • Premium Supporter
  • September 12, 2009
    798
    577
    Germany Germany
    Country flag
    Do I really see Hyperion ? That is promising ! What can you achieve from mediaportal ?
    Psst ;P

    Pretty much the same as with atmowin. We redesigned the core to make it possible to have multiple targets, even at the same time. So its possible to have atmowin and hyperion running simultaneously. Also should be pretty easy now to add support for other software aswell.

    Our current dev branch should be buildable and runable on both MP1 and MP2. This of course can change with any commit :p.
    https://github.com/ambilight-4-mediaportal/AtmoLight/tree/DEV_rework_core

    If you want to test it, go ahead, would be great to hear some more feedback ;).
     

    kilik360

    MP Donator
  • Premium Supporter
  • September 3, 2010
    574
    232
    Canada Canada
    Country flag
    Honnestly, I'm a GitHub newbie, all of this is chinese for me. I don't know how to compile those 'branch'. Maybe you can show me the path ?
     

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,399
    6,970
    Germany Germany
    Country flag
    First recommendation: don't use multiple
    XML:
     <Register Location="/Configuration/Settings/Plugins/AtmoLight">
    <ConfigSection
    Id="General"
    Redundant="true"
    Text="[AtmoLight.General]"/>
    </Register>
    <Register Location="/Configuration/Settings/Plugins/AtmoLight">
    <ConfigSection
    Id="Effects"
    Redundant="true"
    Text="[AtmoLight.Effects]"/>
    </Register>
    but combine them into single <Register>:
    XML:
     <Register Location="/Configuration/Settings/Plugins/AtmoLight">
    <ConfigSection
    Id="General"
    Redundant="true"
    Text="[AtmoLight.General]"/>
    <ConfigSection
    Id="Effects"
    Redundant="true"
    Text="[AtmoLight.Effects]"/>
    </Register>
    Probably not related, but avoiding redundancies is always good.

    And to Redundant="true" is only required, if you expect this section could have been created by another plugin. In your case you should remove it.

    I didn't find any sorting for ListItems yet, but I don't have more time now.
     

    Lightning303

    MP Donator
  • Premium Supporter
  • September 12, 2009
    798
    577
    Germany Germany
    Country flag
    Thanks for your efforts!

    I now combined them all as you suggested aswell as removed the redundant declarations.
    However the menu items are still ordered alphabetically.
     

    jehe

    Test Group
  • Team MediaPortal
  • February 15, 2011
    694
    216
    54
    Belgium Belgium
    Country flag

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,399
    6,970
    Germany Germany
    Country flag
    I now combined them all as you suggested aswell as removed the redundant declarations.
    However the menu items are still ordered alphabetically.
    I've checked the code and found the reason: https://github.com/MediaPortal/Medi...ents/Configuration/ConfigurationModel.cs#L480.

    Here a WorkflowAction is created, using the label as sort criteria.

    What should we do? I would extend the config section metadata with a custom "sort" attribute, so you can define it inside plugin.xml. If it's null or empty default sorting will be title as now. Would this be what you need?
     

    Users Who Are Viewing This Thread (Users: 0, Guests: 2)

    OP Similar threads Forum Replies Date
    joecrow 1.25.0 Radio Time plugin fails after Resume from Sleep with MP 1.25 Bugreports 4
    P MP2: US user, OTA - can NOT get SchedulesDirect plugin to work on MP1 or MP2 --> how do I get OTA schedule? General 5
    E aktuelle englische Forums Webseite von - Showtime Plugin v3 Plugins & Erweiterungen 4
    mrmojo666 [Tv Server Plugin ]Direct Show Video Control Plugin 0.0.0.1 for Hauppauge PVR cards MediaPortal 1 Plugins 0
    joecrow MultiShortcut Plugin (Uavailable) in DWHD skin General Support 58
    vapourEyes Building TV Plugin General Development (no feature request here!) 49
    Golf4 Nach Windows-Updates läuft TV-Plugin nicht mehr Allgemeines Support- und Diskussionsforum 0
    joecrow How about a Launcher plugin for MP1? MediaPortal 1 6
    D [solved] TVServer Plugin must be missing something. General Development (no feature request here!) 1
    framug Nouveau plugin XmlTvFR pour récupérer le guide télé français Kazer / ZguideTv (WebEPGfr) 11
    emphatic Allow remote control mapping of all plugins Improvement Suggestions 0
    D Where should plugins be located on hard drive? General Support 0
    D how to disengage from one version of a plugin to use another Newcomers Forum 0
    cbr954rr How to disable a pre-configured plugin? General 2
    mrmojo666 [Plugin]Marantz Control Plugin 0.0.0.2 MediaPortal 1 Plugins 2
    mrmojo666 beginner: trying to write a plugin, need help to catch event General Development (no feature request here!) 3
    framug [Rejected] Fix PowerScheduler plugin for MP2 single seat Submit: Code Patches 9
    doskabouter [Question] Stale plugins Developer Discussions 9
    M MP1 stops responding after Starting Plugins General Support 14
    Terra LAVFilter Plugin cannot be updated (MP1.23) MediaPortal 1 Plugins 10
    L Mediaportal 1.21 and Windows 10: user schedules de-activated when powerscheduler plugin is selected General Support 1
    C Can the XmlTv Plugin handle 600+ channels? General 3
    M Online Video Plugin V.2.32 keine Installtion unter MediaPortal 1.22 ? TV / Streaming 3
    emphatic Pictures in the cloud - would a plugin be possible for services like Google Photos MediaPortal 1 Plugins 1
    C where is the Online Videos plugin General Support 1
    Similar threads

























    Top Bottom