|
| 1 | +<div id="manual-analysis" style="display: none;"> |
| 2 | + <h1>How to Use the Spotify Analysis Downloader</h1> |
| 3 | + |
| 4 | + <p> |
| 5 | + The Spotify Analysis Downloader lets you download analysis data for the track currently playing on Spotify and any track changes until you close or reload the tab. It only works on desktop browsers. If you want to listen to the song on mobile, upload the analysis from a desktop browser first. Follow these steps to use it: |
| 6 | + </p> |
| 7 | + |
| 8 | + <ol> |
| 9 | + <li> |
| 10 | + <strong>Show your bookmarks bar:</strong> |
| 11 | + <ul> |
| 12 | + <li><strong>Chrome:</strong> Press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>B</kbd> (Windows) or <kbd>Cmd</kbd> + <kbd>Shift</kbd> + <kbd>B</kbd> (Mac) to toggle the bookmark bar.</li> |
| 13 | + <li><strong>Firefox:</strong> Click the menu button and select <strong>Library</strong>, then <strong>Bookmarks</strong>, and <strong>Bookmarking Tools</strong>, and select <strong>Show Bookmarks Toolbar</strong>.</li> |
| 14 | + <li><strong>Edge:</strong> Press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>B</kbd> or go to <strong>Settings</strong> > <strong>Appearance</strong> > <strong>Show favorites bar</strong> and set to <strong>Always</strong>.</li> |
| 15 | + <li><strong>Safari:</strong> Go to <strong>View</strong> in the top menu and select <strong>Show Favorites Bar</strong>.</li> |
| 16 | + </ul> |
| 17 | + </li> |
| 18 | + <li> |
| 19 | + <strong>Bookmark the following link:</strong> |
| 20 | + Drag this button to your bookmark bar to save it as a bookmark: |
| 21 | + <a href="javascript:(() => { {% include manual-analysis-script.js %} })();" class="btn btn-small btn-default">Spotify Analysis Downloader</a> |
| 22 | + </li> |
| 23 | + <li> |
| 24 | + <strong>Open Spotify:</strong> |
| 25 | + Use this link to open Spotify in your browser and log in (Premium account not required): |
| 26 | + <a href="https://open.spotify.com" target="_blank" class="btn btn-small btn-default">Open Spotify</a>. |
| 27 | + </li> |
| 28 | + <li> |
| 29 | + <strong>Play a Spotify track:</strong> |
| 30 | + Start any track on Spotify to begin downloading analysis data for it. Pausing or muting the track will not impact the downloader. |
| 31 | + </li> |
| 32 | + <li> |
| 33 | + <strong>Use the bookmarklet:</strong> |
| 34 | + While the song is playing, click the "Spotify Analysis Downloader" bookmarklet from your bookmark bar. This action will download the analysis file for the current track. |
| 35 | + </li> |
| 36 | + <li> |
| 37 | + <strong>Continue listening:</strong> |
| 38 | + The downloader will automatically save analysis data for each new track you play until you close or reload the tab. |
| 39 | + </li> |
| 40 | + <li> |
| 41 | + <strong>Locate your downloads:</strong> |
| 42 | + The downloaded files will be in your downloads folder and named after the track IDs (e.g., `03UrZgTINDqvnUMbbIMhql.json`). |
| 43 | + </li> |
| 44 | + <li> |
| 45 | + <strong>Upload the analysis file:</strong> |
| 46 | + Match the filename with the track ID of the song you tried to play (see the URL) and use the form below to upload the analysis file for processing. |
| 47 | + </li> |
| 48 | + </ol> |
| 49 | + |
| 50 | + <h2>Upload the Analysis File</h2> |
| 51 | + <p>Select the JSON file you downloaded that corresponds to the song you tried to play on The Eternal Jukebox:</p> |
| 52 | + |
| 53 | + <div class="l-cb" id="l-analysis-upload"> |
| 54 | + <form id="analysis-upload-form"> |
| 55 | + <input id="analysis-upload" type="file" name="song_upload" accept=".json"> |
| 56 | + </form> |
| 57 | + <div class='progress_outer' id="analysis-progress" style="background-color: green; max-width: 300px;"> |
| 58 | + <div id='_progress' class='progress'></div> |
| 59 | + </div> |
| 60 | + </div> |
| 61 | + |
| 62 | + <script> |
| 63 | + $("#analysis-upload").change(function () { |
| 64 | + var params = {}; |
| 65 | + var q = document.URL.split('?')[1]; |
| 66 | + if (q !== undefined) { |
| 67 | + q = q.split('&'); |
| 68 | + for (var i = 0; i < q.length; i++) { |
| 69 | + var pv = q[i].split('='); |
| 70 | + var p = pv[0]; |
| 71 | + var v = pv[1]; |
| 72 | + params[p] = v; |
| 73 | + } |
| 74 | + } |
| 75 | + if (!'id' in params) { |
| 76 | + $("#error").text("You must be on a song page to upload analysis data."); |
| 77 | + $("#error").show(); |
| 78 | + return; |
| 79 | + } |
| 80 | + var id = params['id']; |
| 81 | + |
| 82 | + if ($("#analysis-upload")[0].files[0].name.split('.')[0] !== id) { |
| 83 | + $("#error").text("This is not the correct analysis file for this song. The correct file should be called " + id + ".json."); |
| 84 | + $("#error").show(); |
| 85 | + return; |
| 86 | + } |
| 87 | + |
| 88 | + $("#error").hide(); |
| 89 | + |
| 90 | + $.ajax({ |
| 91 | + url: "/api/analysis/upload/" + id, |
| 92 | + type: "POST", |
| 93 | + data: new FormData($('#analysis-upload-form')[0]), |
| 94 | + processData: false, |
| 95 | + contentType: false, |
| 96 | + headers: { |
| 97 | + "X-XSRF-TOKEN": document.cookie.substring(document.cookie.indexOf("XSRF-TOKEN")).split(";")[0].split("=").slice(1).join("=") |
| 98 | + }, |
| 99 | + xhr: function () { |
| 100 | + var xhr = new window.XMLHttpRequest(); |
| 101 | + xhr.upload.addEventListener("progress", function (evt) { |
| 102 | + if (evt.lengthComputable) { |
| 103 | + var percentComplete = evt.loaded / evt.total; |
| 104 | + percentComplete = percentComplete * 100; |
| 105 | + $('#analysis-progress').text(percentComplete + '%'); |
| 106 | + $('#analysis-progress').css('width', percentComplete + '%'); |
| 107 | + } |
| 108 | + }, false); |
| 109 | + return xhr; |
| 110 | + }, |
| 111 | + success: function () { |
| 112 | + window.location.reload(true); |
| 113 | + }, |
| 114 | + error: function (xhr, textStatus, error) { |
| 115 | + if (xhr.responseJSON && typeof xhr.responseJSON.error === "string") { |
| 116 | + error = xhr.responseJSON.error; |
| 117 | + } |
| 118 | + $("#error").text("Sorry, could not upload analysis data: " + error); |
| 119 | + $("#error").show(); |
| 120 | + } |
| 121 | + }); |
| 122 | + }); |
| 123 | + </script> |
| 124 | +</div> |
0 commit comments