Skip to content

Instantly share code, notes, and snippets.

@nderscore
Last active December 20, 2015 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nderscore/6082168 to your computer and use it in GitHub Desktop.
Save nderscore/6082168 to your computer and use it in GitHub Desktop.
Bookmarklet. Creates a log of all songs played in a room. Run the bookmark once to start logging, and run it again later on to pull up the log. The bookmark will also pull the recently played tracks list.
javascript:(function(){if(window.ttLOG){var e=[];ttLOG.forEach(function(t){var n=t.song;e.push("[DJ: "+t.dj+" ] "+n.artist+" - "+n.song+(n.album?" [ "+n.album+" ]":""))});var t=$('<textarea style="width:640px;height:480px;"></textarea>').text(e.join("\n"));var n=$('<div id="qqq" style="position:absolute;top:0;left:0;z-index:99999;"><a href="javascript:$(\'#qqq\').remove();" style="background:#000;color:#fff;">[close]</a></div>');n.prepend(t);$("body").append(n)}else{ttLOG=[];(function(){for(i in turntable)if(turntable[i]&&turntable[i].roomId)return turntable[i]})().roomData.metadata.songlog.forEach(function(e){ttLOG.push({dj:e.djname,song:e.metadata})});turntable.addEventListener("message",function(e){if(!e.command||e.command!="newsong")return;var t=e.room.metadata.current_song;ttLOG.push({dj:t.djname,song:t.metadata})});alert("Started Logging. Run bookmark again to view the log.")}})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment