# Let n8n play the music - Harshil Agrawal

## Метаданные

- **Канал:** n8n
- **YouTube:** https://www.youtube.com/watch?v=M47hIhNAExY
- **Дата:** 28.06.2021
- **Длительность:** 6:32
- **Просмотры:** 906

## Описание

In this talk, Harshil demonstrates the CLI tool he built to control Spotify

## Содержание

### [0:00](https://www.youtube.com/watch?v=M47hIhNAExY) <Untitled Chapter 1>

so i used to be good at singing but i'm not but i like music and i did some experiment with it and i build a workflow a tool that i use to control my spotify player and so my talk is titled let any 10 play the music i'm just going to do a quick uh introduction because most of you all know me my name is herschel i love to experiment with tech i started doing live streams on twitch and i also have created my own youtube channel so please do follow me over there now talking about this talk i am going to show a command line tool that i built to control my spotify player of being a developer a command line and a command line nerd i enjoy controlling my apps via the terminal so let me quickly show you how it is so this is my terminal on the left and my spotify music player i'm just gonna play some music for now and hope that you all can hear that okay so this is running and i am assuming like i see ricardo is nodding so i am assuming that you all can hear the music i am gonna run this command right now that is spotify first and this would pause my player and over here voila so i build this whole thing using a few tools uh and i use any tent to connect it but let's now you know change the song and then play the music so spotify next okay interesting let's just try it again so now we have another song we got the name as well as you know the name of the artist as well so i'm gonna pause the song now spotify all right and now let me come back to my slides so the workflow is very complex let me tell you beforehand well no i was just kidding it's a simple workflow uh you can see over here it's hardly uh i don't know seven to eight nodes not more than that but let's look uh what tools i use to do this

### [2:19](https://www.youtube.com/watch?v=M47hIhNAExY&t=139s) Tools x

this so i am a javascript developer so i decided to you know create an mpm package that i can use uh to control my spotify player now there was this option of how do i connect my spotify player with my mpm package now i'll be honest with you all i try to avoid writing a lot of code whenever i have the option and just go the uh no code low code path and that's where na10 uh comes into the picture so using na10 i connect my command line tool with my spotify player and the last thing you need is of course a spotify account now i'm going to explain you the whole process of what goes on behind the scenes so i run the command it makes a request to an attend and it intercepts the request it tells fortify to play the song pause the song or whatever command i then spotify the spotify player performs that particular action again and it and then you know creates that response that we saw so we got the name of the song as well as and then we display the message so what happens over here we run the command the orange box is over here uh shows na10 so na10 intercepts the request tells spotify what to do spotify player does that action and then anything sends back some information to a terminal and then the terminal displays the information so talking about the features that this particular command line tool has it has this very

### [4:01](https://www.youtube.com/watch?v=M47hIhNAExY&t=241s) Features

nice help command which can give you the list of all the commands that i have for now integrated so you can see there is the option to play a song pause the song change the song maybe go to the next song in the queue or go to the previous song and then if you do a spotify card it gives you the information of the current song so all this information again is just you know a web book recall to an attend and it ended the process over there and then it give displays it out on the terminal let me again share the workflow over here so the if node over here it just checks if the command is start music so we go to the true branch we get the current uh the current id of the song and then we just tell spotify to play that song and in the set note i am just getting the uh name of the song as well as the artist and if the command is anything other than the start music i dynamically pass this operation in n10 so whatever the command is it will dynamically been fetched and the operation has been recognized over here and then i get the id perform the operation and then it just set a step over here again the set node is similar to the previous one just get the song and the artist name so yeah that's it so there are a few features that are that i want to work on for this a few of them uh is to generators play the song from the given name so let's just say i

### [5:41](https://www.youtube.com/watch?v=M47hIhNAExY&t=341s) What's next?

want to hear a song by ed sharon and the song might be photograph so i say spotify play photograph and then you know it goes to n10 finds that song and plays it in my spotify player so that's one of the features that i want to add the another is to you know get the list of all my playlists the ability to select the specific playlist and then you know play the songs from that playlist so these are the two features that i still want to add but if you have any other features and if you would like to try it out you can always check it out check out it check it out on github i'll be sharing the link in the chat soon so here's the github it's open source you can try it out i have listed all the instructions as well on how you can install it and if you just want the workflow you can get the workflow as well

---
*Источник: https://ekstraktznaniy.ru/video/15792*