html/mp3 thinggy?
Posted by w.e
Saturday, November 12, 2005
Description: yup
example here [tims-design.net]
-Fixed the artist photo
-Added link's to Last.fm's artist/title/album features
on *:load: writeini mirc.ini lastdir generate $mircdir | mkdir organized
menu * {
Organize MP3: generate.html
}
alias iseven { return $iif($chr(46) isin $calc($1 / 2),$false,$true) }
alias generate.html {
var %lastdir $readini(mirc.ini,lastdir,generate)
var %sdir $sdir(%lastdir,Select directory)
if ($isdir(%sdir)) {
writeini mirc.ini lastdir generate %sdir
.fopen -o organizer " $+ $scriptdirorganized/index.html $+ "
.fwrite -n organizer <title>mp3 Organizer - mIRC Generated - Created by TiM @ #script</title><style type="text/css">
.fwrite -n organizer body $chr(123) background: #4F687D; font-family : Verdana, Arial, Helvetica; color: #FFFFFF $chr(125)
.fwrite -n organizer a $chr(123) color: #99FFFF; TEXT-DECORATION: none $chr(125)
.fwrite -n organizer a:hover $chr(123) color: #FFFFFF; TEXT-DECORATION: none $chr(125)
.fwrite -n organizer body,td,th $chr(123)
.fwrite -n organizer font-size: 9px;
.fwrite -n organizer $chr(125)
.fwrite -n organizer a:link $chr(123)
.fwrite -n organizer color: #FFFFFF;
.fwrite -n organizer text-decoration: underline;
.fwrite -n organizer $chr(125)
.fwrite -n organizer a:visited $chr(123)
.fwrite -n organizer text-decoration: underline;
.fwrite -n organizer color: #FFFFFF;
.fwrite -n organizer $chr(125)
.fwrite -n organizer a:active $chr(123)
.fwrite -n organizer text-decoration: underline;
.fwrite -n organizer color: #FFFFFF;
.fwrite -n organizer $chr(125)
.fwrite -n organizer </style>
.fwrite -n organizer <table width="100%" border="0" cellpadding="0" cellspacing="0">
.fwrite -n organizer <tr>
var %#songs $findfile(%sdir,*.mp3,0,generate.songs $1-)
.fclose organizer
.remove said.ini
.timerfind 0 3 finish
}
}
alias finish {
if ($readini(end.ini,artist,number) >= $lines(organized\index.html)) { run $scriptdirorganized\index.html | .fclose music.* | writeini end.ini artist number 23 | .timerfind off | halt }
find.artist $remove($gettok($read(organized\index.html, $readini(end.ini,artist,number)),2,62),</a)
writeini end.ini artist number $calc($readini(end.ini,artist,number) + 1)
}
alias find.artist {
unset %sed
.remove artist.txt
write artist.txt $1-
sockclose artist
sockopen artist www.last.fm 80
}
on *:SOCKOPEN:artist:{
var %artist $read(artist.txt)
sockwrite -n $sockname GET /music/ $+ $replace(%artist,$chr(32),+) $+ / HTTP/1.1
sockwrite -n $sockname Host: www.last.fm
sockwrite -n $sockname Connection: close
sockwrite -n $sockname User-Agent: Mozilla/3.0 (compatible)
sockwrite -n $sockname Authorization: Basic <uu-encoded>
sockwrite -n $sockname $crlf
}
on *:sockread:artist: {
var %artist $read(artist.txt)
sockread %temp
if (%artist isin %temp) && (Picture" isin %temp) {
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <tr height="100%"><td height="100%" colspan="6" align="center"><br><b>Artist photo</b><br><img src=" $+ $replace($gettok(%temp,6,34),http//,http://) $+ "></img><br><b>Taken from <a href="http://last.fm/">last.fm</a>.</b></td></tr>
}
}
alias nohtml { var %tmp, %ignore = $regsub($1-,/(<[^>]+>)/g,$chr(32),%tmp) | return %tmp }
alias generate.songs {
var %title $iif($sound($1-).title,$sound($1-).title,$remove($gettok($nopath($1-),2,45),.mp3))
if ($len(%title) > 30) { var %title $left(%title,30) $+ ... }
var %artist $iif($sound($1-).artist,$sound($1-).artist,$remove($gettok($nopath($1-),1,45),.mp3))
if ($len(%artist) > 30) { var %artist $left(%artist,30) $+ ... }
if (!$readini(said.ini,$replace(%artist,$chr(32),^space^),said)) {
.fwrite -n organizer <a href=" $+ %artist $+ /index.html"> $+ %artist $+ </a><br>
writeini said.ini $replace(%artist,$chr(32),^space^) said 2
if (!$isdir($scriptdir $+ organized/ $+ %artist $+ /)) mkdir " $+ $scriptdir $+ organized/ $+ %artist $+ "
.fopen -o music. $+ $replace(%artist,$chr(32),^space^) " $+ $scriptdir $+ organized/ $+ %artist $+ /index.html $+ "
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <title>mp3 Organizer - ( $+ %artist $+ ) - Created by TiM @ #script</title><style type="text/css">
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) body $chr(123) background: #4F687D; font-family : Verdana, Arial, Helvetica; color: #FFFFFF $chr(125)
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) a $chr(123) color: #99FFFF; TEXT-DECORATION: none $chr(125)
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) a:hover $chr(123) color: #FFFFFF; TEXT-DECORATION: none $chr(125)
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) body,td,th $chr(123)
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) font-size: 9px;
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) $chr(125)
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) a:link $chr(123)
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) color: #FFFFFF;
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) text-decoration: underline;
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) $chr(125)
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) a:visited $chr(123)
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) text-decoration: underline;
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) color: #FFFFFF;
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) $chr(125)
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) a:active $chr(123)
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) text-decoration: underline;
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) color: #FFFFFF;
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) $chr(125)
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) </style>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <table width="100%" border="0" cellpadding="0" cellspacing="0">
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <tr>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td width="2%" bgcolor="#006699"><strong>#</strong></td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td width="22%" bgcolor="#006699"><strong>Artist</strong></td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td width="25%" bgcolor="#006699"><strong>Title</strong></td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td width="10%" bgcolor="#006699"><strong>Length</strong></td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td width="32%" bgcolor="#006699"><strong>Album</strong></td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td width="9%" bgcolor="#006699"><strong>Bitrate</strong></td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) </tr>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <tr>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td bgcolor="#56748B"> $+ 1 $+ </td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td bgcolor="#56748B"> $+ <a href="http://last.fm/music/ $+ $replace(%artist,$chr(32),+) $+ " target="_blank"> $+ %artist $+ </a></td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td bgcolor="#56748B"> $+ <a href="http://last.fm/music/ $+ $replace(%artist,$chr(32),+) $+ /_/ $+ $replace(%title,$chr(32),+) $+ " target="_blank"> $+ %title $+ </a> $+ </td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td bgcolor="#56748B"> $+ $gmt($calc($sound($1-).length / 1000),nn:ss) $+ </td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td bgcolor="#56748B"> $+ <a href="http://www.last.fm/music/ $+ $replace(%artist,$chr(32),+) $+ / $+ $replace($sound($1-).album,$chr(32),+) $+ " target="_blank"> $+ $sound($1-).album $+ </a></td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td bgcolor="#56748B"> $+ $sound($1-).bitrate $+ </td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) </tr>
}
else {
if ($iseven($readini(said.ini,$replace(%artist,$chr(32),^space^),said))) {
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <tr>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td> $+ $readini(said.ini,$replace(%artist,$chr(32),^space^),said) $+ </td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td> $+ <a href="http://last.fm/music/ $+ $replace(%artist,$chr(32),+) $+ " target="_blank"> $+ %artist $+ </a></td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td> $+ <a href="http://last.fm/music/ $+ $replace(%artist,$chr(32),+) $+ /_/ $+ $replace(%title,$chr(32),+) $+ " target="_blank"> $+ %title $+ </a> $+ </td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td> $+ $gmt($calc($sound($1-).length / 1000),nn:ss) $+ </td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td> $+ <a href="http://www.last.fm/music/ $+ $replace(%artist,$chr(32),+) $+ / $+ $replace($sound($1-).album,$chr(32),+) $+ " target="_blank"> $+ $sound($1-).album $+ </a></td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td> $+ $sound($1-).bitrate $+ </td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) </tr>
}
else {
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <tr>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td bgcolor="#56748B"> $+ $readini(said.ini,$replace(%artist,$chr(32),^space^),said) $+ </td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td bgcolor="#56748B"> $+ <a href="http://last.fm/music/ $+ $replace(%artist,$chr(32),+) $+ " target="_blank"> $+ %artist $+ </a></td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td bgcolor="#56748B"> $+ <a href="http://last.fm/music/ $+ $replace(%artist,$chr(32),+) $+ /_/ $+ $replace(%title,$chr(32),+) $+ " target="_blank"> $+ %title $+ </a> $+ </td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td bgcolor="#56748B"> $+ $gmt($calc($sound($1-).length / 1000),nn:ss) $+ </td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td bgcolor="#56748B"> $+ <a href="http://www.last.fm/music/ $+ $replace(%artist,$chr(32),+) $+ / $+ $replace($sound($1-).album,$chr(32),+) $+ " target="_blank"> $+ $sound($1-).album $+ </a></td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) <td bgcolor="#56748B"> $+ $sound($1-).bitrate $+ </td>
.fwrite -n music. $+ $replace(%artist,$chr(32),^space^) </tr>
}
writeini said.ini $replace(%artist,$chr(32),^space^) said $calc($readini(said.ini,$replace(%artist,$chr(32),^space^),said) + 1)
}
}
example here [tims-design.net]
-Fixed the artist photo
-Added link's to Last.fm's artist/title/album features