Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;/**
- ;* mpc.hc.np.mrc, snippet to display now-playing info for MPC-HC
- ;* Released under the terms of MIT license
- ;*
- ;* https://github.com/mpc-hc/snippets
- ;*
- ;* Copyright (C) 2012-2013 MPC-HC Team
- ;*/
- ;#################################################
- ;## ##
- ;## MPC-HC Get 1.0 Regex ##
- ;## Made by TheShadow ##
- ;## ##
- ;#################################################
- ;1.1
- Display Error if app not running
- ;1.0
- Modify to Read other Variable Manually
- ;In order to use it you need to enable web interface in options first
- ;Type /np to show info in active channel / Replaced with Menu
- ;-----------------
- ; Menuswo
- menu channel,query,menubar {
- Display MPC-HC:{ mplayer }
- ;Media Player Classic
- ;.Display MPC-HC:{ mplayer}
- }
- alias nohtml {
- var %nohtml = $regsubex($regsubex($1,/<.+?>/g,),/&#(\d+);/g,$fixentities(\t))
- %nohtml = $replacecs(%nohtml,«,�,»,�,•,�)
- return %nohtml
- }
- alias mplayer {
- var %mpchc.host 127.0.0.1
- var %mpchc.port 13579
- .sockclose mpchc.np
- .sockopen mpchc.np %mpchc.host %mpchc.port
- .sockmark mpchc.np $active
- }
- on *:sockopen:mpchc.np:{
- if ($sockerr > 0) {
- echo -a $1 SOCKET ERROR: $sockerr / failure establishing socket connection
- }
- else {
- sockwrite $sockname GET /variables.html HTTP/1.1 $+ $crlf Host: $sock($sockname).ip $crlf $+ $crlf
- }
- }
- on *:sockread:mpchc.np:{
- var %temptext
- sockread %temptext
- ;echo -a %temptext
- ;FileName
- if ($regex(%temptext,<p id="file">(.*?)</p>)) {
- ;%FileName = $left($regml(1),10)
- %FileName = $regml(1)
- }
- ;FileSize
- if ($regex(%temptext,<p id="size">(.*?)</p>)) {
- %FileSize = $regml(1)
- }
- ;Start
- if ($regex(%temptext,<p id="positionstring">(.*?)</p>)) {
- %positionstring = $regml(1)
- }
- ;End
- if ($regex(%temptext,<p id="durationstring">(.*?)</p>)) {
- %durationstring = $regml(1)
- }
- ;Version
- if ($regex(%temptext,<p id="version">(.*?)</p>)) {
- %MCVersion = $regml(1)
- ;$nohtml([1,MPC0,32V%MCVersion - 1%FileName 1,0])
- msg $sock($sockname).mark [1MPC 0,60V %MCVersion 1,0] 1,0 FileName:2,0 %FileName 1,0- Size: 2,0 %FileSize 1,0- Position/Duration: 2,0 %positionstring / %durationstring
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement