MagicMirror² v2.4.1 is available! For more information about this release, check out this topic.
Please read the release notes carefully since this update requires adjustments to your Raspberry Pi configuration!

MMM-ImageSlideshow need help adding an interesting feature



  • Greetings !
    Very useful module by @MYKLE1
    It puts images on the mirror based on the path given
    Basically it works fine for me !!

    I want to add following feature
    -> Based on my calendar event, the module should choose which path to grab images from
    e.g. If my today’s event is “Jack’s birthday”, then it should pick images from the path: module/imageslideshow/Jack_Birthday
    in other cases, the module should pick images from designated default area
    Isn’t that interesting ? 🙂

    I am currently trying to edit top config.js file with something like this
    Obviously it is incorrect, but still putting it out

    if (calendar.event == "Holi") {
    	var imagePath  = "modules/MMM-ImageSlideshow/Holi";
    } else {
    	var imagePath = "modules/MMM-ImageSlideshow/exampleImages", 
    }
    

    Which is the variable of “calendar” module, which gets me the event name, and how to use that var on config.js file ?
    PS: I dont know javascript , but i know C, python etc
    Appreciate any help
    Thanks
    Chirantan



  • Uh @Mykle1 didn’t write that one LOL

    But at any rate you could also do a switch statement like this:

    var text;
    var fruits = document.getElementById("myInput").value;
    
    switch(fruits) {
      case "Banana":
          text = "Banana is good!";
          break;
      case "Orange":
          text = "I am not a fan of orange.";
          break;
      case "Apple":
          text = "How you like them apples?";
          break;
      default:
          text = "I have never heard of that fruit...";
    }
    


  • @cowboysdude
    True that, Thank you very much for replying

    Either if or switch, which variable from the default calendar module gives me the event name in text format ?
    and can I use that variable at config.js level ?

    Appreciate your time
    Chirantan



  • @cjkj_06 I’m not really sure. I have never used that module so I don’t know anything about it 🙂

    I would look inside it and replace txt with perhaps your dir for images… just a thought.