Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: SDK - Plugin (Read 3699 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

SDK - Plugin

Sorry to post this here, but my irc is acting up.

Does anyone know how to get the current playing songs information, e.g. title and/or artist, for use in a plugin?  I must be not thinking straight today.

I am currently porting winamp's gen_tbar plugin to foobar.  I got the time, length, playing status, and it all displays, just need the other song info to finish it off.


Thanks for any help,
Scott


P.S.  I am still learning cpp so I could have easily missed something, I only use fortran and perl at work.

SDK - Plugin

Reply #1
try this:

Code: [Select]
    string_interface_i curfile;
    metadb *metadb = metadb::get();
    metadb->format_title(track, &curfile, "%artist% - %title%", NULL, NULL);


change the formatting "%artist% - %title%" to whatever you want, use curfile.get_ptr() to return the text.
.

SDK - Plugin

Reply #2
I think I missed something, because how do you get the track?  Once I have that, the metadb calls will work great.  With them I can then put a formating option in the configuration for the plugin.  Just still missing how you get the track.


Currently confused and hungry, a deadly combination.

SDK - Plugin

Reply #3
curfile.get_ptr() ? wont that do it? what do you mean exactly how do you get the track? this will return the text for the current playing track..
.

SDK - Plugin

Reply #4
sorry.  I was meaning what would go in the "track" entry.  I realize "track" would be "const playlist_entry * source".

SDK - Plugin

Reply #5
This has been solved.

Thanks musicmusic!


I am adding some more config options, then I will be posting the plugin.

SDK - Plugin

Reply #6
Quote
try this:

Code: [Select]
    string_interface_i curfile;
    metadb *metadb = metadb::get();
    metadb->format_title(track, &curfile, "%artist% - %title%", NULL, NULL);


change the formatting "%artist% - %title%" to whatever you want, use curfile.get_ptr() to return the text.

Looking at the code there, I take it the SDK uses Visual C++ classes?

Thus, what are the chances of being able to access the SDK in languages other than C++?

SDK - Plugin

Reply #7
I believe you could get away with another language if you changed the header files over to that language.


Anyhow, my plugin is finished and you should see it posted soon on the 3rd party components website.

SDK - Plugin

Reply #8
Try using string8 instead of string_interface_i.

And if you're feeling bold, or just plain lazy, you can get away with converting a whole mIRC command string

Code: [Select]
//mp3title [%artist% - ]$if(%title%,['['%album%[ #[%disc%/]$num(%tracknumber%,2)]'] ']%title%,%_filename%) | /mp3tme %_length% | /mp3file %_path_raw% | /mp3rate %__samplerate% | /mp3bitrate $ifgreater(%__channels%,2,%__channels%0000,%__bitrate%) | /mp3channels %__channels% | /mp3seconds %_length_seconds% | /mp3play


or a whole spam script URL, ready for wininet, complete with lazy $replace() escaping (note use of single quotes to enclose brackets that I want to send, percent signs, conversion of spaces to plus signs after escaping existing plus signs, and the empty pair of single quotes that Tagz turns into one single quote)

Code: [Select]
http://127.0.0.1/submitdb.php?title=$replace([%artist% - ]$if(%title%,['['%album%[ #[%disc%/]$num(%tracknumber%,2)]'] ']%title%,%_filename%),&,'%'26,+,'%'2B,' ',+,#,'%'23,'','%'27)&len=%_length_seconds%&user=kode54


I'd have written a configuration dialog for it, but most would probably find it a chore to assemble URLs for their favorite message board signature music spamming service, not to mention that your password would have to be somewhere in that field. Not to mention that I never felt like begging for a tester slot at WinampDB, or writing the code to fetch the submission password. Instead, I wrote my own insecure spamming system, which I even used here for about a day.

SDK - Plugin

Reply #9
Edited