{ "name": "Sync Spotify Liked Songs to a Playlist", "tags": [ { "id": "TYGC4owzlQuowxvB", "name": "Spotify", "createdAt": "2024-03-14T16:54:47.712Z", "updatedAt": "2024-03-14T16:54:47.712Z" } ], "nodes": [ { "id": "sync-spotify-liked-songs-to-playlist-0", "name": "Start", "type": "n8n-nodes-base.manualTrigger", "position": [ 160, 220 ], "parameters": {}, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-1", "name": "Schedule Trigger", "type": "n8n-nodes-base.scheduleTrigger", "position": [ 180, -100 ], "parameters": { "rule": { "interval": [ {} ] } }, "typeVersion": 1.1 }, { "id": "sync-spotify-liked-songs-to-playlist-2", "name": "Sort first added to first item", "type": "n8n-nodes-base.sort", "position": [ 1480, -60 ], "parameters": { "options": {}, "sortFieldsUi": { "sortField": [ { "fieldName": "added_at" } ] } }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-3", "name": "Gotify Send deleted n from x", "type": "n8n-nodes-base.gotify", "position": [ 3540, 220 ], "parameters": { "message": "=### Sync of Lieblingssongs to {{ $('Edit set Vars').item.json.varplaylistto }} finished.\n#### Deleted {{ $json.count_del }} Songs in {{ (($now.toUnixInteger()-$('Edit set intern vars').item.json.timestart)/60).toFixed(1) }} Minutes from {{ $('Edit set Vars').item.json.varplaylistto }}.", "options": { "contentType": "text/markdown" }, "additionalFields": {} }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-4", "name": "Loop delete old", "type": "n8n-nodes-base.splitInBatches", "position": [ 2560, 300 ], "parameters": { "options": {} }, "typeVersion": 3 }, { "id": "sync-spotify-liked-songs-to-playlist-5", "name": "Spotify delete old", "type": "n8n-nodes-base.spotify", "position": [ 2820, 320 ], "parameters": { "id": "={{ $('Set pluri').item.json.setpluri }}", "trackID": "={{ $json.track.uri }}", "resource": "playlist", "operation": "delete" }, "typeVersion": 1, "alwaysOutputData": false }, { "id": "sync-spotify-liked-songs-to-playlist-6", "name": "Edit set Vars", "type": "n8n-nodes-base.set", "position": [ 480, 100 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "1bacf493-c2bf-47f8-bcb4-a83010d8da57", "name": "varplaylistto", "type": "string", "value": "YOUR_PLAYLIST_NAME" } ] } }, "typeVersion": 3.3 }, { "id": "sync-spotify-liked-songs-to-playlist-7", "name": "Edit success to del", "type": "n8n-nodes-base.set", "position": [ 3180, 240 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "2aab653d-b7ee-4d50-b8e5-fcae0c0da1f4", "name": "del", "type": "string", "value": "={{ $json.success }}" } ] } }, "typeVersion": 3.3 }, { "id": "sync-spotify-liked-songs-to-playlist-8", "name": "Filter Playlist x", "type": "n8n-nodes-base.filter", "position": [ 1480, 160 ], "parameters": { "options": {}, "conditions": { "options": { "version": 1, "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "0665f0f3-fb32-4391-b1a9-ce1dee887392", "operator": { "name": "filter.operator.equals", "type": "string", "operation": "equals" }, "leftValue": "={{ $json.name }}", "rightValue": "={{ $('Edit set Vars').item.json.varplaylistto }}" } ] } }, "typeVersion": 2 }, { "id": "sync-spotify-liked-songs-to-playlist-9", "name": "Compare Datasets", "type": "n8n-nodes-base.compareDatasets", "position": [ 2260, 20 ], "parameters": { "options": {}, "mergeByFields": { "values": [ { "field1": "track.uri", "field2": "track.uri" } ] } }, "typeVersion": 2.3 }, { "id": "sync-spotify-liked-songs-to-playlist-10", "name": "count added", "type": "n8n-nodes-base.summarize", "position": [ 3320, -280 ], "parameters": { "options": {}, "fieldsToSummarize": { "values": [ { "field": "added" } ] } }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-11", "name": "Loop add missing", "type": "n8n-nodes-base.splitInBatches", "position": [ 2560, -240 ], "parameters": { "options": {} }, "executeOnce": false, "typeVersion": 3 }, { "id": "sync-spotify-liked-songs-to-playlist-12", "name": "Spotify add Missing to x", "type": "n8n-nodes-base.spotify", "position": [ 2740, -200 ], "parameters": { "id": "={{ $json.setpluri }}", "trackID": "={{ $json.track.uri }}", "resource": "playlist", "additionalFields": {} }, "retryOnFail": true, "typeVersion": 1, "alwaysOutputData": false }, { "id": "sync-spotify-liked-songs-to-playlist-13", "name": "Edit snapshot to added", "type": "n8n-nodes-base.set", "position": [ 3160, -280 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "2aab653d-b7ee-4d50-b8e5-fcae0c0da1f4", "name": "added", "type": "string", "value": "={{ $json.snapshot_id }}" } ] } }, "typeVersion": 3.3 }, { "id": "sync-spotify-liked-songs-to-playlist-14", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [ 2480, -380 ], "parameters": { "color": 7, "width": 552.0433138756023, "height": 424.7557420711291, "content": "### Spotify add all missing song from your Liked Songs to the Playlist." }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-15", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [ 2480, 140 ], "parameters": { "color": 7, "width": 526.4961431470259, "height": 334.0270849934536, "content": "### Spotify remove all songs that aren't in your Liked Songs anymore." }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-16", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [ 120, -180 ], "parameters": { "color": 7, "width": 208.40632224018503, "height": 218.09160104224037, "content": "Run the workflow every 24h at 0 o'clock" }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-17", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "position": [ 1280, -202 ], "parameters": { "color": 7, "width": 961.006341450897, "height": 611.5473181162548, "content": "## Compare the content of your Liked Songs and the target Playlist " }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-18", "name": "Sticky Note5", "type": "n8n-nodes-base.stickyNote", "position": [ 420, -80 ], "parameters": { "color": 3, "width": 365.4656320955345, "height": 271.1720790719926, "content": "# Edit here!" }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-19", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [ 380, -20 ], "parameters": { "width": 362.28928697919184, "height": 267.99573395564994, "content": "## Change the value to the name of your target playlist." }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-20", "name": "Cound deleted", "type": "n8n-nodes-base.summarize", "position": [ 3320, 231 ], "parameters": { "options": {}, "fieldsToSummarize": { "values": [ { "field": "del" } ] } }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-21", "name": "Sort", "type": "n8n-nodes-base.sort", "position": [ 2100, 160 ], "parameters": { "options": { "disableDotNotation": false }, "sortFieldsUi": { "sortField": [ { "fieldName": "added_at" } ] } }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-22", "name": "Set pluri", "type": "n8n-nodes-base.set", "position": [ 1680, 160 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "f1589697-556f-451d-aada-55d2b0892eb2", "name": "setpluri", "type": "string", "value": "={{ $json.uri }}" } ] } }, "typeVersion": 3.3 }, { "id": "sync-spotify-liked-songs-to-playlist-23", "name": "Merge", "type": "n8n-nodes-base.merge", "position": [ 1700, -60 ], "parameters": { "mode": "combine", "options": {}, "combinationMode": "multiplex" }, "typeVersion": 2.1 }, { "id": "sync-spotify-liked-songs-to-playlist-24", "name": "Gotify", "type": "n8n-nodes-base.gotify", "position": [ 3520, -300 ], "parameters": { "message": "=### Sync of Liked Songs to {{ $('Edit set Vars').item.json.varplaylistto }} finished.\n#### Added {{ $('count added').item.json.count_added }} Songs in {{ (($now.toUnixInteger()-$('Edit set intern vars').item.json.timestart)/60).toFixed(1) }} Minutes to {{ $('Edit set Vars').item.json.varplaylistto }}.", "options": { "contentType": "text/markdown" }, "additionalFields": {} }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-25", "name": "Edit set intern vars", "type": "n8n-nodes-base.set", "position": [ 880, 80 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "88b47bd3-d1b6-4c7d-bec2-1606d8c39bde", "name": "timestart", "type": "string", "value": "={{ $now.toUnixInteger()}}" } ] } }, "typeVersion": 3.3 }, { "id": "sync-spotify-liked-songs-to-playlist-26", "name": "Sticky Note6", "type": "n8n-nodes-base.stickyNote", "position": [ 1120, -150 ], "parameters": { "color": 3, "width": 326.5743290776694, "height": 513.8509299486715, "content": "# Edit here!" }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-27", "name": "Sticky Note7", "type": "n8n-nodes-base.stickyNote", "position": [ 1080, -87 ], "parameters": { "width": 331.1762445648999, "height": 481.41944245487934, "content": "### You need to add your own spotify account here." }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-28", "name": "END", "type": "n8n-nodes-base.noOp", "position": [ 2580, 0 ], "parameters": {}, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-29", "name": "Sticky Note8", "type": "n8n-nodes-base.stickyNote", "position": [ 3140, 131 ], "parameters": { "color": 5, "width": 322.2176178216457, "height": 271.6789308744022, "content": "## (Optional) \n### Count the number of songs that were deleted" }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-30", "name": "Sticky Note9", "type": "n8n-nodes-base.stickyNote", "position": [ 3120, -400 ], "parameters": { "color": 5, "width": 322.2176178216457, "height": 271.6789308744022, "content": "## (Optional) \n### Count the number of songs that were added" }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-31", "name": "Sticky Note10", "type": "n8n-nodes-base.stickyNote", "position": [ 1840, 37 ], "parameters": { "color": 3, "width": 210.26363071246638, "height": 252.15185862696416, "content": "# Edit here!" }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-32", "name": "Sticky Note11", "type": "n8n-nodes-base.stickyNote", "position": [ 1800, 100 ], "parameters": { "width": 223.1734532257829, "height": 240.4901386983871, "content": "### You need to add your own spotify account here." }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-33", "name": "Sticky Note12", "type": "n8n-nodes-base.stickyNote", "position": [ 2800, 180 ], "parameters": { "color": 3, "width": 210.26363071246638, "height": 252.15185862696416, "content": "# Edit here!" }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-34", "name": "Sticky Note13", "type": "n8n-nodes-base.stickyNote", "position": [ 2760, 240 ], "parameters": { "width": 223.1734532257829, "height": 240.4901386983871, "content": "### You need to add your own spotify account here." }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-35", "name": "Sticky Note14", "type": "n8n-nodes-base.stickyNote", "position": [ 2740, -340 ], "parameters": { "color": 3, "width": 210.26363071246638, "height": 252.15185862696416, "content": "# Edit here!" }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-36", "name": "Sticky Note15", "type": "n8n-nodes-base.stickyNote", "position": [ 2700, -280 ], "parameters": { "width": 223.1734532257829, "height": 240.4901386983871, "content": "### You need to add your own spotify account here." }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-37", "name": "Spotify get Liked Songs", "type": "n8n-nodes-base.spotify", "position": [ 1160, -20 ], "parameters": { "resource": "library", "returnAll": true }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-38", "name": "Spotify get all playlists", "type": "n8n-nodes-base.spotify", "position": [ 1160, 200 ], "parameters": { "resource": "playlist", "operation": "getUserPlaylists", "returnAll": true }, "typeVersion": 1 }, { "id": "sync-spotify-liked-songs-to-playlist-39", "name": "Spotify get Tracks of X", "type": "n8n-nodes-base.spotify", "position": [ 1880, 160 ], "parameters": { "id": "={{ $json.setpluri }}", "resource": "playlist", "operation": "getTracks", "returnAll": true }, "typeVersion": 1, "alwaysOutputData": false } ], "active": false, "pinData": {}, "settings": { "timezone": "Europe/Berlin", "callerPolicy": "workflowsFromSameOwner", "executionOrder": "v1", "saveManualExecutions": true }, "connections": { "Sort": { "main": [ [ { "node": "Compare Datasets", "type": "main", "index": 1 } ] ] }, "Merge": { "main": [ [ { "node": "Compare Datasets", "type": "main", "index": 0 } ] ] }, "Start": { "main": [ [ { "node": "Edit set Vars", "type": "main", "index": 0 } ] ] }, "Set pluri": { "main": [ [ { "node": "Spotify get Tracks of X", "type": "main", "index": 0 }, { "node": "Merge", "type": "main", "index": 1 } ] ] }, "count added": { "main": [ [ { "node": "Gotify", "type": "main", "index": 0 } ] ] }, "Cound deleted": { "main": [ [ { "node": "Gotify Send deleted n from x", "type": "main", "index": 0 } ] ] }, "Edit set Vars": { "main": [ [ { "node": "Edit set intern vars", "type": "main", "index": 0 } ] ] }, "Loop delete old": { "main": [ [ { "node": "Edit success to del", "type": "main", "index": 0 } ], [ { "node": "Spotify delete old", "type": "main", "index": 0 } ] ] }, "Compare Datasets": { "main": [ [ { "node": "Loop add missing", "type": "main", "index": 0 } ], [ { "node": "END", "type": "main", "index": 0 } ], [ { "node": "END", "type": "main", "index": 0 } ], [ { "node": "Loop delete old", "type": "main", "index": 0 } ] ] }, "Loop add missing": { "main": [ [ { "node": "Edit snapshot to added", "type": "main", "index": 0 } ], [ { "node": "Spotify add Missing to x", "type": "main", "index": 0 } ] ] }, "Schedule Trigger": { "main": [ [ { "node": "Edit set Vars", "type": "main", "index": 0 } ] ] }, "Filter Playlist x": { "main": [ [ { "node": "Set pluri", "type": "main", "index": 0 } ] ] }, "Spotify delete old": { "main": [ [ { "node": "Loop delete old", "type": "main", "index": 0 } ] ] }, "Edit success to del": { "main": [ [ { "node": "Cound deleted", "type": "main", "index": 0 } ] ] }, "Edit set intern vars": { "main": [ [ { "node": "Spotify get Liked Songs", "type": "main", "index": 0 }, { "node": "Spotify get all playlists", "type": "main", "index": 0 } ] ] }, "Edit snapshot to added": { "main": [ [ { "node": "count added", "type": "main", "index": 0 } ] ] }, "Spotify get Liked Songs": { "main": [ [ { "node": "Sort first added to first item", "type": "main", "index": 0 } ] ] }, "Spotify get Tracks of X": { "main": [ [ { "node": "Sort", "type": "main", "index": 0 } ] ] }, "Spotify add Missing to x": { "main": [ [ { "node": "Loop add missing", "type": "main", "index": 0 } ] ] }, "Spotify get all playlists": { "main": [ [ { "node": "Filter Playlist x", "type": "main", "index": 0 } ] ] }, "Sort first added to first item": { "main": [ [ { "node": "Merge", "type": "main", "index": 0 } ] ] } } }