Created
February 27, 2026 19:56
-
-
Save ZachSaucier/461cf3dd2c9e127171b406c410bd3dd4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Pull up the index view of all of your songs then run this: | |
| (function() { | |
| const artistCount = {}; | |
| let totalSongs = 0; | |
| // 1. Helper function to process a specific document | |
| const processDocument = (doc) => { | |
| // Select rows that have a song title and an artist span | |
| const rows = doc.querySelectorAll('tr'); | |
| rows.forEach(row => { | |
| const songTitle = row.querySelector('.songTitle'); | |
| const artistSpan = row.querySelector('td.truncate span.detail'); | |
| if (songTitle && artistSpan) { | |
| const artistName = artistSpan.textContent.trim(); | |
| if (artistName) { | |
| artistCount[artistName] = (artistCount[artistName] || 0) + 1; | |
| totalSongs++; | |
| } | |
| } | |
| }); | |
| }; | |
| // 2. Process the main page | |
| processDocument(document); | |
| // 3. Process all accessible iframes | |
| const iframes = document.querySelectorAll('iframe'); | |
| iframes.forEach(frame => { | |
| try { | |
| if (frame.contentDocument) { | |
| processDocument(frame.contentDocument); | |
| } | |
| } catch (e) { | |
| // Silently skip cross-origin frames | |
| } | |
| }); | |
| // 4. Sort and Display Results | |
| const sortedArtists = Object.entries(artistCount) | |
| .sort((a, b) => b[1] - a[1]) | |
| .map(([Artist, Songs]) => ({ Artist, Songs })); | |
| if (totalSongs > 0) { | |
| console.log(`%c Total Songs Scanned: ${totalSongs} `, "color: white; background: #2e7d32; font-weight: bold;"); | |
| console.table(sortedArtists); | |
| } else { | |
| console.warn("No songs found. Ensure the table is visible on the screen."); | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment