• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

MMM-Remote-Control API Questions

Scheduled Pinned Locked Moved Troubleshooting
17 Posts 3 Posters 3.5k Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    sgarg15 @sdetweil
    last edited by Apr 19, 2020, 11:09 PM

    @sdetweil

    var dataFile=["Archer S01E02Someshow.tv",
    "Archer S01E03Someshow .tv",
    "Archer S01e02Someshow .tv",
    "Archer S01E04Someshow .tv",
    "Archer S01E05someshow .tv",
    "Archer s01E02Someshow .tv",
    "Archer S01E09Someshow .tv",
    ]
    var counter1=10
    
    
                        if(dataFile){
                            var output_list= [];
                            // should make this a config variable by adding to module defaults
                           // then would be this.config.counter
                           // get display limit, 10 if not specified in defaults
                           var counter=counter1 || 10
                            // setup regex, no i  no g (only once, and case sensitive)
                            var splitRegExp = /.*[S][(0-9)]+[E][(0-9)]+/;
                            // loop thru the list of filenames
                            for(filename of dataFile) {
                                // if the name is not zero length (split could have returned for just linefeed
                                if(filename.length >0 && counter >0) {
                                   // get the filename prefix
                                   var split = splitRegExp.exec(filename);
                                   // save name to the output list, as a table entry
                                   // remove space after the ->< , the forum hides everything after unless a space
                                   // table has a row, 
                                   output_list.push("<tr><td>")
                                   // with data
                                   if(split)
                                      output_list.push(split)
                                   else 
                                       output_list.push('name not matched '+ filename)
                                   // end of data and row
                                   output_list.push("</td></tr>")
                                   counter--;
                                } 
                            }  
                        }
                            // insert the table into the wrapper
                console.log( "<table>" + output_list.join('')+ "</table>");
    

    This correct?

    S 1 Reply Last reply Apr 19, 2020, 11:21 PM Reply Quote 0
    • S Offline
      sgarg15 @sdetweil
      last edited by Apr 19, 2020, 11:12 PM

      @sdetweil Also how do i make it so that the python file is always running?

      1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @sgarg15
        last edited by Apr 19, 2020, 11:21 PM

        @sgarg15 that was the example of running a little js app on the command line node js_filename

        The exact code here doesn’t help you, but the prior code I posted is what u want to try. Altho I don’t know how u will hook it to the sensors on your pc

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        S 1 Reply Last reply Apr 19, 2020, 11:24 PM Reply Quote 0
        • S Offline
          sdetweil @sdetweil
          last edited by Apr 19, 2020, 11:24 PM

          @sgarg15 your python PGM has to loop somehow. I don’t do python

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • S Offline
            sgarg15
            last edited by Apr 20, 2020, 12:14 AM

            @sdetweil so, i have my python script running in the background, and in my nodeHelper.js i would have

            import {PythonShell} from 'python-shell';
            
            let pyshell = new PythonShell('Swiping.py');  // < --- whatever your script name, in the module folder
             
            // the .on handler gets called each time the pythin script writes a message to stdout
            pyshell.on('message', function (message) {
              // received a message sent from the Python script (a simple "print" statement)
              console.log(message);
              // send info up to modulename.js
              this.sendSocketNotification("movement", message)
            });
            

            could you explain what movement and message mean in the sendSocketNotification?

            1 Reply Last reply Reply Quote 0
            • E Offline
              ertopps Banned
              last edited by Apr 28, 2020, 10:16 AM

              If you could help me achieve this, or give me some info that could help me do this i would really appreciate it

              S 1 Reply Last reply Apr 28, 2020, 11:39 AM Reply Quote 0
              • S Offline
                sdetweil @ertopps
                last edited by Apr 28, 2020, 11:39 AM

                @ertopps do what?

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • E Offline
                  ertopps Banned
                  last edited by Apr 29, 2020, 5:45 PM

                  I am stuck due to similar issues. And now I need some professional developers with Python knowledge and good programming skills. I am from the US, check this out. And you need to be able during my working hours, it will be a great advantage for fruitful cooperation. Send me a message to my private box for more details. I do hope to find someone here with your assistance.

                  1 Reply Last reply Reply Quote 0
                  • 1
                  • 2
                  • 2 / 2
                  • First post
                    Last post
                  Enjoying MagicMirror? Please consider a donation!
                  MagicMirror created by Michael Teeuw.
                  Forum managed by Sam, technical setup by Karsten.
                  This forum is using NodeBB as its core | Contributors
                  Contact | Privacy Policy