ptrk95 / MMM-MusicOnDemand

A module for the Magic Mirror using a music on demand service.
MIT License
7 stars 4 forks source link

Search titles or artists #3

Open julenmerchan opened 5 years ago

julenmerchan commented 5 years ago

Hi, first of all, thanks for your job, your module is incredible. It works very well, however i want to know how can i search a title or an artist. I followed the steps of the tutorial but i can't search for a title or an artist. Can you clarify how I have to configure the module?.

P.D: I'm using a Raspberry pi 3b

ptrk95 commented 5 years ago

Thank you :) and sorry for the big delay.

Since this module was made to be used with a speech recognition software/module, it does not have the ability to get the information of the title you search for.

To control the features you have to send messages to this module with an other module. There is no other way to use this module for the moment. Also I am not working on improving its abilities at the near future if no one wants to get more abilities.

Let's say you want to search for the song "The Drunken Warbler" and your "other module" is for example the Grove Gesture module. When you swipe left you want to search for the song, so you change his config entry which looks somehow like this:

...
"LEFT": {
          notificationExec: {
            notification: "ARTICLE_PREVIOUS",
            payload: null,
          }
        },
...

To that:

...
"LEFT": {
          notificationExec: {
            notification: "AtMusicOnDemand",
            payload: {
                         message: "Title", 
             Title: "The Drunken Warbler",  },
          }
        },
...

But you can also add this nice line of code to the function of an other module in its "ModuleName".js file, if you want to search for the song and the module does not provide the ability to send notifications with the config.txt entry like the example above does. But this means you have to do a little dig into the code of the other module to find the right place for this line:

this.sendNotification('AtMusicOnDemand', {message: "Title", Title: "The Drunken Warbler"});

So with this two options you can only search for this one specific title. In the "sendNotification"-option you may be able to get the information about the title in the other module and execute this line with your title, instead of the hardcoded string: "The Drunken Warbler". Sorry if I complicate things a bit.

In the description I mention the use of a speach recognition software/module. This is just to get the information about the title you want to search for. You can of course use any other module to get the information about the title and send it with the line of code above.

Hope this helps and does not confuse you. Have a nice day!