Author Topic: Write Current Song to TXT File?  (Read 127 times)

Jo Li KMC

  • Posts: 26
Write Current Song to TXT File?
« on: 7 Nov '21 - 03:03 »
If anyone's getting déjà vu, here (saga), there was a post from 2003 about this very thing.

Anyway, I'm looking for a way to get the current song from XMPlay to display on a video window.  One such solution might be to have the program, itself, write the current song information to a text file, akin to how Snap – a "music overlay" add-on for streaming software – works, then have a text overlay read from that text file.  That would, in fact, be pretty ideal, and I'd probably be Snap v6.9 – the last one to support anything other than Spotify or iTunes – if it knew what XMPlay was.

The original solution that saga came up with was a program that plopped the song title into the Windows clipboard every couple of seconds.  That… really doesn't sound useful?  Honestly, I'd rather have a teeny-tiny TXT file for my purposes.  In fact, a super-simple plugin would probably do the trick.  I could just capture the XMPlay window in my recording, but I think a text overlay would open up more possibility for customization, ya know?

Any help would be super-groovy.  As always, thank you so much!

saga

  • Posts: 2549
Re: Write Current Song to TXT File?
« Reply #1 on: 7 Nov '21 - 12:14 »
A small program that captures the currently playing song could look like this:

1. Call the WinAPI function FindWindow("XMPLAY-MAIN", 0), which returns XMPlay's window handle.
2. If the returned handle is not 0, call GetWindowText on that handle to return the current window title.
3. Goto 1 every few seconds.

This can be done as a plugin or a standalone executable (as I did back then).

sveakul

  • Posts: 121
Re: Write Current Song to TXT File?
« Reply #2 on: 7 Nov '21 - 17:17 »
One such solution might be to have the program, itself, write the current song information to a text file..
Honestly, I'd rather have a teeny-tiny TXT file for my purposes.  In fact, a super-simple plugin would probably do the trick. 

This plugin does that part well: https://support.xmplay.com/files_view.php?file_id=717

Jo Li KMC

  • Posts: 26
Re: Write Current Song to TXT File?
« Reply #3 on: 7 Nov '21 - 18:16 »
You're beautiful, sveakul.  This is exactly what I wanted.  Thank you so much!
Kinda wish it would display just the name of the file and not the entire path if that's enabled, though, ha hah.

sveakul

  • Posts: 121
Re: Write Current Song to TXT File?
« Reply #4 on: 7 Nov '21 - 20:04 »
Good!  Mine though does NOT display the path for files, it's version 1.4.  Are you sure you can't modify that in the plugin options?  My plugin options for 1.4 are below:



This produces log entries like below, the first two are radio stations the last two are mp3 files on my PC:

2021-11-03 20:09:14  The Reverberators - Tsunami 500   -
2021-11-03 20:09:32  The Tiki Tones - Traitor Vic   -
2021-11-07 14:56:08   [MP3] 4 Strings - Take Me Away (Yuri Sky Chillmix)
2021-11-07 14:56:17   [MP3] 69 Chambers - Dead Letter Office

sveakul

  • Posts: 121
Re: Write Current Song to TXT File?
« Reply #5 on: 7 Nov '21 - 21:25 »
BTW there is a thread for the plugin here https://www.un4seen.com/forum/?topic=19454.0 ,the developer Keltic Danor may be able to help you with an option displaying only the filename and not the path.