Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   Wasabi Development (http://forums.winamp.com/forumdisplay.php?f=122)
-   -   Info File General Component (with source!) (http://forums.winamp.com/showthread.php?t=76574)

Russ 19th February 2002 15:41

Info File General Component (with source!)
 
1 Attachment(s)
Right, after three days on-and-off fiddling with the SDK, I've managed to produce a vaguely useful component, which writes the currently playing song info to a file for use with mIRC (a better solution than DDE IMHO), or other things. I'm also releasing it with source, so people don't have to spend hours playing around with the SDK like I did :).

This component shows new component developers how to create a simple windowless plugin with callbacks, and config file attributes, and I try to illustrate the pitfalls I found.

The information the plugin gets can be a bit intermittent at times, and I blame the metadb functions for not supplying me with the info ;).

Lastly, thanks to schweitn, pokefreak325, and soundsys for helping me on this one.

Peter_Berre 22nd February 2002 10:57

hmm.. i can't get the mirc alias to work.. i can't get it to read the file.
in your example you don't have a path to the txt file. In that case where should winamp save the file?
i've tried changeing $read(playing.txt,1) to $read("full path"\playing.txt,1) but that doesn't work.

Russ 22nd February 2002 11:01

I set the info file as playing.txt in my mIRC directory (i.e. C:\mirc\playing.txt) - I'm not sure how $read works outside of there.

Peter_Berre 22nd February 2002 11:02

hmm seems as though the $read syntax is wrong .... it's as if you can't specify a line... i've never tried mirc script before, so i'm not sure though..
Found out what the default dir is, mirc's (system) directory

Russ 22nd February 2002 11:05

Hmm... $read(file.txt,linenum) is valid syntax on mirc 6.

Peter_Berre 22nd February 2002 11:06

ahh i'm not useing mirc 6.. that might be it... i'll continue playing with my alias

Peter_Berre 22nd February 2002 11:12

seems that the sytax in the older mirc's is: $read -l# playing.txt
# is the line number

BlindSeer 22nd February 2002 22:52

Hey, thanks so much for this plug-in. I've been using a similar one for Winamp2 and was wishing there was one for Winamp3. One question: how do you get it to display "Nothing" when you're not listening to anything? For me, it just keeps the last played song title there.

Also, would you happen to know how I could use server side includes to include only part of the file that Winamp outputs? I only know how to include the whole file, and I'd like to be able to separate artist, title, and album.

Thanks.

Russ 23rd February 2002 08:55

Yeh, that's actually in the PHP script I wrote to generate the image. The newer version of my component (at http://russ.garrett.co.uk/wa3) saves a UNIX-style timestamp to the last line of the file, and I do a simple check to see if it's more than 20mins old, which covers most songs. If it is, I output "Nothing".

I suppose I could clear the file at the end of each track as well, but this solution is pretty acceptable (to me anyway :)). See the source of my script at http://russ.garrett.co.uk/playing.txt.

I'm pretty sure you can't just use SSI, at least not for this file format. Give me 10mins and I'll knock up one which just outputs artist - title :).

Russ 23rd February 2002 09:21

As promised, my new Info File Lite component. This outputs a single-line file with "Artist - Title", which is changed to "Nothing" when the song stops.

Get it here: http://russ.garrett.co.uk/wa3/infofilelite1.wac.

BlindSeer 23rd February 2002 12:35

Perfect, thank you.

BlindSeer 23rd February 2002 14:27

Ahhh... one more request. *bows down* ;)
I've got the whole PHP deal figured out now... could you possibly add the "nothing" functionality to the non-lite version? Thanks again.

Russ 23rd February 2002 20:11

Right, I've modified the info file plugin to clear the file when the playback stops: http://russ.garrett.co.uk/wa3/waInfoFile1.5.zip

It's easy enough to get the recieving script to output "Nothing" - I didn't want to hard-code it in though. The updated php script I use in my sig is at http://russ.garrett.co.uk/playing.txt.

BlindSeer 23rd February 2002 20:30

Excellent, now it's perfect. :)

knole_z 24th February 2002 03:19

russ
i had a look at your source, the reason MT_SIZE and MT_LENGTH aren't coming thruogh properly is that they are int types not strings. plug in MDT_INT as your last argument and you should get usable numbers. all the types and fields are defined in common/metatags.h

Rocker 24th February 2002 07:45

Russ check your PM's

Russ 24th February 2002 09:48

knole_z: I did try MDT_INT I seem to remember - might try again later.

knole_z 25th February 2002 00:58

sorry, i had a bit of a better look at it last night, i didnt realise data was always a char*. my guess is it either returns a numeric string or it returns a 4 char string equivilant to an int. i didnt get to compile anything though - im still trying to get attribute callbacks to work. apologies for talking out of my ass


All times are GMT. The time now is 20:46.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.