()
| 401 | } |
| 402 | |
| 403 | function importItems() { |
| 404 | const input = document.createElement("input"); |
| 405 | input.type = "file"; |
| 406 | input.accept = ".json"; |
| 407 | input.onchange = (e) => { |
| 408 | const file = e.target.files[0]; |
| 409 | const reader = new FileReader(); |
| 410 | reader.onload = (e) => { |
| 411 | try { |
| 412 | const data = JSON.parse(e.target.result); |
| 413 | trashSongList = data.songs; |
| 414 | trashArtistList = data.artists; |
| 415 | putDataLocal(); |
| 416 | Spicetify.showNotification("File Import Successful!"); |
| 417 | } catch (e) { |
| 418 | Spicetify.showNotification("File Import Failed!", true); |
| 419 | console.error(e); |
| 420 | } |
| 421 | }; |
| 422 | reader.onerror = () => { |
| 423 | Spicetify.showNotification("File Read Failed!", true); |
| 424 | console.error(reader.error); |
| 425 | }; |
| 426 | reader.readAsText(file); |
| 427 | }; |
| 428 | input.click(); |
| 429 | } |
| 430 | })(); |
nothing calls this directly
no test coverage detected