Spotify-search then play or add to queue + css

https://flows.nodered.org/node/node-red-contrib-string

https://flows.nodered.org/node/node-red-contrib-spotify

https://flows.nodered.org/node/node-red-node-ui-list

[{"id":"5ed2d57d64f75242","type":"spotify","z":"826d41bf188ee328","name":"","auth":"eb1da49544e69d31","api":"searchTracks","x":540,"y":100,"wires":[["b9a822a854888c15"]]},{"id":"2e96208c38c74688","type":"function","z":"826d41bf188ee328","name":"","func":"\nmsg.params = \n[msg.payload,{ limit : 10, offset : 0 }];\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":100,"wires":[["5ed2d57d64f75242"]]},{"id":"b9a822a854888c15","type":"change","z":"826d41bf188ee328","name":"","rules":[{"t":"move","p":"payload.tracks.items","pt":"msg","to":"payload","tot":"msg"},{"t":"delete","p":"_msgid","pt":"msg"},{"t":"delete","p":"params","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":100,"wires":[["d94bef37811bcc53"]]},{"id":"d94bef37811bcc53","type":"split","z":"826d41bf188ee328","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":910.0068778991699,"y":100,"wires":[["75b91ef40e99ddb6"]]},{"id":"d6951a3acf276376","type":"function","z":"826d41bf188ee328","name":"","func":"msg.payload={\"title\": msg.payload.name, \"icon\": msg.payload.album.images[2].url,\n    \"uri\": msg.payload.album.uri, \"track\": msg.payload.track_number,\n    \"q\": msg.payload.uri,\n    \"menu\": [\n            \"play\",\n            \"file d'attente\"\n        ]\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1167.9028625488281,"y":100,"wires":[["199a93644204d0bc"]]},{"id":"199a93644204d0bc","type":"join","z":"826d41bf188ee328","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1295.4708309173584,"y":100,"wires":[["625e72fa0cce45b7"]]},{"id":"75b91ef40e99ddb6","type":"string","z":"826d41bf188ee328","name":"","methods":[{"name":"left","params":[{"type":"num","value":"30"}]}],"prop":"payload.name","propout":"payload.name","object":"msg","objectout":"msg","x":1036.6735649108887,"y":100,"wires":[["d6951a3acf276376"]]},{"id":"4ba557963e439e3c","type":"spotify","z":"826d41bf188ee328","name":"","auth":"eb1da49544e69d31","api":"play","x":1730,"y":200,"wires":[[]]},{"id":"8bb2c6ef87e41556","type":"range","z":"826d41bf188ee328","minin":"1","maxin":"100","minout":"0","maxout":"99","action":"scale","round":true,"property":"payload.track","name":"","x":1423.8038482666016,"y":200,"wires":[["41462b9e2f6c6fda"]]},{"id":"41462b9e2f6c6fda","type":"function","z":"826d41bf188ee328","name":"","func":"msg.params = [\n    {\n        \"context_uri\": msg.payload.uri\n,\n    \"offset\": {\n    \"position\":  msg.payload.track\n        \n    }\n    }\n];\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1581.4072036743164,"y":200,"wires":[["4ba557963e439e3c"]]},{"id":"cfb3f7a8d8a499d5","type":"spotify","z":"826d41bf188ee328","name":"","auth":"eb1da49544e69d31","api":"addToQueue","x":1591.4072036743164,"y":253.91843605041504,"wires":[[]]},{"id":"614d88a08715e3f2","type":"switch","z":"826d41bf188ee328","name":"","property":"payload.selected","propertyType":"msg","rules":[{"t":"eq","v":"play","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1283.1732635498047,"y":227.47420263290405,"wires":[["8bb2c6ef87e41556"],["caf64fe1aa059724"]]},{"id":"caf64fe1aa059724","type":"function","z":"826d41bf188ee328","name":"","func":"\nmsg.params = \n[msg.payload.q];\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1433.8038482666016,"y":253.91843605041504,"wires":[["cfb3f7a8d8a499d5"]]},{"id":"625e72fa0cce45b7","type":"ui_list","z":"826d41bf188ee328","group":"d783cb980c3979fc","name":"","order":2,"width":"0","height":"0","lineType":"one","actionType":"menu","allowHTML":false,"outputs":1,"topic":"","x":1413.0035934448242,"y":100,"wires":[["614d88a08715e3f2"]]},{"id":"2cc22929a47b82b3","type":"ui_template","z":"826d41bf188ee328","group":"d783cb980c3979fc","name":"Node-Red Dashboard Custom CSS","order":1,"width":0,"height":0,"format":"<style>\n\n    /*Main background*/\n    body {\n        background: -webkit-linear-gradient(\n            55deg,\n            #009785 0%,\n            #245aa5 50%,\n            #b800e9 100%\n            );\n    }\n\n    /*Top bar*/\n    body.nr-dashboard-theme md-toolbar,\n    body.nr-dashboard-theme md-content md-card {\n        background-color: transparent !important;\n        color: #FFFFFF !important;\n    }\n\n\n    /*Left menu*/\n    /*Sidebar*/\n    body.nr-dashboard-theme md-sidenav {\n        color: white !important;\n        background-color: rgba(0,0,0,0) !important;\n    }\n    /*Hover selection*/\n    a.md-no-style, button.md-no-style {\n        border-radius: 10px !important;\n    }\n    /*Selected*/\n    .nr-menu-item-active div button {\n        border-right: 4px solid rgb(41 98 255) !important;\n    }\n    /*List*/\n    body.nr-dashboard-theme md-sidenav div.md-list-item-inner {\n        color: white !important;\n        background-color: rgba(40,85,165,1) !important;\n        border-radius: 10px !important;\n    }\n\n\n    /*Groups*/\n    ui-card-panel {\n        background-color: rgba(255,255,255,0.1) !important;\n        border-radius: 10px !important;\n    }\n    .nr-dashboard-theme ui-card-panel {\n        border: none !important;\n    }\n    /*Name groups*/\n    .nr-dashboard-theme ui-card-panel p.nr-dashboard-cardtitle {\n        color: rgba(255, 255, 255, 0.5) !important;\n    }\n\n\n    /*Bouttons*/\n    .nr-dashboard-theme .nr-dashboard-button .md-button {\n        background-color: rgba(255,255,255,.1) !important;\n    }\n    .md-button {\n        border-radius: 10px !important;\n    }\n\n\n    /*Dropdown menu*/\n    .nr-dashboard-theme md-select-menu{\n        background-color: rgba(40,85,165,1) !important;\n    }\n    .nr-dashboard-theme md-select-menu, .nr-dashboard-theme md-select-menu md-option {\n        background-color: transparent !important;\n    }\n    .nr-dashboard-theme .md-select-menu-container {\n        border-radius: 10px !important;\n        border: none !important;\n    }\n    .nr-dashboard-theme md-select-menu md-option[selected] {\n        color: white !important;\n        background-color: #1a3566 !important;\n    }\n\n    /*Template*/\n    md-card>img, md-card>md-card-header img, md-card md-card-title-media img {\n        border-radius: 10px !important;\n    }\n\n    /* Color picker text BG */\n    .nr-dashboard-theme .color-picker-input-wrapper > input {\n        color: white !important;\n        background-color: transparent !important;\n    }\n    md-list-item .md-list-item-inner {\n    background: #b22a2a00;\n    /* padding-left: 8px; */\n    /* width: 100%; */\n    /* height: 100%; */\n    }\n    md-list-item .md-list-item-inner {\n    background: #00000000;\n    }\n    .nr-dashboard-template p, .nr-dashboard-template h1, .nr-dashboard-template h2, .nr-dashboard-template h3,\n    .nr-dashboard-template h4 {\n    color: #000000 !important;\n    background-color: #301f1f00 !important;\n    }\n    .nr-dashboard-template {\n    overflow-y: clip;\n    /* vertical-align: inherit; */\n    }\n    .nr-dashboard-theme .nr-dashboard-template .md-button {\n    background-color: #2e698000;\n    margin: 0;\n    min-width: unset;\n    line-height: unset;\n    }\n    .nr-dashboard-theme md-menu-content {\n    background-color: #d03e3e00;\n    }\n    \n</style>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"global","className":"","x":200,"y":180,"wires":[[]]},{"id":"33795e3bef11012c","type":"ui_text_input","z":"826d41bf188ee328","name":"","label":"","tooltip":"","group":"d783cb980c3979fc","order":1,"width":"7","height":"1","passthru":true,"mode":"text","delay":300,"topic":"search","sendOnBlur":true,"className":"","topicType":"msg","x":80,"y":100,"wires":[["56d4ec3d0b514bcb"]]},{"id":"56d4ec3d0b514bcb","type":"switch","z":"826d41bf188ee328","name":"","property":"payload","propertyType":"msg","rules":[{"t":"istype","v":"string","vt":"string"}],"checkall":"true","repair":false,"outputs":1,"x":210,"y":100,"wires":[["2e96208c38c74688"]]},{"id":"eb1da49544e69d31","type":"spotify-auth","name":"Spotify OAuth2","scope":"ugc-image-upload\nuser-read-playback-state\nuser-modify-playback-state\nuser-read-currently-playing\napp-remote-control\nstreaming\nplaylist-read-private\nplaylist-read-collaborative\nplaylist-modify-private\nplaylist-modify-public\nuser-follow-modify\nuser-follow-read\nuser-read-playback-position\nuser-top-read\nuser-read-recently-played\nuser-library-modify\nuser-library-read\nuser-read-email\nuser-read-private"},{"id":"d783cb980c3979fc","type":"ui_group","name":"search","tab":"f0a1db7162cd0bdc","order":1,"disp":true,"width":"7","collapse":false,"className":""},{"id":"f0a1db7162cd0bdc","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

Flow Info

Created 2 years, 6 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x1)
  • function (x4)
  • join (x1)
  • range (x1)
  • split (x1)
  • switch (x2)
Other

Tags

  • Spotify
  • search
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option