Created
August 28, 2023 03:16
-
-
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
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
// ==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