MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. jedilkeme
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    J
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 9
    • Groups 0

    jedilkeme

    @jedilkeme

    1
    Reputation
    1
    Profile views
    9
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    jedilkeme Unfollow Follow

    Best posts made by jedilkeme

    • RE: Trouble with non-broken "broken" images

      @sdetweil that was my issue, I had assumed :8080/ what my main directory… fixed it. Thanks a bunch!

      posted in Development
      J
      jedilkeme

    Latest posts made by jedilkeme

    • RE: Trouble with non-broken "broken" images

      @sdetweil that was my issue, I had assumed :8080/ what my main directory… fixed it. Thanks a bunch!

      posted in Development
      J
      jedilkeme
    • RE: Trouble with non-broken "broken" images

      @sdetweil ah, it wasn’t showing errors because I had it written to load at 5am… I set it to run in one minute, and I did receive a 404 for the images, permissions are all groovy but I noticed I can’t view the images from localhost:8080/path-to-images in the browser, but if I just put in the file path in the address bar I can see the images… then I ran npm start dev and I found an EADDRINUSE error. Stumped. Thanks your you assistance so far!

      posted in Development
      J
      jedilkeme
    • RE: Trouble with non-broken "broken" images

      @sdetweil no 404 errors or anything else that pops out at me…

      posted in Development
      J
      jedilkeme
    • RE: Trouble with non-broken "broken" images

      @jedilkeme what should I be looking for from there?

      posted in Development
      J
      jedilkeme
    • RE: Trouble with non-broken "broken" images

      @sdetweil ctrl-alt-i has no effect???

      posted in Development
      J
      jedilkeme
    • Trouble with non-broken "broken" images

      im working on a super basic tarot draw module that draws three cards at random out of seventy eight at random with the chance of inversion of each card. not being a javascript or any other kind of real coder(i am a script kitty at best and not afraid to admit it). i had chat gpt write me a module, which seems well written, ive had it correct itself and i just dont see where the errors are, if anyone would be willing to take a look i would be stoked. thanks in advance code_text ...
      code_text

      MMM_Tarot.css
      
      .tarot-card {
          max-width: 300px; /* Set maximum width */
          max-height: 400px; /* Set maximum height */
          width: auto; /* Maintain aspect ratio */
          height: auto; /* Maintain aspect ratio */
      }
      
      .inverted {
          transform: scaleY(-1);
      }
      
      
      code_text
      MMM_Tarot.js
      
      Module.register("MMM_Tarot", {
          defaults: {
              updateHour: 5, // Update hour (5 am)
              updateMinute: 0, // Update minute
              updateInterval: 24 * 60 * 60 * 1000, // Update every day
          },
      
          start: function() {
              var self = this;
              this.tarotData = {};
              this.scheduleUpdate();
              setInterval(function() {
                  self.scheduleUpdate();
              }, 60 * 1000); // Check every minute if it's time to update
          },
      
          scheduleUpdate: function() {
              var self = this;
              var now = new Date();
              var scheduledTime = new Date(
                  now.getFullYear(),
                  now.getMonth(),
                  now.getDate(),
                  this.config.updateHour,
                  this.config.updateMinute,
                  0,
                  0
              );
      
              var delay = scheduledTime.getTime() - now.getTime();
              if (delay < 0) {
                  delay += this.config.updateInterval;
              }
      
              setTimeout(function() {
                  self.getTarotData();
                  setInterval(function() {
                      self.getTarotData();
                  }, self.config.updateInterval);
              }, delay);
          },
      
          getStyles: function() {
              return ["MMM_Tarot.css"];
          },
      
          getTarotData: function() {
              this.sendSocketNotification("GET_TAROT_DATA");
          },
      
          socketNotificationReceived: function(notification, payload) {
              if (notification === "TAROT_DATA") {
                  this.tarotData = payload;
                  this.updateDom();
              }
          },
      
          getDom: function() {
              const wrapper = document.createElement("div");
      
              if (this.tarotData.images) {
                  for (let i = 0; i < this.tarotData.images.length; i++) {
                      const cardImg = document.createElement("img");
                      cardImg.src = this.tarotData.images[i].image;
                      cardImg.className = "tarot-card"; // Add class to set max-width
      
                      // If the card is inverted, add a class to flip it
                      if (this.tarotData.images[i].inverted) {
                          cardImg.classList.add("inverted");
                      }
      
                      wrapper.appendChild(cardImg);
                  }
              } else {
                  wrapper.innerHTML = "Loading...";
              }
      
      
      
              return wrapper;
          }
      });
      
      

      code_text

      node_helper.js

      const NodeHelper = require(“node_helper”);
      const fs = require(“fs”);
      const path = require(“path”);

      module.exports = NodeHelper.create({
      start: function() {
      console.log(“Starting node_helper for MMM_Tarot”);
      },

      socketNotificationReceived: function(notification) {
          if (notification === "GET_TAROT_DATA") {
              this.getTarotData();
          }
      },
      
      getTarotData: function() {
          // Array of available card images
          const cardImages = fs.readdirSync(path.join(__dirname, "..", "MMM_Tarot", "cards"));
      
          // Randomly select three card images
          const selectedCards = [];
          for (let i = 0; i < 3; i++) {
              const randomIndex = Math.floor(Math.random() * cardImages.length);
              selectedCards.push(cardImages[randomIndex]);
          }
      
          // Determine if each card should be inverted
          const invertedCards = [];
          for (let i = 0; i < 3; i++) {
              invertedCards.push(Math.random() < 0.5); // 50% chance of being inverted
          }
      
          // Construct the file paths for the selected cards
          const cardPaths = selectedCards.map((card, index) => ({
              image: path.join(__dirname, "..", "cards", card),
              inverted: invertedCards[index],
          }));
      
          // Send the selected cards data back to the main module
          this.sendSocketNotification("TAROT_DATA", { images: cardPaths });
      }
      

      });

      posted in Development
      J
      jedilkeme
    • RE: bluetooth audio meta data

      @kayakbabe i am using the mirror as a BlueTooth pass-through for my home audio set-up, i connect to the mirror via BlueTooth, it automatically connects to the house audio works well now. thanks for your input!

      posted in Requests
      J
      jedilkeme
    • RE: bluetooth audio meta data

      i figured out a very hacky solution taking the meta data off of the dbus and spitting it into a text file using grep and from the third party module site i found a simple text file module to display it.

      then, to get constant updating, i set it on a cronjob and found a script to make it run every 5 seconds.

      it works well, but the text blanks for milliseconds at a time and is noticeable, i am sure some adjusting of the cronjobs can hopefully make it appear to be more steady.

      posted in Requests
      J
      jedilkeme
    • bluetooth audio meta data

      ive been searching for a module that will display the audio meta data from a bluetooth connection to the magic mirror, and have yet to find one. does anyone know of such a module or be willing to help me find the right direction?

      posted in Requests
      J
      jedilkeme