Skip to content

Instantly share code, notes, and snippets.

@dorukayhan
Created August 28, 2023 03:16
Show Gist options
  • Save dorukayhan/da93cb612e0f88d4238ba6d9bd6a61f2 to your computer and use it in GitHub Desktop.
Save dorukayhan/da93cb612e0f88d4238ba6d9bd6a61f2 to your computer and use it in GitHub Desktop.
JScript Panel 3 thingy for getting foobar2000 to write the now-playing song to a temp file
// ==PREPROCESSOR==
// @name Now Playing
// @author marc2k3
// ==/PREPROCESSOR==
var tfo = fb.TitleFormat("Now playing: [%artist% - ]%title%");
var path = "C:\\file\\here";
/////////////////////////////////////////////////////////////////////////////////////////////////////////
var last = '';
function on_playback_new_track() {
log_it(false);
}
function on_playback_dynamic_info_track(type) {
if (type == 0) {
log_it(false);
}
}
function on_playback_stop() {
log_it(true);
}
function on_script_unload() {
log_it(true);
}
function on_playback_pause(state) {
log_it(state);
}
function log_it(paused) {
var current = '';
if (!paused) {
current = tfo.Eval();
}
if (current != last) {
last = current;
utils.WriteTextFile(path, current);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment