Latest Media Handler - facade properties - itemcount

Discussion in 'General Support' started by Rob Hexenmeister, May 18, 2019.

  1. Rob Hexenmeister
    • Premium Supporter

    Rob Hexenmeister MP Donator

    Joined:
    May 12, 2011
    Messages:
    95
    Likes Received:
    12
    Gender:
    Male
    Location:
    Slaithwaite
    Ratings:
    +19 / 0
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    Good evening all,



    I am customising my BasicHome screen (some of you may remember). Thanks to the excellent help and support this is coming along quite well.. but I have come across a hurdle. I can't find a property that reports back the number of items in facadeview of Latest Media Handler.

    I can use selected item for the name, selected index for the enumerator of the current item, but I can't find anything to tell me how many items there are - I was expecting to use #itemcount but that doesn't work.

    Am I missing something?

    Many thanks
    RH
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. CyberSimian
    • Team MediaPortal

    CyberSimian Test Group

    Joined:
    June 10, 2013
    Messages:
    1,579
    Likes Received:
    519
    Gender:
    Male
    Location:
    Southampton
    Ratings:
    +935 / 3
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    I have not tried using "Latest Media Handler" in my skin, so there may be some specific restrictions that apply. However, #itemcount is notorious for being unset in various circumstances (so you may have found another one).

    Below is the xml that I use to generate the item count string (top left corner in my skin); the comments explain why this logic is necessary:

    <!-- ====================================================================
    The built-in variables "#selectedindex" and "#itemcount" have incorrect
    values on some panels. To avoid bad labelling appearing on the panel, we
    use the following algorithm, where "(null)" represents the zero-length
    string, and "n" and "m" are integers:
    Code (Text):
    1. #selectedindex  #itemcount  label_shown
    2.    (null)         (null)      (none)
    3.    (null)           0         0 items
    4.    (null)           n         n items
    5.      0            (null)      (none)
    6.      0              0         0 items
    7.      0              n         n items
    8.      n            (null)      Item n
    9.      n              0         Item n
    10.      n              m         Item n/m
    In addition, when the context menu is on the screen, "#selectedindex"
    is the index of the highlighted item in the context menu, and not the
    index of the item in the list. So when the context menu is visible, we
    display the null string or "n items", as appropriate.
    ===================================================================== -->
    <label>#(switch(
    and(eq(#currentmodule,L(102012)),eq(#itemcount,'')),'',
    eq(#currentmodule,L(102012)),'#itemcount items',
    and(eq(#selectedindex,''),eq(#itemcount,'')),'',
    and(eq(#selectedindex,'0'),eq(#itemcount,'')),'',
    or(eq(#selectedindex,''),eq(#selectedindex,'0')),'#itemcount items',
    or(eq(#itemcount,''),eq(#itemcount,'0')),'Item #selectedindex',
    eq(1,1),'Item #selectedindex/#itemcount'))</label>

    So there you have it. Simples! :D

    -- from CyberSimian in the UK
     
    • Like Like x 1
  4. Rob Hexenmeister
    • Premium Supporter

    Rob Hexenmeister MP Donator

    Joined:
    May 12, 2011
    Messages:
    95
    Likes Received:
    12
    Gender:
    Male
    Location:
    Slaithwaite
    Ratings:
    +19 / 0
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    Good heavens! Thank you very much

    So that label code is what I want then? My intention was to use #itemcount in a visibility condition for a forward arrow graphic - i.e. if #selectedindex = #itemcount then forward arrow graphic visibility = false.

    RH
     
    • Like Like x 1
  5. CyberSimian
    • Team MediaPortal

    CyberSimian Test Group

    Joined:
    June 10, 2013
    Messages:
    1,579
    Likes Received:
    519
    Gender:
    Male
    Location:
    Southampton
    Ratings:
    +935 / 3
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    Hmm, I don't think that the <label> code that I showed is quite what you want. The <label> code is what is needed to generate a sensible item count in the top left corner of the panel. Because "#itemcount" and "#selectedindex" are unreliable, I don't think that you will be able to achieve what you want. :(

    -- from CyberSimian in the UK
     
    • Informative Informative x 1
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!