-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lyric.mrc
99 lines (95 loc) · 5.61 KB
/
Lyric.mrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
;*************************************************************************************************
;*
;* Lyric Addon v1.1 © by www.eVolutionX-Project.de (eVolutionX-Project Team)
;*
;*************************************************************************************************
;* Beschreibung
;*************************************************************************************************
;*
;* Sucht bei Magistrix.de nach dem Song und postet die Links in den Channel.
;*
;*************************************************************************************************
;* Befehle
;*************************************************************************************************
;*
;* Mit !lyric <Artist> - <Titel> kannst du eine Suche bei Magistrix starten.
;* Mit !lyric info bekommst du die Copyright angezeigt.
;*
;*************************************************************************************************
;* Changes
;*************************************************************************************************
;*
;* v1.1
;* Added: Flood-Protection.
;* Added: !lyric info um Copyright anzuzeigen.
;* Changed: Code gesäubert und verbessert.
;*
;*************************************************************************************************
;* IRC Kontakt
;*************************************************************************************************
;*
;* Server: irc.SpeedSpace-IRC.eu
;* Port: 6667
;* Channel: #eVolutionX
;*
;* Befehl: /server -m irc.SpeedSpace-IRC.eu -j #eVolutionX
;*
;*************************************************************************************************
;* ON EVENTS Start
;*************************************************************************************************
; - Entfernt die Timer beim entladen
;*************************************************************************************************
on *:UNLOAD:{ .timerMod.Lyric* off | unset %Mod.Lyric* }
;*************************************************************************************************
; - Trigger Befehl des Lyrics Addons.
;*************************************************************************************************
on *:TEXT:!lyric*:#:{
if ($2 == info) { .notice $nick 14Lyric Addon v1.4 © by 09www.eVolutionX-Project.de14 (09eVolutionX-Project Team14) | halt }
if (!$timer($+(Mod.Lyric-Flood., #, ., $cid))) {
if (* - * iswm $2-) {
var %interpret = $replace($left($gettok($2-, 1, 45), $calc($len($gettok($2-, 1, 45)) - 1)), $chr(32), +), %title = $replace($right($gettok($2-, 2, 45), $calc($len($gettok($2-, 2, 45)) - 1)), $chr(32), +)
.timerMod.Lyric-Flood. $+ $+(#, ., $cid) 1 40 halt | sockclose Mod.Lyrics.sHTTP
sockopen Mod.Lyrics.sHTTP www.magistrix.de 80
sockmark Mod.Lyrics.sHTTP # 3 $+(/lyrics/search?title=, %title, &lang=0&artist=, %interpret, &pagelen=50&text=&order=title)
set -u10 %Mod.Lyrics.vRead 1
}
else .notice $nick 14Du hast vergessen den 09Artisten14 oder den 09Titel14 mit anzugeben (08z.B. !lyric Azad - Eines Tages14).
}
else {
if ($timer($+(Mod.Lyric-Flood., #, ., $cid, ., $nick, .3))) halt
var %secs = $timer($+(Mod.Lyric-Flood., #, ., $cid)).secs | .notice $nick 14Flood-Protection: Versuchs in09 $duration(%secs) 14nochmal!
inc $+($chr(37), Mod.Lyric-vFlood., #, ., $cid, ., $nick) | .timerMod.Lyric-Flood. $+ $+(#, ., $cid, ., $nick, *) off
.timerMod.Lyric-Flood. $+ $+(#, ., $cid, ., $nick, ., $eval($+(%, Mod.Lyric-vFlood., #, ., $cid, ., $nick), 2)) 1 %secs unset %Mod.Lyric-vFlood.*
}
}
;*************************************************************************************************
; - Öffnet die Seite www.magistrix.de
;*************************************************************************************************
on *:SOCKOPEN:Mod.Lyrics.sHTTP:{
tokenize 32 $sock($sockname).mark
if ($sockerr > 0) { .msg $1 14Es ist ein Fehler aufgetreten:09 $sock($sockname).wsmsg | halt }
sockwrite -n $sockname GET $3- HTTP/1.1
sockwrite -n $sockname Host: www.magistrix.de
sockwrite -n $sockname $crlf
}
;*************************************************************************************************
; - Liest die Treffer aus und postet sie in den Channel.
;*************************************************************************************************
on *:SOCKREAD:Mod.Lyrics.sHTTP:{
tokenize 32 $sock($sockname).mark
if ($sockerr > 0) { .msg $1 14Es ist ein Fehler aufgetreten:09 $sock($sockname).wsmsg | halt }
sockread %Mod.Lyrics.sRead
while ($sockbr) {
if ($regex(%Mod.Lyrics.sRead, /.*Es konnte leider keine Songtexte.*/)) .msg $1 14Es konnte leider 09keine14 Songtexte, die auf das Suchmuster passen, gefunden werden.
if ($regex(%Mod.Lyrics.sRead, /.*<b>Suchergebnis <small>(.*)</small></b>.*/)) .msg $1 14Die Songtext Suche ergab09 $remove($gettok($regml(1), 1, 32), $chr(40)) 14Treffer.
if ($regex(%Mod.Lyrics.sRead, /.*</a>.*<a href="(.*)" class="lyricIcon bgMove">.*/)) {
.timer 1 %Mod.Lyrics.vRead .msg $1 14 $+ http://lyrics.songtext.name/ $+ $regml(1)
if (%Mod.Lyrics.vRead == $2) { sockclose Mod.Lyrics.sHTTP | unset %Mod.Lyrics.* | halt }
inc %Mod.Lyrics.vRead 1
}
sockread %Mod.Lyrics.sRead
}
}
;*************************************************************************************************
;* ON EVENTS Ende
;*************************************************************************************************