Advertisement
TheShadow

mIRC mpc.hc

Mar 31st, 2021
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. ;/**
  2. ;* mpc.hc.np.mrc, snippet to display now-playing info for MPC-HC
  3. ;* Released under the terms of MIT license
  4. ;*
  5. ;* https://github.com/mpc-hc/snippets
  6. ;*
  7. ;* Copyright (C) 2012-2013 MPC-HC Team
  8. ;*/
  9.  
  10. ;#################################################
  11. ;## ##
  12. ;## MPC-HC Get 1.0 Regex ##
  13. ;## Made by TheShadow ##
  14. ;## ##
  15. ;#################################################
  16.  
  17. ;1.1
  18. Display Error if app not running
  19.  
  20. ;1.0
  21. Modify to Read other Variable Manually
  22.  
  23. ;In order to use it you need to enable web interface in options first
  24. ;Type /np to show info in active channel / Replaced with Menu
  25.  
  26. ;-----------------
  27. ; Menuswo
  28.  
  29. menu channel,query,menubar {
  30. Display MPC-HC:{ mplayer }
  31. ;Media Player Classic
  32. ;.Display MPC-HC:{ mplayer}
  33. }
  34.  
  35. alias nohtml {
  36. var %nohtml = $regsubex($regsubex($1,/<.+?>/g,),/&#(\d+);/g,$fixentities(\t))
  37. %nohtml = $replacecs(%nohtml,&laquo;,�,&raquo;,�,&bull;,�)
  38. return %nohtml
  39. }
  40.  
  41. alias mplayer {
  42. var %mpchc.host 127.0.0.1
  43. var %mpchc.port 13579
  44. .sockclose mpchc.np
  45. .sockopen mpchc.np %mpchc.host %mpchc.port
  46. .sockmark mpchc.np $active
  47. }
  48.  
  49. on *:sockopen:mpchc.np:{
  50. if ($sockerr > 0) {
  51. echo -a $1 SOCKET ERROR: $sockerr / failure establishing socket connection
  52. }
  53. else {
  54. sockwrite $sockname GET /variables.html HTTP/1.1 $+ $crlf Host: $sock($sockname).ip $crlf $+ $crlf
  55. }
  56. }
  57.  
  58. on *:sockread:mpchc.np:{
  59. var %temptext
  60. sockread %temptext
  61. ;echo -a %temptext
  62.  
  63. ;FileName
  64. if ($regex(%temptext,<p id="file">(.*?)</p>)) {
  65. ;%FileName = $left($regml(1),10)
  66. %FileName = $regml(1)
  67. }
  68.  
  69. ;FileSize
  70. if ($regex(%temptext,<p id="size">(.*?)</p>)) {
  71. %FileSize = $regml(1)
  72. }
  73.  
  74. ;Start
  75. if ($regex(%temptext,<p id="positionstring">(.*?)</p>)) {
  76. %positionstring = $regml(1)
  77. }
  78.  
  79. ;End
  80. if ($regex(%temptext,<p id="durationstring">(.*?)</p>)) {
  81. %durationstring = $regml(1)
  82. }
  83.  
  84. ;Version
  85. if ($regex(%temptext,<p id="version">(.*?)</p>)) {
  86. %MCVersion = $regml(1)
  87. ;$nohtml([1,MPC0,32V%MCVersion - 1%FileName 1,0])
  88. 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
  89. }
  90. }
  91.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement