PDA

View Full Version : PlayMP3 v2.0.1BETA


Dave
07-29-2005, 03:00 PM
Hey,

I dont know if this is the most recent version of this script, as I have done work on it recently....

PlayMP3.mrc

; /************************************************** ************************************************** ****/
; /* PlayMP3 V2.0.1 - (C) 2001 - 2005, Dave Wintrip, PureVanity.net. All Rights Reserved. dave@purevanity.net */
' /* Greets: derfy */
; /************************************************** ************************************************** ****/

alias udur { return $remove($replace($replace($replace($replace($repla ce($replace($replace($replace($replace($replace($d uration($1),secs,s),mins,m),hrs,h),min,m),hrs,h),h r,h),sec,s),days,d),day,d),wks,w),$chr(32)) }


alias stfu {
/mp3.stfu
}

alias mp3.stfu {
if (%mp3.stfu) {
.unset %mp3.stfu
.echo -a %mp3.programcall Silent Running (STFU) Disabled.
.halt
}
if (!(%mp3.stfu)) {
.set %mp3.stfu true
.echo -a %mp3.programcall Silent Running (STFU) Enabled.
}
}


;/* This is the main function of the program. This is executed by Winamp */
alias dmp3-n {
; /echo -a $1-
;/* Silent-Running feature */
if (%mp3.stfu) {
.halt
}


;/* Phase One! Disqualification. Nail the fake to the wall. */
if ($2 == [Connecting] || $2 == prebuffering || $2 == [Buffer: || $1 < 1) {
.halt
}
if (%mp3.watchcount > 0) {
if (%mp3.minwatch > $calc(%mp3.lastlen - %mp3.watchcount)) {
.echo -s %mp3.callsign Warning: Minimum song spacing detected. Skipping report.
.halt
}
if (%mp3.lastplay == $2-) {
if ($calc(%mp3.lastlen - %mp3.watchcount) < $1) {
.echo -s %mp3.callsign Warning: Song repeated before it was done plaing! WTF?! Skipping report.
.halt
}
if (%mp3.lastlen != $1) {
set %mp3.lastlen $1
.halt
}
}
}

; derfyfix - thanks derf for this idea
if ($1 < %mp3.minlen) {
.halt
}


; /* Phase Two! Report that stuff. */
if (%mp3.lastplay = $2-) { halt }
.set %mp3.lastplay $2-
.set %mp3.lastlen $1
.inc %mp3.played 1
.inc %mp3.totaltime $1
.saveini
.set %mp3.watchcount $1
.timermp3watch 0 2 /mp3.decwatch
.set %mp3.mipst $2-
.set %mp3.vlen $len($2-)
.set %mp3.mipst $replace(%mp3.mipst,.MPG,)
.set %mp3.mipst $replace(%mp3.mipst,.MPG2,)
.set %mp3.mipst $replace(%mp3.mipst,.mv2,)
.set %mp3.mipst $replace(%mp3.mipst,.avi,)
.set %mp3.mipst $replace(%mp3.mipst,.wmv,)
.set %mp3.mipst $replace(%mp3.mipst,.mpeg,)
.set %mp3.mipst $replace(%mp3.mipst,.m2v,)

if (%mp3.vlen > $len(%mp3.mipst)) {
.inc %mp3.vidplayed 1
.set %mp3.lasttype video
/inc %mp3.vidlen $1
/scon %ntwrk /msg %mp3.playchan1 %mp3.vidcallsign .;: %mp3.mipst :;. L: $+ $udur($1) v: $+ %mp3.vidplayed P: $+ %mp3.played
if (%mp3.onlinestats) {
}

}
if (%mp3.playchan2) {
/scon %ntwrk /msg %mp3.playchan2 %mp3.vidcallsign .;: %mp3.mipst :;. L: $+ $udur($1) v: $+ %mp3.vidplayed P: $+ %mp3.played
}
;if (%mp3.playchan3) {
; /scon %ntwrk /msg %mp3.playchan3 %mp3.vidcallsign .;: %mp3.mipst :;. L: $+ $udur($1) v: $+ %mp3.vidplayed P: $+ %mp3.played
;}
;if (%mp3.playchan4) {
; /scon %ntwrk /msg %mp3.playchan4 %mp3.vidcallsign .;: %mp3.mipst :;. L: $+ $udur($1) v: $+ %mp3.vidplayed P: $+ %mp3.played
;}
;if ($lower($active) != %mp3.playchan1 && $lower($active) != %mp3.playchan2 && $lower($active) != %mp3.playchan3 && $lower($active) != %mp3.playchan4) {
; if (%mp3.playontop == 1) {
; /echo -a %mp3.vidcallsign .;: %mp3.mipst :;. L: $+ $udur($1) v: $+ %mp3.vidplayed P: $+ %mp3.played
; }
;}



if (%mp3.lasttype != video) {
/inc %mp3.songlen $1
/scon %ntwrk /msg %mp3.playchan1 %mp3.callsign .;: $2- :;. L: $+ $udur($1) s: $+ $calc(%mp3.played - %mp3.vidplayed) P: %mp3.played
;/msg %mp3.playchan2 %mp3.callsign .;: $2- :;. L: $+ $udur($1) s: $+ $calc(%mp3.played - %mp3.vidplayed) P: %mp3.played
if (%mp3.onlinestats) {
/msg #Data Dave-MP3 MUS $1 %mp3.mipst
}
if (%mp3.playchan2) {
/scon %ntwrk /msg %mp3.playchan2 %mp3.callsign .;: $2- :;. L: $+ $udur($1) s: $+ $calc(%mp3.played - %mp3.vidplayed) P: %mp3.played
}
;if (%mp3.playchan3) {
; /scon %ntwrk /msg %mp3.playchan3 %mp3.callsign .;: $2- :;. L: $+ $udur($1) s: $+ $calc(%mp3.played - %mp3.vidplayed) P: %mp3.played
;}
;if (%mp3.playchan4) {
; /scon %ntwrk /msg %mp3.playchan4 %mp3.callsign .;: $2- :;. L: $+ $udur($1) s: $+ $calc(%mp3.played - %mp3.vidplayed) P: %mp3.played
;}

;if ($lower($active) != %mp3.playchan1 && $lower($active) != %mp3.playchan2 && $lower($active) != %mp3.playchan3 && $lower($active) != %mp3.playchan4) {
; if (%mp3.playontop == 1) {
; /echo -a %mp3.callsign .;: $2- :;. L: $+ $udur($1) s: $+ $calc(%mp3.played - %mp3.vidplayed) P: %mp3.played
; }
;}
}

; /* Phase Three: Profit! */
.unset %mp3.lasttype

}

alias mp3.decwatch {
if (%mp3.watchcount < 1) {
.timermp3watch off
}
.inc %mp3.watchcount -2
}




alias mp3.stats {
.say %mp3.programcall .;: Played: $calc(%mp3.played - %mp3.vidplayed) songs, %mp3.vidplayed videos, $udur(%mp3.totaltime) total length in %mp3.played files Av: $udur($calc(%mp3.totaltime / %mp3.played)) $+ . :;.
.say %mp3.programcall .;: Reset: %mp3.resetdate $+ , Video Length: $udur(%mp3.vidlen) $+ , Song Length: $udur(%mp3.songlen) $+ .  :;.
}

alias mp3.setup {
if ($1 == $null) {
.set %mp3.help Missing Parameters.
}
if ($1 == help) {
.set %mp3.help Mp3Echo Setup Help.
}
if ($1 == h) {
.set %mp3.help Mp3Echo Setup Help.
}
if ($1 == ResetStats) {
.set %mp3.resetdate $asctime(mmmm d yyyy H:nnt)
.set %mp3.played 0
.set %mp3.vidplayed 0
.set %mp3.totaltime 0
.set %mp3.lastplay 0
.set %mp3.lastlen 0
.echo %mp3.programcall $+ : Reset Stats counters.
}
if ($1 == Mp3Prefix) {
if ($2-) {
.echo %mp3.programcall $+ : Reset MP3 Prefix to: $2-
.set %mp3.callsign $2-
.halt
}
}
if ($1 == MinWatch) {
if ($2-) {
.echo %mp3.programcall $+ : Reset MinWatch to: $2-
.set %mp3.minwatch $2-
.halt
}
}
if ($1 == VideoPrefix) {
if ($2-) {
.echo %mp3.programcall $+ : Reset Video Prefix to: $2-
.set %mp3.vidcallsign $2-
.halt
}
}
if ($1 == ProgramPrefix) {
if ($2-) {
.set %mp3.programcall $2-
.echo %mp3.programcall $+ : Reset Program Prefix to: $2-
.halt
}
}
if ($1 == PlayOnTop) {
if ($2 == no || $2 == n || $2 == 0) {
.set %mp3.playontop 0
.echo -a %mp3.programcall $+ : Set PlayOnTop to: Off
}
if ($2 == yes || $2 == y || $2 == 1) {
.set %mp3.playontop 1
.echo -a %mp3.programcall $+ : Set PlayOnTop to: On
}
}
if ($1 == Brackets) {
if ($2 && $3) {
.set %mp3.bracket1 $2
.set %mp3.bracket2 $3
.echo %mp3.programcall $+ : Reset Brackets to: %mp3.bracket1 Test! %mp3.bracket2
.halt
}
}
if (%mp3.help) {
; /* Default Menu */
/echo -a -
/echo -a %mp3.programcall $+ : %mp3.help  Commands available:
/echo -a %mp3.programcall $+ : Help or H (This menu)
/echo -a %mp3.programcall $+ : ResetStats (Resets the Stats Counters) Last Reset: %mp3.resetdate
/echo -a %mp3.programcall $+ : Mp3Prefix <song prefix> (Sets the prefix for MP3 channel plays.) Currently: %mp3.callsign
/echo -a %mp3.programcall $+ : VideoPrefix <video prefix> (Sets the prefix for Video channel plays.) Currently: %mp3.vidcallsign
/echo -a %mp3.programcall $+ : ProgramPrefix <stats prefix> (Sets the prefix for program displays.) Currently: %mp3.programcall
/echo -a %mp3.programcall $+ : Brackets <bracket1> <bracket2> (Sets the bracket string.) %mp3.bracket1 Currently %mp3.bracket2
/echo -a %mp3.programcall $+ : MinWatch <int delay in seconds> (Sets the minimal inter-song time) Currently: $udur(%mp3.minwatch)
/echo -a %mp3.programcall $+ : PlayOnTop <0 or 1 (yes or no)> (Sets the local display of plays in active window) Currently: %mp3.playontop
/echo -a -
.unset %mp3.help
}
}


alias mp3count {
var %ticks $ticks, %temp, %ltime, %lsize, %output
%temp = $findfile(%mcimp3.dir, *.mp*, 0, inc %ltime $int($calc($sound($1-).length / 1000)))
%temp = $findfile(%mcimp3.dir, *.mp*, 0, inc %lsize $file($1-).size)
%output = $round($calc(($ticks - %ticks) / 1000),2)
if (#) { say [Mp3 Count]: ( $+ %mcimp3.dir $+ ) ( $+ $chr(91) $+ %temp $+ $chr(93) $+ / $+ $bytes(%lsize, 3).suf $+ / $+ $chr(91) $+ $udur(%ltime) $+ $chr(93) $+ ) ( $+ %output $+ s) }
else { echo -a [Mp3 Count]: ( $+ %mcimp3.dir $+ ) ( $+ $chr(91) $+ %temp $+ $chr(93) $+ / $+ $bytes(%lsize, 3).suf $+ / $+ $chr(91) $+ $udur(%ltime) $+ $chr(93) $+ ) ( $+ %output $+ s) }
}



Variables:

%ntwrk 1

set this to the number of the network you wish to plays to. This must be set. If you dont know, or use only one irc connection, set this to 1.



%mp3.playchan1 #PlayMP3

Set this to the channel you wish to spew mp3s to. Multi chan is coded in, but its buggy for some reason.





To set everything up, be sure to /mp3.setup after you load the script. We need to get an orginal install of the Winamp plugin eventually. We plan to release an updated version of this script shortly, but we're working on a lot of other projects right now.

Let me know if its missing anything.

Thanks,


--Dave

profpaddy
09-08-2005, 05:33 PM
I've tried, but at the end I get the following error:


: Missing Parameters.  Commands available:
: Help or H (This menu)
: ResetStats (Resets the Stats Counters) Last Reset:
: Mp3Prefix <song prefix> (Sets the prefix for MP3 channel plays.) Currently:
: VideoPrefix <video prefix> (Sets the prefix for Video channel plays.) Currently:
: ProgramPrefix <stats prefix> (Sets the prefix for program displays.) Currently:
: Brackets <bracket1> <bracket2> (Sets the bracket string.) Currently
* No such identifier: $repla (line 6, play_mp3.mrc)


I'm not a coder, so I don't know how to fix this. Please help a newbie with this kind of things, because I had it working once

Rob
09-11-2005, 09:53 PM
Pft, he's got a few spaces in there that shouldn't be. Dave, fix yo script. There's a comment out of whack and at least 1 extra space in the middle of an alias call. I'm too lazy to go over the whole thing and fix it :S.

Dave
09-12-2005, 10:11 PM
Pft, he's got a few spaces in there that shouldn't be. Dave, fix yo script. There's a comment out of whack and at least 1 extra space in the middle of an alias call. I'm too lazy to go over the whole thing and fix it :S.


Bah! I'll fix it all up and release a new version soon. I've been busy coding all the stuff for our new website. Few weeks, no ETA.

Apparently the move from phpBB to vB screwed some stuff up. Nice to see a commercial product takes time to test.... I'll probably delete this thread when the updated version is posted.

--Dave

profpaddy
09-14-2005, 08:11 AM
*waits patiently*